qcacld-3.0: Support obtaining thermal level for non-offload case
Currently thermal level can be got from upper layer only for FW thermal mgmt offload case. Per the requirement, refine the code to support it for thermal non-offload case as well. Similar to offload thermal mitigation, add TX_OFF and shutdown two states for non-offload case. Host will fully stop TX traffic in TX_OFF state and target will trigger shutdown when temperature come to the range of shutdown. Per above requirement, add below four INI to configure thermal temperature threshold value as need for TX off and target shutdown. gThermalTempMinLevel4 gThermalTempMaxLevel4 gThermalTempMinLevel5 gThermalTempMaxLevel5 Change-Id: I40d097ab8a5801052553ad7adedd38be475c7669 CRs-Fixed: 3413165
This commit is contained in:
parent
a86d1881cc
commit
29869c5fa8
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2012 - 2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@ -113,7 +113,7 @@ struct wlan_fwol_coex_config {
|
||||
#endif
|
||||
};
|
||||
|
||||
#define FWOL_THERMAL_LEVEL_MAX 4
|
||||
#define FWOL_THERMAL_LEVEL_MAX 6
|
||||
#define FWOL_THERMAL_THROTTLE_LEVEL_MAX 6
|
||||
/**
|
||||
* struct wlan_fwol_thermal_temp - Thermal temperature config items
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@ -152,6 +152,14 @@ fwol_init_thermal_temp_in_cfg(struct wlan_objmgr_psoc *psoc,
|
||||
cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL3);
|
||||
thermal_temp->thermal_temp_max_level[3] =
|
||||
cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL3);
|
||||
thermal_temp->thermal_temp_min_level[4] =
|
||||
cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL4);
|
||||
thermal_temp->thermal_temp_max_level[4] =
|
||||
cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL4);
|
||||
thermal_temp->thermal_temp_min_level[5] =
|
||||
cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL5);
|
||||
thermal_temp->thermal_temp_max_level[5] =
|
||||
cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL5);
|
||||
|
||||
thermal_temp->thermal_mitigation_enable =
|
||||
cfg_get(psoc, CFG_THERMAL_MITIGATION_ENABLE);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018,2020-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@ -176,6 +176,86 @@
|
||||
CFG_VALUE_OR_DEFAULT, \
|
||||
"Thermal Temp Max Level3")
|
||||
|
||||
/*
|
||||
* <ini>
|
||||
* gThermalTempMinLevel4 - Set Thermal Temp Min Level
|
||||
* for TX OFF
|
||||
* @Min: 0
|
||||
* @Max: 1000
|
||||
* @Default: 116
|
||||
*
|
||||
* Usage: External
|
||||
*
|
||||
* </ini>
|
||||
*/
|
||||
#define CFG_THERMAL_TEMP_MIN_LEVEL4 CFG_INI_UINT( \
|
||||
"gThermalTempMinLevel4", \
|
||||
0, \
|
||||
1000, \
|
||||
116, \
|
||||
CFG_VALUE_OR_DEFAULT, \
|
||||
"Thermal Temp Min Level4")
|
||||
|
||||
/*
|
||||
* <ini>
|
||||
* gThermalTempMaxLevel4 - Set Thermal Temp Max Level
|
||||
* for TX OFF
|
||||
* @Min: 0
|
||||
* @Max: 1000
|
||||
* @Default: 117
|
||||
*
|
||||
* Usage: External
|
||||
*
|
||||
* </ini>
|
||||
*/
|
||||
#define CFG_THERMAL_TEMP_MAX_LEVEL4 CFG_INI_UINT( \
|
||||
"gThermalTempMaxLevel4", \
|
||||
0, \
|
||||
1000, \
|
||||
117, \
|
||||
CFG_VALUE_OR_DEFAULT, \
|
||||
"Thermal Temp Max Level4")
|
||||
|
||||
/*
|
||||
* <ini>
|
||||
* gThermalTempMinLevel5 - Set Thermal Temp Min Level
|
||||
* for target shutdown
|
||||
* @Min: 0
|
||||
* @Max: 1000
|
||||
* @Default: 118
|
||||
*
|
||||
* Usage: External
|
||||
*
|
||||
* </ini>
|
||||
*/
|
||||
#define CFG_THERMAL_TEMP_MIN_LEVEL5 CFG_INI_UINT( \
|
||||
"gThermalTempMinLevel5", \
|
||||
0, \
|
||||
1000, \
|
||||
118, \
|
||||
CFG_VALUE_OR_DEFAULT, \
|
||||
"Thermal Temp Min Level5")
|
||||
|
||||
/*
|
||||
* <ini>
|
||||
* gThermalTempMaxLevel5 - Set Thermal Temp Max Level
|
||||
* for target shutdown
|
||||
* @Min: 0
|
||||
* @Max: 1000
|
||||
* @Default: 120
|
||||
*
|
||||
* Usage: External
|
||||
*
|
||||
* </ini>
|
||||
*/
|
||||
#define CFG_THERMAL_TEMP_MAX_LEVEL5 CFG_INI_UINT( \
|
||||
"gThermalTempMaxLevel5", \
|
||||
0, \
|
||||
1000, \
|
||||
120, \
|
||||
CFG_VALUE_OR_DEFAULT, \
|
||||
"Thermal Temp Max Level5")
|
||||
|
||||
/*
|
||||
* <ini>
|
||||
* gThermalMitigationEnable - Set Thermal mitigation feature control
|
||||
@ -465,6 +545,10 @@
|
||||
CFG(CFG_THERMAL_TEMP_MAX_LEVEL2) \
|
||||
CFG(CFG_THERMAL_TEMP_MIN_LEVEL3) \
|
||||
CFG(CFG_THERMAL_TEMP_MAX_LEVEL3) \
|
||||
CFG(CFG_THERMAL_TEMP_MIN_LEVEL4) \
|
||||
CFG(CFG_THERMAL_TEMP_MAX_LEVEL4) \
|
||||
CFG(CFG_THERMAL_TEMP_MIN_LEVEL5) \
|
||||
CFG(CFG_THERMAL_TEMP_MAX_LEVEL5) \
|
||||
CFG(CFG_THERMAL_MITIGATION_ENABLE) \
|
||||
CFG(CFG_THROTTLE_PERIOD) \
|
||||
CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL0) \
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2019 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@ -55,4 +56,27 @@ target_if_fwol_unregister_event_handler(struct wlan_objmgr_psoc *psoc,
|
||||
*/
|
||||
QDF_STATUS target_if_fwol_register_tx_ops(struct wlan_fwol_tx_ops *tx_ops);
|
||||
|
||||
/**
|
||||
* target_if_fwol_notify_thermal_throttle() - Notify thermal throttle level
|
||||
* to upper layer
|
||||
* @psoc: PSOC object manager
|
||||
* @info: Thermal throttle information from target
|
||||
*
|
||||
* This function is used to notify thermal throttle level to upper layer
|
||||
* when thermal management event receive.
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS for success otherwise failure
|
||||
*/
|
||||
#ifdef FW_THERMAL_THROTTLE_SUPPORT
|
||||
QDF_STATUS
|
||||
target_if_fwol_notify_thermal_throttle(struct wlan_objmgr_psoc *psoc,
|
||||
struct thermal_throttle_info *info);
|
||||
#else
|
||||
static inline QDF_STATUS
|
||||
target_if_fwol_notify_thermal_throttle(struct wlan_objmgr_psoc *psoc,
|
||||
struct thermal_throttle_info *info)
|
||||
{
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
#endif
|
||||
#endif /* __TARGET_IF_FWOL_H__ */
|
||||
|
@ -321,6 +321,49 @@ target_if_fwol_is_thermal_stats_enable(struct wlan_fwol_psoc_obj *fwol_obj)
|
||||
#endif
|
||||
|
||||
#if defined FW_THERMAL_THROTTLE_SUPPORT || defined THERMAL_STATS_SUPPORT
|
||||
QDF_STATUS
|
||||
target_if_fwol_notify_thermal_throttle(struct wlan_objmgr_psoc *psoc,
|
||||
struct thermal_throttle_info *info)
|
||||
{
|
||||
struct wlan_fwol_psoc_obj *fwol_obj;
|
||||
struct wlan_fwol_rx_ops *rx_ops;
|
||||
QDF_STATUS status;
|
||||
|
||||
fwol_obj = fwol_get_psoc_obj(psoc);
|
||||
if (!fwol_obj) {
|
||||
target_if_err("Failed to get FWOL Obj");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
rx_ops = &fwol_obj->rx_ops;
|
||||
if (!rx_ops) {
|
||||
target_if_err("rx_ops Null");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
if (!info) {
|
||||
target_if_err("info Null");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
if (rx_ops->notify_thermal_throttle_handler) {
|
||||
if (info->level == THERMAL_UNKNOWN) {
|
||||
target_if_debug("Invalid thermal target lvl");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
status = rx_ops->notify_thermal_throttle_handler(psoc, info);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
target_if_debug("notify thermal_throttle failed.");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
} else {
|
||||
target_if_debug("No notify thermal_throttle callback");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* target_if_fwol_thermal_throttle_event_handler() - handler for thermal
|
||||
* throttle event
|
||||
@ -456,7 +499,6 @@ target_if_fwol_unregister_thermal_throttle_handler(
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
target_if_debug("Failed to unregister thermal stats event cb");
|
||||
}
|
||||
|
||||
#else
|
||||
static void
|
||||
target_if_fwol_register_thermal_throttle_handler(struct wlan_objmgr_psoc *psoc)
|
||||
|
@ -761,3 +761,6 @@ endif
|
||||
ifeq ($(CONFIG_CNSS_UTILS), m)
|
||||
CONFIG_CNSS_UTILS_MODULE := y
|
||||
endif
|
||||
|
||||
#Enable thermal throttle
|
||||
CONFIG_FW_THERMAL_THROTTLE := y
|
||||
|
@ -2365,10 +2365,12 @@ typedef enum {
|
||||
WLAN_WMA_THERMAL_LEVEL_1,
|
||||
WLAN_WMA_THERMAL_LEVEL_2,
|
||||
WLAN_WMA_THERMAL_LEVEL_3,
|
||||
WLAN_WMA_THERMAL_LEVEL_4,
|
||||
WLAN_WMA_THERMAL_LEVEL_5,
|
||||
WLAN_WMA_MAX_THERMAL_LEVELS
|
||||
} t_thermal_level;
|
||||
|
||||
#define WLAN_THROTTLE_DUTY_CYCLE_LEVEL_MAX (4)
|
||||
#define WLAN_THROTTLE_DUTY_CYCLE_LEVEL_MAX (6)
|
||||
|
||||
typedef struct {
|
||||
/* Array of thermal levels */
|
||||
|
@ -8378,6 +8378,10 @@ QDF_STATUS sme_init_thermal_info(mac_handle_t mac_handle)
|
||||
thermal_temp.throttle_dutycycle_level[2];
|
||||
pWmaParam->throttle_duty_cycle_tbl[3] =
|
||||
thermal_temp.throttle_dutycycle_level[3];
|
||||
pWmaParam->throttle_duty_cycle_tbl[4] =
|
||||
thermal_temp.throttle_dutycycle_level[4];
|
||||
pWmaParam->throttle_duty_cycle_tbl[5] =
|
||||
thermal_temp.throttle_dutycycle_level[5];
|
||||
|
||||
pWmaParam->thermalLevels[0].minTempThreshold =
|
||||
thermal_temp.thermal_temp_min_level[0];
|
||||
@ -8395,6 +8399,14 @@ QDF_STATUS sme_init_thermal_info(mac_handle_t mac_handle)
|
||||
thermal_temp.thermal_temp_min_level[3];
|
||||
pWmaParam->thermalLevels[3].maxTempThreshold =
|
||||
thermal_temp.thermal_temp_max_level[3];
|
||||
pWmaParam->thermalLevels[4].minTempThreshold =
|
||||
thermal_temp.thermal_temp_min_level[4];
|
||||
pWmaParam->thermalLevels[4].maxTempThreshold =
|
||||
thermal_temp.thermal_temp_max_level[4];
|
||||
pWmaParam->thermalLevels[5].minTempThreshold =
|
||||
thermal_temp.thermal_temp_min_level[5];
|
||||
pWmaParam->thermalLevels[5].maxTempThreshold =
|
||||
thermal_temp.thermal_temp_max_level[5];
|
||||
pWmaParam->thermal_action = thermal_temp.thermal_action;
|
||||
if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&mac->sme)) {
|
||||
msg.type = WMA_INIT_THERMAL_INFO_CMD;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@ -84,6 +84,8 @@
|
||||
#include "wlan_pkt_capture_ucfg_api.h"
|
||||
#include "wma_eht.h"
|
||||
#include "wlan_mlo_mgr_sta.h"
|
||||
#include "wlan_fw_offload_main.h"
|
||||
#include "target_if_fwol.h"
|
||||
|
||||
struct wma_search_rate {
|
||||
int32_t rate;
|
||||
@ -1818,11 +1820,15 @@ QDF_STATUS wma_process_init_thermal_info(tp_wma_handle wma,
|
||||
"0 %d\n"
|
||||
"1 %d\n"
|
||||
"2 %d\n"
|
||||
"3 %d",
|
||||
"3 %d\n"
|
||||
"4 %d\n"
|
||||
"5 %d",
|
||||
pThermalParams->throttle_duty_cycle_tbl[0],
|
||||
pThermalParams->throttle_duty_cycle_tbl[1],
|
||||
pThermalParams->throttle_duty_cycle_tbl[2],
|
||||
pThermalParams->throttle_duty_cycle_tbl[3]);
|
||||
pThermalParams->throttle_duty_cycle_tbl[3],
|
||||
pThermalParams->throttle_duty_cycle_tbl[4],
|
||||
pThermalParams->throttle_duty_cycle_tbl[5]);
|
||||
|
||||
wma->thermal_mgmt_info.thermalMgmtEnabled =
|
||||
pThermalParams->thermalMgmtEnabled;
|
||||
@ -1842,13 +1848,23 @@ QDF_STATUS wma_process_init_thermal_info(tp_wma_handle wma,
|
||||
pThermalParams->thermalLevels[3].minTempThreshold;
|
||||
wma->thermal_mgmt_info.thermalLevels[3].maxTempThreshold =
|
||||
pThermalParams->thermalLevels[3].maxTempThreshold;
|
||||
wma->thermal_mgmt_info.thermalLevels[4].minTempThreshold =
|
||||
pThermalParams->thermalLevels[4].minTempThreshold;
|
||||
wma->thermal_mgmt_info.thermalLevels[4].maxTempThreshold =
|
||||
pThermalParams->thermalLevels[4].maxTempThreshold;
|
||||
wma->thermal_mgmt_info.thermalLevels[5].minTempThreshold =
|
||||
pThermalParams->thermalLevels[5].minTempThreshold;
|
||||
wma->thermal_mgmt_info.thermalLevels[5].maxTempThreshold =
|
||||
pThermalParams->thermalLevels[5].maxTempThreshold;
|
||||
wma->thermal_mgmt_info.thermalCurrLevel = WLAN_WMA_THERMAL_LEVEL_0;
|
||||
wma->thermal_mgmt_info.thermal_action = pThermalParams->thermal_action;
|
||||
wma_nofl_debug("TM level min max:\n"
|
||||
"0 %d %d\n"
|
||||
"1 %d %d\n"
|
||||
"2 %d %d\n"
|
||||
"3 %d %d",
|
||||
"3 %d %d\n"
|
||||
"4 %d %d\n"
|
||||
"5 %d %d",
|
||||
wma->thermal_mgmt_info.thermalLevels[0].minTempThreshold,
|
||||
wma->thermal_mgmt_info.thermalLevels[0].maxTempThreshold,
|
||||
wma->thermal_mgmt_info.thermalLevels[1].minTempThreshold,
|
||||
@ -1856,7 +1872,11 @@ QDF_STATUS wma_process_init_thermal_info(tp_wma_handle wma,
|
||||
wma->thermal_mgmt_info.thermalLevels[2].minTempThreshold,
|
||||
wma->thermal_mgmt_info.thermalLevels[2].maxTempThreshold,
|
||||
wma->thermal_mgmt_info.thermalLevels[3].minTempThreshold,
|
||||
wma->thermal_mgmt_info.thermalLevels[3].maxTempThreshold);
|
||||
wma->thermal_mgmt_info.thermalLevels[3].maxTempThreshold,
|
||||
wma->thermal_mgmt_info.thermalLevels[4].minTempThreshold,
|
||||
wma->thermal_mgmt_info.thermalLevels[4].maxTempThreshold,
|
||||
wma->thermal_mgmt_info.thermalLevels[5].minTempThreshold,
|
||||
wma->thermal_mgmt_info.thermalLevels[5].maxTempThreshold);
|
||||
|
||||
#ifdef FW_THERMAL_THROTTLE_SUPPORT
|
||||
for (i = 0; i < THROTTLE_LEVEL_MAX; i++)
|
||||
@ -2023,6 +2043,31 @@ static uint8_t wma_thermal_mgmt_get_level(void *handle, uint32_t temp)
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* wms_thermal_level_to_host() - Convert wma thermal level to host enum
|
||||
* @level: current thermal throttle level
|
||||
*
|
||||
* Return: host thermal throttle level
|
||||
*/
|
||||
static enum thermal_throttle_level
|
||||
wma_thermal_level_to_host(uint8_t level)
|
||||
{
|
||||
switch (level) {
|
||||
case WLAN_WMA_THERMAL_LEVEL_0:
|
||||
return THERMAL_FULLPERF;
|
||||
case WLAN_WMA_THERMAL_LEVEL_1:
|
||||
case WLAN_WMA_THERMAL_LEVEL_2:
|
||||
case WLAN_WMA_THERMAL_LEVEL_3:
|
||||
return THERMAL_MITIGATION;
|
||||
case WLAN_WMA_THERMAL_LEVEL_4:
|
||||
return THERMAL_SHUTOFF;
|
||||
case WLAN_WMA_THERMAL_LEVEL_5:
|
||||
return THERMAL_SHUTDOWN_TARGET;
|
||||
default:
|
||||
return THERMAL_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* wma_thermal_mgmt_evt_handler() - thermal mgmt event handler
|
||||
* @wma_handle: Pointer to WMA handle
|
||||
@ -2040,6 +2085,8 @@ int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event, uint32_t len)
|
||||
uint8_t thermal_level;
|
||||
t_thermal_cmd_params thermal_params = {0};
|
||||
WMI_THERMAL_MGMT_EVENTID_param_tlvs *param_buf;
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
struct thermal_throttle_info info = {0};
|
||||
|
||||
if (!event || !handle) {
|
||||
wma_err("Invalid thermal mitigation event buffer");
|
||||
@ -2051,6 +2098,12 @@ int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event, uint32_t len)
|
||||
if (wma_validate_handle(wma))
|
||||
return -EINVAL;
|
||||
|
||||
psoc = wma->psoc;
|
||||
if (!psoc) {
|
||||
wma_err("NULL psoc");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
param_buf = (WMI_THERMAL_MGMT_EVENTID_param_tlvs *) event;
|
||||
|
||||
/* Check if thermal mitigation is enabled */
|
||||
@ -2075,6 +2128,8 @@ int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event, uint32_t len)
|
||||
}
|
||||
|
||||
wma->thermal_mgmt_info.thermalCurrLevel = thermal_level;
|
||||
info.level = wma_thermal_level_to_host(thermal_level);
|
||||
target_if_fwol_notify_thermal_throttle(psoc, &info);
|
||||
|
||||
if (!wma->fw_therm_throt_support) {
|
||||
/* Inform txrx */
|
||||
|
Loading…
Reference in New Issue
Block a user