qcacld-3.0: Add support to get thermal throttle stats

Add support for sending WMI_REQUEST_THERMAL_STATS_CMDID
to request for the thermal stats via vendor cmd:
QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_THERMAL_STATS
This vendor cmd can either be used to clear the thermal
stats or to request for the thermal stats.
Added ini gThermalStatsTempOffset, which can
configure thermal temperature offset value for capturing
thermal stats in  thermal range such as Thermal STATS
starts capturing from temperature threshold to temperature
threshold + offset.
If this ini is set to 0, then the events are disabled.
Also, add support for the FW event where the requested
thermal stats are sent in FW event
WMI_THERM_THROT_STATS_EVENTID().
The following attributes are sent in the events for every
level:
	STATS_MIN_TEMPERATURE
	STATS_MAX_TEMPERATURE
	STATS_DWELL_TIME
	STATS_TEMP_LEVEL_COUNTER

Change-Id: If8acdeec5bde33be346332ccaf39d78d0151203d
CRs-Fixed: 3016818
这个提交包含在:
Utkarsh Bhatnagar
2021-08-11 18:32:30 +05:30
提交者 Madan Koyyalamudi
父节点 e13583c8c9
当前提交 ac66479f44
修改 17 个文件,包含 777 行新增36 行删除

查看文件

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018,2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2018,2020-2021 The Linux Foundation. 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
@@ -430,6 +430,31 @@
CFG_VALUE_OR_DEFAULT, \
"Thermal management action")
/* <ini>
* gThermalStatsTempOffset - Configure the thermal stats offset
*
* @Min: 0
* @Max: 10
* @Default: 5
*
* This ini will configure Thermal temperature offset value for capturing
* thermal stats in thermal range.
* Thermal STATS start capturing from temperature threshold to temperature
* threshold + offset.
* If the value 0 is given then then thermal STATS capture is disabled
*
* Usage: External
*
* </ini>
*/
#define CFG_THERMAL_STATS_TEMP_OFFSET CFG_INI_UINT( \
"gThermalStatsTempOffset", \
0, \
10, \
5, \
CFG_VALUE_OR_DEFAULT, \
"Thermal Stats Temperature Offset")
#define CFG_THERMAL_TEMP_ALL \
CFG(CFG_THERMAL_TEMP_MIN_LEVEL0) \
CFG(CFG_THERMAL_TEMP_MAX_LEVEL0) \
@@ -450,6 +475,7 @@
CFG(CFG_THERMAL_SAMPLING_TIME) \
CFG(CFG_THERMAL_APPS_PRIORITY) \
CFG(CFG_THERMAL_WPPS_PRIOITY) \
CFG(CFG_THERMAL_MGMT_ACTION)
#endif
CFG(CFG_THERMAL_MGMT_ACTION) \
CFG(CFG_THERMAL_STATS_TEMP_OFFSET)\
#endif

查看文件

@@ -25,6 +25,7 @@
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_thermal_public_struct.h"
#include "wmi_unified.h"
#ifdef WLAN_FEATURE_ELNA
/**
@@ -58,10 +59,28 @@ struct get_elna_bypass_response {
};
#endif
/**
* struct thermal_throttle_info - thermal throttle info from Target
* @temperature: current temperature in c Degree
* @level: target thermal level info
* @pdev_id: pdev id
* @therm_throt_levels: Number of thermal throttle levels
* @level_info: Thermal Stats for each level
*/
struct thermal_throttle_info {
uint32_t temperature;
enum thermal_throttle_level level;
uint32_t pdev_id;
uint32_t therm_throt_levels;
struct thermal_throt_level_stats level_info[WMI_THERMAL_STATS_TEMP_THRESH_LEVEL_MAX];
};
/**
* struct wlan_fwol_callbacks - fw offload callbacks
* @get_elna_bypass_callback: callback for get eLNA bypass
* @get_elna_bypass_context: context for get eLNA bypass
* @get_thermal_stats_callback: callback for get thermal stats
* @get_thermal_stats_context: context for get thermal stats
*/
struct wlan_fwol_callbacks {
#ifdef WLAN_FEATURE_ELNA
@@ -69,18 +88,11 @@ struct wlan_fwol_callbacks {
struct get_elna_bypass_response *response);
void *get_elna_bypass_context;
#endif
};
/**
* struct thermal_throttle_info - thermal throttle info from Target
* @temperature: current temperature in c Degree
* @level: target thermal level info
* @pdev_id: pdev id
*/
struct thermal_throttle_info {
uint32_t temperature;
enum thermal_throttle_level level;
uint32_t pdev_id;
#ifdef THERMAL_STATS_SUPPORT
void (*get_thermal_stats_callback)(void *context,
struct thermal_throttle_info *response);
void *get_thermal_stats_context;
#endif
};
#ifdef WLAN_FEATURE_MDNS_OFFLOAD
@@ -125,6 +137,7 @@ struct mdns_config_info {
* @unreg_evt_handler: unregister event handler
* @send_dscp_up_map_to_fw: send dscp-to-up map values to FW
* @set_mdns_config: set mdns config info
* @get_thermal_stats: send get_thermal_stats cmd to FW
*/
struct wlan_fwol_tx_ops {
#ifdef WLAN_FEATURE_ELNA
@@ -146,6 +159,11 @@ struct wlan_fwol_tx_ops {
QDF_STATUS (*set_mdns_config)(struct wlan_objmgr_psoc *psoc,
struct mdns_config_info *mdns_info);
#endif
#ifdef THERMAL_STATS_SUPPORT
QDF_STATUS (*get_thermal_stats)(struct wlan_objmgr_psoc *psoc,
enum thermal_stats_request_type req_type,
uint8_t therm_stats_offset);
#endif
};
/**
@@ -153,6 +171,7 @@ struct wlan_fwol_tx_ops {
* @get_elna_bypass_resp: get eLNA bypass response
* @notify_thermal_throttle_handler: thermal stats indication callback to fwol
* core from target if layer
* @get_thermal_stats_resp: thermal stats cmd response callback to fwol
*/
struct wlan_fwol_rx_ops {
#ifdef WLAN_FEATURE_ELNA
@@ -164,6 +183,10 @@ struct wlan_fwol_rx_ops {
struct wlan_objmgr_psoc *psoc,
struct thermal_throttle_info *info);
#endif
#ifdef THERMAL_STATS_SUPPORT
QDF_STATUS (*get_thermal_stats_resp)(struct wlan_objmgr_psoc *psoc,
struct thermal_throttle_info *resp);
#endif
};
/**

查看文件

@@ -669,6 +669,26 @@ QDF_STATUS ucfg_fwol_set_mdns_config(struct wlan_objmgr_psoc *psoc,
struct mdns_config_info *mdns_info);
#endif /* WLAN_FEATURE_MDNS_OFFLOAD */
/**
* ucfg_fwol_update_fw_cap_info - API to update fwol capability info
* @psoc: pointer to psoc object
* @caps: pointer to wlan_fwol_capability_info struct
*
* Used to update fwol capability info.
*
* Return: void
*/
void ucfg_fwol_update_fw_cap_info(struct wlan_objmgr_psoc *psoc,
struct wlan_fwol_capability_info *caps);
#ifdef THERMAL_STATS_SUPPORT
QDF_STATUS ucfg_fwol_send_get_thermal_stats_cmd(struct wlan_objmgr_psoc *psoc,
enum thermal_stats_request_type req_type,
void (*callback)(void *context,
struct thermal_throttle_info *response),
void *context);
#endif /* THERMAL_STATS_SUPPORT */
/**
* ucfg_fwol_configure_global_params - API to configure global params
* @psoc: pointer to psoc object