summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Huang <wilhuang@codeaurora.org>2019-04-18 09:56:31 +0800
committerWill Huang <wilhuang@codeaurora.org>2019-04-18 15:18:54 +0800
commit80fcf84f41fb0ccf2d731255d8eb42f767013894 (patch)
tree59155305145381d11cf04a6032ea47f4233d2c1b
parent87cb45fe5b0769f462d24d663fe0ea89048f9393 (diff)
qcacld-2.0: Add iwpriv command to support TDCC
Tx duty cycle control power save is a feature required to support for both station and GO, so add a iwpriv command "set_ps_tdcc" to set required TDCC parameters to target. These parameters are treated as global parameters by target, so don't differentiate it between adapters. Change-Id: Iff94532db882be7ed5ce2e38c88067c9ac99b693 CRs-Fixed: 2437625
-rw-r--r--CORE/HDD/inc/qc_sap_ioctl.h3
-rw-r--r--CORE/HDD/inc/wlan_hdd_wext.h13
-rw-r--r--CORE/HDD/src/wlan_hdd_hostapd.c7
-rw-r--r--CORE/HDD/src/wlan_hdd_wext.c28
-rw-r--r--CORE/SERVICES/COMMON/wma_api.h1
-rw-r--r--CORE/SERVICES/WMA/wma.c48
-rw-r--r--CORE/SERVICES/WMA/wma.h11
7 files changed, 109 insertions, 2 deletions
diff --git a/CORE/HDD/inc/qc_sap_ioctl.h b/CORE/HDD/inc/qc_sap_ioctl.h
index 087a9242d8b6..18d7df8cb804 100644
--- a/CORE/HDD/inc/qc_sap_ioctl.h
+++ b/CORE/HDD/inc/qc_sap_ioctl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -194,6 +194,7 @@ typedef struct
#define QCSAP_IOCTL_SET_FW_CRASH_INJECT 1
#endif
#define QCSAP_IOCTL_DUMP_DP_TRACE_LEVEL 2
+#define QCSAP_IOCTL_SET_PS_TDCC 3
#define QCSAP_IOCTL_PRIV_GET_RSSI (SIOCIWFIRSTPRIV + 29)
#define QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
diff --git a/CORE/HDD/inc/wlan_hdd_wext.h b/CORE/HDD/inc/wlan_hdd_wext.h
index 88c15d5aee11..0c5e2f2b27b2 100644
--- a/CORE/HDD/inc/wlan_hdd_wext.h
+++ b/CORE/HDD/inc/wlan_hdd_wext.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -472,6 +472,17 @@ void* wlan_hdd_change_country_code_callback(void *pAdapter);
VOS_STATUS wlan_hdd_set_powersave(hdd_adapter_t *pAdapter, int mode);
+/**
+ * wlan_hdd_process_tdcc_ps() - To process set_ps_tdcc command
+ * @adapter: adapter handle
+ * @enable: 1 enable, 0 disable
+ * @percentage: percentage of tx duty cycle control
+ *
+ * Return: 0 if success, otherwise error code
+ */
+int
+wlan_hdd_process_tdcc_ps(hdd_adapter_t *adapter, int enable, int percentage);
+
int hdd_setBand(struct net_device *dev, u8 ui_band);
int hdd_setBand_helper(struct net_device *dev, const char *command);
int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal,
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index 66e7151e17c3..0cdf00ad0811 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -3715,6 +3715,9 @@ static int __iw_softap_set_two_ints_getnone(struct net_device *dev,
pHddCtx->isLogpInProgress = true;
break;
#endif
+ case QCSAP_IOCTL_SET_PS_TDCC:
+ ret = wlan_hdd_process_tdcc_ps(pAdapter, value[1], value[2]);
+ break;
case QCSAP_IOCTL_DUMP_DP_TRACE_LEVEL:
hddLog(LOG1, "WE_DUMP_DP_TRACE: %d %d",
value[1], value[2]);
@@ -7620,6 +7623,10 @@ static const struct iw_priv_args hostapd_private_args[] = {
0,
"crash_inject" },
#endif
+ { QCSAP_IOCTL_SET_PS_TDCC,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
+ 0,
+ "set_ps_tdcc" },
/* handlers for main ioctl */
{ QCSAP_IOCTL_WOWL_CONFIG_PTRN,
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index dde8e23c4e8d..2628a1776ae1 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -502,6 +502,7 @@ typedef enum eMonFilterType{
#define WLAN_STATS_TX_UC_BYTE_CNT 19
#define WLAN_STATS_TX_MC_BYTE_CNT 20
#define WLAN_STATS_TX_BC_BYTE_CNT 21
+#define WE_SET_PS_TDCC 22
#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
if ((__tlen + __size + 2) < WE_MAX_STR_LEN) \
@@ -11464,6 +11465,27 @@ VOS_STATUS iw_set_power_params(struct net_device *dev, struct iw_request_info *i
return VOS_STATUS_SUCCESS;
}/*iw_set_power_params*/
+int wlan_hdd_process_tdcc_ps(hdd_adapter_t *adapter, int enable, int percentage)
+{
+ static int32_t ps_tdcc_enabled = 0;
+
+ if (enable !=0 && enable != 1) {
+ hddLog(LOGE, "Invalid tdcc enable/disable");
+ return -EINVAL;
+ }
+ if (percentage < 0 || percentage > 100) {
+ hddLog(LOGE, "Invalid tdcc duty cycle percentage");
+ return -EINVAL;
+ }
+ if (enable == ps_tdcc_enabled)
+ return 0;
+
+ ps_tdcc_enabled = enable;
+ return process_wma_set_command_twoargs((int)adapter->sessionId,
+ (int)GEN_PARAM_PS_TDCC,
+ enable, percentage, GEN_CMD);
+}
+
static int __iw_set_two_ints_getnone(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
@@ -11504,6 +11526,9 @@ static int __iw_set_two_ints_getnone(struct net_device *dev,
break;
#endif
+ case WE_SET_PS_TDCC:
+ ret = wlan_hdd_process_tdcc_ps(pAdapter, value[1], value[2]);
+ break;
case WE_SET_MON_MODE_CHAN:
/*
* TODO: Remove this private implementation use standard
@@ -12839,6 +12864,9 @@ static const struct iw_priv_args we_private_args[] = {
{ WE_DUMP_DP_TRACE_LEVEL,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
0, "dump_dp_trace"},
+ { WE_SET_PS_TDCC,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
+ 0, "set_ps_tdcc" },
#ifdef FEATURE_PBM_MAGIC_WOW
{
WE_SET_WOW_START,
diff --git a/CORE/SERVICES/COMMON/wma_api.h b/CORE/SERVICES/COMMON/wma_api.h
index 1a07321f60c0..053ca97345a9 100644
--- a/CORE/SERVICES/COMMON/wma_api.h
+++ b/CORE/SERVICES/COMMON/wma_api.h
@@ -79,6 +79,7 @@ typedef enum {
GEN_PARAM_MODULATED_DTIM,
GEN_PARAM_CAPTURE_TSF,
GEN_PARAM_RESET_TSF_GPIO,
+ GEN_PARAM_PS_TDCC,
GEN_PDEV_MONITOR_MODE,
} GEN_PARAM;
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index e5392ffe1df8..acdbfa3f2b98 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -17719,6 +17719,10 @@ static void wma_process_cli_set_cmd(tp_wma_handle wma,
case GEN_PARAM_MODULATED_DTIM:
wma_set_modulated_dtim(wma, privcmd);
break;
+ case GEN_PARAM_PS_TDCC:
+ wma_ps_set_tx_duty_cycle_control(wma,
+ privcmd->param_value, privcmd->param_sec_value);
+ break;
case GEN_PDEV_MONITOR_MODE:
wma_send_pdev_monitor_mode_cmd(wma, privcmd);
break;
@@ -42157,6 +42161,50 @@ int wma_btc_set_bt_wlan_interval(tp_wma_handle wma_handle,
return 0;
}
+int wma_ps_set_tx_duty_cycle_control(tp_wma_handle wma_handle,
+ uint32_t enable,
+ uint32_t tx_cycle_percentage)
+{
+ int ret;
+ uint32_t len;
+ wmi_buf_t buf;
+ wmi_sta_tdcc_config_cmd_fixed_param *cmd;
+
+ if (!WMI_SERVICE_EXT_IS_ENABLED(wma_handle->wmi_service_bitmap,
+ wma_handle->wmi_service_ext_bitmap,
+ WMI_SERVICE_PS_TDCC)) {
+ WMA_LOGE(FL("TDCC not support"));
+ return 0;
+ }
+
+ len = sizeof(*cmd);
+ buf = wmi_buf_alloc(wma_handle->wmi_handle, len);
+ if (!buf) {
+ WMA_LOGE(FL("wmi_buf_alloc failed"));
+ return -ENOMEM;
+ }
+
+ cmd = (wmi_sta_tdcc_config_cmd_fixed_param *)wmi_buf_data(buf);
+ WMITLV_SET_HDR(&cmd->tlv_header,
+ WMITLV_TAG_STRUC_wmi_sta_tdcc_config_cmd_fixed_param,
+ WMITLV_GET_STRUCT_TLVLEN(wmi_sta_tdcc_config_cmd_fixed_param));
+
+ cmd->enabled = enable;
+ cmd->tx_cycle_percentage = tx_cycle_percentage;
+
+ ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len,
+ WMI_STA_TDCC_CONFIG_CMDID);
+ if (ret != EOK) {
+ WMA_LOGE(FL("Fail to set tx duty cycle control"));
+ wmi_buf_free(buf);
+ return -EIO;
+ }
+
+ WMA_LOGI("Set tx ducy cycle control: enable %d, percentage %d",
+ enable, tx_cycle_percentage);
+ return 0;
+}
+
/**
* wma_set_tx_power_scale() - set tx power scale
* @vdev_id: vdev id
diff --git a/CORE/SERVICES/WMA/wma.h b/CORE/SERVICES/WMA/wma.h
index 6b84d02faeae..104bc7f87bc1 100644
--- a/CORE/SERVICES/WMA/wma.h
+++ b/CORE/SERVICES/WMA/wma.h
@@ -1875,6 +1875,17 @@ bool wma_is_vdev_up(uint8_t vdev_id);
int wma_btc_set_bt_wlan_interval(tp_wma_handle wma_handle,
WMI_COEX_CONFIG_CMD_fixed_param *interval);
+/**
+ * wma_ps_set_tx_duty_cycle_control() - API to set tx duty cycle control param
+ * @wma_handle: wma handle
+ * @enable: tdcc enable or disable
+ * @tx_cycle_percentage: percentage of tx duty cycle
+ *
+ * Return: error code if fail, 0 if success
+ */
+int wma_ps_set_tx_duty_cycle_control(tp_wma_handle wma_handle,
+ uint32_t enable,
+ uint32_t tx_cycle_percentage);
int wma_crash_inject(tp_wma_handle wma_handle, uint32_t type,
uint32_t delay_time_ms);