Skip to content

Commit ef02e29

Browse files
eldadtiwai
authored andcommitted
ALSA: usb-audio: UAC2: auto clock selection module param
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>
1 parent 8c55af3 commit ef02e29

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎sound/usb/card.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
8282
static int nrpacks = 8; /* max. number of packets per urb */
8383
static int device_setup[SNDRV_CARDS]; /* device parameter for this card */
8484
static bool ignore_ctl_error;
85+
static bool autoclock = true;
8586

8687
module_param_array(index, int, NULL, 0444);
8788
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).");
100101
module_param(ignore_ctl_error, bool, 0444);
101102
MODULE_PARM_DESC(ignore_ctl_error,
102103
"Ignore errors from USB controller for mixer interfaces.");
104+
module_param(autoclock, bool, 0444);
105+
MODULE_PARM_DESC(autoclock, "Enable auto-clock selection for UAC2 devices (default: yes).");
103106

104107
/*
105108
* 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,
354357
chip->card = card;
355358
chip->setup = device_setup[idx];
356359
chip->nrpacks = nrpacks;
360+
chip->autoclock = autoclock;
357361
chip->probing = 1;
358362

359363
chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),

‎sound/usb/clock.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
217217
cur = ret;
218218
ret = __uac_clock_find_source(chip, selector->baCSourceID[ret - 1],
219219
visited, validate);
220-
if (!validate || ret > 0)
220+
if (!validate || ret > 0 || !chip->autoclock)
221221
return ret;
222222

223223
/* The current clock source is invalid, try others. */

‎sound/usb/usbaudio.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct snd_usb_audio {
5656

5757
int setup; /* from the 'device_setup' module param */
5858
int nrpacks; /* from the 'nrpacks' module param */
59+
bool autoclock; /* from the 'autoclock' module param */
5960

6061
struct usb_host_interface *ctrl_intf; /* the audio control interface */
6162
};

0 commit comments

Comments
 (0)