[SRU][B/OEM-B/C/D/unstable][PATCH 0/3] line-out on the Dell dock station can't work

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU][B/OEM-B/C/D/unstable][PATCH 0/3] line-out on the Dell dock station can't work

Hui Wang
BugLink: https://bugs.launchpad.net/bugs/1806532

The 0001-xxx.patch and 0002-xxx.patch are already in the kernel-v4.18, so these
two patches are only for Bionic and oem-bionic.

The 0003-xxx.patch is in the kernel-v4.20-rc5, it is for B/OEM-B/C/D/unstable

[Impact]
On the Dell thunderbolt docs stations (WD15 and WD19), there are two playback
devices, one is headphone, the other is line-out, but there is no UCM for
these docks yet, so the pluseaudio only can handle the 1st playback device,
need us to add the UCM for them, before adding UCM, we need to set the
longname of the sound card in the linux kernel.

[Fix]
Cherry-picked 3 upstream patches, these patches add the longname of the sound
card for the dock station.


[Test Case]
Open the gnome-sound-setting, we can choose headphone-usb and lineout-usb from
UI, and play sound via these devices

[Regression Potential]
Very low, these patches come from upstream, and the change is only specific
to WD15 and WD19 dock station.


Hui Wang (1):
  ALSA: usb-audio: Add vendor and product name for Dell WD19 Dock

Takashi Iwai (2):
  ALSA: usb-audio: Allow to override the longname string
  ALSA: usb-audio: Give proper vendor/product name for Dell WD15 Dock

 sound/usb/card.c         | 146 ++++++++++++++++++++++++++++-------------------
 sound/usb/quirks-table.h |  20 +++++++
 sound/usb/usbaudio.h     |   1 +
 3 files changed, 108 insertions(+), 59 deletions(-)

--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][B/OEM-B][PATCH 1/3] ALSA: usb-audio: Allow to override the longname string

Hui Wang
From: Takashi Iwai <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1806532

Historically USB-audio driver sets the card's longname field with the
details of the device and the bus information.  It's good per se, but
not preferable when it's referred as the identifier for UCM profile.

This patch adds a quirk profile_name field to override the card's
longname string to a pre-defined one, so that one can create a unique
and consistent ID string for the specific USB device via a quirk table
to be used as a UCM profile name.

The patch does a slight code refactoring to split out the functions to
set shortname and longname fields as well.

Signed-off-by: Takashi Iwai <[hidden email]>
(cherry picked from commit 07eca5fc3ebad1d33bc12a2f09670c0edd8e6eb6)
Signed-off-by: Hui Wang <[hidden email]>
---
 sound/usb/card.c     | 146 ++++++++++++++++++++++++++++++---------------------
 sound/usb/usbaudio.h |   1 +
 2 files changed, 88 insertions(+), 59 deletions(-)

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 23d1d23..3ffb8e5 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -346,6 +346,90 @@ static int snd_usb_audio_dev_free(struct snd_device *device)
  return snd_usb_audio_free(chip);
 }
 
+static void usb_audio_make_shortname(struct usb_device *dev,
+     struct snd_usb_audio *chip,
+     const struct snd_usb_audio_quirk *quirk)
+{
+ struct snd_card *card = chip->card;
+
+ if (quirk && quirk->product_name && *quirk->product_name) {
+ strlcpy(card->shortname, quirk->product_name,
+ sizeof(card->shortname));
+ return;
+ }
+
+ /* retrieve the device string as shortname */
+ if (!dev->descriptor.iProduct ||
+    usb_string(dev, dev->descriptor.iProduct,
+       card->shortname, sizeof(card->shortname)) <= 0) {
+ /* no name available from anywhere, so use ID */
+ sprintf(card->shortname, "USB Device %#04x:%#04x",
+ USB_ID_VENDOR(chip->usb_id),
+ USB_ID_PRODUCT(chip->usb_id));
+ }
+
+ strim(card->shortname);
+}
+
+static void usb_audio_make_longname(struct usb_device *dev,
+    struct snd_usb_audio *chip,
+    const struct snd_usb_audio_quirk *quirk)
+{
+ struct snd_card *card = chip->card;
+ int len;
+
+ /* shortcut - if any pre-defined string is given, use it */
+ if (quirk && quirk->profile_name && *quirk->profile_name) {
+ strlcpy(card->longname, quirk->profile_name,
+ sizeof(card->longname));
+ return;
+ }
+
+ if (quirk && quirk->vendor_name && *quirk->vendor_name) {
+ len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname));
+ } else {
+ /* retrieve the vendor and device strings as longname */
+ if (dev->descriptor.iManufacturer)
+ len = usb_string(dev, dev->descriptor.iManufacturer,
+ card->longname, sizeof(card->longname));
+ else
+ len = 0;
+ /* we don't really care if there isn't any vendor string */
+ }
+ if (len > 0) {
+ strim(card->longname);
+ if (*card->longname)
+ strlcat(card->longname, " ", sizeof(card->longname));
+ }
+
+ strlcat(card->longname, card->shortname, sizeof(card->longname));
+
+ len = strlcat(card->longname, " at ", sizeof(card->longname));
+
+ if (len < sizeof(card->longname))
+ usb_make_path(dev, card->longname + len, sizeof(card->longname) - len);
+
+ switch (snd_usb_get_speed(dev)) {
+ case USB_SPEED_LOW:
+ strlcat(card->longname, ", low speed", sizeof(card->longname));
+ break;
+ case USB_SPEED_FULL:
+ strlcat(card->longname, ", full speed", sizeof(card->longname));
+ break;
+ case USB_SPEED_HIGH:
+ strlcat(card->longname, ", high speed", sizeof(card->longname));
+ break;
+ case USB_SPEED_SUPER:
+ strlcat(card->longname, ", super speed", sizeof(card->longname));
+ break;
+ case USB_SPEED_SUPER_PLUS:
+ strlcat(card->longname, ", super speed plus", sizeof(card->longname));
+ break;
+ default:
+ break;
+ }
+}
+
 /*
  * create a chip instance and set its names.
  */
@@ -357,7 +441,7 @@ static int snd_usb_audio_create(struct usb_interface *intf,
 {
  struct snd_card *card;
  struct snd_usb_audio *chip;
- int err, len;
+ int err;
  char component[14];
  static struct snd_device_ops ops = {
  .dev_free = snd_usb_audio_dev_free,
@@ -419,64 +503,8 @@ static int snd_usb_audio_create(struct usb_interface *intf,
  USB_ID_VENDOR(chip->usb_id), USB_ID_PRODUCT(chip->usb_id));
  snd_component_add(card, component);
 
- /* retrieve the device string as shortname */
- if (quirk && quirk->product_name && *quirk->product_name) {
- strlcpy(card->shortname, quirk->product_name, sizeof(card->shortname));
- } else {
- if (!dev->descriptor.iProduct ||
-    usb_string(dev, dev->descriptor.iProduct,
-    card->shortname, sizeof(card->shortname)) <= 0) {
- /* no name available from anywhere, so use ID */
- sprintf(card->shortname, "USB Device %#04x:%#04x",
- USB_ID_VENDOR(chip->usb_id),
- USB_ID_PRODUCT(chip->usb_id));
- }
- }
- strim(card->shortname);
-
- /* retrieve the vendor and device strings as longname */
- if (quirk && quirk->vendor_name && *quirk->vendor_name) {
- len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname));
- } else {
- if (dev->descriptor.iManufacturer)
- len = usb_string(dev, dev->descriptor.iManufacturer,
- card->longname, sizeof(card->longname));
- else
- len = 0;
- /* we don't really care if there isn't any vendor string */
- }
- if (len > 0) {
- strim(card->longname);
- if (*card->longname)
- strlcat(card->longname, " ", sizeof(card->longname));
- }
-
- strlcat(card->longname, card->shortname, sizeof(card->longname));
-
- len = strlcat(card->longname, " at ", sizeof(card->longname));
-
- if (len < sizeof(card->longname))
- usb_make_path(dev, card->longname + len, sizeof(card->longname) - len);
-
- switch (snd_usb_get_speed(dev)) {
- case USB_SPEED_LOW:
- strlcat(card->longname, ", low speed", sizeof(card->longname));
- break;
- case USB_SPEED_FULL:
- strlcat(card->longname, ", full speed", sizeof(card->longname));
- break;
- case USB_SPEED_HIGH:
- strlcat(card->longname, ", high speed", sizeof(card->longname));
- break;
- case USB_SPEED_SUPER:
- strlcat(card->longname, ", super speed", sizeof(card->longname));
- break;
- case USB_SPEED_SUPER_PLUS:
- strlcat(card->longname, ", super speed plus", sizeof(card->longname));
- break;
- default:
- break;
- }
+ usb_audio_make_shortname(dev, chip, quirk);
+ usb_audio_make_longname(dev, chip, quirk);
 
  snd_usb_audio_create_proc(chip);
 
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 4d5c89a..419b5f5 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -109,6 +109,7 @@ enum quirk_type {
 struct snd_usb_audio_quirk {
  const char *vendor_name;
  const char *product_name;
+ const char *profile_name; /* override the card->longname */
  int16_t ifnum;
  uint16_t type;
  const void *data;
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][B/OEM-B][PATCH 2/3] ALSA: usb-audio: Give proper vendor/product name for Dell WD15 Dock

Hui Wang
In reply to this post by Hui Wang
From: Takashi Iwai <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1806532

Dell WD15 Dock with 0bda:4014 doesn't give any useful strings for the
vendor and the product names.  Name them more specifically via quirk,
as well as the UCM profile name.

Signed-off-by: Takashi Iwai <[hidden email]>
(cherry picked from commit 6455abb43374346f10b4842a9bc9b7f4d10fa038)
Signed-off-by: Hui Wang <[hidden email]>
---
 sound/usb/quirks-table.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 69bf5cf..f6a934f 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -3323,5 +3323,15 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
  }
  }
 },
+/* Dell WD15 Dock */
+{
+ USB_DEVICE(0x0bda, 0x4014),
+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+ .vendor_name = "Dell",
+ .product_name = "WD15 Dock",
+ .profile_name = "Dell-WD15-Dock",
+ .ifnum = QUIRK_NO_INTERFACE
+ }
+},
 
 #undef USB_DEVICE_VENDOR_SPEC
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][B/OEM-B/C/D/unstable][PATCH 3/3] ALSA: usb-audio: Add vendor and product name for Dell WD19 Dock

Hui Wang
In reply to this post by Hui Wang
BugLink: https://bugs.launchpad.net/bugs/1806532

Like the Dell WD15 Dock, the WD19 Dock (0bda:402e) doens't provide
useful string for the vendor and product names too. In order to share
the UCM with WD15, here we keep the profile_name same as the WD15.

Signed-off-by: Hui Wang <[hidden email]>
Signed-off-by: Takashi Iwai <[hidden email]>
(cherry picked from commit 8159a6a4a7d2a092d5375f695ecfca22b4562b5f)
Signed-off-by: Hui Wang <[hidden email]>
---
 sound/usb/quirks-table.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index f6a934f..bbd2e49 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -3333,5 +3333,15 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
  .ifnum = QUIRK_NO_INTERFACE
  }
 },
+/* Dell WD19 Dock */
+{
+ USB_DEVICE(0x0bda, 0x402e),
+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+ .vendor_name = "Dell",
+ .product_name = "WD19 Dock",
+ .profile_name = "Dell-WD15-Dock",
+ .ifnum = QUIRK_NO_INTERFACE
+ }
+},
 
 #undef USB_DEVICE_VENDOR_SPEC
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK / APPLIED[D]: [SRU][B/OEM-B/C/D/unstable][PATCH 0/3] line-out on the Dell dock station can't work

Seth Forshee
In reply to this post by Hui Wang
On Tue, Dec 04, 2018 at 02:30:05PM +0800, Hui Wang wrote:

> BugLink: https://bugs.launchpad.net/bugs/1806532
>
> The 0001-xxx.patch and 0002-xxx.patch are already in the kernel-v4.18, so these
> two patches are only for Bionic and oem-bionic.
>
> The 0003-xxx.patch is in the kernel-v4.20-rc5, it is for B/OEM-B/C/D/unstable
>
> [Impact]
> On the Dell thunderbolt docs stations (WD15 and WD19), there are two playback
> devices, one is headphone, the other is line-out, but there is no UCM for
> these docks yet, so the pluseaudio only can handle the 1st playback device,
> need us to add the UCM for them, before adding UCM, we need to set the
> longname of the sound card in the linux kernel.
>
> [Fix]
> Cherry-picked 3 upstream patches, these patches add the longname of the sound
> card for the dock station.
>
>
> [Test Case]
> Open the gnome-sound-setting, we can choose headphone-usb and lineout-usb from
> UI, and play sound via these devices
>
> [Regression Potential]
> Very low, these patches come from upstream, and the change is only specific
> to WD15 and WD19 dock station.

Striaghtforward upstream cherry picks, impact limited to specific
hardware.

Acked-by: Seth Forshee <[hidden email]>

Applied to disco/master-next, thanks!

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK/APPLIED[OEM-B]: [SRU][B/OEM-B/C/D/unstable][PATCH 0/3] line-out on the Dell dock station can't work

AceLan Kao
In reply to this post by Hui Wang
Applied on Ubuntu-oem-4.15.0-1030.35

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team