diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-06-16 11:57:30 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-06-23 10:09:50 -0400 |
commit | 157a57b6fae7d3c6d24b7623dcc6679c6d244621 (patch) | |
tree | d4e803455aa7cbcab244355171be428a3b33fa47 /sound/usb/clock.c | |
parent | 21af7d8c0c0a88f6f9fc6993d73001b4caf23b08 (diff) |
ALSA: usb-audio: move and add some comments
Also add a list of open topics.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/clock.c')
-rw-r--r-- | sound/usb/clock.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/usb/clock.c b/sound/usb/clock.c index 386b09c5ce73..7279d6190875 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c | |||
@@ -120,8 +120,6 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id) | |||
120 | return !!data; | 120 | return !!data; |
121 | } | 121 | } |
122 | 122 | ||
123 | /* Try to find the clock source ID of a given clock entity */ | ||
124 | |||
125 | static int __uac_clock_find_source(struct snd_usb_audio *chip, | 123 | static int __uac_clock_find_source(struct snd_usb_audio *chip, |
126 | struct usb_host_interface *host_iface, | 124 | struct usb_host_interface *host_iface, |
127 | int entity_id, unsigned long *visited) | 125 | int entity_id, unsigned long *visited) |
@@ -154,6 +152,8 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, | |||
154 | if (ret < 0) | 152 | if (ret < 0) |
155 | return ret; | 153 | return ret; |
156 | 154 | ||
155 | /* Selector values are one-based */ | ||
156 | |||
157 | if (ret > selector->bNrInPins || ret < 1) { | 157 | if (ret > selector->bNrInPins || ret < 1) { |
158 | printk(KERN_ERR | 158 | printk(KERN_ERR |
159 | "%s(): selector reported illegal value, id %d, ret %d\n", | 159 | "%s(): selector reported illegal value, id %d, ret %d\n", |
@@ -176,6 +176,17 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, | |||
176 | return -EINVAL; | 176 | return -EINVAL; |
177 | } | 177 | } |
178 | 178 | ||
179 | /* | ||
180 | * For all kinds of sample rate settings and other device queries, | ||
181 | * the clock source (end-leaf) must be used. However, clock selectors, | ||
182 | * clock multipliers and sample rate converters may be specified as | ||
183 | * clock source input to terminal. This functions walks the clock path | ||
184 | * to its end and tries to find the source. | ||
185 | * | ||
186 | * The 'visited' bitfield is used internally to detect recursive loops. | ||
187 | * | ||
188 | * Returns the clock source UnitID (>=0) on success, or an error. | ||
189 | */ | ||
179 | int snd_usb_clock_find_source(struct snd_usb_audio *chip, | 190 | int snd_usb_clock_find_source(struct snd_usb_audio *chip, |
180 | struct usb_host_interface *host_iface, | 191 | struct usb_host_interface *host_iface, |
181 | int entity_id) | 192 | int entity_id) |
@@ -246,6 +257,7 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface, | |||
246 | return clock; | 257 | return clock; |
247 | 258 | ||
248 | if (!uac_clock_source_is_valid(chip, clock)) { | 259 | if (!uac_clock_source_is_valid(chip, clock)) { |
260 | /* TODO: should we try to find valid clock setups by ourself? */ | ||
249 | snd_printk(KERN_ERR "%d:%d:%d: clock source %d is not valid, cannot use\n", | 261 | snd_printk(KERN_ERR "%d:%d:%d: clock source %d is not valid, cannot use\n", |
250 | dev->devnum, iface, fmt->altsetting, clock); | 262 | dev->devnum, iface, fmt->altsetting, clock); |
251 | return -ENXIO; | 263 | return -ENXIO; |