qcacld-3.0: Add support for thermal mitigation after SSR

Wlan driver is not caching the thermal mitigation level
configured by framework. As a result after ssr thermal
level is not send to fw.

Fix, to cache the thermal level in the driver and apply
it after ssr.

change-ID: I7ede84a11149e093b6a674c3a72f0aeb54a980db
CRs-Fixed: 2678533
This commit is contained in:
Pankaj Singh 2020-05-05 16:31:08 +05:30 • committed by nshrivas
commit beccafae0d
4 changed files with 64 additions and 0 deletions

View file

@ -1974,6 +1974,9 @@ struct hdd_context {
uint8_t val_pkt_capture_mode;
#endif
bool roam_ch_from_fw_supported;
#ifdef FW_THERMAL_THROTTLE_SUPPORT
uint8_t dutycycle_off_percent;
#endif
};
/**

View file

@ -83,6 +83,7 @@
#include "wlan_osif_request_manager.h"
#include <wlan_hdd_sar_limits.h>
#include "wlan_pkt_capture_ucfg_api.h"
#include "wlan_hdd_thermal.h"
/* Preprocessor definitions and constants */
#ifdef QCA_WIFI_NAPIER_EMULATION
@ -1524,6 +1525,7 @@ QDF_STATUS hdd_wlan_re_init(void)
sme_set_chip_pwr_save_fail_cb(hdd_ctx->mac_handle,
hdd_chip_pwr_save_fail_detected_cb);
hdd_restore_thermal_mitigation_config(hdd_ctx);
hdd_restore_sar_config(hdd_ctx);
hdd_send_default_scan_ies(hdd_ctx);

View file

@ -144,6 +144,15 @@ __wlan_hdd_cfg80211_set_thermal_mitigation_policy(struct wiphy *wiphy,
target_temp);
if (QDF_IS_STATUS_ERROR(status))
hdd_err_rl("Failed to set throttle configuration %d", status);
else {
/*
* After SSR, the thermal mitigation level is lost.
* As SSR is hidden from userland, this command will not come
* from userspace after a SSR. To restore this configuration,
* save this in hdd context and restore after re-init.
*/
hdd_ctx->dutycycle_off_percent = dc_off_percent;
}
return qdf_status_to_os_return(status);
}
@ -184,3 +193,37 @@ bool wlan_hdd_thermal_config_support(void)
return true;
}
QDF_STATUS hdd_restore_thermal_mitigation_config(struct hdd_context *hdd_ctx)
{
bool enable = true;
uint32_t dc, dc_off_percent = 0;
uint32_t prio = 0, target_temp = 0;
struct wlan_fwol_thermal_temp thermal_temp = {0};
QDF_STATUS status;
status = ucfg_fwol_get_thermal_temp(hdd_ctx->psoc, &thermal_temp);
if (QDF_IS_STATUS_ERROR(status)) {
hdd_err_rl("Failed to get fwol thermal obj");
return status;
}
dc_off_percent = hdd_ctx->dutycycle_off_percent;
dc = thermal_temp.thermal_sampling_time;
if (!dc_off_percent)
enable = false;
hdd_debug("dc %d dc_off_per %d enable %d", dc, dc_off_percent, enable);
status = sme_set_thermal_throttle_cfg(hdd_ctx->mac_handle,
enable,
dc,
dc_off_percent,
prio,
target_temp);
if (QDF_IS_STATUS_ERROR(status))
hdd_err_rl("Failed to set throttle configuration %d", status);
return status;
}

View file

@ -41,6 +41,16 @@ wlan_hdd_cfg80211_set_thermal_mitigation_policy(struct wiphy *wiphy,
*/
bool wlan_hdd_thermal_config_support(void);
/**
* hdd_restore_thermal_mitigation_config - Restore the saved thermal config
* @hdd_ctx: HDD context
*
* Restore the thermal mitigation config afetr SSR.
*
* Return: QDF_STATUS
*/
QDF_STATUS hdd_restore_thermal_mitigation_config(struct hdd_context *hdd_ctx);
extern const struct nla_policy
wlan_hdd_thermal_mitigation_policy
[QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_MAX + 1];
@ -62,5 +72,11 @@ static inline bool wlan_hdd_thermal_config_support(void)
return false;
}
static inline
QDF_STATUS hdd_restore_thermal_mitigation_config(struct hdd_context *hdd_ctx)
{
return false;
}
#endif /* FEATURE_THERMAL_VENDOR_COMMANDS */
#endif /* __HDD_THERMAL_H */