diff options
| author | Sourav Mohapatra <mohapatr@codeaurora.org> | 2019-05-23 14:35:58 +0530 |
|---|---|---|
| committer | Sourav Mohapatra <mohapatr@codeaurora.org> | 2019-06-12 17:23:44 +0530 |
| commit | 6b334c3ba407ab700d2bc7f1c1d76e7b7dbae8f4 (patch) | |
| tree | 857176ba1a6147c969275186c3b1f1dcf1c0cae6 | |
| parent | 1083615c2ba0f9f973cc778082f842775e55e19b (diff) | |
qcacmn: Add support for WLAN thermal mitigation
As a part of a new requirement, the WLAN subsystem needs to perform
thermal mitigation action as per the thermal state of the device. The
platform driver sends the notification with the thermal state and the
host performs the required appropriate action. The actions include
blocking northbound communication as a maximum power save state and
throttling (via duty cycle control) as an intermediate power save
action. The driver switches states and maintains the configured states
across load/unload.
Make changes to perform registration with the platform driver, act as
per the thermal state as received by the platform driver and
communicate with FW regarding the mitigation action to be performed.
The communication with the FW is done via the WMI command
WMI_THERM_THROT_SET_CONF_CMDID.
Change-Id: Icbbfd4d75e191b2e9b523afc4806fc714a4a251e
CRs-Fixed: 2468792
| -rw-r--r-- | wmi/inc/wmi_unified_param.h | 2 | ||||
| -rw-r--r-- | wmi/src/wmi_unified_tlv.c | 75 |
2 files changed, 77 insertions, 0 deletions
diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index d6895160d87d..ba5539fce602 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -3964,12 +3964,14 @@ typedef struct { * @enable: Enable/Disable Thermal mitigation * @dc: DC * @dc_per_event: DC per event + * @num_thermal_conf: Number of thermal configurations to be sent * @tt_level_config: TT level config params */ struct thermal_mitigation_params { uint32_t enable; uint32_t dc; uint32_t dc_per_event; + uint8_t num_thermal_conf; tt_level_config levelconf[THERMAL_LEVELS]; }; diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 953628eb479b..badc4c915480 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -15110,6 +15110,77 @@ static QDF_STATUS send_btm_config_cmd_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } +#ifdef FW_THERMAL_THROTTLE_SUPPORT +/** + * send_thermal_mitigation_param_cmd_tlv() - configure thermal mitigation params + * @wmi_handle: handle to WMI. + * @param: pointer to hold thermal mitigation param + * + * Return: QDF_STATUS_SUCCESS on success and appropriate error on failure. + */ +static QDF_STATUS send_thermal_mitigation_param_cmd_tlv( + wmi_unified_t wmi_handle, + struct thermal_mitigation_params *param) +{ + wmi_therm_throt_config_request_fixed_param *tt_conf; + wmi_therm_throt_level_config_info *lvl_conf = NULL; + wmi_buf_t buf = NULL; + uint8_t *buf_ptr = NULL; + QDF_STATUS error; + size_t len; + int i; + + len = sizeof(*tt_conf) + WMI_TLV_HDR_SIZE + + param->num_thermal_conf * + sizeof(wmi_therm_throt_level_config_info); + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) + return QDF_STATUS_E_NOMEM; + + tt_conf = (wmi_therm_throt_config_request_fixed_param *) + wmi_buf_data(buf); + + /* init fixed params */ + WMITLV_SET_HDR( + tt_conf, + WMITLV_TAG_STRUC_wmi_therm_throt_config_request_fixed_param, + WMITLV_GET_STRUCT_TLVLEN( + wmi_therm_throt_config_request_fixed_param)); + + tt_conf->enable = param->enable; + tt_conf->dc = param->dc; + tt_conf->therm_throt_levels = param->num_thermal_conf; + + buf_ptr = (uint8_t *)(++tt_conf); + /* init TLV params */ + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, + param->num_thermal_conf * + sizeof(wmi_therm_throt_level_config_info)); + + lvl_conf = (wmi_therm_throt_level_config_info *)(buf_ptr + + WMI_TLV_HDR_SIZE); + for (i = 0; i < param->num_thermal_conf; i++) { + WMITLV_SET_HDR( + &lvl_conf->tlv_header, + WMITLV_TAG_STRUC_wmi_therm_throt_level_config_info, + WMITLV_GET_STRUCT_TLVLEN( + wmi_therm_throt_level_config_info)); + lvl_conf->dc_off_percent = param->levelconf[i].dcoffpercent; + lvl_conf++; + } + + error = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_THERM_THROT_SET_CONF_CMDID); + if (QDF_IS_STATUS_ERROR(error)) { + wmi_buf_free(buf); + WMI_LOGE("Failed to send WMI_THERM_THROT_SET_CONF_CMDID cmd"); + } + + return error; +} +#endif + struct wmi_ops tlv_ops = { .send_vdev_create_cmd = send_vdev_create_cmd_tlv, .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, @@ -15413,6 +15484,10 @@ struct wmi_ops tlv_ops = { .send_offload_11k_cmd = send_offload_11k_cmd_tlv, .send_invoke_neighbor_report_cmd = send_invoke_neighbor_report_cmd_tlv, .send_btm_config = send_btm_config_cmd_tlv, +#ifdef FW_THERMAL_THROTTLE_SUPPORT + .send_thermal_mitigation_param_cmd = + send_thermal_mitigation_param_cmd_tlv, +#endif }; #ifdef WMI_TLV_AND_NON_TLV_SUPPORT |
