Browse Source

qcacld-3.0: Check for WMI_SERVICE_THERM_THROT and Thermal Mitigation

WMI send command WMI_PDEV_GET_TEMPERATURE_CMDID to FW without
checking whether WMI_SERVICE_THERM_THROT and Thermal Mitigation
is enable or disable.

To address this issue add a check whether WMI_SERVICE_THERM_THROT
and Thermal Mitigation is enable or disable.

Change-Id: I1485b2ba6ee64143c9b7d4c8c4a8feadddbaae59
CRs-Fixed: 2698143
Abdul Muqtadeer Ahmed 4 years ago
parent
commit
8ee3a92264

+ 2 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -1751,6 +1751,7 @@ struct hdd_adapter_ops_history {
  * @qos_cpu_mask: voted cpu core mask
  * @adapter_ops_wq: High priority workqueue for handling adapter operations
  * @multi_client_thermal_mitigation: Multi client thermal mitigation by fw
+ * @is_therm_cmd_supp: get temperature command enable or disable
  */
 struct hdd_context {
 	struct wlan_objmgr_psoc *psoc;
@@ -1759,6 +1760,7 @@ struct hdd_context {
 	struct wiphy *wiphy;
 	qdf_spinlock_t hdd_adapter_lock;
 	qdf_list_t hdd_adapters; /* List of adapters */
+	bool is_therm_cmd_supp;
 
 	/** Pointer for firmware image data */
 	const struct firmware *fw;

+ 4 - 0
core/hdd/src/wlan_hdd_main.c

@@ -1722,6 +1722,10 @@ static void hdd_update_tgt_services(struct hdd_context *hdd_ctx,
 					cfg->ll_stats_per_chan_rx_tx_time;
 
 	hdd_update_feature_cfg_club_get_sta_in_ll_stats_req(hdd_ctx, cfg);
+	hdd_ctx->is_therm_cmd_supp =
+				cfg->is_fw_therm_throt_supp &&
+				cfg_get(hdd_ctx->psoc,
+					CFG_THERMAL_MITIGATION_ENABLE);
 }
 
 /**

+ 5 - 0
core/hdd/src/wlan_hdd_stats.c

@@ -6484,6 +6484,11 @@ int wlan_hdd_get_temperature(struct hdd_adapter *adapter, int *temperature)
 		return -EPERM;
 	}
 
+	if (!adapter->hdd_ctx->is_therm_cmd_supp) {
+		hdd_err("WMI_SERVICE_THERM_THROT or gThermalMitigationEnable is disable");
+		return -EINVAL;
+	}
+
 	request = osif_request_alloc(&params);
 	if (!request) {
 		hdd_err("Request allocation failure");

+ 2 - 0
core/wma/inc/wma_tgt_cfg.h

@@ -47,6 +47,7 @@
  * @ll_stats_per_chan_rx_tx_time: Per channel tx and rx time support in ll stats
  * @is_get_station_clubbed_in_ll_stats_req: Get station req support within ll
  *                                          stats req
+ * @is_fw_therm_throt_supp: Get thermal throttling threshold
  */
 struct wma_tgt_services {
 	uint32_t sta_power_save;
@@ -84,6 +85,7 @@ struct wma_tgt_services {
 #ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION
 	bool is_get_station_clubbed_in_ll_stats_req;
 #endif
+	bool is_fw_therm_throt_supp;
 };
 
 /**

+ 4 - 0
core/wma/src/wma_main.c

@@ -4572,6 +4572,10 @@ static inline void wma_update_target_services(struct wmi_unified *wmi_handle,
 	/* Adaptive early-rx */
 	cfg->early_rx = wmi_service_enabled(wmi_handle,
 					       wmi_service_early_rx);
+
+	cfg->is_fw_therm_throt_supp = wmi_service_enabled(wmi_handle,
+							  wmi_service_tt);
+
 #ifdef FEATURE_WLAN_SCAN_PNO
 	/* PNO offload */
 	if (wmi_service_enabled(wmi_handle, wmi_service_nlo)) {