aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/clock.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-06-16 11:57:31 -0400
committerTakashi Iwai <tiwai@suse.de>2010-06-23 10:10:23 -0400
commit3d8d4dcfd423b01ef7ea7c3c97720764b7adb6df (patch)
tree4bb52394ecfe1f2bda274ab6af3dbe1be9d7bbf2 /sound/usb/clock.c
parent157a57b6fae7d3c6d24b7623dcc6679c6d244621 (diff)
ALSA: usb-audio: simplify control interface access
As the control interface is now carried in struct snd_usb_audio, we can simplify the API a little and also drop the private ctrlif field from struct usb_mixer_interface. Also remove a left-over function prototype in pcm.h. 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.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 7279d6190875..66bd1574d80b 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -121,7 +121,6 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
121} 121}
122 122
123static int __uac_clock_find_source(struct snd_usb_audio *chip, 123static int __uac_clock_find_source(struct snd_usb_audio *chip,
124 struct usb_host_interface *host_iface,
125 int entity_id, unsigned long *visited) 124 int entity_id, unsigned long *visited)
126{ 125{
127 struct uac_clock_source_descriptor *source; 126 struct uac_clock_source_descriptor *source;
@@ -138,11 +137,11 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
138 } 137 }
139 138
140 /* first, see if the ID we're looking for is a clock source already */ 139 /* first, see if the ID we're looking for is a clock source already */
141 source = snd_usb_find_clock_source(host_iface, entity_id); 140 source = snd_usb_find_clock_source(chip->ctrl_intf, entity_id);
142 if (source) 141 if (source)
143 return source->bClockID; 142 return source->bClockID;
144 143
145 selector = snd_usb_find_clock_selector(host_iface, entity_id); 144 selector = snd_usb_find_clock_selector(chip->ctrl_intf, entity_id);
146 if (selector) { 145 if (selector) {
147 int ret; 146 int ret;
148 147
@@ -162,16 +161,15 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
162 return -EINVAL; 161 return -EINVAL;
163 } 162 }
164 163
165 return __uac_clock_find_source(chip, host_iface, 164 return __uac_clock_find_source(chip, selector->baCSourceID[ret-1],
166 selector->baCSourceID[ret-1],
167 visited); 165 visited);
168 } 166 }
169 167
170 /* FIXME: multipliers only act as pass-thru element for now */ 168 /* FIXME: multipliers only act as pass-thru element for now */
171 multiplier = snd_usb_find_clock_multiplier(host_iface, entity_id); 169 multiplier = snd_usb_find_clock_multiplier(chip->ctrl_intf, entity_id);
172 if (multiplier) 170 if (multiplier)
173 return __uac_clock_find_source(chip, host_iface, 171 return __uac_clock_find_source(chip, multiplier->bCSourceID,
174 multiplier->bCSourceID, visited); 172 visited);
175 173
176 return -EINVAL; 174 return -EINVAL;
177} 175}
@@ -187,13 +185,11 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
187 * 185 *
188 * Returns the clock source UnitID (>=0) on success, or an error. 186 * Returns the clock source UnitID (>=0) on success, or an error.
189 */ 187 */
190int snd_usb_clock_find_source(struct snd_usb_audio *chip, 188int snd_usb_clock_find_source(struct snd_usb_audio *chip, int entity_id)
191 struct usb_host_interface *host_iface,
192 int entity_id)
193{ 189{
194 DECLARE_BITMAP(visited, 256); 190 DECLARE_BITMAP(visited, 256);
195 memset(visited, 0, sizeof(visited)); 191 memset(visited, 0, sizeof(visited));
196 return __uac_clock_find_source(chip, host_iface, entity_id, visited); 192 return __uac_clock_find_source(chip, entity_id, visited);
197} 193}
198 194
199static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface, 195static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
@@ -251,7 +247,7 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
251 struct usb_device *dev = chip->dev; 247 struct usb_device *dev = chip->dev;
252 unsigned char data[4]; 248 unsigned char data[4];
253 int err, crate; 249 int err, crate;
254 int clock = snd_usb_clock_find_source(chip, chip->ctrl_intf, fmt->clock); 250 int clock = snd_usb_clock_find_source(chip, fmt->clock);
255 251
256 if (clock < 0) 252 if (clock < 0)
257 return clock; 253 return clock;