Linux-mediatek Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Bluetooth: btusb: WBS support USB alternate setting 1
@ 2020-06-29  6:03 hildawu
  2020-06-29  6:19 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: hildawu @ 2020-06-29  6:03 UTC (permalink / raw)
  To: marcel
  Cc: max.chou, johan.hedberg, kidman, linux-kernel, linux-bluetooth,
	alex_lu, linux-mediatek, matthias.bgg, linux-arm-kernel

From: Hilda Wu <hildawu@realtek.com>

For WBS support, btusb driver could be set to alternate setting 1.

Signed-off-by: Hilda Wu <hildawu@realtek.com>
---
 drivers/bluetooth/btusb.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index c7cc8e594166..7942f9314fd7 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -453,6 +453,7 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = {
 #define BTUSB_HW_RESET_ACTIVE	12
 #define BTUSB_TX_WAIT_VND_EVT	13
 #define BTUSB_WAKEUP_DISABLE	14
+#define BTUSB_WBS_ALT1		15
 
 struct btusb_data {
 	struct hci_dev       *hdev;
@@ -1666,14 +1667,18 @@ static void btusb_work(struct work_struct *work)
 				new_alts = data->sco_num;
 			}
 		} else if (data->air_mode == HCI_NOTIFY_ENABLE_SCO_TRANSP) {
-
-			data->usb_alt6_packet_flow = true;
-
 			/* Check if Alt 6 is supported for Transparent audio */
-			if (btusb_find_altsetting(data, 6))
+			if (btusb_find_altsetting(data, 6)) {
+				data->usb_alt6_packet_flow = true;
 				new_alts = 6;
-			else
+			} else if (test_bit(BTUSB_WBS_ALT1, &data->flags)) {
+				if (btusb_find_altsetting(data, 1))
+					new_alts = 1;
+				else
+					bt_dev_err(hdev, "Device does not support ALT setting 1");
+			} else {
 				bt_dev_err(hdev, "Device does not support ALT setting 6");
+			}
 		}
 
 		if (btusb_switch_alt_setting(hdev, new_alts) < 0)
@@ -3965,6 +3970,7 @@ static int btusb_probe(struct usb_interface *intf,
 		 * (DEVICE_REMOTE_WAKEUP)
 		 */
 		set_bit(BTUSB_WAKEUP_DISABLE, &data->flags);
+		set_bit(BTUSB_WBS_ALT1, &data->flags);
 
 		err = usb_autopm_get_interface(intf);
 		if (err < 0)
-- 
2.17.1


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] Bluetooth: btusb: WBS support USB alternate setting 1
  2020-06-29  6:03 [PATCH] Bluetooth: btusb: WBS support USB alternate setting 1 hildawu
@ 2020-06-29  6:19 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2020-06-29  6:19 UTC (permalink / raw)
  To: hildawu
  Cc: max.chou, Johan Hedberg, kidman, kernel list, BlueZ, alex_lu,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Hi Hilda,

> For WBS support, btusb driver could be set to alternate setting 1.

please be more descriptive since this is special for Realtek devices.

> 
> Signed-off-by: Hilda Wu <hildawu@realtek.com>
> ---
> drivers/bluetooth/btusb.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index c7cc8e594166..7942f9314fd7 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -453,6 +453,7 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = {
> #define BTUSB_HW_RESET_ACTIVE	12
> #define BTUSB_TX_WAIT_VND_EVT	13
> #define BTUSB_WAKEUP_DISABLE	14
> +#define BTUSB_WBS_ALT1		15

Use BTUSB_USE_ALT1_FOR_WBS as a more descriptive name.

> 
> struct btusb_data {
> 	struct hci_dev       *hdev;
> @@ -1666,14 +1667,18 @@ static void btusb_work(struct work_struct *work)
> 				new_alts = data->sco_num;
> 			}
> 		} else if (data->air_mode == HCI_NOTIFY_ENABLE_SCO_TRANSP) {
> -
> -			data->usb_alt6_packet_flow = true;
> -
> 			/* Check if Alt 6 is supported for Transparent audio */
> -			if (btusb_find_altsetting(data, 6))
> +			if (btusb_find_altsetting(data, 6)) {
> +				data->usb_alt6_packet_flow = true;
> 				new_alts = 6;
> -			else
> +			} else if (test_bit(BTUSB_WBS_ALT1, &data->flags)) {
> +				if (btusb_find_altsetting(data, 1))
> +					new_alts = 1;
> +				else
> +					bt_dev_err(hdev, "Device does not support ALT setting 1");

Scrap this check and error and move it into the probe() function if you actually have Realtek hardware that does not support alternate setting 1.

> +			} else {
> 				bt_dev_err(hdev, "Device does not support ALT setting 6");
> +			}
> 		}
> 
> 		if (btusb_switch_alt_setting(hdev, new_alts) < 0)
> @@ -3965,6 +3970,7 @@ static int btusb_probe(struct usb_interface *intf,
> 		 * (DEVICE_REMOTE_WAKEUP)
> 		 */
> 		set_bit(BTUSB_WAKEUP_DISABLE, &data->flags);
> +		set_bit(BTUSB_WBS_ALT1, &data->flags);
> 
> 		err = usb_autopm_get_interface(intf);
> 		if (err < 0)

Regards

Marcel


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29  6:03 [PATCH] Bluetooth: btusb: WBS support USB alternate setting 1 hildawu
2020-06-29  6:19 ` Marcel Holtmann

Linux-mediatek Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mediatek/0 linux-mediatek/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mediatek linux-mediatek/ https://lore.kernel.org/linux-mediatek \
		linux-mediatek@lists.infradead.org
	public-inbox-index linux-mediatek

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-mediatek


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git