From 2165592b837e086f2b94835a2d81e6f3199c1319 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Fri, 16 Jan 2009 11:03:19 +0100 Subject: ALSA: snd-usb-caiaq: support for two more audio devices - Added support for two new audio devices from Native Instuments, 'Audio4DJ' and 'GuitarRig mobile' - Add missing statement about 'Session IO' in Kconfig help text - Version number bumped to 1.3.11 Signed-off-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/Kconfig | 3 +++ sound/usb/caiaq/caiaq-audio.c | 5 +++-- sound/usb/caiaq/caiaq-control.c | 15 ++++++++++++--- sound/usb/caiaq/caiaq-device.c | 16 ++++++++++++++-- sound/usb/caiaq/caiaq-device.h | 2 ++ 5 files changed, 34 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig index 4f0eac9bff1..523aec188cc 100644 --- a/sound/usb/Kconfig +++ b/sound/usb/Kconfig @@ -48,7 +48,10 @@ config SND_USB_CAIAQ * Native Instruments Kore Controller * Native Instruments Kore Controller 2 * Native Instruments Audio Kontrol 1 + * Native Instruments Audio 4 DJ * Native Instruments Audio 8 DJ + * Native Instruments Guitar Rig Session I/O + * Native Instruments Guitar Rig mobile To compile this driver as a module, choose M here: the module will be called snd-usb-caiaq. diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index b3a60332583..fc6d571eeac 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/caiaq-audio.c @@ -638,9 +638,10 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev) case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_SESSIONIO): - dev->samplerates |= SNDRV_PCM_RATE_88200; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_GUITARRIGMOBILE): dev->samplerates |= SNDRV_PCM_RATE_192000; - break; + /* fall thru */ + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): dev->samplerates |= SNDRV_PCM_RATE_88200; break; diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index ccd763dd716..6ac5489a0f2 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c @@ -39,14 +39,15 @@ static int control_info(struct snd_kcontrol *kcontrol, struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); int pos = kcontrol->private_value; int is_intval = pos & CNT_INTVAL; + unsigned int id = dev->chip.usb_id; uinfo->count = 1; pos &= ~CNT_INTVAL; - if (dev->chip.usb_id == - USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ) + if (((id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)) || + (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ))) && (pos == 0)) { - /* current input mode of A8DJ */ + /* current input mode of A8DJ and A4DJ */ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->value.integer.min = 0; uinfo->value.integer.max = 2; @@ -247,6 +248,10 @@ static struct caiaq_controller a8dj_controller[] = { { "Software lock", 40 } }; +static struct caiaq_controller a4dj_controller[] = { + { "Current input mode", 0 | CNT_INTVAL } +}; + static int __devinit add_controls(struct caiaq_controller *c, int num, struct snd_usb_caiaqdev *dev) { @@ -295,6 +300,10 @@ int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev) ret = add_controls(a8dj_controller, ARRAY_SIZE(a8dj_controller), dev); break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): + ret = add_controls(a4dj_controller, + ARRAY_SIZE(a4dj_controller), dev); + break; } return ret; diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 41c36b055f6..d09fc2a88cf 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -42,15 +42,17 @@ #endif MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.10"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.11"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," "{Native Instruments, Kore Controller}," "{Native Instruments, Kore Controller 2}," "{Native Instruments, Audio Kontrol 1}," + "{Native Instruments, Audio 4 DJ}," "{Native Instruments, Audio 8 DJ}," - "{Native Instruments, Session I/O}}"); + "{Native Instruments, Session I/O}," + "{Native Instruments, GuitarRig mobile}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 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[] = { .idVendor = USB_VID_NATIVEINSTRUMENTS, .idProduct = USB_PID_SESSIONIO }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_GUITARRIGMOBILE + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_AUDIO4DJ + }, { /* terminator */ } }; diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h index ab56e738c5f..0560c327d99 100644 --- a/sound/usb/caiaq/caiaq-device.h +++ b/sound/usb/caiaq/caiaq-device.h @@ -10,8 +10,10 @@ #define USB_PID_KORECONTROLLER 0x4711 #define USB_PID_KORECONTROLLER2 0x4712 #define USB_PID_AK1 0x0815 +#define USB_PID_AUDIO4DJ 0x0839 #define USB_PID_AUDIO8DJ 0x1978 #define USB_PID_SESSIONIO 0x1915 +#define USB_PID_GUITARRIGMOBILE 0x0d8d #define EP1_BUFSIZE 64 #define CAIAQ_USB_STR_LEN 0xff -- cgit v1.2.3 From 705350f8bd6b44fda3f0dcc3e6f4b453da4378dd Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Wed, 4 Feb 2009 22:34:30 +0000 Subject: ALSA: snd-usb-caiaq: Send the correct command when setting controls Fixes a bug where an incorrect command was sent which had no effect on the device. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index 6ac5489a0f2..1f9531d0fce 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c @@ -94,7 +94,7 @@ static int control_put(struct snd_kcontrol *kcontrol, if (pos & CNT_INTVAL) { dev->control_state[pos & ~CNT_INTVAL] = ucontrol->value.integer.value[0]; - snd_usb_caiaq_send_command(dev, EP1_CMD_DIMM_LEDS, + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, dev->control_state, sizeof(dev->control_state)); } else { if (ucontrol->value.integer.value[0]) -- cgit v1.2.3 From e3ca4c9982e3b84da859ca20a3ca0a9d5bda8c30 Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Wed, 4 Feb 2009 22:34:31 +0000 Subject: ALSA: snd-usb-caiaq: Set default input mode of A4DJ Do not start the device with input mode undefined. Mimic the behaviour of the Audio 8 DJ and start in phono input mode. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-device.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index d09fc2a88cf..94610dda8ab 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -312,6 +312,12 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev) } break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): + /* Audio 4 DJ - default input mode to phono */ + dev->control_state[0] = 2; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, + dev->control_state, 1); + break; } if (dev->spec.num_analog_audio_out + -- cgit v1.2.3 From 9a9527ed49f45e75a5b005592a261ab2bd7c1b1d Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Wed, 4 Feb 2009 22:34:32 +0000 Subject: ALSA: snd-usb-caiaq: Do not expose hardware input mode 0 of A4DJ In the context of the Audio 4 DJ (when compared to Audio 8 DJ), hardware input mode 0 is not used. Expose modes 1 (line) and 2 (phono) to the user as modes 0 and 1 respectively. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-control.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index 1f9531d0fce..136ef34300d 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c @@ -44,16 +44,24 @@ static int control_info(struct snd_kcontrol *kcontrol, uinfo->count = 1; pos &= ~CNT_INTVAL; - if (((id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)) || - (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ))) + if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ) && (pos == 0)) { - /* current input mode of A8DJ and A4DJ */ + /* current input mode of A8DJ */ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->value.integer.min = 0; uinfo->value.integer.max = 2; return 0; } + if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ) + && (pos == 0)) { + /* current input mode of A4DJ */ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 1; + return 0; + } + if (is_intval) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->value.integer.min = 0; @@ -74,6 +82,14 @@ static int control_get(struct snd_kcontrol *kcontrol, struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); int pos = kcontrol->private_value; + if (dev->chip.usb_id == + USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { + /* A4DJ has only one control */ + /* do not expose hardware input mode 0 */ + ucontrol->value.integer.value[0] = dev->control_state[0] - 1; + return 0; + } + if (pos & CNT_INTVAL) ucontrol->value.integer.value[0] = dev->control_state[pos & ~CNT_INTVAL]; @@ -91,6 +107,16 @@ static int control_put(struct snd_kcontrol *kcontrol, struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); int pos = kcontrol->private_value; + if (dev->chip.usb_id == + USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { + /* A4DJ has only one control */ + /* do not expose hardware input mode 0 */ + dev->control_state[0] = ucontrol->value.integer.value[0] + 1; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, + dev->control_state, sizeof(dev->control_state)); + return 1; + } + if (pos & CNT_INTVAL) { dev->control_state[pos & ~CNT_INTVAL] = ucontrol->value.integer.value[0]; -- cgit v1.2.3 From a8564155a9cb3b5c4a18afc451679a1f02c647b5 Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Wed, 4 Feb 2009 22:34:33 +0000 Subject: ALSA: snd-usb-caiaq: Remove duplicate A8DJ control Remove a duplicate control which causes an error when it is registered, and causes later controls to not be registered. The device does not have a fourth ground lift control. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-control.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index 136ef34300d..e92c2bbf4fe 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c @@ -270,7 +270,6 @@ static struct caiaq_controller a8dj_controller[] = { { "GND lift for TC Vinyl mode", 24 + 0 }, { "GND lift for TC CD/Line mode", 24 + 1 }, { "GND lift for phono mode", 24 + 2 }, - { "GND lift for TC Vinyl mode", 24 + 3 }, { "Software lock", 40 } }; -- cgit v1.2.3 From 238c0270baade3a542c1497712dd8e66cc9cc476 Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Wed, 4 Feb 2009 22:34:34 +0000 Subject: ALSA: snd-usb-caiaq: Increase version number to 1.3.12 Indicates fixes affecting control messages and switching of input mode on Audio 8 DJ and Audio 4 DJ. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 94610dda8ab..5736669df2d 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -42,7 +42,7 @@ #endif MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.11"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.12"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," -- cgit v1.2.3 From 1313e7041480f523a09dedc7ef2185d8ee94c163 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 18 Mar 2009 11:03:53 +0100 Subject: ALSA: snd-usb-caiaq: only warn once on streaming errors Limit the number of printed warnings to one in case of streaming errors. printk() happens to be expensive, especially in code called as often as here. Signed-off-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-audio.c | 4 +++- sound/usb/caiaq/caiaq-device.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index fc6d571eeac..577b1129de0 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) dev->output_panic = 0; dev->first_packet = 1; dev->streaming = 1; + dev->warned = 0; for (i = 0; i < N_URBS; i++) { ret = usb_submit_urb(dev->data_urbs_in[i], GFP_ATOMIC); @@ -406,10 +407,11 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev, break; } - if (dev->input_panic || dev->output_panic) { + if ((dev->input_panic || dev->output_panic) && !dev->warned) { debug("streaming error detected %s %s\n", dev->input_panic ? "(input)" : "", dev->output_panic ? "(output)" : ""); + dev->warned = 1; } } diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h index 0560c327d99..098b194f725 100644 --- a/sound/usb/caiaq/caiaq-device.h +++ b/sound/usb/caiaq/caiaq-device.h @@ -89,7 +89,7 @@ struct snd_usb_caiaqdev { int audio_out_buf_pos[MAX_STREAMS]; int period_in_count[MAX_STREAMS]; int period_out_count[MAX_STREAMS]; - int input_panic, output_panic; + int input_panic, output_panic, warned; char *audio_in_buf, *audio_out_buf; unsigned int samplerates; -- cgit v1.2.3 From 9311c9b4f12218b588e51806c44d290cfec678a3 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 18 Mar 2009 11:03:54 +0100 Subject: ALSA: snd-usb-caiaq: drop bogus iso packets Drop inbound packets that are smaller than expected. This has been observed at the very beginning of the streaming transaction. And when the hardware is in panic mode (which can only very rarely happen in case of massive EMI chaos), mute the input channels. Signed-off-by: Daniel Mack Tested-by: Mark Hills Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-audio.c | 6 ++++++ sound/usb/caiaq/caiaq-device.c | 2 ++ sound/usb/caiaq/caiaq-device.h | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index 577b1129de0..08d51e0c9fe 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/caiaq-audio.c @@ -377,6 +377,9 @@ static void read_in_urb_mode2(struct snd_usb_caiaqdev *dev, for (stream = 0; stream < dev->n_streams; stream++, i++) { sub = dev->sub_capture[stream]; + if (dev->input_panic) + usb_buf[i] = 0; + if (sub) { struct snd_pcm_runtime *rt = sub->runtime; char *audio_buf = rt->dma_area; @@ -398,6 +401,9 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev, if (!dev->streaming) return; + if (iso->actual_length < dev->bpp) + return; + switch (dev->spec.data_alignment) { case 0: read_in_urb_mode0(dev, urb, iso); diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 5736669df2d..336a93de0b3 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -251,6 +251,8 @@ int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, if (dev->audio_parm_answer != 1) debug("unable to set the device's audio params\n"); + else + dev->bpp = bpp; return dev->audio_parm_answer == 1 ? 0 : -EINVAL; } diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h index 098b194f725..4cce1ad7493 100644 --- a/sound/usb/caiaq/caiaq-device.h +++ b/sound/usb/caiaq/caiaq-device.h @@ -91,7 +91,7 @@ struct snd_usb_caiaqdev { int period_out_count[MAX_STREAMS]; int input_panic, output_panic, warned; char *audio_in_buf, *audio_out_buf; - unsigned int samplerates; + unsigned int samplerates, bpp; struct snd_pcm_substream *sub_playback[MAX_STREAMS]; struct snd_pcm_substream *sub_capture[MAX_STREAMS]; -- cgit v1.2.3 From 28514fe5bbbdbc0f7c9700569378d55cafd061ea Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 18 Mar 2009 11:03:55 +0100 Subject: ALSA: snd-usb-caiaq: bump version number Signed-off-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 336a93de0b3..771c523b3fc 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -42,7 +42,7 @@ #endif MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.12"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.13"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," -- cgit v1.2.3