[PATCH v2] ALSA: usb-audio: Reset Blue Yeti firmware 0.20 after system resume
From: jasmeet . bhatia . us
Date: Tue Nov 17 2026 - 20:39:57 EST
From: "Jasmeet (Jazz) Bhatia" <jasmeet.bhatia.us@xxxxxxxxx>
Blue Yeti Classic microphones (046d:0ab7, bcdDevice 0x0020) may
remain enumerated after system suspend/resume while capture fails with
-EIO. USB resets, unbind/rebind and USB_QUIRK_RESET_RESUME do not
recover capture on this firmware.
Send the device-specific AudioControl SET_CUR command to restart the
Yeti's MCU and USB logic, allowing it to disconnect and re-enumerate.
Since the command disconnects the device, defer it to a freezable work
item after the last ALSA interface completes its system-resume
bookkeeping instead of sending it inline from the resume callback.
Keep a single work item in the card, avoid overlapping reset requests,
and serialize scheduling against the disconnect shutdown transition.
Drain the work item before ALSA resources are released. On a failed
control transfer, allow a later system resume to retry while the device
remains connected, without immediately requeuing the running work.
Disable runtime autosuspend for the affected firmware so that a
runtime-suspended interface does not bypass this system-resume path.
On the affected device, five consecutive system suspend/resume cycles
caused automatic disconnect and re-enumeration, with capture working
without a manual replug. Unplug/replug and suspend while unplugged
followed by reconnect were also tested. ftrace confirmed that the
firmware-reset worker completed in about 2 ms.
Signed-off-by: Jasmeet (Jazz) Bhatia <jasmeet.bhatia.us@xxxxxxxxx>
---
v2:
- Rebase onto ALSA commit 01f46c3244c9.
- Use one embedded work item per card instead of dynamically
allocating work and managing module references.
- Queue after ALSA system-resume bookkeeping completes.
- Synchronize reset scheduling with shutdown and drain work
during disconnect.
- Retry failed transfers on a later system resume.
- Disable autosuspend only for the affected firmware.
v1: https://lore.kernel.org/lkml/20261021231754.16928-1-jasmeet.bhatia.us@xxxxxxxxx/
sound/usb/card.c | 17 +++++++++++++-
sound/usb/quirks.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++
sound/usb/quirks.h | 4 ++++
sound/usb/usbaudio.h | 6 ++++++
4 files changed, 87 insertions(+), 1 deletion(-)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 59979b7..e681cb8 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -756,6 +756,7 @@ static int snd_usb_audio_create(struct usb_interface *intf,
atomic_set(&chip->active, 1); /* avoid autopm during probing */
snd_refcount_init(&chip->usage_count);
atomic_set(&chip->shutdown, 0);
+ snd_usb_init_resume_quirk(chip);
chip->usb_id = usb_id;
INIT_LIST_HEAD(&chip->pcm_list);
@@ -767,6 +768,8 @@ static int snd_usb_audio_create(struct usb_interface *intf,
INIT_LIST_HEAD(&chip->mixer_list);
snd_usb_init_quirk_flags(idx, chip);
+ if (snd_usb_yeti_fw_020(dev))
+ chip->quirk_flags |= QUIRK_FLAG_DISABLE_AUTOSUSPEND;
card->private_free = snd_usb_audio_free;
@@ -1104,12 +1107,20 @@ static bool __usb_audio_disconnect(struct usb_interface *intf,
struct snd_usb_audio *chip,
struct snd_card *card)
{
+ unsigned long flags;
+ bool first_disconnect;
+
guard(mutex)(®ister_mutex);
if (platform_ops && platform_ops->disconnect_cb)
platform_ops->disconnect_cb(chip);
- if (atomic_inc_return(&chip->shutdown) == 1) {
+ /* Exclude new reset work before waiting for pending work to exit. */
+ spin_lock_irqsave(&chip->resume_reset_lock, flags);
+ first_disconnect = atomic_inc_return(&chip->shutdown) == 1;
+ spin_unlock_irqrestore(&chip->resume_reset_lock, flags);
+ if (first_disconnect) {
+ cancel_work_sync(&chip->resume_reset_work);
/* wait until all pending tasks done;
* they are protected by snd_usb_lock_shutdown()
*/
@@ -1248,6 +1259,7 @@ static int usb_audio_resume(struct usb_interface *intf)
struct snd_usb_stream *as;
struct usb_mixer_interface *mixer;
struct list_head *p;
+ bool system_resume = false;
int err = 0;
if (chip == USB_AUDIO_IFACE_UNUSED)
@@ -1291,12 +1303,15 @@ static int usb_audio_resume(struct usb_interface *intf)
out:
if (chip->num_suspended_intf == chip->system_suspend) {
snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0);
+ system_resume = chip->system_suspend != 0;
chip->system_suspend = 0;
}
chip->num_suspended_intf--;
err_out:
atomic_dec(&chip->active); /* allow autopm after this point */
+ if (system_resume)
+ snd_usb_apply_resume_quirk(chip);
return err;
}
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -11,6 +11,7 @@
#include <linux/usb.h>
#include <linux/usb/audio.h>
#include <linux/usb/midi.h>
+#include <linux/workqueue.h>
#include <linux/bits.h>
#include <sound/control.h>
@@ -1708,6 +1709,66 @@ int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,
return 0;
}
+/* Blue Yeti Classic firmware 0.20 stops capturing after system resume. */
+bool snd_usb_yeti_fw_020(struct usb_device *dev)
+{
+ return le16_to_cpu(dev->descriptor.idVendor) == 0x046d &&
+ le16_to_cpu(dev->descriptor.idProduct) == 0x0ab7 &&
+ le16_to_cpu(dev->descriptor.bcdDevice) == 0x0020;
+}
+
+/* The device-specific SET_CUR command reboots the MCU and USB device. */
+static void snd_usb_yeti_reset_work(struct work_struct *work)
+{
+ struct snd_usb_audio *chip =
+ container_of(work, struct snd_usb_audio, resume_reset_work);
+ static const u8 reset_cmd[] = { 0x00, 0x09, 0, 0, 0, 0, 0, 0 };
+ int err;
+ unsigned long flags;
+
+ if (atomic_read(&chip->shutdown))
+ return;
+
+ err = usb_control_msg_send(chip->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)
+ usb_audio_warn(chip, "Blue Yeti resume reset failed: %d\n", err);
+ if (err) {
+ /* Retry only on a later system resume if still connected. */
+ spin_lock_irqsave(&chip->resume_reset_lock, flags);
+ if (!atomic_read(&chip->shutdown))
+ chip->resume_reset_queued = false;
+ spin_unlock_irqrestore(&chip->resume_reset_lock, flags);
+ }
+}
+
+void snd_usb_init_resume_quirk(struct snd_usb_audio *chip)
+{
+ spin_lock_init(&chip->resume_reset_lock);
+ INIT_WORK(&chip->resume_reset_work, snd_usb_yeti_reset_work);
+ chip->resume_reset_queued = false;
+}
+
+void snd_usb_apply_resume_quirk(struct snd_usb_audio *chip)
+{
+ unsigned long flags;
+
+ if (!snd_usb_yeti_fw_020(chip->dev))
+ return;
+
+ /* Keep queueing atomic with disconnect's shutdown transition. */
+ spin_lock_irqsave(&chip->resume_reset_lock, flags);
+ if (!atomic_read(&chip->shutdown) && !chip->resume_reset_queued) {
+ chip->resume_reset_queued = true;
+ queue_work(system_freezable_wq, &chip->resume_reset_work);
+ }
+ spin_unlock_irqrestore(&chip->resume_reset_lock, flags);
+}
+
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 0a723c2..2b0ce93 100644
--- a/sound/usb/quirks.h
+++ b/sound/usb/quirks.h
@@ -15,6 +15,10 @@ int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,
int iface,
int altno);
+bool snd_usb_yeti_fw_020(struct usb_device *dev);
+void snd_usb_init_resume_quirk(struct snd_usb_audio *chip);
+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,
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index c6d5921..1ef0f33 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -7,6 +7,8 @@
* Copyright (c) 2002 by Takashi Iwai <tiwai@xxxxxxx>
*/
+#include <linux/spinlock.h>
+#include <linux/workqueue.h>
#include <sound/core.h>
/* handling of USB vendor/product ID pairs as 32-bit numbers */
@@ -43,6 +45,10 @@ struct snd_usb_audio {
unsigned int system_suspend;
atomic_t active;
atomic_t shutdown;
+ /* Protects reset queueing against concurrent device shutdown. */
+ spinlock_t resume_reset_lock;
+ struct work_struct resume_reset_work;
+ bool resume_reset_queued;
struct snd_refcount usage_count;
u64 quirk_flags;
unsigned int need_delayed_register:1; /* warn for delayed registration */
--
2.47.3
base-commit: 01f46c3244c9df036f751d12e4d2037a029f3891