ALSA: usb-audio: Add implicit_fb module option
authorTakashi Iwai <tiwai@suse.de>
Mon, 23 Nov 2020 08:53:45 +0000 (09:53 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 23 Nov 2020 14:17:24 +0000 (15:17 +0100)
A new module option, implicit_fb, is added to specify the driver
looking for the implicit feedback sync.  This can be useful for a
device that could be working better in the implicit feed back mode and
user wants to test it quickly.  When this works, we can add the quirk
entry easily.

Tested-by: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-40-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Documentation/sound/alsa-configuration.rst
sound/usb/card.c
sound/usb/implicit.c
sound/usb/usbaudio.h

index c755b1c5e16f27287fd3884ca0553e3a39104a6a..fe52c314b76391a4f5fc071c65ff98e92f0432cd 100644 (file)
@@ -2227,6 +2227,11 @@ quirk_alias
     Quirk alias list, pass strings like ``0123abcd:5678beef``, which
     applies the existing quirk for the device 5678:beef to a new
     device 0123:abcd.
+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.
 use_vmalloc
     Use vmalloc() for allocations of the PCM buffers (default: yes).
     For architectures with non-coherent memory like ARM or MIPS, the
index 7940b3bff5bcaf7c51bdf1f6ddaa8085b26a55e2..cb0b6582dfee95548b0a48af136350177f8614c4 100644 (file)
@@ -72,6 +72,7 @@ static bool ignore_ctl_error;
 static bool autoclock = true;
 static char *quirk_alias[SNDRV_CARDS];
 static char *delayed_register[SNDRV_CARDS];
+static bool implicit_fb[SNDRV_CARDS];
 
 bool snd_usb_use_vmalloc = true;
 bool snd_usb_skip_validation;
@@ -97,6 +98,8 @@ module_param_array(quirk_alias, charp, NULL, 0444);
 MODULE_PARM_DESC(quirk_alias, "Quirk aliases, e.g. 0123abcd:5678beef.");
 module_param_array(delayed_register, charp, NULL, 0444);
 MODULE_PARM_DESC(delayed_register, "Quirk for delayed registration, given by id:iface, e.g. 0123abcd:4.");
+module_param_array(implicit_fb, bool, NULL, 0444);
+MODULE_PARM_DESC(implicit_fb, "Apply generic implicit feedback sync mode.");
 module_param_named(use_vmalloc, snd_usb_use_vmalloc, bool, 0444);
 MODULE_PARM_DESC(use_vmalloc, "Use vmalloc for PCM intermediate buffers (default: yes).");
 module_param_named(skip_validation, snd_usb_skip_validation, bool, 0444);
@@ -596,6 +599,7 @@ static int snd_usb_audio_create(struct usb_interface *intf,
        chip->dev = dev;
        chip->card = card;
        chip->setup = device_setup[idx];
+       chip->generic_implicit_fb = implicit_fb[idx];
        chip->autoclock = autoclock;
        atomic_set(&chip->active, 1); /* avoid autopm during probing */
        atomic_set(&chip->usage_count, 0);
index 16b1fb55b7b9fadaf960dc09d0785209fab24feb..1d87fcdae95bca8a5ecf0d345ddea0b6e11fc409 100644 (file)
@@ -269,6 +269,10 @@ static int audioformat_implicit_fb_quirk(struct snd_usb_audio *chip,
                        return 1;
        }
 
+       /* Try the generic implicit fb if available */
+       if (chip->generic_implicit_fb)
+               return add_generic_implicit_fb(chip, fmt, alts);
+
        /* No quirk */
        return 0;
 }
index cc338e8e25975b3e2a5662239e5abd80f0e8d1d8..980287aadd361b4b48f3aaa63faa6e05495805e0 100644 (file)
@@ -51,6 +51,7 @@ struct snd_usb_audio {
        struct list_head mixer_list;    /* list of mixer interfaces */
 
        int setup;                      /* from the 'device_setup' module param */
+       bool generic_implicit_fb;       /* from the 'implicit_fb' module param */
        bool autoclock;                 /* from the 'autoclock' module param */
 
        struct usb_host_interface *ctrl_intf;   /* the audio control interface */