qcacmn: Set thermal action to FW in thermal mgmt command

Set "action" field when send WMI_THERMAL_MGMT_CMDID
to firmware. Then driver can configure the target management action
based on different customer requirement.

Change-Id: I3da5eea0d756444ede816be5cb74407863d63781
CRs-Fixed: 2767144
This commit is contained in:
Liangwei Dong
2020-09-01 14:11:26 +08:00
committed by snandini
parent 41e8d82db9
commit 2b2ff01a06
2 changed files with 53 additions and 3 deletions

View File

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

View File

@@ -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,