@@ -1439,6 +1439,39 @@ 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 btcoex_support = 0;
+ int ret;
+
+ node = ar->dev->of_node;
+ if (!node)
+ goto out;
+
+ ret = of_property_read_u32(node, "btcoex_support", &btcoex_support);
+ if (ret) {
+ ar->btcoex_support = ATH10K_DT_BTCOEX_NOT_FOUND;
+ goto out;
+ }
+
+ if (btcoex_support)
+ ar->btcoex_support = ATH10K_DT_BTCOEX_SUPPORTED;
+ else
+ ar->btcoex_support = ATH10K_DT_BTCOEX_NOT_SUPPORTED;
+
+ ret = of_property_read_u32(node, "btcoex_gpio_pin",
+ &ar->btcoex_gpio_pin);
+ if (ret) {
+ ar->btcoex_gpio_pin = -1;
+ goto out;
+ }
+
+out:
+ ath10k_dbg(ar, ATH10K_DBG_BOOT, "btcoex support flag :%d gpio %d\n",
+ ar->btcoex_support, ar->btcoex_gpio_pin);
+}
+
static int ath10k_init_uart(struct ath10k *ar)
{
int ret;
@@ -1920,14 +1953,23 @@ 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->btcoex_support != ATH10K_DT_BTCOEX_NOT_SUPPORTED)
val |= WMI_10_4_COEX_GPIO_SUPPORT;
status = ath10k_mac_ext_resource_config(ar, val);
@@ -658,6 +658,12 @@ enum ath10k_tx_pause_reason {
ATH10K_TX_PAUSE_MAX,
};
+enum ath10k_dt_btcoex_support_flag {
+ ATH10K_DT_BTCOEX_NOT_FOUND,
+ ATH10K_DT_BTCOEX_SUPPORTED,
+ ATH10K_DT_BTCOEX_NOT_SUPPORTED,
+};
+
struct ath10k_fw_file {
const struct firmware *firmware;
@@ -926,6 +932,9 @@ struct ath10k {
u32 reg_ack_cts_timeout_orig;
} fw_coverage;
+ enum ath10k_dt_btcoex_support_flag btcoex_support;
+ int btcoex_gpio_pin;
+
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
};
@@ -2149,6 +2149,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
if (strtobool(buf, &val) != 0)
return -EINVAL;
+ if (ar->btcoex_support == ATH10K_DT_BTCOEX_NOT_SUPPORTED)
+ return -EOPNOTSUPP;
+
mutex_lock(&ar->conf_mutex);
ret = ath10k_mac_set_btcoex(ar, val);
if (!ret)
@@ -4564,9 +4564,11 @@ 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->btcoex_support != ATH10K_DT_BTCOEX_NOT_SUPPORTED) {
ret = ath10k_wmi_pdev_set_param(ar, param, 0);
if (ret) {
ath10k_warn(ar,
@@ -7811,6 +7811,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->btcoex_gpio_pin = __cpu_to_le32(ar->btcoex_gpio_pin);
ath10k_dbg(ar, ATH10K_DBG_WMI,
"wmi ext resource config host type %d firmware feature bitmap %08x\n",
@@ -2734,6 +2734,8 @@ struct wmi_ext_resource_config_10_4_cmd {
__le32 host_platform_config;
/* see enum wmi_10_4_feature_mask */
__le32 fw_feature_bitmap;
+ /* Contains btcoex gpio pin number */
+ __le32 btcoex_gpio_pin;
};
struct wmi_set_coex_param_10_4_cmd {