aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorEldad Zack <eldad@fogrefinery.com>2013-04-03 17:18:56 -0400
committerTakashi Iwai <tiwai@suse.de>2013-04-04 02:31:32 -0400
commitef02e29b0180ddbcc1ecf3c362e333c572f27c08 (patch)
tree2c645903e9fbff3996c5e32cb8993a86d9a6b0b4 /sound/usb
parent8c55af3f69be6021631628b968cad301d3f294c8 (diff)
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>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/card.c4
-rw-r--r--sound/usb/clock.c2
-rw-r--r--sound/usb/usbaudio.h1
3 files changed, 6 insertions, 1 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 314e8a211c9a..5254b18cedcd 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -82,6 +82,7 @@ static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
82static int nrpacks = 8; /* max. number of packets per urb */ 82static int nrpacks = 8; /* max. number of packets per urb */
83static int device_setup[SNDRV_CARDS]; /* device parameter for this card */ 83static int device_setup[SNDRV_CARDS]; /* device parameter for this card */
84static bool ignore_ctl_error; 84static bool ignore_ctl_error;
85static bool autoclock = true;
85 86
86module_param_array(index, int, NULL, 0444); 87module_param_array(index, int, NULL, 0444);
87MODULE_PARM_DESC(index, "Index value for the USB audio adapter."); 88MODULE_PARM_DESC(index, "Index value for the USB audio adapter.");
@@ -100,6 +101,8 @@ MODULE_PARM_DESC(device_setup, "Specific device setup (if needed).");
100module_param(ignore_ctl_error, bool, 0444); 101module_param(ignore_ctl_error, bool, 0444);
101MODULE_PARM_DESC(ignore_ctl_error, 102MODULE_PARM_DESC(ignore_ctl_error,
102 "Ignore errors from USB controller for mixer interfaces."); 103 "Ignore errors from USB controller for mixer interfaces.");
104module_param(autoclock, bool, 0444);
105MODULE_PARM_DESC(autoclock, "Enable auto-clock selection for UAC2 devices (default: yes).");
103 106
104/* 107/*
105 * we keep the snd_usb_audio_t instances by ourselves for merging 108 * 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,
354 chip->card = card; 357 chip->card = card;
355 chip->setup = device_setup[idx]; 358 chip->setup = device_setup[idx];
356 chip->nrpacks = nrpacks; 359 chip->nrpacks = nrpacks;
360 chip->autoclock = autoclock;
357 chip->probing = 1; 361 chip->probing = 1;
358 362
359 chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), 363 chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index d7ab2d75aefd..e59d359b907c 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -217,7 +217,7 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
217 cur = ret; 217 cur = ret;
218 ret = __uac_clock_find_source(chip, selector->baCSourceID[ret - 1], 218 ret = __uac_clock_find_source(chip, selector->baCSourceID[ret - 1],
219 visited, validate); 219 visited, validate);
220 if (!validate || ret > 0) 220 if (!validate || ret > 0 || !chip->autoclock)
221 return ret; 221 return ret;
222 222
223 /* The current clock source is invalid, try others. */ 223 /* The current clock source is invalid, try others. */
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 1ac3fd9cc5a6..bc43bcaddf4d 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -56,6 +56,7 @@ struct snd_usb_audio {
56 56
57 int setup; /* from the 'device_setup' module param */ 57 int setup; /* from the 'device_setup' module param */
58 int nrpacks; /* from the 'nrpacks' module param */ 58 int nrpacks; /* from the 'nrpacks' module param */
59 bool autoclock; /* from the 'autoclock' module param */
59 60
60 struct usb_host_interface *ctrl_intf; /* the audio control interface */ 61 struct usb_host_interface *ctrl_intf; /* the audio control interface */
61}; 62};