diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-03-23 19:36:23 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-03-23 19:36:23 -0400 |
commit | c441c2971de52b7045acb708cc9959815f554f66 (patch) | |
tree | 909be321dd72292c3fcd6479077aaa2c99ae54c4 /sound | |
parent | afad17c0ae21013f958c39594e8a64d120a611f8 (diff) | |
parent | 28514fe5bbbdbc0f7c9700569378d55cafd061ea (diff) |
Merge branch 'topic/usb-caiaq' into for-linus
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/Kconfig | 3 | ||||
-rw-r--r-- | sound/usb/caiaq/caiaq-audio.c | 15 | ||||
-rw-r--r-- | sound/usb/caiaq/caiaq-control.c | 42 | ||||
-rw-r--r-- | sound/usb/caiaq/caiaq-device.c | 24 | ||||
-rw-r--r-- | sound/usb/caiaq/caiaq-device.h | 6 |
5 files changed, 79 insertions, 11 deletions
diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig index 4f0eac9bff1e..523aec188ccf 100644 --- a/sound/usb/Kconfig +++ b/sound/usb/Kconfig | |||
@@ -48,7 +48,10 @@ config SND_USB_CAIAQ | |||
48 | * Native Instruments Kore Controller | 48 | * Native Instruments Kore Controller |
49 | * Native Instruments Kore Controller 2 | 49 | * Native Instruments Kore Controller 2 |
50 | * Native Instruments Audio Kontrol 1 | 50 | * Native Instruments Audio Kontrol 1 |
51 | * Native Instruments Audio 4 DJ | ||
51 | * Native Instruments Audio 8 DJ | 52 | * Native Instruments Audio 8 DJ |
53 | * Native Instruments Guitar Rig Session I/O | ||
54 | * Native Instruments Guitar Rig mobile | ||
52 | 55 | ||
53 | To compile this driver as a module, choose M here: the module | 56 | To compile this driver as a module, choose M here: the module |
54 | will be called snd-usb-caiaq. | 57 | will be called snd-usb-caiaq. |
diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index b3a603325835..08d51e0c9fea 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/caiaq-audio.c | |||
@@ -114,6 +114,7 @@ static int stream_start(struct snd_usb_caiaqdev *dev) | |||
114 | dev->output_panic = 0; | 114 | dev->output_panic = 0; |
115 | dev->first_packet = 1; | 115 | dev->first_packet = 1; |
116 | dev->streaming = 1; | 116 | dev->streaming = 1; |
117 | dev->warned = 0; | ||
117 | 118 | ||
118 | for (i = 0; i < N_URBS; i++) { | 119 | for (i = 0; i < N_URBS; i++) { |
119 | ret = usb_submit_urb(dev->data_urbs_in[i], GFP_ATOMIC); | 120 | ret = usb_submit_urb(dev->data_urbs_in[i], GFP_ATOMIC); |
@@ -376,6 +377,9 @@ static void read_in_urb_mode2(struct snd_usb_caiaqdev *dev, | |||
376 | 377 | ||
377 | for (stream = 0; stream < dev->n_streams; stream++, i++) { | 378 | for (stream = 0; stream < dev->n_streams; stream++, i++) { |
378 | sub = dev->sub_capture[stream]; | 379 | sub = dev->sub_capture[stream]; |
380 | if (dev->input_panic) | ||
381 | usb_buf[i] = 0; | ||
382 | |||
379 | if (sub) { | 383 | if (sub) { |
380 | struct snd_pcm_runtime *rt = sub->runtime; | 384 | struct snd_pcm_runtime *rt = sub->runtime; |
381 | char *audio_buf = rt->dma_area; | 385 | char *audio_buf = rt->dma_area; |
@@ -397,6 +401,9 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev, | |||
397 | if (!dev->streaming) | 401 | if (!dev->streaming) |
398 | return; | 402 | return; |
399 | 403 | ||
404 | if (iso->actual_length < dev->bpp) | ||
405 | return; | ||
406 | |||
400 | switch (dev->spec.data_alignment) { | 407 | switch (dev->spec.data_alignment) { |
401 | case 0: | 408 | case 0: |
402 | read_in_urb_mode0(dev, urb, iso); | 409 | read_in_urb_mode0(dev, urb, iso); |
@@ -406,10 +413,11 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev, | |||
406 | break; | 413 | break; |
407 | } | 414 | } |
408 | 415 | ||
409 | if (dev->input_panic || dev->output_panic) { | 416 | if ((dev->input_panic || dev->output_panic) && !dev->warned) { |
410 | debug("streaming error detected %s %s\n", | 417 | debug("streaming error detected %s %s\n", |
411 | dev->input_panic ? "(input)" : "", | 418 | dev->input_panic ? "(input)" : "", |
412 | dev->output_panic ? "(output)" : ""); | 419 | dev->output_panic ? "(output)" : ""); |
420 | dev->warned = 1; | ||
413 | } | 421 | } |
414 | } | 422 | } |
415 | 423 | ||
@@ -638,9 +646,10 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev) | |||
638 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): | 646 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): |
639 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): | 647 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): |
640 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_SESSIONIO): | 648 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_SESSIONIO): |
641 | dev->samplerates |= SNDRV_PCM_RATE_88200; | 649 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_GUITARRIGMOBILE): |
642 | dev->samplerates |= SNDRV_PCM_RATE_192000; | 650 | dev->samplerates |= SNDRV_PCM_RATE_192000; |
643 | break; | 651 | /* fall thru */ |
652 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): | ||
644 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): | 653 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): |
645 | dev->samplerates |= SNDRV_PCM_RATE_88200; | 654 | dev->samplerates |= SNDRV_PCM_RATE_88200; |
646 | break; | 655 | break; |
diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index ccd763dd7167..e92c2bbf4fe9 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c | |||
@@ -39,12 +39,12 @@ static int control_info(struct snd_kcontrol *kcontrol, | |||
39 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); | 39 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); |
40 | int pos = kcontrol->private_value; | 40 | int pos = kcontrol->private_value; |
41 | int is_intval = pos & CNT_INTVAL; | 41 | int is_intval = pos & CNT_INTVAL; |
42 | unsigned int id = dev->chip.usb_id; | ||
42 | 43 | ||
43 | uinfo->count = 1; | 44 | uinfo->count = 1; |
44 | pos &= ~CNT_INTVAL; | 45 | pos &= ~CNT_INTVAL; |
45 | 46 | ||
46 | if (dev->chip.usb_id == | 47 | if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ) |
47 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ) | ||
48 | && (pos == 0)) { | 48 | && (pos == 0)) { |
49 | /* current input mode of A8DJ */ | 49 | /* current input mode of A8DJ */ |
50 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 50 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
@@ -53,6 +53,15 @@ static int control_info(struct snd_kcontrol *kcontrol, | |||
53 | return 0; | 53 | return 0; |
54 | } | 54 | } |
55 | 55 | ||
56 | if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ) | ||
57 | && (pos == 0)) { | ||
58 | /* current input mode of A4DJ */ | ||
59 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
60 | uinfo->value.integer.min = 0; | ||
61 | uinfo->value.integer.max = 1; | ||
62 | return 0; | ||
63 | } | ||
64 | |||
56 | if (is_intval) { | 65 | if (is_intval) { |
57 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 66 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
58 | uinfo->value.integer.min = 0; | 67 | uinfo->value.integer.min = 0; |
@@ -73,6 +82,14 @@ static int control_get(struct snd_kcontrol *kcontrol, | |||
73 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); | 82 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); |
74 | int pos = kcontrol->private_value; | 83 | int pos = kcontrol->private_value; |
75 | 84 | ||
85 | if (dev->chip.usb_id == | ||
86 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { | ||
87 | /* A4DJ has only one control */ | ||
88 | /* do not expose hardware input mode 0 */ | ||
89 | ucontrol->value.integer.value[0] = dev->control_state[0] - 1; | ||
90 | return 0; | ||
91 | } | ||
92 | |||
76 | if (pos & CNT_INTVAL) | 93 | if (pos & CNT_INTVAL) |
77 | ucontrol->value.integer.value[0] | 94 | ucontrol->value.integer.value[0] |
78 | = dev->control_state[pos & ~CNT_INTVAL]; | 95 | = dev->control_state[pos & ~CNT_INTVAL]; |
@@ -90,10 +107,20 @@ static int control_put(struct snd_kcontrol *kcontrol, | |||
90 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); | 107 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); |
91 | int pos = kcontrol->private_value; | 108 | int pos = kcontrol->private_value; |
92 | 109 | ||
110 | if (dev->chip.usb_id == | ||
111 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { | ||
112 | /* A4DJ has only one control */ | ||
113 | /* do not expose hardware input mode 0 */ | ||
114 | dev->control_state[0] = ucontrol->value.integer.value[0] + 1; | ||
115 | snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, | ||
116 | dev->control_state, sizeof(dev->control_state)); | ||
117 | return 1; | ||
118 | } | ||
119 | |||
93 | if (pos & CNT_INTVAL) { | 120 | if (pos & CNT_INTVAL) { |
94 | dev->control_state[pos & ~CNT_INTVAL] | 121 | dev->control_state[pos & ~CNT_INTVAL] |
95 | = ucontrol->value.integer.value[0]; | 122 | = ucontrol->value.integer.value[0]; |
96 | snd_usb_caiaq_send_command(dev, EP1_CMD_DIMM_LEDS, | 123 | snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, |
97 | dev->control_state, sizeof(dev->control_state)); | 124 | dev->control_state, sizeof(dev->control_state)); |
98 | } else { | 125 | } else { |
99 | if (ucontrol->value.integer.value[0]) | 126 | if (ucontrol->value.integer.value[0]) |
@@ -243,10 +270,13 @@ static struct caiaq_controller a8dj_controller[] = { | |||
243 | { "GND lift for TC Vinyl mode", 24 + 0 }, | 270 | { "GND lift for TC Vinyl mode", 24 + 0 }, |
244 | { "GND lift for TC CD/Line mode", 24 + 1 }, | 271 | { "GND lift for TC CD/Line mode", 24 + 1 }, |
245 | { "GND lift for phono mode", 24 + 2 }, | 272 | { "GND lift for phono mode", 24 + 2 }, |
246 | { "GND lift for TC Vinyl mode", 24 + 3 }, | ||
247 | { "Software lock", 40 } | 273 | { "Software lock", 40 } |
248 | }; | 274 | }; |
249 | 275 | ||
276 | static struct caiaq_controller a4dj_controller[] = { | ||
277 | { "Current input mode", 0 | CNT_INTVAL } | ||
278 | }; | ||
279 | |||
250 | static int __devinit add_controls(struct caiaq_controller *c, int num, | 280 | static int __devinit add_controls(struct caiaq_controller *c, int num, |
251 | struct snd_usb_caiaqdev *dev) | 281 | struct snd_usb_caiaqdev *dev) |
252 | { | 282 | { |
@@ -295,6 +325,10 @@ int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev) | |||
295 | ret = add_controls(a8dj_controller, | 325 | ret = add_controls(a8dj_controller, |
296 | ARRAY_SIZE(a8dj_controller), dev); | 326 | ARRAY_SIZE(a8dj_controller), dev); |
297 | break; | 327 | break; |
328 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): | ||
329 | ret = add_controls(a4dj_controller, | ||
330 | ARRAY_SIZE(a4dj_controller), dev); | ||
331 | break; | ||
298 | } | 332 | } |
299 | 333 | ||
300 | return ret; | 334 | return ret; |
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 09aed2363cc9..cf573a982fdc 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c | |||
@@ -42,15 +42,17 @@ | |||
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); | 44 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); |
45 | MODULE_DESCRIPTION("caiaq USB audio, version 1.3.10"); | 45 | MODULE_DESCRIPTION("caiaq USB audio, version 1.3.13"); |
46 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
47 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," | 47 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," |
48 | "{Native Instruments, RigKontrol3}," | 48 | "{Native Instruments, RigKontrol3}," |
49 | "{Native Instruments, Kore Controller}," | 49 | "{Native Instruments, Kore Controller}," |
50 | "{Native Instruments, Kore Controller 2}," | 50 | "{Native Instruments, Kore Controller 2}," |
51 | "{Native Instruments, Audio Kontrol 1}," | 51 | "{Native Instruments, Audio Kontrol 1}," |
52 | "{Native Instruments, Audio 4 DJ}," | ||
52 | "{Native Instruments, Audio 8 DJ}," | 53 | "{Native Instruments, Audio 8 DJ}," |
53 | "{Native Instruments, Session I/O}}"); | 54 | "{Native Instruments, Session I/O}," |
55 | "{Native Instruments, GuitarRig mobile}"); | ||
54 | 56 | ||
55 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ | 57 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ |
56 | static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ | 58 | static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ |
@@ -116,6 +118,16 @@ static struct usb_device_id snd_usb_id_table[] = { | |||
116 | .idVendor = USB_VID_NATIVEINSTRUMENTS, | 118 | .idVendor = USB_VID_NATIVEINSTRUMENTS, |
117 | .idProduct = USB_PID_SESSIONIO | 119 | .idProduct = USB_PID_SESSIONIO |
118 | }, | 120 | }, |
121 | { | ||
122 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, | ||
123 | .idVendor = USB_VID_NATIVEINSTRUMENTS, | ||
124 | .idProduct = USB_PID_GUITARRIGMOBILE | ||
125 | }, | ||
126 | { | ||
127 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, | ||
128 | .idVendor = USB_VID_NATIVEINSTRUMENTS, | ||
129 | .idProduct = USB_PID_AUDIO4DJ | ||
130 | }, | ||
119 | { /* terminator */ } | 131 | { /* terminator */ } |
120 | }; | 132 | }; |
121 | 133 | ||
@@ -239,6 +251,8 @@ int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, | |||
239 | 251 | ||
240 | if (dev->audio_parm_answer != 1) | 252 | if (dev->audio_parm_answer != 1) |
241 | debug("unable to set the device's audio params\n"); | 253 | debug("unable to set the device's audio params\n"); |
254 | else | ||
255 | dev->bpp = bpp; | ||
242 | 256 | ||
243 | return dev->audio_parm_answer == 1 ? 0 : -EINVAL; | 257 | return dev->audio_parm_answer == 1 ? 0 : -EINVAL; |
244 | } | 258 | } |
@@ -300,6 +314,12 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev) | |||
300 | } | 314 | } |
301 | 315 | ||
302 | break; | 316 | break; |
317 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): | ||
318 | /* Audio 4 DJ - default input mode to phono */ | ||
319 | dev->control_state[0] = 2; | ||
320 | snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, | ||
321 | dev->control_state, 1); | ||
322 | break; | ||
303 | } | 323 | } |
304 | 324 | ||
305 | if (dev->spec.num_analog_audio_out + | 325 | if (dev->spec.num_analog_audio_out + |
diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h index ab56e738c5fc..4cce1ad7493d 100644 --- a/sound/usb/caiaq/caiaq-device.h +++ b/sound/usb/caiaq/caiaq-device.h | |||
@@ -10,8 +10,10 @@ | |||
10 | #define USB_PID_KORECONTROLLER 0x4711 | 10 | #define USB_PID_KORECONTROLLER 0x4711 |
11 | #define USB_PID_KORECONTROLLER2 0x4712 | 11 | #define USB_PID_KORECONTROLLER2 0x4712 |
12 | #define USB_PID_AK1 0x0815 | 12 | #define USB_PID_AK1 0x0815 |
13 | #define USB_PID_AUDIO4DJ 0x0839 | ||
13 | #define USB_PID_AUDIO8DJ 0x1978 | 14 | #define USB_PID_AUDIO8DJ 0x1978 |
14 | #define USB_PID_SESSIONIO 0x1915 | 15 | #define USB_PID_SESSIONIO 0x1915 |
16 | #define USB_PID_GUITARRIGMOBILE 0x0d8d | ||
15 | 17 | ||
16 | #define EP1_BUFSIZE 64 | 18 | #define EP1_BUFSIZE 64 |
17 | #define CAIAQ_USB_STR_LEN 0xff | 19 | #define CAIAQ_USB_STR_LEN 0xff |
@@ -87,9 +89,9 @@ struct snd_usb_caiaqdev { | |||
87 | int audio_out_buf_pos[MAX_STREAMS]; | 89 | int audio_out_buf_pos[MAX_STREAMS]; |
88 | int period_in_count[MAX_STREAMS]; | 90 | int period_in_count[MAX_STREAMS]; |
89 | int period_out_count[MAX_STREAMS]; | 91 | int period_out_count[MAX_STREAMS]; |
90 | int input_panic, output_panic; | 92 | int input_panic, output_panic, warned; |
91 | char *audio_in_buf, *audio_out_buf; | 93 | char *audio_in_buf, *audio_out_buf; |
92 | unsigned int samplerates; | 94 | unsigned int samplerates, bpp; |
93 | 95 | ||
94 | struct snd_pcm_substream *sub_playback[MAX_STREAMS]; | 96 | struct snd_pcm_substream *sub_playback[MAX_STREAMS]; |
95 | struct snd_pcm_substream *sub_capture[MAX_STREAMS]; | 97 | struct snd_pcm_substream *sub_capture[MAX_STREAMS]; |