aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/caiaq/caiaq-control.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/caiaq/caiaq-control.c')
-rw-r--r--sound/usb/caiaq/caiaq-control.c73
1 files changed, 30 insertions, 43 deletions
diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c
index 798ca124da58..ccd763dd7167 100644
--- a/sound/usb/caiaq/caiaq-control.c
+++ b/sound/usb/caiaq/caiaq-control.c
@@ -247,69 +247,56 @@ static struct caiaq_controller a8dj_controller[] = {
247 { "Software lock", 40 } 247 { "Software lock", 40 }
248}; 248};
249 249
250int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev) 250static int __devinit add_controls(struct caiaq_controller *c, int num,
251 struct snd_usb_caiaqdev *dev)
251{ 252{
252 int i; 253 int i, ret;
253 struct snd_kcontrol *kc; 254 struct snd_kcontrol *kc;
254 255
256 for (i = 0; i < num; i++, c++) {
257 kcontrol_template.name = c->name;
258 kcontrol_template.private_value = c->index;
259 kc = snd_ctl_new1(&kcontrol_template, dev);
260 ret = snd_ctl_add(dev->chip.card, kc);
261 if (ret < 0)
262 return ret;
263 }
264
265 return 0;
266}
267
268int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev)
269{
270 int ret = 0;
271
255 switch (dev->chip.usb_id) { 272 switch (dev->chip.usb_id) {
256 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): 273 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1):
257 for (i = 0; i < ARRAY_SIZE(ak1_controller); i++) { 274 ret = add_controls(ak1_controller,
258 struct caiaq_controller *c = ak1_controller + i; 275 ARRAY_SIZE(ak1_controller), dev);
259 kcontrol_template.name = c->name;
260 kcontrol_template.private_value = c->index;
261 kc = snd_ctl_new1(&kcontrol_template, dev);
262 snd_ctl_add(dev->chip.card, kc);
263 }
264
265 break; 276 break;
266 277
267 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): 278 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2):
268 for (i = 0; i < ARRAY_SIZE(rk2_controller); i++) { 279 ret = add_controls(rk2_controller,
269 struct caiaq_controller *c = rk2_controller + i; 280 ARRAY_SIZE(rk2_controller), dev);
270 kcontrol_template.name = c->name;
271 kcontrol_template.private_value = c->index;
272 kc = snd_ctl_new1(&kcontrol_template, dev);
273 snd_ctl_add(dev->chip.card, kc);
274 }
275
276 break; 281 break;
277 282
278 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): 283 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3):
279 for (i = 0; i < ARRAY_SIZE(rk3_controller); i++) { 284 ret = add_controls(rk3_controller,
280 struct caiaq_controller *c = rk3_controller + i; 285 ARRAY_SIZE(rk3_controller), dev);
281 kcontrol_template.name = c->name;
282 kcontrol_template.private_value = c->index;
283 kc = snd_ctl_new1(&kcontrol_template, dev);
284 snd_ctl_add(dev->chip.card, kc);
285 }
286
287 break; 286 break;
288 287
289 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): 288 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER):
290 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): 289 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2):
291 for (i = 0; i < ARRAY_SIZE(kore_controller); i++) { 290 ret = add_controls(kore_controller,
292 struct caiaq_controller *c = kore_controller + i; 291 ARRAY_SIZE(kore_controller), dev);
293 kcontrol_template.name = c->name;
294 kcontrol_template.private_value = c->index;
295 kc = snd_ctl_new1(&kcontrol_template, dev);
296 snd_ctl_add(dev->chip.card, kc);
297 }
298
299 break; 292 break;
300 293
301 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): 294 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ):
302 for (i = 0; i < ARRAY_SIZE(a8dj_controller); i++) { 295 ret = add_controls(a8dj_controller,
303 struct caiaq_controller *c = a8dj_controller + i; 296 ARRAY_SIZE(a8dj_controller), dev);
304 kcontrol_template.name = c->name;
305 kcontrol_template.private_value = c->index;
306 kc = snd_ctl_new1(&kcontrol_template, dev);
307 snd_ctl_add(dev->chip.card, kc);
308 }
309
310 break; 297 break;
311 } 298 }
312 299
313 return 0; 300 return ret;
314} 301}
315 302