diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index cf1ecd72d7..d9d9397a79 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -1461,15 +1461,39 @@ struct wmi_peer_rate_report_params { }; /** - * struct t_thermal_cmd_params - thermal command parameters + * enum thermal_mgmt_action_code - thermal mgmt action code + * @THERMAL_MGMT_ACTION_DEFAULT: target chooses what action to take, based + * on its default thermal management policy. + * @THERMAL_MGMT_ACTION_HALT_TRAFFIC: If the temperature rises above + * configured upper thresh degreeC, the target will halt tx. + * @THERMAL_MGMT_ACTION_NOTIFY_HOST: the target will notify the host + * if the temperature either rises above configured upper thresh degreeC or + * falls below lower thresh degreeC. + * @THERMAL_MGMT_ACTION_CHAINSCALING: The target will switch tx chain + * mask from multi chains to single chain if the temperature rises + * above upper thresh degreeC. + * The target will switch tx chainmask back to multi chains if the + * temperature drops below upper_thresh_degreeC. + */ +enum thermal_mgmt_action_code { + THERMAL_MGMT_ACTION_DEFAULT, + THERMAL_MGMT_ACTION_HALT_TRAFFIC, + THERMAL_MGMT_ACTION_NOTIFY_HOST, + THERMAL_MGMT_ACTION_CHAINSCALING, +}; + +/** + * struct thermal_cmd_params - thermal command parameters * @min_temp: minimum temprature * @max_temp: maximum temprature * @thermal_enable: thermal enable + * @thermal_action: thermal action code */ struct thermal_cmd_params { uint16_t min_temp; uint16_t max_temp; uint8_t thermal_enable; + enum thermal_mgmt_action_code thermal_action; }; #define WMI_LRO_IPV4_SEED_ARR_SZ 5 diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 1416c04e45..b6069d388f 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -4003,6 +4003,30 @@ static QDF_STATUS send_set_thermal_mgmt_cmd_tlv(wmi_unified_t wmi_handle, wmi_buf_t buf = NULL; QDF_STATUS status; uint32_t len = 0; + uint8_t action; + + switch (thermal_info->thermal_action) { + case THERMAL_MGMT_ACTION_DEFAULT: + action = WMI_THERMAL_MGMT_ACTION_DEFAULT; + break; + + case THERMAL_MGMT_ACTION_HALT_TRAFFIC: + action = WMI_THERMAL_MGMT_ACTION_HALT_TRAFFIC; + break; + + case THERMAL_MGMT_ACTION_NOTIFY_HOST: + action = WMI_THERMAL_MGMT_ACTION_NOTIFY_HOST; + break; + + case THERMAL_MGMT_ACTION_CHAINSCALING: + action = WMI_THERMAL_MGMT_ACTION_CHAINSCALING; + break; + + default: + WMI_LOGE("invalid thermal_action code %d", + thermal_info->thermal_action); + return QDF_STATUS_E_FAILURE; + } len = sizeof(*cmd); @@ -4020,9 +4044,11 @@ static QDF_STATUS send_set_thermal_mgmt_cmd_tlv(wmi_unified_t wmi_handle, cmd->lower_thresh_degreeC = thermal_info->min_temp; cmd->upper_thresh_degreeC = thermal_info->max_temp; cmd->enable = thermal_info->thermal_enable; + cmd->action = action; - WMI_LOGE("TM Sending thermal mgmt cmd: low temp %d, upper temp %d, enabled %d", - cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); + WMI_LOGD("TM Sending thermal mgmt cmd: low temp %d, upper temp %d, enabled %d action %d", + cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, + cmd->enable, cmd->action); wmi_mtrace(WMI_THERMAL_MGMT_CMDID, NO_SESSION, 0); status = wmi_unified_cmd_send(wmi_handle, buf, len,