linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ath10k: Debugfs entry to enable/disable WLAN&Blutooth Coexist feature
@ 2015-05-28 19:19 Yanbo Li
  2015-06-02  9:39 ` Jakub Kiciński
       [not found] ` <CAFqt6zbpEfX_DPwZwzVZkcUD3uuYa=-Ujuo9PXcB+-HtM9b8tA@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Yanbo Li @ 2015-05-28 19:19 UTC (permalink / raw)
  To: kvalo; +Cc: dreamfly281, ath10k, linux-wireless

As some radio have no connection with BT modules, enable the WLAN/Bluetooth
coexist(BTC) feature will has some side effect if the radio's GPIO connect
with any other HW modules. Add the control switcher "btc_feature" at
debugfs and set the feature as disable by default to avoid such case.

To enable this feature, execute:
echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
To disable:
echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature

Signed-off-by: Yanbo Li <yanbol@qca.qualcomm.com>

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 70fcdc9c2758..4a84e17016c9 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -728,6 +728,8 @@ struct ath10k {
 		u32 fw_cold_reset_counter;
 	} stats;
 
+	bool btc_feature;
+
 	struct ath10k_thermal thermal;
 	struct ath10k_wow wow;
 
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 8fa606a9c4dd..820a12bc0dd8 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2092,6 +2092,56 @@ static const struct file_operations fops_quiet_period = {
 	.open = simple_open
 };
 
+static ssize_t ath10k_write_btc_feature(struct file *file,
+					const char __user *ubuf,
+					size_t count, loff_t *ppos)
+{
+	struct ath10k *ar = file->private_data;
+	char buf[32];
+	size_t buf_size;
+	bool val;
+
+	buf_size = min(count, (sizeof(buf) - 1));
+	if (copy_from_user(buf, ubuf, buf_size))
+		return -EFAULT;
+
+	buf[buf_size] = '\0';
+	if (strtobool(buf, &val) != 0) {
+		ath10k_warn(ar, "Wrong BTC feature setting\n");
+		return -EINVAL;
+	}
+
+	mutex_lock(&ar->conf_mutex);
+	if (val != ar->btc_feature) {
+		ar->btc_feature = val;
+		queue_work(ar->workqueue, &ar->restart_work);
+	}
+	mutex_unlock(&ar->conf_mutex);
+
+	return count;
+}
+
+static ssize_t ath10k_read_btc_feature(struct file *file, char __user *ubuf,
+				       size_t count, loff_t *ppos)
+{
+	char buf[32];
+	struct ath10k *ar = file->private_data;
+	int len = 0;
+
+	mutex_lock(&ar->conf_mutex);
+	len = scnprintf(buf, sizeof(buf) - len, "%d\n",
+			ar->btc_feature);
+	mutex_unlock(&ar->conf_mutex);
+
+	return simple_read_from_buffer(ubuf, count, ppos, buf, len);
+}
+
+static const struct file_operations fops_btc_feature = {
+	.read = ath10k_read_btc_feature,
+	.write = ath10k_write_btc_feature,
+	.open = simple_open
+};
+
 int ath10k_debug_create(struct ath10k *ar)
 {
 	ar->debug.fw_crash_data = vzalloc(sizeof(*ar->debug.fw_crash_data));
@@ -2195,6 +2245,8 @@ int ath10k_debug_register(struct ath10k *ar)
 	debugfs_create_file("quiet_period", S_IRUGO | S_IWUSR,
 			    ar->debug.debugfs_phy, ar, &fops_quiet_period);
 
+	debugfs_create_file("btc_feature", S_IRUGO | S_IWUSR,
+			    ar->debug.debugfs_phy, ar, &fops_btc_feature);
 	return 0;
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 0fabe689179c..e3c880230ee6 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3933,7 +3933,8 @@ static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar)
 	cmd = (struct wmi_init_cmd_10_2 *)buf->data;
 
 	features = WMI_10_2_RX_BATCH_MODE;
-	if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map))
+	if (ar->btc_feature &&
+	    test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map))
 		features |= WMI_10_2_COEX_GPIO;
 	cmd->resource_config.feature_mask = __cpu_to_le32(features);
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ath10k: Debugfs entry to enable/disable WLAN&Blutooth Coexist feature
  2015-05-28 19:19 [PATCH v2] ath10k: Debugfs entry to enable/disable WLAN&Blutooth Coexist feature Yanbo Li
@ 2015-06-02  9:39 ` Jakub Kiciński
  2015-06-02 12:10   ` Kalle Valo
  2015-06-03  0:18   ` Li, Yanbo
       [not found] ` <CAFqt6zbpEfX_DPwZwzVZkcUD3uuYa=-Ujuo9PXcB+-HtM9b8tA@mail.gmail.com>
  1 sibling, 2 replies; 5+ messages in thread
From: Jakub Kiciński @ 2015-06-02  9:39 UTC (permalink / raw)
  To: Yanbo Li; +Cc: kvalo, dreamfly281, ath10k, linux-wireless

On Thu, 28 May 2015 12:19:05 -0700, Yanbo Li wrote:
> As some radio have no connection with BT modules, enable the WLAN/Bluetooth
> coexist(BTC) feature will has some side effect if the radio's GPIO connect
> with any other HW modules. Add the control switcher "btc_feature" at
> debugfs and set the feature as disable by default to avoid such case.
>
> To enable this feature, execute:
> echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
> To disable:
> echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
> 
> Signed-off-by: Yanbo Li <yanbol@qca.qualcomm.com>

IMHO common API for disabling/enabling btcoex is something we would all
benefit from and easy enough to implement properly.  Burying it in
driver-specific debugfs is less than appropriate.

I seem to recall there were plans to discuss btcoex at one of the
linux-wireless summits.  If the consensus was to leave it in debugfs
then I apologize for the noise ;)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ath10k: Debugfs entry to enable/disable WLAN&Blutooth Coexist feature
  2015-06-02  9:39 ` Jakub Kiciński
@ 2015-06-02 12:10   ` Kalle Valo
  2015-06-03  0:18   ` Li, Yanbo
  1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2015-06-02 12:10 UTC (permalink / raw)
  To: Jakub Kiciński; +Cc: Yanbo Li, dreamfly281, linux-wireless, ath10k

Jakub Kiciński <moorray3@wp.pl> writes:

> On Thu, 28 May 2015 12:19:05 -0700, Yanbo Li wrote:
>> As some radio have no connection with BT modules, enable the WLAN/Bluetooth
>> coexist(BTC) feature will has some side effect if the radio's GPIO connect
>> with any other HW modules. Add the control switcher "btc_feature" at
>> debugfs and set the feature as disable by default to avoid such case.
>>
>> To enable this feature, execute:
>> echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
>> To disable:
>> echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
>> 
>> Signed-off-by: Yanbo Li <yanbol@qca.qualcomm.com>
>
> IMHO common API for disabling/enabling btcoex is something we would all
> benefit from and easy enough to implement properly.  Burying it in
> driver-specific debugfs is less than appropriate.
>
> I seem to recall there were plans to discuss btcoex at one of the
> linux-wireless summits.  If the consensus was to leave it in debugfs
> then I apologize for the noise ;)

I agree. I don't recall anymore the discussion in the summit but I think
that adding btcoex support to nl80211 would be the right thing to do.
It's a common setting for many drivers. But before we have that, ath10k
still has to use debugfs.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] ath10k: Debugfs entry to enable/disable WLAN&Blutooth Coexist feature
  2015-06-02  9:39 ` Jakub Kiciński
  2015-06-02 12:10   ` Kalle Valo
@ 2015-06-03  0:18   ` Li, Yanbo
  1 sibling, 0 replies; 5+ messages in thread
From: Li, Yanbo @ 2015-06-03  0:18 UTC (permalink / raw)
  To: Jakub Kiciński
  Cc: Valo, Kalle, dreamfly281@gmail.com, ath10k@lists.infradead.org,
	linux-wireless@vger.kernel.org



> -----Original Message-----
> From: Jakub Kiciński [mailto:moorray3@wp.pl]
> Sent: Tuesday, June 02, 2015 2:39 AM
> To: Li, Yanbo
> Cc: Valo, Kalle; dreamfly281@gmail.com; ath10k@lists.infradead.org; linux-
> wireless@vger.kernel.org
> Subject: Re: [PATCH v2] ath10k: Debugfs entry to enable/disable
> WLAN&Blutooth Coexist feature
> 
> On Thu, 28 May 2015 12:19:05 -0700, Yanbo Li wrote:
> > As some radio have no connection with BT modules, enable the
> > WLAN/Bluetooth
> > coexist(BTC) feature will has some side effect if the radio's GPIO
> > connect with any other HW modules. Add the control switcher
> > "btc_feature" at debugfs and set the feature as disable by default to avoid
> such case.
> >
> > To enable this feature, execute:
> > echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
> > To disable:
> > echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
> >
> > Signed-off-by: Yanbo Li <yanbol@qca.qualcomm.com>
> 
> IMHO common API for disabling/enabling btcoex is something we would all
> benefit from and easy enough to implement properly.  Burying it in driver-
> specific debugfs is less than appropriate.
> 
> I seem to recall there were plans to discuss btcoex at one of the linux-
> wireless summits.  If the consensus was to leave it in debugfs then I
> apologize for the noise ;)

Thanks for your comments, agree with a general BTcoex interface will be good for lots of wlan chip/driver. 
It worth to be consider to implement such framework in future.

BR /Yanbo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ath10k: Debugfs entry to enable/disable WLAN&Blutooth Coexist feature
       [not found] ` <CAFqt6zbpEfX_DPwZwzVZkcUD3uuYa=-Ujuo9PXcB+-HtM9b8tA@mail.gmail.com>
@ 2015-06-03  9:56   ` Kalle Valo
  0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2015-06-03  9:56 UTC (permalink / raw)
  To: Souptick Joarder; +Cc: Yanbo Li, ath10k, dreamfly281, linux-wireless

Souptick Joarder <jrdr.linux@gmail.com> writes:

> From patch it looks like we can optimize the size of char buf [32] to
> 16 /8 as it is only going to store 0 or 1. If there are some other
> purpose to keep it 32 , then I apologize for the noise.

I'm going to send v3 which will use dev_flags bitmap.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-03  9:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-28 19:19 [PATCH v2] ath10k: Debugfs entry to enable/disable WLAN&Blutooth Coexist feature Yanbo Li
2015-06-02  9:39 ` Jakub Kiciński
2015-06-02 12:10   ` Kalle Valo
2015-06-03  0:18   ` Li, Yanbo
     [not found] ` <CAFqt6zbpEfX_DPwZwzVZkcUD3uuYa=-Ujuo9PXcB+-HtM9b8tA@mail.gmail.com>
2015-06-03  9:56   ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).