diff options
author | Daniel Mack <daniel@caiaq.de> | 2007-09-17 16:45:14 +0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 18:50:46 +0400 |
commit | ad1e34b5653f86cbff2ea45dd166e2e58949d9bb (patch) | |
tree | 458dcaa4e760288957e819b745db2c0e0a42b713 /sound | |
parent | 1cf0bc7e730c4148605164ac542c1c191c1d2e09 (diff) | |
download | linux-ad1e34b5653f86cbff2ea45dd166e2e58949d9bb.tar.xz |
[ALSA] caiaq - support for Native Instrument's RigKontrol3
This patch adds support for Native Instrument's upcoming
RigKontrol3 sound interface.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/Kconfig | 2 | ||||
-rw-r--r-- | sound/usb/caiaq/caiaq-audio.c | 1 | ||||
-rw-r--r-- | sound/usb/caiaq/caiaq-device.c | 18 | ||||
-rw-r--r-- | sound/usb/caiaq/caiaq-device.h | 1 | ||||
-rw-r--r-- | sound/usb/caiaq/caiaq-input.c | 27 |
5 files changed, 45 insertions, 4 deletions
diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig index 315360f31278..706143826aff 100644 --- a/sound/usb/Kconfig +++ b/sound/usb/Kconfig @@ -40,6 +40,7 @@ config SND_USB_CAIAQ namely: * Native Instruments RigKontrol2 + * Native Instruments RigKontrol3 * Native Instruments Kore Controller * Native Instruments Audio Kontrol 1 * Native Instruments Audio 8 DJ @@ -55,6 +56,7 @@ config SND_USB_CAIAQ_INPUT alpha dials and analog pedals on the following products: * Native Instruments RigKontrol2 + * Native Instruments RigKontrol3 * Native Instruments Audio Kontrol 1 endmenu diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index 0414d766ba07..0666908a2361 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/caiaq-audio.c @@ -648,6 +648,7 @@ int __devinit snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev) dev->samplerates = dev->pcm_info.rates; switch (dev->chip.usb_id) { case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): dev->samplerates |= SNDRV_PCM_RATE_88200; dev->samplerates |= SNDRV_PCM_RATE_192000; break; diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 4709347326f9..58af8142c571 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -41,9 +41,10 @@ #endif MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); -MODULE_DESCRIPTION("caiaq USB audio, version 1.1.0"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.2.0"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," + "{Native Instruments, RigKontrol3}," "{Native Instruments, Kore Controller}," "{Native Instruments, Audio Kontrol 1}" "{Native Instruments, Audio 8 DJ}}"); @@ -85,6 +86,11 @@ static struct usb_device_id snd_usb_id_table[] = { { .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_RIGKONTROL3 + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, .idProduct = USB_PID_KORECONTROLLER }, { @@ -226,7 +232,7 @@ int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, static void setup_card(struct snd_usb_caiaqdev *dev) { int ret; - char val[3]; + char val[4]; /* device-specific startup specials */ switch (dev->chip.usb_id) { @@ -237,6 +243,14 @@ static void setup_card(struct snd_usb_caiaqdev *dev) val[2] = 0x01; send_command(dev, EP1_CMD_WRITE_IO, val, 3); break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): + /* RigKontrol2 - display two centered dashes ('--') */ + val[0] = 0x00; + val[1] = 0x40; + val[2] = 0x40; + val[3] = 0x00; + send_command(dev, EP1_CMD_WRITE_IO, val, 4); + break; case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): /* Audio Kontrol 1 - make USB-LED stop blinking */ val[0] = 0x00; diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h index 088d5ec241f3..79bc5be2df7a 100644 --- a/sound/usb/caiaq/caiaq-device.h +++ b/sound/usb/caiaq/caiaq-device.h @@ -6,6 +6,7 @@ #define USB_VID_NATIVEINSTRUMENTS 0x17cc #define USB_PID_RIGKONTROL2 0x1969 +#define USB_PID_RIGKONTROL3 0x1940 #define USB_PID_KORECONTROLLER 0x4711 #define USB_PID_AK1 0x0815 #define USB_PID_AUDIO8DJ 0x1978 diff --git a/sound/usb/caiaq/caiaq-input.c b/sound/usb/caiaq/caiaq-input.c index 6978dabb2258..a1de0c608957 100644 --- a/sound/usb/caiaq/caiaq-input.c +++ b/sound/usb/caiaq/caiaq-input.c @@ -34,6 +34,8 @@ static unsigned char keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; static unsigned char keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7 }; +static unsigned char keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4, + KEY_5, KEY_6, KEY_7, KEY_5, KEY_6 }; #define DEG90 (range/2) #define DEG180 (range) @@ -107,7 +109,8 @@ static unsigned int decode_erp(unsigned char a, unsigned char b) static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev, - const char *buf, unsigned int len) + const unsigned char *buf, + unsigned int len) { switch(dev->input_dev->id.product) { case USB_PID_RIGKONTROL2: @@ -116,6 +119,12 @@ static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev, input_report_abs(dev->input_dev, ABS_Z, (buf[2] << 8) |buf[3]); input_sync(dev->input_dev); break; + case USB_PID_RIGKONTROL3: + input_report_abs(dev->input_dev, ABS_X, (buf[0] << 8) |buf[1]); + input_report_abs(dev->input_dev, ABS_Y, (buf[2] << 8) |buf[3]); + input_report_abs(dev->input_dev, ABS_Z, (buf[4] << 8) |buf[5]); + input_sync(dev->input_dev); + break; } } @@ -128,7 +137,7 @@ static void snd_caiaq_input_read_erp(struct snd_usb_caiaqdev *dev, case USB_PID_AK1: i = decode_erp(buf[0], buf[1]); input_report_abs(dev->input_dev, ABS_X, i); - input_sync(dev->input_dev); + input_sync(dev->input_dev); break; } } @@ -204,6 +213,20 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): + input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + input->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_Z); + input->keycode = keycode_rk3; + input->keycodesize = sizeof(char); + input->keycodemax = ARRAY_SIZE(keycode_rk3); + for (i=0; i<ARRAY_SIZE(keycode_rk3); i++) + set_bit(keycode_rk3[i], input->keybit); + + input_set_abs_params(input, ABS_X, 0, 1024, 0, 10); + input_set_abs_params(input, ABS_Y, 0, 1024, 0, 10); + input_set_abs_params(input, ABS_Z, 0, 1024, 0, 10); + snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); + break; case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input->absbit[0] = BIT(ABS_X); |