linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: <hildawu@realtek.com>
To: <marcel@holtmann.org>
Cc: max.chou@realtek.com, johan.hedberg@gmail.com,
	kidman@realtek.com, linux-kernel@vger.kernel.org,
	linux-bluetooth@vger.kernel.org, alex_lu@realsil.com.cn,
	linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Bluetooth: btusb: WBS support USB alternate setting 1
Date: Mon, 29 Jun 2020 14:03:38 +0800	[thread overview]
Message-ID: <20200629060338.10705-1-hildawu@realtek.com> (raw)

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

             reply	other threads:[~2020-06-29  6:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29  6:03 hildawu [this message]
2020-06-29  6:19 ` [PATCH] Bluetooth: btusb: WBS support USB alternate setting 1 Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200629060338.10705-1-hildawu@realtek.com \
    --to=hildawu@realtek.com \
    --cc=alex_lu@realsil.com.cn \
    --cc=johan.hedberg@gmail.com \
    --cc=kidman@realtek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=marcel@holtmann.org \
    --cc=matthias.bgg@gmail.com \
    --cc=max.chou@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).