Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50e40422 authored by Pankaj Singh's avatar Pankaj Singh Committed by nshrivas
Browse files

qcacld-3.0: Add support for WLAN thermal mitigation

As part of new requirement WLAN subsystem needs to perform thermal
mitigation action as per the thermal state of the device. The
wifi hal sends vendor command QCA_NL80211_VENDOR_SUBCMD_THERMAL_CMD
with the thermal level parameter and wlan host performs the required
appropriate action. wlan host driver maps the thermal level to
corresponding duty cycle off percent value and duty cycle value,
send WMI_THERM_THROT_SET_CONF_CMDID cmd to FW.

Make changes to perform vendor command handling, mapping thermal level
to duty cycle value and communicating the thermal information to FW.

change-ID: I77175048c817ab755cdb838018e414ef3ee0b112
CRs-Fixed: 2610395
parent 5f1c7172
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -269,6 +269,10 @@ ifeq ($(CONFIG_QCACLD_FEATURE_HW_CAPABILITY), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_hw_capability.o
endif

ifeq ($(CONFIG_FW_THERMAL_THROTTLE), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_thermal.o
endif

###### OSIF_SYNC ########
SYNC_DIR := os_if/sync
SYNC_INC_DIR := $(SYNC_DIR)/inc
@@ -2823,6 +2827,9 @@ cppflags-$(CONFIG_DISABLE_CHANNEL_LIST) += -DDISABLE_CHANNEL_LIST
#Flag to enable/disable WIPS feature
cppflags-$(CONFIG_WLAN_BCN_RECV_FEATURE) += -DWLAN_BCN_RECV_FEATURE

#Flag to enable/disable thermal mitigation
cppflags-$(CONFIG_FW_THERMAL_THROTTLE) += -DFW_THERMAL_THROTTLE

#Flag to enable/disable LTE COEX support
cppflags-$(CONFIG_LTE_COEX) += -DLTE_COEX

+4 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012 - 2019 The Linux Foundation. All rights reserved.
 * Copyright (c) 2012 - 2020 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
@@ -100,7 +100,7 @@ struct wlan_fwol_coex_config {
};

#define FWOL_THERMAL_LEVEL_MAX 4
#define FWOL_THERMAL_THROTTLE_LEVEL_MAX 4
#define FWOL_THERMAL_THROTTLE_LEVEL_MAX 6
/*
 * struct wlan_fwol_thermal_temp - Thermal temperature config items
 * @thermal_temp_min_level: Array of temperature minimum levels
@@ -108,6 +108,7 @@ struct wlan_fwol_coex_config {
 * @thermal_mitigation_enable: Control for Thermal mitigation feature
 * @throttle_period: Thermal throttle period value
 * @throttle_dutycycle_level: Array of throttle duty cycle levels
 * @thermal_sampling_time: sampling time for thermal mitigation in ms
 */
struct wlan_fwol_thermal_temp {
	bool     thermal_mitigation_enable;
@@ -115,6 +116,7 @@ struct wlan_fwol_thermal_temp {
	uint16_t thermal_temp_min_level[FWOL_THERMAL_LEVEL_MAX];
	uint16_t thermal_temp_max_level[FWOL_THERMAL_LEVEL_MAX];
	uint32_t throttle_dutycycle_level[FWOL_THERMAL_THROTTLE_LEVEL_MAX];
	uint16_t thermal_sampling_time;
};

/**
+9 −3
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@ fwol_init_thermal_temp_in_cfg(struct wlan_objmgr_psoc *psoc,
	thermal_temp->thermal_mitigation_enable =
				cfg_get(psoc, CFG_THERMAL_MITIGATION_ENABLE);
	thermal_temp->throttle_period = cfg_get(psoc, CFG_THROTTLE_PERIOD);
	thermal_temp->thermal_sampling_time =
				cfg_get(psoc, CFG_THERMAL_SAMPLING_TIME);
	thermal_temp->throttle_dutycycle_level[0] =
				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL0);
	thermal_temp->throttle_dutycycle_level[1] =
@@ -140,6 +142,10 @@ fwol_init_thermal_temp_in_cfg(struct wlan_objmgr_psoc *psoc,
				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL2);
	thermal_temp->throttle_dutycycle_level[3] =
				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL3);
	thermal_temp->throttle_dutycycle_level[4] =
				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL4);
	thermal_temp->throttle_dutycycle_level[5] =
				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL5);
}

QDF_STATUS fwol_init_neighbor_report_cfg(struct wlan_objmgr_psoc *psoc,
+75 −8
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2018,2020 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
@@ -234,7 +234,7 @@
 * gThrottleDutyCycleLevel1 - Set Thermal mitigation throttle duty cycle level1
 * @Min: 0
 * @Max: 100
 * @Default: 50
 * @Default: 10
 *
 * Usage: External
 *
@@ -244,7 +244,7 @@
			"gThrottleDutyCycleLevel1", \
			0, \
			100, \
			50, \
			10, \
			CFG_VALUE_OR_DEFAULT, \
			"Thermal mitigation throttle duty cycle level1")

@@ -253,7 +253,7 @@
 * gThrottleDutyCycleLevel2 - Set Thermal mitigation throttle duty cycle level2
 * @Min: 0
 * @Max: 100
 * @Default: 75
 * @Default: 30
 *
 * Usage: External
 *
@@ -263,7 +263,7 @@
			"gThrottleDutyCycleLevel2", \
			0, \
			100, \
			75, \
			30, \
			CFG_VALUE_OR_DEFAULT, \
			"Thermal mitigation throttle duty cycle level2")

@@ -272,7 +272,7 @@
 * gThrottleDutyCycleLevel3 - Set Thermal mitigation throttle duty cycle level3
 * @Min: 0
 * @Max: 100
 * @Default: 94
 * @Default: 50
 *
 * Usage: External
 *
@@ -282,10 +282,74 @@
			"gThrottleDutyCycleLevel3", \
			0, \
			100, \
			94, \
			50, \
			CFG_VALUE_OR_DEFAULT, \
			"Thermal mitigation throttle duty cycle level3")

/*
 * <ini>
 * gThrottleDutyCycleLevel4 - Set Thermal mitigation throttle duty cycle level4
 * @Min: 0
 * @Max: 100
 * @Default: 70
 *
 * This ini will apply the thermal throttle duty cycle value in FW
 * Usage: External
 *
 * </ini>
 */
#define CFG_THROTTLE_DUTY_CYCLE_LEVEL4 CFG_INI_UINT( \
			"gThrottleDutyCycleLevel4", \
			0, \
			100, \
			70, \
			CFG_VALUE_OR_DEFAULT, \
			"Thermal mitigation throttle duty cycle level4")

/*
 * <ini>
 * gThrottleDutyCycleLevel5 - Set Thermal mitigation throttle duty cycle level5
 * @Min: 0
 * @Max: 100
 * @Default: 90
 *
 * This ini will apply the thermal throttle duty cycle value in FW
 * Usage: External
 *
 * </ini>
 */
#define CFG_THROTTLE_DUTY_CYCLE_LEVEL5 CFG_INI_UINT( \
			"gThrottleDutyCycleLevel5", \
			0, \
			100, \
			90, \
			CFG_VALUE_OR_DEFAULT, \
			"Thermal mitigation throttle duty cycle level5")

/* <ini>
 *gThermalSamplingTime - Configure the thermal mitigation sampling time in ms.
 *
 * @Min: 10
 * @Max: 100
 * @Default: 100
 *
 * This ini will control the sampling time that the thermal mitigation in FW
 * will consider while applying the duty cycle.
 *
 * Usage: External
 *
 * Supported features: Thermal Mitigation
 *
 *</ini>
 */
#define CFG_THERMAL_SAMPLING_TIME CFG_INI_UINT( \
				"gThermalSamplingTime", \
				10, \
				100, \
				100, \
				CFG_VALUE_OR_DEFAULT, \
				"Thermal mitigation sampling time")

#define CFG_THERMAL_TEMP_ALL \
	CFG(CFG_THERMAL_TEMP_MIN_LEVEL0) \
	CFG(CFG_THERMAL_TEMP_MAX_LEVEL0) \
@@ -300,7 +364,10 @@
	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL0) \
	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL1) \
	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL2) \
	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL3)
	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL3) \
	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL4) \
	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL5) \
	CFG(CFG_THERMAL_SAMPLING_TIME)

#endif
+8 −1
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@
#include "wlan_hdd_oemdata.h"
#include "os_if_fwol.h"
#include "wlan_hdd_sta_info.h"
#include "sme_api.h"
#include "wlan_hdd_thermal.h"
#include <ol_defines.h>
#define g_mode_rates_size (12)
@@ -3886,6 +3888,11 @@ __wlan_hdd_cfg80211_get_features(struct wiphy *wiphy,
	wlan_hdd_cfg80211_set_feature(feature_flags,
			QCA_WLAN_VENDOR_FEATURE_SELF_MANAGED_REGULATORY);
#endif
	if (wlan_hdd_thermal_config_support())
		wlan_hdd_cfg80211_set_feature(feature_flags,
					QCA_WLAN_VENDOR_FEATURE_THERMAL_CONFIG);
	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(feature_flags) +
			NLMSG_HDRLEN);
@@ -14183,7 +14190,6 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wlan_hdd_cfg80211_extscan_get_valid_channels
	},
#ifdef WLAN_FEATURE_STATS_EXT
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
@@ -14797,6 +14803,7 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
	FEATURE_COEX_CONFIG_COMMANDS
	FEATURE_MPTA_HELPER_COMMANDS
	FEATURE_HW_CAPABILITY_COMMANDS
	FEATURE_THERMAL_VENDOR_COMMANDS
};
struct hdd_context *hdd_cfg80211_wiphy_alloc(void)
Loading