]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ath10k: Add support to read btcoex related data from DT
authorTamizh Chelvam <tamizhr@codeaurora.org>
Mon, 27 Jan 2020 19:18:56 +0000 (00:48 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 11 Feb 2020 14:22:49 +0000 (16:22 +0200)
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

Signed-off-by: Tamizh Chelvam <tamizhr@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath10k/core.c
drivers/net/wireless/ath/ath10k/core.h
drivers/net/wireless/ath/ath10k/debug.c
drivers/net/wireless/ath/ath10k/mac.c
drivers/net/wireless/ath/ath10k/wmi.c

index 5ec16ce19b695f98bdac92c6955e2aa81e7d248c..5712e283e2d76c7cde4d9cd2f2eb53af4c8d182f 100644 (file)
@@ -2119,6 +2119,40 @@ done:
        return 0;
 }
 
+static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar)
+{
+       struct device_node *node;
+       u8 coex_support = 0;
+       int ret;
+
+       node = ar->dev->of_node;
+       if (!node)
+               goto out;
+
+       ret = of_property_read_u8(node, "qcom,coexist-support", &coex_support);
+       if (ret) {
+               ar->coex_support = true;
+               goto out;
+       }
+
+       if (coex_support) {
+               ar->coex_support = true;
+       } else {
+               ar->coex_support = false;
+               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)
                        val |= WMI_10_4_COEX_GPIO_SUPPORT;
 
                if (test_bit(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY,
index 5101bf2b5b158e8e2541eb10f8f47ed8e1d38129..edf314e3e19e39dd4eb18c8ae1fcd48fae93ccd0 100644 (file)
@@ -1222,6 +1222,9 @@ struct ath10k {
        struct ath10k_bus_params bus_param;
        struct completion peer_delete_done;
 
+       bool coex_support;
+       int coex_gpio_pin;
+
        /* must be last */
        u8 drv_priv[0] __aligned(sizeof(void *));
 };
index e000677ac516b4f64226092451f6d69fadba26b6..3894b77db71da60ee573475de702fabb535d16c7 100644 (file)
@@ -1978,6 +1978,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
        if (strtobool(buf, &val) != 0)
                return -EINVAL;
 
+       if (!ar->coex_support)
+               return -EOPNOTSUPP;
+
        mutex_lock(&ar->conf_mutex);
 
        if (ar->state != ATH10K_STATE_ON &&
index 7fee35ff966b60a370c33f22a375a93a4b51af3a..ac3ad5c5acfc9a161c0cc71170e2900f184596f7 100644 (file)
@@ -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) {
                ret = ath10k_wmi_pdev_set_param(ar, param, 0);
                if (ret) {
                        ath10k_warn(ar,
index 61885d4d662c729d0912ca38e34df8fae83c6c1c..e76e3654126a4a8565f62bec7dbdc48fafe92e27 100644 (file)
@@ -8787,7 +8787,7 @@ ath10k_wmi_10_4_ext_resource_config(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);