ALSA: usb-audio: Move set-interface-first workaround into common quirk
authorTakashi Iwai <tiwai@suse.de>
Tue, 24 Aug 2021 05:57:20 +0000 (07:57 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 24 Aug 2021 05:58:16 +0000 (07:58 +0200)
The recent quirk for WALKMAN (commit 7af5a14371c1: "ALSA: usb-audio:
Fix regression on Sony WALKMAN NW-A45 DAC") may be required for other
devices and is worth to be put into the common quirk flags.
This patch adds a new quirk flag bit QUIRK_FLAG_SET_IFACE_FIRST and a
quirk table entry for the device.

Link: https://lore.kernel.org/r/20210824055720.9240-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Documentation/sound/alsa-configuration.rst
sound/usb/endpoint.c
sound/usb/quirks.c
sound/usb/usbaudio.h

index e3c33b8d6d78a1fc40730aa0a2a76e310a8daf2c..65f61695f5618b58c9620c5e748fa0dcf34db84b 100644 (file)
@@ -2278,6 +2278,7 @@ quirk_flags
         * bit 13: Disable runtime PM autosuspend
         * bit 14: Ignore errors for mixer access
         * bit 15: Support generic DSD raw U32_BE format
+        * bit 16: Set up the interface at first like UAC1
 
 This module supports multiple devices, autoprobe and hotplugging.
 
index e6d58d7674a0a9a2c2045c6bdf523d3d8ddc6be3..79a8c569c62ba8e37b64b58338e850376b7d7e4e 100644 (file)
@@ -1293,10 +1293,8 @@ int snd_usb_endpoint_configure(struct snd_usb_audio *chip,
         * to be set up before parameter setups
         */
        iface_first = ep->cur_audiofmt->protocol == UAC_VERSION_1;
-       /* Workaround for Sony WALKMAN NW-A45 DAC;
-        * it requires the interface setup at first like UAC1
-        */
-       if (chip->usb_id == USB_ID(0x054c, 0x0b8c))
+       /* Workaround for devices that require the interface setup at first like UAC1 */
+       if (chip->quirk_flags & QUIRK_FLAG_SET_IFACE_FIRST)
                iface_first = true;
        if (iface_first) {
                err = endpoint_set_interface(chip, ep, true);
index 670abc6318f2aa29259605861f268f6d722003c0..4479a590194f47b9b6622f4e17caedf2dfe04d64 100644 (file)
@@ -1790,6 +1790,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
                   QUIRK_FLAG_GET_SAMPLE_RATE),
        DEVICE_FLG(0x04e8, 0xa051, /* Samsung USBC Headset (AKG) */
                   QUIRK_FLAG_SKIP_CLOCK_SELECTOR | QUIRK_FLAG_CTL_MSG_DELAY_5M),
+       DEVICE_FLG(0x054c, 0x0b8c, /* Sony WALKMAN NW-A45 DAC */
+                  QUIRK_FLAG_SET_IFACE_FIRST),
        DEVICE_FLG(0x0556, 0x0014, /* Phoenix Audio TMX320VC */
                   QUIRK_FLAG_GET_SAMPLE_RATE),
        DEVICE_FLG(0x05a3, 0x9420, /* ELP HD USB Camera */
index 4e93668a2a488d5c8a7d40c42a3a71f9ff0fb690..94261d19cceb88959a99dc4c3b76a6207ca6c20f 100644 (file)
@@ -161,6 +161,8 @@ extern bool snd_usb_skip_validation;
  *  Ignore errors for mixer access
  * QUIRK_FLAG_DSD_RAW:
  *  Support generic DSD raw U32_BE format
+ * QUIRK_FLAG_SET_IFACE_FIRST:
+ *  Set up the interface at first like UAC1
  */
 
 #define QUIRK_FLAG_GET_SAMPLE_RATE     (1U << 0)
@@ -179,5 +181,6 @@ extern bool snd_usb_skip_validation;
 #define QUIRK_FLAG_DISABLE_AUTOSUSPEND (1U << 13)
 #define QUIRK_FLAG_IGNORE_CTL_ERROR    (1U << 14)
 #define QUIRK_FLAG_DSD_RAW             (1U << 15)
+#define QUIRK_FLAG_SET_IFACE_FIRST     (1U << 16)
 
 #endif /* __USBAUDIO_H */