software/drivers/sd8887/src/wlan/mlinux/moal_cfg80211.c
/**
 * @brief Request the driver to set antenna configuration
 *
 * @param wiphy           A pointer to wiphy structure
 * @param tx_ant          Bitmaps of allowed antennas to use for TX
 * @param rx_ant          Bitmaps of allowed antennas to use for RX
 *
 * @return                0 -- success, otherwise fail
 */
@brief Request the driver to set antenna configuration
@param wiphy           A pointer to wiphy structure
@param tx_ant          Bitmaps of allowed antennas to use for TX
@param rx_ant          Bitmaps of allowed antennas to use for RX

@return                0 -- success, otherwise fail
@brief Request the driver to set antenna configuration @param wiphy A pointer to wiphy structure @param tx_ant Bitmaps of allowed antennas to use for TX @param rx_ant Bitmaps of allowed antennas to use for RX @return 0 -- success otherwise fail
int
woal_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
{
	moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy);
	moal_private *priv = NULL;
	mlan_ds_radio_cfg *radio = NULL;
	mlan_ioctl_req *req = NULL;
	mlan_status status = MLAN_STATUS_SUCCESS;
	int ret = 0;
	ENTER();
	if (!handle) {
		PRINTM(MFATAL, "Unable to get handle\n");
		ret = -EINVAL;
		goto done;
	}
	priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY);
	if (!priv) {
		ret = -EINVAL;
		goto done;
	}
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_radio_cfg));
	if (req == NULL) {
		ret = -ENOMEM;
		goto done;
	}
	radio = (mlan_ds_radio_cfg *)req->pbuf;
	radio->sub_command = MLAN_OID_ANT_CFG;
	req->req_id = MLAN_IOCTL_RADIO_CFG;
	req->action = MLAN_ACT_SET;
	radio->param.ant_cfg_1x1.antenna = tx_ant;
	status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
	if (MLAN_STATUS_SUCCESS != status) {
		ret = -EFAULT;
		goto done;
	}
done:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	if (ret)
		ret = -EINVAL;
	LEAVE();
	return ret;
}
int woal_cfg80211_set_antenna ( struct wiphy * wiphy , u32 tx_ant , u32 rx_ant ) { moal_handle * handle = ( moal_handle * ) woal_get_wiphy_priv ( wiphy ) ; moal_private * priv = NULL ; mlan_ds_radio_cfg * radio = NULL ; mlan_ioctl_req * req = NULL ; mlan_status status = MLAN_STATUS_SUCCESS ; int ret = 0 ; ENTER ( ) ; if ( ! handle ) { PRINTM ( MFATAL , " \n " ) ; ret = - EINVAL ; goto done ; } priv = woal_get_priv ( handle , MLAN_BSS_ROLE_ANY ) ; if ( ! priv ) { ret = - EINVAL ; goto done ; } req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_radio_cfg ) ) ; if ( req == NULL ) { ret = - ENOMEM ; goto done ; } radio = ( mlan_ds_radio_cfg * ) req -> pbuf ; radio -> sub_command = MLAN_OID_ANT_CFG ; req -> req_id = MLAN_IOCTL_RADIO_CFG ; req -> action = MLAN_ACT_SET ; radio -> param . ant_cfg_1x1 . antenna = tx_ant ; status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( MLAN_STATUS_SUCCESS != status ) { ret = - EFAULT ; goto done ; } done : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; if ( ret ) ret = - EINVAL ; LEAVE ( ) ; return ret ; }
@brief Request the driver to set antenna configuration
 @param wiphy           A pointer to wiphy structure
 @param tx_ant          Bitmaps of allowed antennas to use for TX
 @param rx_ant          Bitmaps of allowed antennas to use for RX
@brief Request the driver to set antenna configuration @param wiphy A pointer to wiphy structure @param tx_ant Bitmaps of allowed antennas to use for TX @param rx_ant Bitmaps of allowed antennas to use for RX
/* Driver must return -EINVAL to cfg80211 */