Skip to contentSkip to conversation

ALSA: usb-audio: Disable sample read check if firmware doesn't give back

PATCH New Takashi Iwai 1 participant 1 message Dec 18, 2020 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: Disable sample read check if firmware doesn't give back

Some buggy firmware don't give the current sample rate but leaves zero. Handle this case more gracefully without warning but just skip the current rate verification from the next time.

---
 sound/usb/clock.c | 6 ++++++
 1 file changed, 6 insertions(+)
sound/usb/clock.c +6 -0
index e940dcee792b..31051f2be46d 100644
@@ -534,6 +534,12 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip,
 	}
 
 	crate = data[0] | (data[1] << 8) | (data[2] << 16);
+	if (!crate) {
+		dev_info(&dev->dev, "failed to read current rate; disabling the check\n");
+		chip->sample_rate_read_error = 3; /* three strikes, see above */
+		return 0;
+	}
+
 	if (crate != rate) {
 		dev_warn(&dev->dev, "current rate %d is different from the runtime rate %d\n", crate, rate);
 		// runtime->rate = crate;
Signature · 1 line
2.26.2