ath10k: SAR power limit vendor command
v2 cover ath10k: SAR power limit vendor command
v2: change description of "nl80211: vendor-cmd: qca: add dynamic SAR power limits" remove ATH10K_WMI_SAR_*G_0_MASK of wmi.h
here's a patchset adding dynamic SAR power limit vendor command to ath10k. This follows the new process documented in the wiki:
https://wireless.wiki.kernel.org/en/developers/documentation/nl80211#vendor-specific_api
Wen Gong (2):
nl80211: vendor-cmd: qca: add dynamic SAR power limits
ath10k: allow dynamic SAR power limits to be configured
drivers/net/wireless/ath/ath10k/Makefile | 1 + drivers/net/wireless/ath/ath10k/core.c | 2 + drivers/net/wireless/ath/ath10k/core.h | 2 + drivers/net/wireless/ath/ath10k/hw.h | 3 + drivers/net/wireless/ath/ath10k/mac.c | 64 +++++++++++++ drivers/net/wireless/ath/ath10k/mac.h | 2 +- drivers/net/wireless/ath/ath10k/vendor.c | 114 +++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/vendor.h | 13 +++ include/uapi/nl80211-vnd-qca.h | 68 ++++++++++++++ 9 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 drivers/net/wireless/ath/ath10k/vendor.c create mode 100644 drivers/net/wireless/ath/ath10k/vendor.h create mode 100644 include/uapi/nl80211-vnd-qca.h
Signature · 7 lines
2.23.0 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 1/2 nl80211: vendor-cmd: qca: add dynamic SAR power limits
The vendor commands is to add API for user to configure dynamic SAR power limits, it will not replace the existing power control functionality, it is to make more convenient to configure power.
For different chips and drivers, they has different configuration, such as dBm units, 5G Hz subbands, valid range, etc. so user space can not know what configuration should be used. If use a common API for all chips and drivers, then it need a reporting API too, so drivers can tell what configuration it support. Recently it is better to use this vendor-cmd for different chips and drivers.
An example of usage(wlan0 is the wireless interface dev name):
iw dev wlan0 vendor send 0x1374 0x92 0x2C 0x00 0x03 0x00 0x14 0x00 0x01 0x00 0x08 0x00 0x07 0x00 0x22 0x00 0x00 0x00 0x08 0x00 0x04 0x00 0x00 0x00 0x00 0x00 0x14 0x00 0x02 0x00 0x08 0x00 0x07 0x00 0x11 0x00 0x00 0x00 0x08 0x00 0x04 0x00 0x01 0x00 0x00 0x00
means of bytes:0x1374: vendor id0x92: vendor subcmd id0x22: 2.4G power limit0x11: 5G power limit
Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.
--- include/uapi/nl80211-vnd-qca.h | 68 ++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 include/uapi/nl80211-vnd-qca.h
include/uapi/nl80211-vnd-qca.h new file +68 -0
@@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: ISC */ +/* +* Copyright (c) 2019 The Linux Foundation. All rights reserved. +*/ + +#ifndef _UAPI_NL80211_VND_QCA_H +#define _UAPI_NL80211_VND_QCA_H + +/* Vendor id to be used in vendor specific command and events to user space +* NOTE: The authoritative place for definition of QCA_NL80211_VENDOR_ID, +* vendor subcmd definitions prefixed with QCA_NL80211_VENDOR_SUBCMD, and +* qca_wlan_vendor_attr is open source file src/common/qca-vendor.h in +* git://w1.fi/srv/git/hostap.git; the values here are just a copy of that +*/ +#define QCA_NL80211_VENDOR_ID 0x001374 + +/** +* enum qca_nl80211_vendor_subcmds - QCA nl80211 vendor command identifiers +* +*@QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS and is used to retrieve the +* settings currently in use. The attributes returned by this command are +* defined by enum qca_vendor_attr_sar_limits. +*/ +enum qca_nl80211_vendor_subcmds { +QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS =146 , + }; + +/** +* enum qca_vendor_attr_sar_limits - Attributes for SAR power limits +* +* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC: Nested array of SAR power +* limit specifications. The number of specifications is +* specified by @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_NUM_SPECS. Each +* specification contains a set of +* QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_* attributes. A +* specification is uniquely identified by the attributes +* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND and always +* contains as a payload the attribute +* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT. +* +* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND: Optional (u32) value to +* indicate for which band this specification applies. Valid +* values are enumerated in enum %nl80211_band (although not all +* bands may be supported by a given device). If the attribute is +* not supplied then the specification will be applied to all +* supported bands. +* +* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT: Required (u32) +* value to specify the actual power limit value in units of 0.5 +* dBm (i.e., a value of 11 represents 5.5 dBm). +* This is required, when %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT is +* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER. +* +* These attributes are used with %QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS +* and %QCA_NL80211_VENDOR_SUBCMD_GET_SAR_LIMITS. +*/ +enum qca_vendor_attr_sar_limits { +QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_INVALID =0 , +QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC =3 , +QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND =4 , +QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT =7 , + +QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_AFTER_LAST , +QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_MAX = +QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_AFTER_LAST -1 +}; + +#endif /* _UAPI_NL80211_VND_QCA_H_ */
Signature · 7 lines
2.23.0 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 2/2 ath10k: allow dynamic SAR power limits to be configured
In reply to Wen GongAdd support for a vendor command for STATION, the command QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS which is already defined ingit://w1.fi/hostap.git (src/command/qca-vendor.h). This allows user space to configure power limits for 2.4 GHz and 5 GHz bands.
ath10k set pdev parameter WMI_PDEV_PARAM_TXPOWER_LIMIT2G and WMI_PDEV_PARAM_TXPOWER_LIMIT5G to firmware, the 2 value will be used as one input source to affect the tx power.
When QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS set to ath10k, it will be saved the 2.4G and 5G limit value, If STATION is connected meanwhile, then the 2.4G and 5G WMI command will be set to firmware, otherwise it will not set to firmware at this moment. When STATION connect next time, it will set to firmware.
Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.
--- drivers/net/wireless/ath/ath10k/Makefile | 1 + drivers/net/wireless/ath/ath10k/core.c | 2 + drivers/net/wireless/ath/ath10k/core.h | 2 + drivers/net/wireless/ath/ath10k/hw.h | 3 + drivers/net/wireless/ath/ath10k/mac.c | 64 +++++++++++++ drivers/net/wireless/ath/ath10k/mac.h | 2 +- drivers/net/wireless/ath/ath10k/vendor.c | 114 +++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/vendor.h | 13 +++ 8 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 drivers/net/wireless/ath/ath10k/vendor.c create mode 100644 drivers/net/wireless/ath/ath10k/vendor.h
drivers/net/wireless/ath/ath10k/Makefile +1 -0
@@ -13,6 +13,7 @@ ath10k_core-y += mac.o \ bmi.o \ hw.o \ p2p.o \ + vendor.o \ swap.o ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += spectral.o
drivers/net/wireless/ath/ath10k/core.c +2 -0
@@ -25,6 +25,7 @@#include "testmode.h" #include "wmi-ops.h" #include "coredump.h" +#include "vendor.h" unsigned int ath10k_debug_mask;EXPORT_SYMBOL (ath10k_debug_mask);
@@ -191,6 +192,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .bmi_large_size_download = true, .supports_peer_stats_info = true, + .dynamic_sar_support = true, }, { .id = QCA6174_HW_2_1_VERSION,
drivers/net/wireless/ath/ath10k/core.h +2 -0
@@ -1016,6 +1016,8 @@ struct ath10k {u8 ps_state_enable;bool nlo_enabled; +u32 tx_power_2g_limit; +u32 tx_power_5g_limit;bool p2p;struct {
drivers/net/wireless/ath/ath10k/hw.h +3 -0
@@ -626,6 +626,9 @@ struct ath10k_hw_params {/* provides bitrates for sta_statistics using WMI_TLV_PEER_STATS_INFO_EVENTID */ bool supports_peer_stats_info; + +/* support dynamic sar */ +bool dynamic_sar_support; };struct htt_rx_desc ;
drivers/net/wireless/ath/ath10k/mac.c +64 -0
88 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/mac.h +1 -1
@@ -58,7 +58,7 @@ u8 ath10k_mac_hw_rate_to_idx(const struct ieee80211_supported_band *sband, u8 hw_rate, bool cck);u8 ath10k_mac_bitrate_to_idx (const struct ieee80211_supported_band *sband,u32 bitrate); - +int ath10k_mac_set_sar_power_limit (struct ath10k *ar);void ath10k_mac_tx_lock (struct ath10k *ar,int reason);void ath10k_mac_tx_unlock (struct ath10k *ar,int reason);void ath10k_mac_vif_tx_lock (struct ath10k_vif *arvif,int reason);
drivers/net/wireless/ath/ath10k/vendor.c new file +114 -0
114 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/vendor.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: ISC */ +/* +* Copyright (c) 2019 The Linux Foundation. All rights reserved. +*/ + +#ifndef _VENDOR_H_ +#define _VENDOR_H_ + +#include <linux/kernel.h> + +void ath10k_vendor_register (struct ath10k *ar); + +#endif /* _VENDOR_H_ */
Signature · 7 lines
2.23.0 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Re: [PATCH v2 2/2] ath10k: allow dynamic SAR power limits to be configured
Quoted 15 lines · Wen Gong
Add support for a vendor command for STATION, the command
QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITSwhich is already defined ingit://w1.fi/hostap.git(src/command/qca-vendor.h). This allows user space to configure power limits for 2.4 GHz and 5 GHz bands.ath10k set pdev parameter
WMI_PDEV_PARAM_TXPOWER_LIMIT2GandWMI_PDEV_PARAM_TXPOWER_LIMIT5Gto firmware, the 2 value will be used as one input source to affect the tx power.When
QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITSset to ath10k, it will be saved the 2.4G and 5G limit value, If STATION is connected meanwhile, then the 2.4G and 5G WMI command will be set to firmware, otherwise it will not set to firmware at this moment. When STATION connect next time, it will set to firmware.
Quoted 4 lines
Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.
Signed-off-by Wen Gong <[email protected]>Signed-off-by Kalle Valo <[email protected]>
The plan is to have a common API for SAR limits, not use vendor API.
Patch set to Rejected.
Signature · 9 lines
https://patchwork.kernel.org/patch/11686327/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Re: [PATCH v2 2/2] ath10k: allow dynamic SAR power limits to be configured
In reply to Wen GongQuoted 15 lines · Wen Gong
Add support for a vendor command for STATION, the command
QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITSwhich is already defined ingit://w1.fi/hostap.git(src/command/qca-vendor.h). This allows user space to configure power limits for 2.4 GHz and 5 GHz bands.ath10k set pdev parameter
WMI_PDEV_PARAM_TXPOWER_LIMIT2GandWMI_PDEV_PARAM_TXPOWER_LIMIT5Gto firmware, the 2 value will be used as one input source to affect the tx power.When
QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITSset to ath10k, it will be saved the 2.4G and 5G limit value, If STATION is connected meanwhile, then the 2.4G and 5G WMI command will be set to firmware, otherwise it will not set to firmware at this moment. When STATION connect next time, it will set to firmware.
Quoted 4 lines
Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.
Signed-off-by Wen Gong <[email protected]>Signed-off-by Kalle Valo <[email protected]>
The plan is to have a common API for SAR limits, not use vendor API.
Patch set to Rejected.
Signature · 3 lines
https://patchwork.kernel.org/patch/11686327/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches