mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Reset Blue Yeti firmware 0.20 after resume
@ 2026-10-21 23:17 jasmeet.bhatia.us
  0 siblings, 0 replies; only message in thread
From: jasmeet.bhatia.us @ 2026-10-21 23:17 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Jaroslav Kysela, Geoffrey D . Bennett, linux-sound, linux-kernel,
	Jasmeet (Jazz) Bhatia

From: "Jasmeet (Jazz) Bhatia" <jasmeet.bhatia.us@gmail.com>

Blue Yeti Classic microphones with firmware 0.20 remain enumerated
after a system suspend/resume cycle but stop delivering capture
samples. This results in an attempt to capture audio failing with
-EIO.

Instead, the device should be recovered by sending its volatile ROM
reset command after a system resume. The command restarts the device's
MCU and USB logic, causing it to disconnect and re-enumerate with
working capture.

Defering the reset to system_freezable_wq provided best results when
testing, ensuring device resumes only after callbacks have completed.

Limits the quirk to USB ID 046d:0ab7 with bcdDevice 0x0020.

Signed-off-by: Jasmeet (Jazz) Bhatia <jasmeet.bhatia.us@gmail.com>
---
 sound/usb/card.c   |  3 ++
 sound/usb/quirks.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
 sound/usb/quirks.h |  1 +
 3 files changed, 81 insertions(+)

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 9307da95efbe..ebacb98fc34e 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -1280,6 +1280,9 @@ static int usb_audio_resume(struct usb_interface *intf)
 	if (chip->num_suspended_intf > 1)
 		goto out;
 
+	if (chip->system_suspend)
+		snd_usb_apply_resume_quirk(chip);
+
 	list_for_each_entry(as, &chip->pcm_list, list) {
 		err = snd_usb_pcm_resume(as);
 		if (err < 0) {
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index a54fabce7920..42d955c7b7a4 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -10,6 +10,8 @@
 #include <linux/usb.h>
 #include <linux/usb/audio.h>
 #include <linux/usb/midi.h>
+#include <linux/module.h>
+#include <linux/workqueue.h>
 #include <linux/bits.h>
 
 #include <sound/control.h>
@@ -1626,6 +1628,81 @@ int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,
 	return 0;
 }
 
+/*
+ * Blue Yeti Classic firmware 0.20 may stop delivering capture samples
+ * after a system suspend/resume while otherwise remaining enumerated.
+ *
+ * Sending the device's volatile ROM reset command restarts its MCU and
+ * USB logic, causing it to re-enumerate and restoring capture.
+ *
+ * Do not send the command directly from the USB resume callback because
+ * it deliberately disconnects the device.  Queue it on the freezable
+ * workqueue so it runs after device resume callbacks have completed.
+ */
+struct snd_usb_yeti_reset {
+	struct work_struct work;
+	struct usb_device *dev;
+};
+
+static void snd_usb_yeti_reset_work(struct work_struct *work)
+{
+	struct snd_usb_yeti_reset *yeti =
+		container_of(work, struct snd_usb_yeti_reset, work);
+	struct usb_device *dev = yeti->dev;
+	static const u8 reset_cmd[8] = {
+		0x00, 0x09, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00
+	};
+	int err;
+
+	err = usb_control_msg_send(dev, 0, UAC_SET_CUR,
+				   USB_DIR_OUT | USB_TYPE_CLASS |
+				   USB_RECIP_INTERFACE,
+				   0x0a00, 0x1900,
+				   reset_cmd, sizeof(reset_cmd),
+				   USB_CTRL_SET_TIMEOUT, GFP_KERNEL);
+
+	if (err && err != -ENODEV)
+		dev_warn(&dev->dev,
+			 "Blue Yeti resume reset failed: %d\n", err);
+
+	usb_put_dev(dev);
+	kfree(yeti);
+	module_put(THIS_MODULE);
+}
+
+static void snd_usb_yeti_resume_quirk(struct snd_usb_audio *chip)
+{
+	struct usb_device *dev = chip->dev;
+	struct snd_usb_yeti_reset *yeti;
+
+	if (chip->usb_id != USB_ID(0x046d, 0x0ab7) ||
+	    le16_to_cpu(dev->descriptor.bcdDevice) != 0x0020)
+		return;
+
+	yeti = kmalloc_obj(*yeti);
+	if (!yeti) {
+		dev_warn(&dev->dev,
+			 "Blue Yeti resume reset allocation failed\n");
+		return;
+	}
+
+	INIT_WORK(&yeti->work, snd_usb_yeti_reset_work);
+	yeti->dev = usb_get_dev(dev);
+	__module_get(THIS_MODULE);
+
+	if (!queue_work(system_freezable_wq, &yeti->work)) {
+		module_put(THIS_MODULE);
+		usb_put_dev(yeti->dev);
+		kfree(yeti);
+	}
+}
+
+void snd_usb_apply_resume_quirk(struct snd_usb_audio *chip)
+{
+	snd_usb_yeti_resume_quirk(chip);
+}
+
 int snd_usb_apply_boot_quirk(struct usb_device *dev,
 			     struct usb_interface *intf,
 			     const struct snd_usb_audio_quirk *quirk,
diff --git a/sound/usb/quirks.h b/sound/usb/quirks.h
index 0a723c266bb4..9988e185538f 100644
--- a/sound/usb/quirks.h
+++ b/sound/usb/quirks.h
@@ -15,6 +15,7 @@ int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,
 				  int iface,
 				  int altno);
 
+void snd_usb_apply_resume_quirk(struct snd_usb_audio *chip);
 int snd_usb_apply_boot_quirk(struct usb_device *dev,
 			     struct usb_interface *intf,
 			     const struct snd_usb_audio_quirk *quirk,

base-commit: 4df4d2a577db2d3d57b888bcfb1206fc74661d16
-- 
2.56.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-21 23:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 23:17 [PATCH] ALSA: usb-audio: Reset Blue Yeti firmware 0.20 after resume jasmeet.bhatia.us

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®