Skip to contentSkip to conversation

dt-bindings: ath10k: Add new dt entries to identify coex support

PATCH Superseded Tamizh Chelvam 2 participants 5 messages Dec 16, 2019 – Dec 30, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: ath10k: Add new dt entries to identify coex support

This adds new dt entries qcom,coexist-support and qcom,coexist-gpio-pin which will be used by ath10k driver to identify coex support of a hardware and notify wifi firmware the gpio pin number. This pin number information is needed for the hardware QCA4019.

---
 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +6 -0
index 0171283..a41e936 100644
@@ -87,6 +87,10 @@ Optional properties:
 	Definition: Quirk specifying that the firmware expects the 8bit version
 		    of the host capability QMI request
 - qcom,xo-cal-data: xo cal offset to be configured in xo trim register.
+- qcom,coexist-support : should contain eithr "0" or "1" to indicate coex
+			 support by the hardware.
+- qcom,coexist-gpio-pin : gpio pin number  information to support coex
+			  which will be used by wifi firmware.
 
 Example (to supply PCI based wifi block details):
 
@@ -156,6 +160,8 @@ wifi0: wifi@a000000 {
 	qcom,msi_addr = <0x0b006040>;
 	qcom,msi_base = <0x40>;
 	qcom,ath10k-pre-calibration-data = [ 01 02 03 ... ];
+	qcom,coexist-support = <1>;
+	qcom,coexist-gpio-pin = <0x33>;
 };
 
 Example (to supply wcn3990 SoC wifi block details):
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/2 ath10k: Add support to read btcoex related data from DT

BTCOEX feature is not supported by all QCA4019 chipsets. Since btcoex enabled by default in firmware, host needs to enable COEX support depends on the hardware. Enabling it by default in unsupported hardware will cause some feature disabled in hardware.
This patch will read btcoex_support flag and
wlan priority gpio pin number from DT. Depends on the btcoex_support flag value host will expose BTCOEX support and wlan priority gpio pin number to target.

Testing:
* Tested HW : QCA4019
* Tested FW : 10.4-3.2.1.1-00017

---
 drivers/net/wireless/ath/ath10k/core.c  | 44 ++++++++++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath10k/core.h  |  9 +++++++
 drivers/net/wireless/ath/ath10k/debug.c |  3 +++
 drivers/net/wireless/ath/ath10k/mac.c   |  3 ++-
 drivers/net/wireless/ath/ath10k/wmi.c   |  2 +-
 5 files changed, 58 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +43 -1
index 5ec16ce..f9434bc 100644
@@ -2119,6 +2119,40 @@ static int ath10k_download_cal_data(struct ath10k *ar)
 	return 0;
 }
 
+static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar)
+{
+	struct device_node *node;
+	u32 coex_support = 0;
+	int ret;
+
+	node = ar->dev->of_node;
+	if (!node)
+		goto out;
+
+	ret = of_property_read_u32(node, "qcom,coexist-support", &coex_support);
+	if (ret) {
+		ar->coex_support = ATH10K_DT_COEX_NOT_FOUND;
+		goto out;
+	}
+
+	if (coex_support) {
+		ar->coex_support = ATH10K_DT_COEX_SUPPORTED;
+	} else {
+		ar->coex_support = ATH10K_DT_COEX_NOT_SUPPORTED;
+		ar->coex_gpio_pin = -1;
+		goto out;
+	}
+
+	ret = of_property_read_u32(node, "qcom,coexist-gpio-pin",
+				   &ar->coex_gpio_pin);
+	if (ret)
+		ar->coex_gpio_pin = -1;
+
+out:
+	ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot coex_support %d coex_gpio_pin %d\n",
+		   ar->coex_support, ar->coex_gpio_pin);
+}
+
 static int ath10k_init_uart(struct ath10k *ar)
 {
 	int ret;
@@ -2696,14 +2730,22 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
 		if (test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map))
 			val |= WMI_10_4_BSS_CHANNEL_INFO_64;
 
+		ath10k_core_fetch_btcoex_dt(ar);
+
 		/* 10.4 firmware supports BT-Coex without reloading firmware
 		 * via pdev param. To support Bluetooth coexistence pdev param,
 		 * WMI_COEX_GPIO_SUPPORT of extended resource config should be
 		 * enabled always.
+		 *
+		 * We can still enable BTCOEX if firmware has the support
+		 * eventhough btceox_support value is
+		 * ATH10K_DT_BTCOEX_NOT_FOUND
 		 */
+
 		if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) &&
 		    test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
-			     ar->running_fw->fw_file.fw_features))
+			     ar->running_fw->fw_file.fw_features) &&
+		    ar->coex_support != ATH10K_DT_COEX_NOT_SUPPORTED)
 			val |= WMI_10_4_COEX_GPIO_SUPPORT;
 
 		if (test_bit(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY,
drivers/net/wireless/ath/ath10k/core.h +9 -0
index 5101bf2..90f437a 100644
@@ -875,6 +875,12 @@ enum ath10k_tx_pause_reason {
 	ATH10K_TX_PAUSE_MAX,
 };
 
+enum ath10k_dt_coex_support_flag {
+	ATH10K_DT_COEX_NOT_FOUND,
+	ATH10K_DT_COEX_SUPPORTED,
+	ATH10K_DT_COEX_NOT_SUPPORTED,
+};
+
 struct ath10k_fw_file {
 	const struct firmware *firmware;
 
@@ -1222,6 +1228,9 @@ struct ath10k {
 	struct ath10k_bus_params bus_param;
 	struct completion peer_delete_done;
 
+	enum ath10k_dt_coex_support_flag coex_support;
+	int coex_gpio_pin;
+
 	/* must be last */
 	u8 drv_priv[0] __aligned(sizeof(void *));
 };
drivers/net/wireless/ath/ath10k/debug.c +3 -0
index e000677..bb452a1 100644
@@ -1978,6 +1978,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
 	if (strtobool(buf, &val) != 0)
 		return -EINVAL;
 
+	if (ar->coex_support == ATH10K_DT_COEX_NOT_SUPPORTED)
+		return -EOPNOTSUPP;
+
 	mutex_lock(&ar->conf_mutex);
 
 	if (ar->state != ATH10K_STATE_ON &&
drivers/net/wireless/ath/ath10k/mac.c +2 -1
index 767c7bf..63c22653 100644
@@ -4982,7 +4982,8 @@ static int ath10k_start(struct ieee80211_hw *hw)
 	param = ar->wmi.pdev_param->enable_btcoex;
 	if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) &&
 	    test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
-		     ar->running_fw->fw_file.fw_features)) {
+		     ar->running_fw->fw_file.fw_features) &&
+	    ar->coex_support != ATH10K_DT_COEX_NOT_SUPPORTED) {
 		ret = ath10k_wmi_pdev_set_param(ar, param, 0);
 		if (ret) {
 			ath10k_warn(ar,
drivers/net/wireless/ath/ath10k/wmi.c +1 -1
index 13f7531..4684aa75 100644
@@ -8787,7 +8787,7 @@ static int ath10k_wmi_10_4_op_get_vdev_subtype(struct ath10k *ar,
 	cmd = (struct wmi_ext_resource_config_10_4_cmd *)skb->data;
 	cmd->host_platform_config = __cpu_to_le32(type);
 	cmd->fw_feature_bitmap = __cpu_to_le32(fw_feature_bitmap);
-	cmd->wlan_gpio_priority = __cpu_to_le32(-1);
+	cmd->wlan_gpio_priority = __cpu_to_le32(ar->coex_gpio_pin);
 	cmd->coex_version = __cpu_to_le32(WMI_NO_COEX_VERSION_SUPPORT);
 	cmd->coex_gpio_pin1 = __cpu_to_le32(-1);
 	cmd->coex_gpio_pin2 = __cpu_to_le32(-1);
Signature · 1 line
1.9.1
maintainer
#2 lore raw
In reply to Tamizh Chelvam
Quoted 15 lines · Tamizh Chelvam

This adds new dt entries qcom,coexist-support and qcom,coexist-gpio-pin which will be used by ath10k driver to identify coex support of a hardware and notify wifi firmware the gpio pin number. This pin number information is needed for the hardware QCA4019.

---
 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +0 -0
index 0171283..a41e936 100644

Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt Optional properties: · line 93

Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +4 -0
@@ -87,6 +87,10 @@ Optional properties:
 	Definition: Quirk specifying that the firmware expects the 8bit version
 		    of the host capability QMI request
 - qcom,xo-cal-data: xo cal offset to be configured in xo trim register.
+- qcom,coexist-support : should contain eithr "0" or "1" to indicate coex
+			 support by the hardware.
+- qcom,coexist-gpio-pin : gpio pin number  information to support coex
+			  which will be used by wifi firmware.

What combinations of these 2 properties are valid?

Is qcom,coexist-gpio-pin required for coexist support? If so then it alone should be enough to enable/disable coexist.

Quoted 14 lines
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +2 -0
 Example (to supply PCI based wifi block details):
 
@@ -156,6 +160,8 @@ wifi0: wifi@a000000 {
 	qcom,msi_addr = <0x0b006040>;
 	qcom,msi_base = <0x40>;
 	qcom,ath10k-pre-calibration-data = [ 01 02 03 ... ];
+	qcom,coexist-support = <1>;
+	qcom,coexist-gpio-pin = <0x33>;
 };
 
 Example (to supply wcn3990 SoC wifi block details):
Signature · 1 line
1.9.1
#3 lore raw

Hi Rob,

Thanks for your review comments.

Quoted 30 lines
Quoted 26 lines

This adds new dt entries qcom,coexist-support and qcom,coexist-gpio-pin which will be used by ath10k driver to identify coex support of a hardware and notify wifi firmware the gpio pin number. This pin number information is needed for the hardware QCA4019.

---
 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 6 
++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +0 -0
index 0171283..a41e936 100644
@@ -87,6 +87,10 @@ Optional properties:
 	Definition: Quirk specifying that the firmware expects the 8bit 

version
of the host capability QMI request
- qcom,xo-cal-data: xo cal offset to be configured in xo trim
register.
+- qcom,coexist-support : should contain eithr "0" or "1" to indicate coex

Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +2 -0
+			 support by the hardware.
+- qcom,coexist-gpio-pin : gpio pin number  information to support 

coex

Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt Optional properties: · line 93

Quoted 1 line
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +1 -0
+			  which will be used by wifi firmware.

What combinations of these 2 properties are valid?

Quoted 3 lines

Is qcom,coexist-gpio-pin required for coexist support? If so then it alone should be enough to enable/disable coexist.

qcom,coexist-gpio-pin is required for QCA4019 devices. And other ath10k devices doesn't required that value. So only added two fields to enable/disable coexist and another for notifying the gpio pin info.

Quoted 11 lines
Quoted 11 lines

Example (to supply PCI based wifi block details):

Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +2 -0
@@ -156,6 +160,8 @@ wifi0: wifi@a000000 {
 	qcom,msi_addr = <0x0b006040>;
 	qcom,msi_base = <0x40>;
 	qcom,ath10k-pre-calibration-data = [ 01 02 03 ... ];
+	qcom,coexist-support = <1>;
+	qcom,coexist-gpio-pin = <0x33>;
 };
 
Quoted 2 lines

Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt wifi0: wifi@a000000 {

Quoted 2 lines
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +0 -1
 Example (to supply wcn3990 SoC wifi block details):
--

Thanks,
Tamizh.

maintainer
#4 lore raw
Quoted 17 lines · On Sun, Dec 29, 2019 at 10:07 PM <[email protected]> wrote:

Hi Rob,

Thanks for your review comments.

Quoted 12 lines
Quoted 12 lines

This adds new dt entries qcom,coexist-support and qcom,coexist-gpio-pin
which will be used by ath10k driver to identify coex support of a hardware and notify wifi firmware the gpio pin number. This pin number information is needed for the hardware QCA4019.

---
 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 6
++++++
 1 file changed, 6 insertions(+)
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt index 0171283..a41e936 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt

Quoted 8 lines
Quoted 8 lines

+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt

(quoted diff) +0 -0
@@ -87,6 +87,10 @@ Optional properties:
     Definition: Quirk specifying that the firmware expects the 8bit

version
of the host capability QMI request
- qcom,xo-cal-data: xo cal offset to be configured in xo trim
register.
+- qcom,coexist-support : should contain eithr "0" or "1" to indicate

typo

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

coex
+ support by the hardware.
+- qcom,coexist-gpio-pin : gpio pin number information to support coex
+ which will be used by wifi firmware.

What combinations of these 2 properties are valid?

Quoted 7 lines
Quoted 3 lines

Is qcom,coexist-gpio-pin required for coexist support? If so then it alone should be enough to enable/disable coexist.

qcom,coexist-gpio-pin is required for QCA4019 devices. And other ath10k devices doesn't required that value.
So only added two fields to enable/disable coexist and another for notifying the gpio pin info.

Okay.

'qcom,coexist-support' can be boolean instead. Unless you need it to override a default setting.

Rob

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k