diff --git a/drivers/staging/prima/Android.mk b/drivers/staging/prima/Android.mk new file mode 100644 index 000000000000..59685825d8f1 --- /dev/null +++ b/drivers/staging/prima/Android.mk @@ -0,0 +1,167 @@ +# Android makefile for the WLAN Module + +# Assume no targets will be supported +WLAN_CHIPSET := + +# Build/Package options for 8960 target +ifeq ($(TARGET_BOARD_PLATFORM),msm8960) +WLAN_CHIPSET := prima +WLAN_SELECT := CONFIG_PRIMA_WLAN=m +endif + +# Build/Package options for 8916, 8974, 8226, 8610, 8909, 8952, 8937, 8953 targets +ifneq (,$(filter msm8916 msm8974 msm8226 msm8610 msm8909 msm8952 msm8937 msm8953 titanium,$(TARGET_BOARD_PLATFORM))) +ifneq ($(TARGET_SUPPORTS_ANDROID_WEAR_KERNEL_4_14),true) +WLAN_CHIPSET := pronto +WLAN_SELECT := CONFIG_PRONTO_WLAN=m +endif +endif + +# Build/Package only in case of supported target +ifneq ($(WLAN_CHIPSET),) + +LOCAL_PATH := $(call my-dir) + +ifeq ($(TARGET_SUPPORTS_WEARABLES),true) +ifneq ($(findstring device,$(LOCAL_PATH)),) + WLAN_DLKM := 1 +else +ifneq ($(findstring vendor,$(LOCAL_PATH)),) + WLAN_DLKM := 1 +else + WLAN_DLKM := 0 +endif # findstring device +endif +else +ifneq ($(findstring vendor,$(LOCAL_PATH)),) + WLAN_DLKM := 1 +else + WLAN_DLKM := 0 +endif # findstring vendor +endif # TARGET_SUPPORTS_WEARABLES + +# This makefile is only for DLKM +ifeq ($(WLAN_DLKM),1) + +# Determine if we are Proprietary or Open Source +ifneq ($(findstring opensource,$(LOCAL_PATH)),) + WLAN_PROPRIETARY := 0 +else + WLAN_PROPRIETARY := 1 +endif + +# DLKM_DIR was moved for JELLY_BEAN (PLATFORM_SDK 16) +ifeq (1,$(filter 1,$(shell echo "$$(( $(PLATFORM_SDK_VERSION) >= 16 ))" ))) +ifneq ($(TARGET_SUPPORTS_WEARABLES),true) + DLKM_DIR := $(TOP)/device/qcom/common/dlkm +else + DLKM_DIR := $(BOARD_DLKM_DIR) +endif +else + DLKM_DIR := build/dlkm +endif + +# Copy WCNSS_cfg.dat file from firmware_bin/ folder to target out directory. +ifeq ($(WLAN_PROPRIETARY),0) + +$(shell mkdir -p $(TARGET_OUT_ETC)/firmware/wlan/prima) +$(shell rm -f $(TARGET_OUT_ETC)/firmware/wlan/prima/WCNSS_cfg.dat) +$(shell cp $(LOCAL_PATH)/firmware_bin/WCNSS_cfg.dat $(TARGET_OUT_ETC)/firmware/wlan/prima) + +else + +include $(CLEAR_VARS) +LOCAL_MODULE := WCNSS_qcom_wlan_nv.bin +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(PRODUCT_OUT)/persist +LOCAL_SRC_FILES := firmware_bin/$(LOCAL_MODULE) +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := WCNSS_cfg.dat +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/firmware/wlan/prima +LOCAL_SRC_FILES := firmware_bin/$(LOCAL_MODULE) +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := WCNSS_qcom_cfg.ini +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(PRODUCT_OUT)/persist +LOCAL_SRC_FILES := firmware_bin/$(LOCAL_MODULE) +include $(BUILD_PREBUILT) + +endif + +ifeq ($(TARGET_KERNEL_VERSION),) +$(info "WLAN: TARGET_KERNEL_VERSION is not defined, assuming default") +TARGET_KERNEL_SOURCE := kernel +KERNEL_TO_BUILD_ROOT_OFFSET := ../ +endif + +ifeq ($(KERNEL_TO_BUILD_ROOT_OFFSET),) +$(info "WLAN: KERNEL_TO_BUILD_ROOT_OFFSET is not defined, assuming default") +KERNEL_TO_BUILD_ROOT_OFFSET := ../ +endif + +# Build wlan.ko as either prima_wlan.ko or pronto_wlan.ko +########################################################### + +# This is set once per LOCAL_PATH, not per (kernel) module + +ifeq ($(KBUILD_OPTIONS),) +KBUILD_OPTIONS += WLAN_PROPRIETARY=$(WLAN_PROPRIETARY) +KBUILD_OPTIONS += TARGET_SUPPORTS_WEARABLES=$(TARGET_SUPPORTS_WEARABLES) +KBUILD_OPTIONS += KERNEL_TO_BUILD_ROOT_OFFSET=$(KERNEL_TO_BUILD_ROOT_OFFSET) +endif + +# We are actually building wlan.ko here, as per the +# requirement we are specifying _wlan.ko as LOCAL_MODULE. +# This means we need to rename the module to _wlan.ko +# after wlan.ko is built. +KBUILD_OPTIONS += MODNAME=wlan +KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM) +KBUILD_OPTIONS += $(WLAN_SELECT) + + +ifeq ($(KERNEL_TO_BUILD_ROOT_OFFSET),../../) +VERSION=$(shell grep -w "VERSION =" $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/Makefile | sed 's/^VERSION = //' ) +PATCHLEVEL=$(shell grep -w "PATCHLEVEL =" $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/Makefile | sed 's/^PATCHLEVEL = //' ) +else +VERSION=$(shell grep -w "VERSION =" $(TOP)/kernel/Makefile | sed 's/^VERSION = //' ) +PATCHLEVEL=$(shell grep -w "PATCHLEVEL =" $(TOP)/kernel/Makefile | sed 's/^PATCHLEVEL = //' ) +endif + +include $(CLEAR_VARS) +LOCAL_MODULE := $(WLAN_CHIPSET)_wlan.ko +LOCAL_MODULE_KBUILD_NAME := wlan.ko +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_DEBUG_ENABLE := true +ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED), true) + ifeq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),true) + LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) + else + LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET) + endif +else + LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules/$(WLAN_CHIPSET) +endif # PRODUCT_VENDOR_MOVE_ENABLED +include $(DLKM_DIR)/AndroidKernelModule.mk +########################################################### + +#Create symbolic link +ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED), true) +$(shell mkdir -p $(TARGET_OUT_VENDOR)/lib/modules; \ + ln -sf /$(TARGET_COPY_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)/$(WLAN_CHIPSET)_wlan.ko \ + $(TARGET_OUT_VENDOR)/lib/modules/wlan.ko) +else +$(shell mkdir -p $(TARGET_OUT)/lib/modules; \ + ln -sf /system/lib/modules/$(WLAN_CHIPSET)/$(WLAN_CHIPSET)_wlan.ko \ + $(TARGET_OUT)/lib/modules/wlan.ko) +endif # PRODUCT_VENDOR_MOVE_ENABLED +endif # DLKM check + +endif # supported target check diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_main.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_main.h index aadd9fecdba4..ac36d11fe381 100644 --- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_main.h +++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_main.h @@ -2349,6 +2349,18 @@ hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value) } #endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) +static inline void hdd_dev_setup_destructor(struct net_device *dev) +{ + dev->destructor = free_netdev; +} +#else +static inline void hdd_dev_setup_destructor(struct net_device *dev) +{ + dev->needs_free_netdev = true; +} +#endif /* KERNEL_VERSION(4, 12, 0) */ + /* * hdd_parse_disable_chn_cmd() - Parse the channel list received * in command. diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c index 3e6418fa8acf..b8b2d9a59318 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c @@ -800,8 +800,13 @@ static void hdd_copy_vht_operation(hdd_station_ctx_t *hdd_sta_ctx, vos_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) + hdd_vht_ops->center_freq_seg0_idx = roam_vht_ops->chanCenterFreqSeg1; + hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg2; +#else hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg1; hdd_vht_ops->center_freq_seg2_idx = roam_vht_ops->chanCenterFreqSeg2; +#endif hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; } diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c index 44cbd1d26451..71768c10ad69 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -135,10 +135,12 @@ .flags = flag, \ } +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)) #ifdef WLAN_FEATURE_VOWIFI_11R #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 #endif +#endif #define HDD_CHANNEL_14 14 #define WLAN_HDD_MAX_FEATURE_SET 8 @@ -14429,7 +14431,11 @@ static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( freq = ieee80211_channel_to_frequency(chan_no); #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) + chan = ieee80211_get_channel(wiphy, freq); +#else chan = __ieee80211_get_channel(wiphy, freq); +#endif if (!chan) { hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); @@ -14602,7 +14608,13 @@ wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, #else freq = ieee80211_channel_to_frequency(chan_no); #endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) + chan = ieee80211_get_channel(wiphy, freq); +#else chan = __ieee80211_get_channel(wiphy, freq); +#endif + /*when the band is changed on the fly using the GUI, three things are done * 1. scan abort 2.flush scan results from cache 3.update the band with the new band user specified(refer to the hdd_setBand_helper function) * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_hostapd.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_hostapd.c index 750edef8b2c5..bd6c80dd16ee 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_hostapd.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_hostapd.c @@ -1097,7 +1097,11 @@ static VOS_STATUS hdd_chan_change_notify(hdd_adapter_t *hostapd_adapter, freq = vos_chan_to_freq(oper_chan); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) + chan = ieee80211_get_channel(hostapd_adapter->wdev.wiphy, freq); +#else chan = __ieee80211_get_channel(hostapd_adapter->wdev.wiphy, freq); +#endif if (!chan) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, @@ -5734,8 +5738,7 @@ hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAd vos_mem_copy(pWlanHostapdDev->dev_addr, (void *)macAddr,sizeof(tSirMacAddr)); vos_mem_copy(pHostapdAdapter->macAddressCurrent.bytes, (void *)macAddr, sizeof(tSirMacAddr)); - - pWlanHostapdDev->destructor = free_netdev; + hdd_dev_setup_destructor(pWlanHostapdDev); pWlanHostapdDev->ieee80211_ptr = &pHostapdAdapter->wdev ; pHostapdAdapter->wdev.wiphy = pHddCtx->wiphy; pHostapdAdapter->wdev.netdev = pWlanHostapdDev; diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_main.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_main.c index 4f50dcc329ac..8d534a2d2efe 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_main.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_main.c @@ -250,6 +250,7 @@ static int hdd_ParseUserParams(tANI_U8 *pValue, tANI_U8 **ppArg); void wlan_hdd_restart_timer_cb(v_PVOID_t usrDataForCallback); void hdd_set_wlan_suspend_mode(bool suspend); void hdd_set_vowifi_mode(hdd_context_t *hdd_ctx, bool enable); +void hdd_set_olpc_mode(tHalHandle hHal, bool low_power); v_U16_t hdd_select_queue(struct net_device *dev, struct sk_buff *skb @@ -878,6 +879,19 @@ static int hdd_parse_setrmcactionperiod_command(tANI_U8 *pValue, return 0; } +/* ++ * hdd_set_olpc_mode() - Process the OLPCMODE command and invoke the SME api +* +* @hHal: context handler +* @low_power: Value to be sent as a part of the OLPCMODE command +* +* Return: void +*/ +void hdd_set_olpc_mode(tHalHandle hHal, bool low_power) +{ + sme_update_olpc_mode(hHal, low_power); +} + /** * hdd_set_vowifi_mode() - Process VOWIFI command. * @hdd_ctx: context handler @@ -4078,6 +4092,21 @@ static int hdd_driver_command(hdd_adapter_t *pAdapter, ptr = (tANI_U8*)command + 11; hdd_set_vowifi_mode(pHddCtx, *ptr - '0'); + } + + else if (strncmp(command, "OLPCMODE", 8) == 0) + { + tANI_U8 *ptr; + + ret = hdd_drv_cmd_validate(command, 8); + if (ret) + goto exit; + + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, + " Received Command to go to low power mode in %s", __func__); + + ptr = (tANI_U8*)command + 9; + hdd_set_olpc_mode((tHalHandle)(pHddCtx->hHal), *ptr - '0'); } else if(strncmp(command, "SETSUSPENDMODE", 14) == 0) @@ -9130,7 +9159,7 @@ static hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMac hdd_set_station_ops( pAdapter->dev ); - pWlanDev->destructor = free_netdev; + hdd_dev_setup_destructor(pWlanDev); pWlanDev->ieee80211_ptr = &pAdapter->wdev ; pAdapter->wdev.wiphy = pHddCtx->wiphy; pAdapter->wdev.netdev = pWlanDev; diff --git a/drivers/staging/prima/CORE/MAC/src/include/sirParams.h b/drivers/staging/prima/CORE/MAC/src/include/sirParams.h index 8c74bc6b26e7..51f6b0f8e4e6 100644 --- a/drivers/staging/prima/CORE/MAC/src/include/sirParams.h +++ b/drivers/staging/prima/CORE/MAC/src/include/sirParams.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017, 2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2017, 2019-2020 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -826,6 +826,7 @@ struct sir_mgmt_msg { /* ARP Debug stats */ #define SIR_HAL_SET_ARP_STATS_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 303) #define SIR_HAL_GET_ARP_STATS_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 304) +#define SIR_HAL_LOW_POWER_MODE (SIR_HAL_ITC_MSG_TYPES_BEGIN + 305) #define SIR_HAL_VOWIFI_MODE (SIR_HAL_ITC_MSG_TYPES_BEGIN + 306) #define SIR_HAL_QPOWER (SIR_HAL_ITC_MSG_TYPES_BEGIN + 307) diff --git a/drivers/staging/prima/CORE/SME/inc/smeInside.h b/drivers/staging/prima/CORE/SME/inc/smeInside.h index 0748347ccce2..38aa64874b89 100644 --- a/drivers/staging/prima/CORE/SME/inc/smeInside.h +++ b/drivers/staging/prima/CORE/SME/inc/smeInside.h @@ -210,6 +210,7 @@ typedef struct tagSmeCmd struct csr_set_tx_max_pwr_per_band set_tx_max_pwr_per_band; tpSirUpdateChanList chan_list; tpRoamParams RoamParams; + bool olpc_mode_enable; }u; }tSmeCmd; diff --git a/drivers/staging/prima/CORE/SME/inc/smeInternal.h b/drivers/staging/prima/CORE/SME/inc/smeInternal.h index 95af72a4f684..1a598adb63ca 100644 --- a/drivers/staging/prima/CORE/SME/inc/smeInternal.h +++ b/drivers/staging/prima/CORE/SME/inc/smeInternal.h @@ -78,6 +78,7 @@ typedef enum eSmeCommandType eSmeCommandSetMaxTxPower, eSmeCommandSetMaxTxPowerPerBand, eSmeCommandUpdateChannelList, + eSmeCommandOlpcMode, #ifdef FEATURE_WLAN_TDLS //eSmeTdlsCommandMask = 0x80000, //To identify TDLS commands //These can be considered as csr commands. diff --git a/drivers/staging/prima/CORE/SME/inc/sme_Api.h b/drivers/staging/prima/CORE/SME/inc/sme_Api.h index 54e281a2e365..0b7eb43be429 100644 --- a/drivers/staging/prima/CORE/SME/inc/sme_Api.h +++ b/drivers/staging/prima/CORE/SME/inc/sme_Api.h @@ -233,6 +233,7 @@ sme_SetLinkLayerStatsIndCB void sme_set_vowifi_mode(tpAniSirGlobal pMac, bool enable); void sme_set_qpower(tpAniSirGlobal pMac, uint8_t enable); +void sme_set_olpc_mode(tpAniSirGlobal pMac, bool enable); #ifdef WLAN_FEATURE_EXTSCAN /* --------------------------------------------------------------------------- @@ -4164,4 +4165,14 @@ struct roam_ext_params { */ eHalStatus sme_UpdateBlacklist(tHalHandle hHal, uint8_t session_id, struct roam_ext_params *roam_params); + +/** + * sme_update_olpc_mode() - Send OLPC mode command received from user space + * @hal: The handle returned by mac_open + * @enable: OLPC mode enable/disable + * + * Return: HAL_STATUS + */ +eHalStatus sme_update_olpc_mode(tHalHandle hHal, bool enable); + #endif //#if !defined( __SME_API_H ) diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c b/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c index 17c7ee416cb7..43ded77277bb 100644 --- a/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c +++ b/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c @@ -18969,6 +18969,11 @@ eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, fNeedFullPower = eANI_BOOLEAN_TRUE; } + else if (pCommand->command == eSmeCommandOlpcMode) + { + fNeedFullPower = eANI_BOOLEAN_TRUE; + } + break; case REQUEST_STOP_UAPSD: case REQUEST_EXIT_WOWL: diff --git a/drivers/staging/prima/CORE/SME/src/sme_common/sme_Api.c b/drivers/staging/prima/CORE/SME/src/sme_common/sme_Api.c index 12dbbbbea78d..9337620317da 100644 --- a/drivers/staging/prima/CORE/SME/src/sme_common/sme_Api.c +++ b/drivers/staging/prima/CORE/SME/src/sme_common/sme_Api.c @@ -991,6 +991,37 @@ void sme_set_vowifi_mode(tpAniSirGlobal pMac, bool enable) } } +/* + * sme_set_olpc_mode() - Set OLPC (low power) + * @pMac - context handler + * @enable - boolean value that determines the state + * + * The function sends the low power mode to firmware received + * via driver command + */ +void sme_set_olpc_mode(tpAniSirGlobal pMac, bool enable) +{ + tSirMsgQ msgQ; + tSirRetStatus retCode = eSIR_SUCCESS; + + vos_mem_zero(&msgQ, sizeof(tSirMsgQ)); + msgQ.type = WDA_LOW_POWER_MODE; + msgQ.reserved = 0; + msgQ.bodyval = enable; + + retCode = wdaPostCtrlMsg(pMac, &msgQ); + if(eSIR_SUCCESS != retCode) + { + smsLog(pMac, LOGE, + FL("Posting WDA_LOW_POWER_MODE to WDA failed, reason=%X"), + retCode); + } + else + { + smsLog(pMac, LOG1, FL("posted WDA_LOW_POWER_MODE command")); + } +} + tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac ) { tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE; @@ -1456,6 +1487,19 @@ tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac ) fContinue = eANI_BOOLEAN_TRUE; break; + case eSmeCommandOlpcMode: + csrLLUnlock(&pMac->sme.smeCmdActiveList); + sme_set_olpc_mode(pMac, + pCommand->u.olpc_mode_enable); + if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, + &pCommand->Link, LL_ACCESS_LOCK)) { + csrReleaseCommand(pMac, pCommand); + } + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, + "sme_command_olpc_mode processed"); + fContinue = eANI_BOOLEAN_TRUE; + break; + default: //something is wrong //remove it from the active list @@ -1772,6 +1816,7 @@ eHalStatus sme_UpdateChannelConfig(tHalHandle hHal) &pMac->scan.base20MHzChannels, FALSE); return eHAL_STATUS_SUCCESS; } + #endif // FEATURE_WLAN_SCAN_PNLO eHalStatus sme_UpdateChannelList(tHalHandle hHal) @@ -15509,3 +15554,30 @@ eHalStatus sme_UpdateBlacklist(tHalHandle hHal, uint8_t session_id, return eHAL_STATUS_SUCCESS; } + +eHalStatus sme_update_olpc_mode(tHalHandle hHal, bool enable) +{ + tSmeCmd *pCommand; + tpAniSirGlobal pMac = PMAC_STRUCT(hHal); + + pCommand = csrGetCommandBuffer(pMac); + if (pCommand == NULL) { + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, + FL("Failed to get command buffer for roam params")); + return eHAL_STATUS_RESOURCES; + } + + smsLog(pMac, LOG1, "Posting OLPC command to csr queue"); + + pCommand->command = eSmeCommandOlpcMode; + pCommand->u.olpc_mode_enable = enable; + + if (!HAL_STATUS_SUCCESS(csrQueueSmeCommand(pMac, pCommand, TRUE))) { + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, + FL("failed to post OLPC sme command")); + csrReleaseCommand(pMac, pCommand); + return eHAL_STATUS_FAILURE; + } + + return eHAL_STATUS_SUCCESS; +} diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_packet.c b/drivers/staging/prima/CORE/VOSS/src/vos_packet.c index 1765c804b776..748ae4830998 100644 --- a/drivers/staging/prima/CORE/VOSS/src/vos_packet.c +++ b/drivers/staging/prima/CORE/VOSS/src/vos_packet.c @@ -3213,7 +3213,9 @@ v_VOID_t vos_recover_tail(vos_pkt_t *pPacket) shinfo = skb_shinfo(skb); memset(shinfo, 0, sizeof(struct skb_shared_info)); atomic_set(&shinfo->dataref, 1); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)) kmemcheck_annotate_variable(shinfo->destructor_arg); +#endif return; } diff --git a/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda.h b/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda.h index 1971d2a8a76d..7ca2db4e4bbd 100644 --- a/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda.h +++ b/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda.h @@ -1112,6 +1112,7 @@ tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb); #define WDA_BEACON_FILTER_IND SIR_HAL_BEACON_FILTER_IND #define WDA_VOWIFI_MODE SIR_HAL_VOWIFI_MODE #define WDA_QPOWER SIR_HAL_QPOWER +#define WDA_LOW_POWER_MODE SIR_HAL_LOW_POWER_MODE /// PE <-> HAL WOWL messages #define WDA_WOWL_ADD_BCAST_PTRN SIR_HAL_WOWL_ADD_BCAST_PTRN diff --git a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c index bf63cf95907d..026bb276d308 100644 --- a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c +++ b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c @@ -12164,6 +12164,26 @@ VOS_STATUS WDA_set_vowifi_ind(tWDA_CbContext *pWDA, return CONVERT_WDI2VOS_STATUS(status); } +VOS_STATUS WDA_set_low_power_req(tWDA_CbContext *pWDA, + tANI_BOOLEAN low_power) +{ + WDI_Status status; + + VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, + FL("---> %s"), __func__); + status = WDI_set_low_power_mode_req(low_power); + if (status == WDI_STATUS_PENDING) + { + VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, + FL("pending status received ")); + } + else if (status != WDI_STATUS_SUCCESS_SYNC) + { + VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, + FL("Failure status %d"), status); + } + return CONVERT_WDI2VOS_STATUS(status); +} /* * FUNCTION: WDA_SetRSSIThresholdsRespCallback * @@ -17162,6 +17182,14 @@ VOS_STATUS WDA_McProcessMsg( v_CONTEXT_t pVosContext, vos_msg_t *pMsg ) WDA_set_qpower(pWDA, pMsg->bodyval); break; } + case WDA_LOW_POWER_MODE : + { + VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_HIGH, + "Handling msg type WDA_LOW_POWER_MODE"); + + WDA_set_low_power_req(pWDA, pMsg->bodyval); + break; + } case WDA_BTC_SET_CFG: { diff --git a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h index 8997e546f6fe..1af5b1502aa9 100644 --- a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h +++ b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2017, 2020 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -6795,7 +6795,6 @@ typedef void (*WDI_StartScanRspCb)(WDI_StartScanRspParamsType* wdiParams, typedef void (*WDI_EndScanRspCb)(WDI_Status wdiStatus, void* pUserData); - /*--------------------------------------------------------------------------- WDI_StartRspCb @@ -12341,6 +12340,14 @@ WDI_Status WDI_set_vowifi_mode_ind(wpt_boolean enable); */ WDI_Status WDI_set_qpower(uint8_t enable); +/* + * WDI_set_low_power_mode_req() - Set OLPC (low power) mode request + * + * @enable - boolean value that determins the state + * + * Return: success if the value is sent + */ +WDI_Status WDI_set_low_power_mode_req(wpt_boolean enable); WDI_Status WDI_FWLoggingDXEdoneInd diff --git a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h index 4455c84e06d2..17c0dbdc9e7f 100644 --- a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h +++ b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2017, 2020 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -507,6 +507,7 @@ typedef enum /* BLACKLIST Request */ WDI_BLACKLIST_REQ = 127, + WDI_SET_LOW_POWER_REQ = 128, WDI_MAX_REQ, /*Send a suspend Indication down to HAL*/ @@ -898,6 +899,8 @@ typedef enum /* BLACKLIST Response */ WDI_BLACKLIST_RSP = 126, + WDI_SET_LOW_POWER_RSP = 127, + /*------------------------------------------------------------------------- Indications !! Keep these last in the enum if possible @@ -1898,6 +1901,20 @@ WDI_ProcessEndScanReq WDI_EventInfoType* pEventData ); +/** + * WDI_process_low_power_request - Sends the low_power request data to + * the firmware when OLPCMODE driver command is invoked + * @pWDICtx: pointer to the WLAN DAL context + * @pEventData: pointer to the event information structure + * + * Return value: status whether the sending is successful or not + */ +WDI_Status +WDI_process_low_power_request +( + WDI_ControlBlockType* pWDICtx, + WDI_EventInfoType* pEventData +); /** * WDI_process_vowifi_request - Sends the vowifi request data to @@ -6848,6 +6865,24 @@ WDI_ProcessApFindInd ); #endif +/* + * WDI_low_power_rsp_callback() - The callback function for the response of + * OLPCMODE driver command + * + * @wdi_ctx: pointer to the HAL DAL context + * @event_data: pointer to the event information structure + * + * The function will be called when the firmware sends status of the OLPCMODE + * command sent by driver + * + * Return: status success on receiving valid response + */ +WDI_Status WDI_low_power_rsp_callback +( + WDI_ControlBlockType *wdi_ctx, + WDI_EventInfoType *event_data +); + WDI_Status wdi_cap_tsf_req ( diff --git a/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c b/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c index 9a70c877e6ef..6b4b4979ea97 100644 --- a/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c +++ b/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c @@ -549,6 +549,8 @@ WDI_ReqProcFuncType pfnReqProcTbl[WDI_MAX_UMAC_IND] = WDI_ProcessGetArpStatsReq, /* WDI_FW_GET_ARP_STATS_REQ */ WDI_ProcessBlackListReq, /* WDI_BLACKLIST_REQ*/ + WDI_process_low_power_request, /* WDI_SET_LOW_POWER_REQ */ + /*------------------------------------------------------------------------- Indications -------------------------------------------------------------------------*/ @@ -902,6 +904,7 @@ WDI_RspProcFuncType pfnRspProcTbl[WDI_MAX_RESP] = /* ARP Debug Stats*/ WDI_ProcessSetArpStatsResp, /* WDI_FW_ARP_STATS_RSP */ WDI_ProcessGetArpStatsResp, /* WDI_FW_GET_ARP_STATS_RSP */ + WDI_low_power_rsp_callback, /* WDI_SET_LOW_POWER_RSP */ WDI_ProcessBlackListResp, /* WDI_BLACKLIST_RSP */ /*--------------------------------------------------------------------- @@ -1015,8 +1018,6 @@ WDI_RspProcFuncType pfnRspProcTbl[WDI_MAX_RESP] = NULL, #endif }; - - /*--------------------------------------------------------------------------- WLAN DAL Global Control Block ---------------------------------------------------------------------------*/ @@ -1815,6 +1816,7 @@ static char *WDI_getRespMsgString(wpt_uint16 wdiRespMsgId) #endif /* DHCP_SERVER_OFFLOAD */ CASE_RETURN_STRING (WDI_CAPTURE_GET_TSF_TSTAMP_RSP); CASE_RETURN_STRING (WDI_BLACKLIST_RSP); + CASE_RETURN_STRING (WDI_SET_LOW_POWER_RSP); default: return "Unknown WDI MessageId"; } @@ -9115,6 +9117,67 @@ WDI_process_qpower_request(WDI_ControlBlockType* pWDICtx, return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC; } + +WDI_Status +WDI_process_low_power_request(WDI_ControlBlockType* pWDICtx, + WDI_EventInfoType* pEventData) +{ + wpt_uint8* pSendBuffer = NULL; + wpt_uint16 usDataOffset = 0; + wpt_uint16 usSendSize = 0; + wpt_boolean *enable; + tHalPowerControlModeChangeReqMsg hal_low_power_msg; + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, + "%s", __func__); + + /*------------------------------------------------------------------------- + Sanity check + -------------------------------------------------------------------------*/ + if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ) { + WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL, + "%s: Invalid parameters", __func__); + WDI_ASSERT(0); + return WDI_STATUS_E_FAILURE; + } + enable = (wpt_boolean*)pEventData->pEventData; + + /*----------------------------------------------------------------------- + Get message buffer + -----------------------------------------------------------------------*/ + if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, + WDI_SET_LOW_POWER_REQ, + sizeof(tHalPowerControlModeChangeReqParams), + &pSendBuffer, &usDataOffset, &usSendSize))|| + ( usSendSize < (usDataOffset + sizeof(tHalPowerControlModeChangeReqParams) ))) + { + WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL, + "Unable to get send buffer in RTS CTS ind %pK ", + pEventData); + WDI_ASSERT(0); + return WDI_STATUS_E_FAILURE; + } + + hal_low_power_msg.pwrCtrlModeChangeReqParams.enable = *enable; + + wpalMemoryCopy( pSendBuffer+usDataOffset, + &hal_low_power_msg.pwrCtrlModeChangeReqParams, + sizeof(hal_low_power_msg.pwrCtrlModeChangeReqParams)); + + pWDICtx->pReqStatusUserData = NULL; + pWDICtx->pfncRspCB = NULL; + + /*------------------------------------------------------------------------- + Send OLPC mode Request to HAL + -------------------------------------------------------------------------*/ + + return WDI_SendMsg(pWDICtx, pSendBuffer, usSendSize, + NULL, NULL, WDI_SET_LOW_POWER_RSP); +} + /** @brief Process End Scan Request function (called when Main FSM allows it) @@ -11604,6 +11667,36 @@ WDI_ProcessUpdateEDCAParamsReq WDI_UPD_EDCA_PRMS_RESP); }/*WDI_ProcessUpdateEDCAParamsReq*/ + +/** + * WDI_set_low_power_mode_req() - Set OLPC (low power) mode request + * + * @enable - boolean value that determins the state + * + * Return value: status whether the post is successful or not + */ +WDI_Status WDI_set_low_power_mode_req(wpt_boolean enable) +{ + WDI_EventInfoType wdiEventData; + + if (eWLAN_PAL_FALSE == gWDIInitialized ) + { + WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, + "WDI API call before module is initialized - Fail request"); + return WDI_STATUS_E_NOT_ALLOWED; + } + + wdiEventData.wdiRequest = WDI_SET_LOW_POWER_REQ; + wdiEventData.pEventData = (void *) &enable; + wdiEventData.uEventDataSize = sizeof(wpt_boolean); + wdiEventData.pCBfnc = NULL; + wdiEventData.pUserData = NULL; + + return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData); +} + + + /** * WDI_set_vowifi_mode_ind() - Set VOWIFI mode request * @@ -17319,6 +17412,43 @@ WDI_ProcessCloseRsp return WDI_STATUS_SUCCESS; }/*WDI_ProcessCloseRsp*/ +/* + * WDI_low_power_rsp_callback() - The callback function for the response of + * OLPCMODE driver command + * + * @wdi_ctx: pointer to the HAL DAL context + * @event_data: pointer to the event information structure + * + * The function will be called when the firmware sends status of the OLPCMODE + * command sent by driver + * + * Return: status success on receiving valid response + */ +WDI_Status WDI_low_power_rsp_callback(WDI_ControlBlockType* pWDICtx, + WDI_EventInfoType* pEventData) +{ + tHalPowerControlModeChangeRspMsg low_power_rsp; + + VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO, + "<------ %s " ,__func__); + if(NULL == pEventData || NULL == pEventData->pEventData) + { + VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR, + "%s: Received NULL", __func__); + VOS_ASSERT(0) ; + return WDI_STATUS_E_FAILURE; + } + + wpalMemoryCopy(&low_power_rsp.pwrCtrlModeChangeRspParams, + pEventData->pEventData, + sizeof(low_power_rsp.pwrCtrlModeChangeRspParams)); + + VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO, + "OLPC status -> %lu" , + (unsigned long)(low_power_rsp.pwrCtrlModeChangeRspParams.status)); + return WDI_STATUS_SUCCESS; +} + /*============================================================================ SCAN RESPONSE PROCESSING API @@ -25346,6 +25476,8 @@ WDI_2_HAL_REQ_TYPE return WLAN_HAL_VOWIFI_IND; case WDI_SET_QPOWER: return WLAN_HAL_QPOWER_ENABLE_BY_HOST_IND; + case WDI_SET_LOW_POWER_REQ: + return WLAN_HAL_POWER_CONTROL_MODE_CHANGE_REQ; case WDI_MON_START_REQ: return WLAN_HAL_ENABLE_MONITOR_MODE_REQ; case WDI_MON_STOP_REQ: @@ -25795,6 +25927,8 @@ case WLAN_HAL_DEL_STA_SELF_RSP: return WDI_FW_ARP_STATS_RSP; case WLAN_HAL_FW_GET_ARP_STATS_RSP: return WDI_FW_GET_ARP_STATS_RSP; + case WLAN_HAL_POWER_CONTROL_MODE_CHANGE_RSP: + return WDI_SET_LOW_POWER_RSP; default: return eDRIVER_TYPE_MAX; }