qcacld-3.0: Add handler for new optimized_power_management attribute

Add handler for the newly created optimized_power_management attribute.

Change-Id: I09d0a328f8685484e53e17329ffe40fbbcdd568a
CRs-Fixed: 2715055
This commit is contained in:
Alan Chen 2020-06-16 18:41:55 -07:00 • committed by nshrivas
commit dfcef91465
2 changed files with 41 additions and 4 deletions

View file

@ -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},
};
/**

View file

@ -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;
}