All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci
@ 2021-05-21  8:20 Geoffrey D. Bennett
  2021-05-21  8:20 ` [PATCH 1/2] " Geoffrey D. Bennett
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geoffrey D. Bennett @ 2021-05-21  8:20 UTC (permalink / raw)
  To: alsa-devel, Takashi Iwai; +Cc: Geoffrey D. Bennett

This patchset fixes a show-stopper bug with the Scarlett Gen 2 mixer
driver not working with the ehci-pci host driver, and improves the
user experience with better driver startup messages.

Patch 1: Fixes the driver hanging the device by using the correct
direction pipe now.

Patch 2: Improves the user experience with more specific enabling
instructions, positive feedback when it is enabled or if
initialisation fails. The previous instructions were incomplete and
didn't confirm that the driver was enabled.

#Cc: stable@vger.kernel.org please (sorry, not sure if I should be
sending this there myself or if it gets added by Takashi after
review?)

Geoffrey D. Bennett (2):
  ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci
  ALSA: usb-audio: scarlett2: Improve driver startup messages

 sound/usb/mixer_quirks.c        |  2 +-
 sound/usb/mixer_scarlett_gen2.c | 81 +++++++++++++++++++++------------
 sound/usb/mixer_scarlett_gen2.h |  2 +-
 3 files changed, 53 insertions(+), 32 deletions(-)

-- 
2.31.1


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

* [PATCH 1/2] ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci
  2021-05-21  8:20 [PATCH 0/2] ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci Geoffrey D. Bennett
@ 2021-05-21  8:20 ` Geoffrey D. Bennett
  2021-05-21  8:20 ` [PATCH 2/2] ALSA: usb-audio: scarlett2: Improve driver startup messages Geoffrey D. Bennett
  2021-05-21 14:23 ` [PATCH 0/2] ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Geoffrey D. Bennett @ 2021-05-21  8:20 UTC (permalink / raw)
  To: alsa-devel, Takashi Iwai; +Cc: Geoffrey D. Bennett

Use usb_rcvctrlpipe() not usb_sndctrlpipe() for USB control input in
the Scarlett Gen 2 mixer driver. This fixes the device hang during
initialisation when used with the ehci-pci host driver.

Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
---
 sound/usb/mixer_scarlett_gen2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index 560c2ade829d..dcff3e3a49f3 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -635,7 +635,7 @@ static int scarlett2_usb(
 	/* send a second message to get the response */
 
 	err = snd_usb_ctl_msg(mixer->chip->dev,
-			usb_sndctrlpipe(mixer->chip->dev, 0),
+			usb_rcvctrlpipe(mixer->chip->dev, 0),
 			SCARLETT2_USB_VENDOR_SPECIFIC_CMD_RESP,
 			USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
 			0,
-- 
2.31.1


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

* [PATCH 2/2] ALSA: usb-audio: scarlett2: Improve driver startup messages
  2021-05-21  8:20 [PATCH 0/2] ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci Geoffrey D. Bennett
  2021-05-21  8:20 ` [PATCH 1/2] " Geoffrey D. Bennett
@ 2021-05-21  8:20 ` Geoffrey D. Bennett
  2021-05-21 14:23 ` [PATCH 0/2] ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Geoffrey D. Bennett @ 2021-05-21  8:20 UTC (permalink / raw)
  To: alsa-devel, Takashi Iwai; +Cc: Geoffrey D. Bennett

Add separate init function to call the existing controls_create
function so a custom error can be displayed if initialisation fails.

Use info level instead of error for notifications.

Display the VID/PID so device_setup is targeted to the right device.

Display "enabled" message to easily confirm that the driver is loaded.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
---
 sound/usb/mixer_quirks.c        |  2 +-
 sound/usb/mixer_scarlett_gen2.c | 79 +++++++++++++++++++++------------
 sound/usb/mixer_scarlett_gen2.h |  2 +-
 3 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index ffd922327ae4..805873d0cd55 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -3017,7 +3017,7 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 	case USB_ID(0x1235, 0x8203): /* Focusrite Scarlett 6i6 2nd Gen */
 	case USB_ID(0x1235, 0x8204): /* Focusrite Scarlett 18i8 2nd Gen */
 	case USB_ID(0x1235, 0x8201): /* Focusrite Scarlett 18i20 2nd Gen */
-		err = snd_scarlett_gen2_controls_create(mixer);
+		err = snd_scarlett_gen2_init(mixer);
 		break;
 
 	case USB_ID(0x041e, 0x323b): /* Creative Sound Blaster E1 */
diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index dcff3e3a49f3..3ad8f61a2095 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -1997,38 +1997,11 @@ static int scarlett2_mixer_status_create(struct usb_mixer_interface *mixer)
 	return usb_submit_urb(mixer->urb, GFP_KERNEL);
 }
 
-/* Entry point */
-int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer)
+int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer,
+				      const struct scarlett2_device_info *info)
 {
-	const struct scarlett2_device_info *info;
 	int err;
 
-	/* only use UAC_VERSION_2 */
-	if (!mixer->protocol)
-		return 0;
-
-	switch (mixer->chip->usb_id) {
-	case USB_ID(0x1235, 0x8203):
-		info = &s6i6_gen2_info;
-		break;
-	case USB_ID(0x1235, 0x8204):
-		info = &s18i8_gen2_info;
-		break;
-	case USB_ID(0x1235, 0x8201):
-		info = &s18i20_gen2_info;
-		break;
-	default: /* device not (yet) supported */
-		return -EINVAL;
-	}
-
-	if (!(mixer->chip->setup & SCARLETT2_ENABLE)) {
-		usb_audio_err(mixer->chip,
-			"Focusrite Scarlett Gen 2 Mixer Driver disabled; "
-			"use options snd_usb_audio device_setup=1 "
-			"to enable and report any issues to g@b4.vu");
-		return 0;
-	}
-
 	/* Initialise private data, routing, sequence number */
 	err = scarlett2_init_private(mixer, info);
 	if (err < 0)
@@ -2073,3 +2046,51 @@ int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer)
 
 	return 0;
 }
+
+int snd_scarlett_gen2_init(struct usb_mixer_interface *mixer)
+{
+	struct snd_usb_audio *chip = mixer->chip;
+	const struct scarlett2_device_info *info;
+	int err;
+
+	/* only use UAC_VERSION_2 */
+	if (!mixer->protocol)
+		return 0;
+
+	switch (chip->usb_id) {
+	case USB_ID(0x1235, 0x8203):
+		info = &s6i6_gen2_info;
+		break;
+	case USB_ID(0x1235, 0x8204):
+		info = &s18i8_gen2_info;
+		break;
+	case USB_ID(0x1235, 0x8201):
+		info = &s18i20_gen2_info;
+		break;
+	default: /* device not (yet) supported */
+		return -EINVAL;
+	}
+
+	if (!(chip->setup & SCARLETT2_ENABLE)) {
+		usb_audio_info(chip,
+			"Focusrite Scarlett Gen 2 Mixer Driver disabled; "
+			"use options snd_usb_audio vid=0x%04x pid=0x%04x "
+			"device_setup=1 to enable and report any issues "
+			"to g@b4.vu",
+			USB_ID_VENDOR(chip->usb_id),
+			USB_ID_PRODUCT(chip->usb_id));
+		return 0;
+	}
+
+	usb_audio_info(chip,
+		"Focusrite Scarlett Gen 2 Mixer Driver enabled pid=0x%04x",
+		USB_ID_PRODUCT(chip->usb_id));
+
+	err = snd_scarlett_gen2_controls_create(mixer, info);
+	if (err < 0)
+		usb_audio_err(mixer->chip,
+			      "Error initialising Scarlett Mixer Driver: %d",
+			      err);
+
+	return err;
+}
diff --git a/sound/usb/mixer_scarlett_gen2.h b/sound/usb/mixer_scarlett_gen2.h
index 52e1dad77afd..668c6b0cb50a 100644
--- a/sound/usb/mixer_scarlett_gen2.h
+++ b/sound/usb/mixer_scarlett_gen2.h
@@ -2,6 +2,6 @@
 #ifndef __USB_MIXER_SCARLETT_GEN2_H
 #define __USB_MIXER_SCARLETT_GEN2_H
 
-int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer);
+int snd_scarlett_gen2_init(struct usb_mixer_interface *mixer);
 
 #endif /* __USB_MIXER_SCARLETT_GEN2_H */
-- 
2.31.1


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

* Re: [PATCH 0/2] ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci
  2021-05-21  8:20 [PATCH 0/2] ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci Geoffrey D. Bennett
  2021-05-21  8:20 ` [PATCH 1/2] " Geoffrey D. Bennett
  2021-05-21  8:20 ` [PATCH 2/2] ALSA: usb-audio: scarlett2: Improve driver startup messages Geoffrey D. Bennett
@ 2021-05-21 14:23 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-05-21 14:23 UTC (permalink / raw)
  To: Geoffrey D. Bennett; +Cc: alsa-devel

On Fri, 21 May 2021 10:20:11 +0200,
Geoffrey D. Bennett wrote:
> 
> This patchset fixes a show-stopper bug with the Scarlett Gen 2 mixer
> driver not working with the ehci-pci host driver, and improves the
> user experience with better driver startup messages.
> 
> Patch 1: Fixes the driver hanging the device by using the correct
> direction pipe now.
> 
> Patch 2: Improves the user experience with more specific enabling
> instructions, positive feedback when it is enabled or if
> initialisation fails. The previous instructions were incomplete and
> didn't confirm that the driver was enabled.
> 
> #Cc: stable@vger.kernel.org please (sorry, not sure if I should be
> sending this there myself or if it gets added by Takashi after
> review?)

No problem, I added manually at applying.

> 
> Geoffrey D. Bennett (2):
>   ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci
>   ALSA: usb-audio: scarlett2: Improve driver startup messages

Applied both patches now.  Thanks.


Takashi

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

end of thread, other threads:[~2021-05-21 14:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21  8:20 [PATCH 0/2] ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci Geoffrey D. Bennett
2021-05-21  8:20 ` [PATCH 1/2] " Geoffrey D. Bennett
2021-05-21  8:20 ` [PATCH 2/2] ALSA: usb-audio: scarlett2: Improve driver startup messages Geoffrey D. Bennett
2021-05-21 14:23 ` [PATCH 0/2] ALSA: usb-audio: scarlett2: Fix device hang with ehci-pci Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.