瀏覽代碼

qcacld-3.0: Cleanup qpower vendor command

The original qpower vendor command implementation incorrectly configured
the qpower setting in firmware. Cleanup the implementation.

Change-Id: Id84eb7cf579a29da30f3366edef24821fcd5be55
CRs-Fixed: 1075582
Dustin Brown 8 年之前
父節點
當前提交
10a7b71ecc
共有 4 個文件被更改,包括 27 次插入38 次删除
  1. 1 1
      core/hdd/src/wlan_hdd_cfg80211.c
  2. 8 21
      core/hdd/src/wlan_hdd_power.c
  3. 9 1
      core/wma/inc/wma_api.h
  4. 9 15
      core/wma/src/wma_power.c

+ 1 - 1
core/hdd/src/wlan_hdd_cfg80211.c

@@ -3933,7 +3933,7 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 	u32 guard_time;
 	uint8_t set_value;
 	u32 ftm_capab;
-	uint8_t qpower;
+	u8 qpower;
 	QDF_STATUS status;
 	int attr_len;
 	int access_policy = 0;

+ 8 - 21
core/hdd/src/wlan_hdd_power.c

@@ -2343,40 +2343,27 @@ int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
  * Return: 0 on success; Errno on failure
  */
 int hdd_set_qpower_config(hdd_context_t *hddctx, hdd_adapter_t *adapter,
-				 uint8_t qpower)
+			  u8 qpower)
 {
-	QDF_STATUS qdf_status;
-	int status;
-	bool is_timer_running;
+	QDF_STATUS status;
 
 	if (!hddctx->config->enablePowersaveOffload) {
 		hdd_err("qpower is disabled in configuration");
 		return -EINVAL;
 	}
+
 	if (qpower > PS_DUTY_CYCLING_QPOWER ||
 	    qpower < PS_LEGACY_NODEEPSLEEP) {
-		hdd_err("invalid qpower value=%d", qpower);
+		hdd_err("invalid qpower value: %d", qpower);
 		return -EINVAL;
 	}
-	hdd_info("updating qpower value=%d to wma", qpower);
-	qdf_status = wma_set_powersave_config(qpower);
-	if (qdf_status != QDF_STATUS_SUCCESS) {
-		hdd_err("failed to update qpower %d",
-			qdf_status);
+
+	status = wma_set_qpower_config(adapter->sessionId, qpower);
+	if (status != QDF_STATUS_SUCCESS) {
+		hdd_err("failed to configure qpower: %d", status);
 		return -EINVAL;
 	}
-	is_timer_running = sme_is_auto_ps_timer_running(
-						WLAN_HDD_GET_HAL_CTX(adapter),
-						adapter->sessionId);
-	if (!is_timer_running) {
-		status =  wlan_hdd_set_powersave(adapter, true, 0);
 
-		if (status != 0) {
-			hdd_err("failed to put device in power save mode %d",
-				status);
-			return -EINVAL;
-		}
-	}
 	return 0;
 }
 

+ 9 - 1
core/wma/inc/wma_api.h

@@ -299,7 +299,6 @@ void wma_process_pdev_hw_mode_trans_ind(void *wma,
 	wmi_pdev_hw_mode_transition_event_fixed_param *fixed_param,
 	wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry,
 	struct sir_hw_mode_trans_ind *hw_mode_trans_ind);
-QDF_STATUS wma_set_powersave_config(uint8_t val);
 QDF_STATUS wma_encrypt_decrypt_msg(WMA_HANDLE wma,
 		struct encrypt_decrypt_req_params *encrypt_decrypt_params);
 
@@ -317,4 +316,13 @@ QDF_STATUS wma_set_cts2self_for_p2p_go(void *wma_handle,
 		uint32_t cts2self_for_p2p_go);
 QDF_STATUS wma_set_tx_rx_aggregation_size
 	(struct sir_set_tx_rx_aggregation_size *tx_rx_aggregation_size);
+
+/**
+ * wma_set_qpower_config() - update qpower config in wma
+ * @vdev_id:	the Id of the vdev to configure
+ * @qpower:	new qpower value
+ *
+ * Return: QDF_STATUS_SUCCESS on success, error number otherwise
+ */
+QDF_STATUS wma_set_qpower_config(uint8_t vdev_id, uint8_t qpower);
 #endif

+ 9 - 15
core/wma/src/wma_power.c

@@ -856,27 +856,21 @@ void wma_disable_sta_ps_mode(tp_wma_handle wma, tpDisablePsParams ps_req)
 	}
 }
 
-/**
- * wma_set_powersave_config() - update power save config in wma
- * @val: new power save value
- *
- * This function update qpower value in wma layer
- *
- * Return: QDF_STATUS_SUCCESS on success, error number otherwise
- */
-QDF_STATUS wma_set_powersave_config(uint8_t val)
+QDF_STATUS wma_set_qpower_config(uint8_t vdev_id, uint8_t qpower)
 {
-	tp_wma_handle wma_handle;
-
-	wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
+	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
 
-	if (!wma_handle) {
+	if (!wma) {
 		WMA_LOGE("%s: WMA context is invald!", __func__);
 		return QDF_STATUS_E_INVAL;
 	}
-	wma_handle->powersave_mode = val;
 
-	return QDF_STATUS_SUCCESS;
+	WMA_LOGI("configuring qpower: %d", qpower);
+	wma->powersave_mode = qpower;
+	return wma_unified_set_sta_ps_param(wma->wmi_handle,
+					    vdev_id,
+					    WMI_STA_PS_ENABLE_QPOWER,
+					    wma_get_qpower_config(wma));
 }
 
 /**