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