diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 6dc912ceeb94..35f93338f1f1 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -8488,6 +8488,8 @@ static const struct independent_setters independent_setters[] = { hdd_set_dynamic_bw}, {QCA_WLAN_VENDOR_ATTR_CONFIG_NSS, hdd_set_nss}, + {QCA_WLAN_VENDOR_ATTR_CONFIG_OPTIMIZED_POWER_MANAGEMENT, + hdd_config_power}, }; #ifdef WLAN_FEATURE_ELNA @@ -8856,6 +8858,39 @@ static int hdd_get_nss_config(struct hdd_adapter *adapter, return 0; } +/** + * hdd_get_optimized_power_config() - Get the number of spatial streams + * supported by the adapter + * @adapter: Pointer to HDD adapter + * @skb: sk buffer to hold nl80211 attributes + * @attr: Pointer to struct nlattr + * + * Return: 0 on success; error number otherwise + */ +static int hdd_get_optimized_power_config(struct hdd_adapter *adapter, + struct sk_buff *skb, + const struct nlattr *attr) +{ + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + uint8_t optimized_power_cfg; + int errno; + + errno = wlan_hdd_validate_context(hdd_ctx); + if (errno) + return errno; + + optimized_power_cfg = ucfg_pmo_get_power_save_mode(hdd_ctx->psoc); + + if (nla_put_u8(skb, + QCA_WLAN_VENDOR_ATTR_CONFIG_OPTIMIZED_POWER_MANAGEMENT, + optimized_power_cfg)) { + hdd_err_rl("nla_put failure"); + return -EINVAL; + } + + return 0; +} + /** * typedef config_getter_fn - get configuration handler * @adapter: The adapter being configured @@ -8921,6 +8956,9 @@ static const struct config_getters config_getters[] = { {QCA_WLAN_VENDOR_ATTR_CONFIG_NSS, sizeof(uint8_t), hdd_get_nss_config}, + {QCA_WLAN_VENDOR_ATTR_CONFIG_OPTIMIZED_POWER_MANAGEMENT, + sizeof(uint8_t), + hdd_get_optimized_power_config}, }; /** diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index a5cba64d5d4a..31cefedba3b0 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -2520,10 +2520,6 @@ int hdd_set_power_config(struct hdd_context *hddctx, { QDF_STATUS status; - if (!ucfg_pmo_get_power_save_mode(hddctx->psoc)) { - hdd_err("power save is disabled in configuration"); - return -EINVAL; - } if (adapter->device_mode != QDF_STA_MODE && adapter->device_mode != QDF_P2P_CLIENT_MODE) { hdd_info("Advanced power save only allowed in STA/P2P-Client modes:%d", @@ -2548,6 +2544,9 @@ int hdd_set_power_config(struct hdd_context *hddctx, return -EINVAL; } + /* cache latest userspace power save config to reapply after SSR */ + ucfg_pmo_set_power_save_mode(hddctx->psoc, power); + return 0; }