ALSA: usb-audio: Add quirk bits for enabling/disabling generic implicit fb
authorTakashi Iwai <tiwai@suse.de>
Thu, 21 Apr 2022 06:41:00 +0000 (08:41 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 21 Apr 2022 08:17:17 +0000 (10:17 +0200)
For making easier to test, add the new quirk_flags bits 17 and 18 to
enable and disable the generic implicit feedback mode.  The bit 17 is
equivalent with implicit_fb=1 option, applying the generic implicit
feedback sync mode.  OTOH, the bit 18 disables the implicit fb mode
forcibly.

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

index 34888d4..21ab5e6 100644 (file)
@@ -2246,7 +2246,7 @@ implicit_fb
     Apply the generic implicit feedback sync mode.  When this is set
     and the playback stream sync mode is ASYNC, the driver tries to
     tie an adjacent ASYNC capture stream as the implicit feedback
-    source.
+    source.  This is equivalent with quirk_flags bit 17.
 use_vmalloc
     Use vmalloc() for allocations of the PCM buffers (default: yes).
     For architectures with non-coherent memory like ARM or MIPS, the
@@ -2288,6 +2288,8 @@ quirk_flags
         * 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
+        * bit 17: Apply the generic implicit feedback sync mode
+        * bit 18: Don't apply implicit feedback sync mode
 
 This module supports multiple devices, autoprobe and hotplugging.
 
index 2d444ec..1fd0871 100644 (file)
@@ -350,7 +350,8 @@ static int audioformat_implicit_fb_quirk(struct snd_usb_audio *chip,
        }
 
        /* Try the generic implicit fb if available */
-       if (chip->generic_implicit_fb)
+       if (chip->generic_implicit_fb ||
+           (chip->quirk_flags & QUIRK_FLAG_GENERIC_IMPLICIT_FB))
                return add_generic_implicit_fb(chip, fmt, alts);
 
        /* No quirk */
@@ -387,6 +388,8 @@ int snd_usb_parse_implicit_fb_quirk(struct snd_usb_audio *chip,
                                    struct audioformat *fmt,
                                    struct usb_host_interface *alts)
 {
+       if (chip->quirk_flags & QUIRK_FLAG_SKIP_IMPLICIT_FB)
+               return 0;
        if (fmt->endpoint & USB_DIR_IN)
                return audioformat_capture_quirk(chip, fmt, alts);
        else
index b8359a0..044cd7a 100644 (file)
@@ -164,6 +164,10 @@ extern bool snd_usb_skip_validation;
  *  Support generic DSD raw U32_BE format
  * QUIRK_FLAG_SET_IFACE_FIRST:
  *  Set up the interface at first like UAC1
+ * QUIRK_FLAG_GENERIC_IMPLICIT_FB
+ *  Apply the generic implicit feedback sync mode (same as implicit_fb=1 option)
+ * QUIRK_FLAG_SKIP_IMPLICIT_FB
+ *  Don't apply implicit feedback sync mode
  */
 
 #define QUIRK_FLAG_GET_SAMPLE_RATE     (1U << 0)
@@ -183,5 +187,7 @@ extern bool snd_usb_skip_validation;
 #define QUIRK_FLAG_IGNORE_CTL_ERROR    (1U << 14)
 #define QUIRK_FLAG_DSD_RAW             (1U << 15)
 #define QUIRK_FLAG_SET_IFACE_FIRST     (1U << 16)
+#define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17)
+#define QUIRK_FLAG_SKIP_IMPLICIT_FB    (1U << 18)
 
 #endif /* __USBAUDIO_H */