]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
ALSA: usb-audio: UAC2: auto clock selection module param
authorEldad Zack <eldad@fogrefinery.com>
Wed, 3 Apr 2013 21:18:56 +0000 (23:18 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 4 Apr 2013 06:31:32 +0000 (08:31 +0200)
Add a module param to disable auto clock selection.
This is provided for users that expect the audio stream to
fail when the clock source is invalid (e.g., the word clock
was unintentionally disconnected).

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/card.c
sound/usb/clock.c
sound/usb/usbaudio.h

index 314e8a211c9a13bd7e6d5656b5379477f178bfa4..5254b18cedcd25e3c7da9ffb0b2b71351b4c9adf 100644 (file)
@@ -82,6 +82,7 @@ static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
 static int nrpacks = 8;                /* max. number of packets per urb */
 static int device_setup[SNDRV_CARDS]; /* device parameter for this card */
 static bool ignore_ctl_error;
+static bool autoclock = true;
 
 module_param_array(index, int, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for the USB audio adapter.");
@@ -100,6 +101,8 @@ MODULE_PARM_DESC(device_setup, "Specific device setup (if needed).");
 module_param(ignore_ctl_error, bool, 0444);
 MODULE_PARM_DESC(ignore_ctl_error,
                 "Ignore errors from USB controller for mixer interfaces.");
+module_param(autoclock, bool, 0444);
+MODULE_PARM_DESC(autoclock, "Enable auto-clock selection for UAC2 devices (default: yes).");
 
 /*
  * we keep the snd_usb_audio_t instances by ourselves for merging
@@ -354,6 +357,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
        chip->card = card;
        chip->setup = device_setup[idx];
        chip->nrpacks = nrpacks;
+       chip->autoclock = autoclock;
        chip->probing = 1;
 
        chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
index d7ab2d75aefd45425436d6079500effe4a3bd126..e59d359b907ccf72ca7ec0e42f11ad3a1b8ff5a3 100644 (file)
@@ -217,7 +217,7 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
                cur = ret;
                ret = __uac_clock_find_source(chip, selector->baCSourceID[ret - 1],
                                               visited, validate);
-               if (!validate || ret > 0)
+               if (!validate || ret > 0 || !chip->autoclock)
                        return ret;
 
                /* The current clock source is invalid, try others. */
index 1ac3fd9cc5a625e89cc1290ab3274ebac6982793..bc43bcaddf4d5ade6c4c32794c324c565b7ab7ff 100644 (file)
@@ -56,6 +56,7 @@ struct snd_usb_audio {
 
        int setup;                      /* from the 'device_setup' module param */
        int nrpacks;                    /* from the 'nrpacks' module param */
+       bool autoclock;                 /* from the 'autoclock' module param */
 
        struct usb_host_interface *ctrl_intf;   /* the audio control interface */
 };