diff options
author | Daniel Mack <daniel@caiaq.de> | 2007-09-17 08:45:14 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 10:50:46 -0400 |
commit | ad1e34b5653f86cbff2ea45dd166e2e58949d9bb (patch) | |
tree | 458dcaa4e760288957e819b745db2c0e0a42b713 /sound | |
parent | 1cf0bc7e730c4148605164ac542c1c191c1d2e09 (diff) |
[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 | |||
40 | namely: | 40 | namely: |
41 | 41 | ||
42 | * Native Instruments RigKontrol2 | 42 | * Native Instruments RigKontrol2 |
43 | * Native Instruments RigKontrol3 | ||
43 | * Native Instruments Kore Controller | 44 | * Native Instruments Kore Controller |
44 | * Native Instruments Audio Kontrol 1 | 45 | * Native Instruments Audio Kontrol 1 |
45 | * Native Instruments Audio 8 DJ | 46 | * Native Instruments Audio 8 DJ |
@@ -55,6 +56,7 @@ config SND_USB_CAIAQ_INPUT | |||
55 | alpha dials and analog pedals on the following products: | 56 | alpha dials and analog pedals on the following products: |
56 | 57 | ||
57 | * Native Instruments RigKontrol2 | 58 | * Native Instruments RigKontrol2 |
59 | * Native Instruments RigKontrol3 | ||
58 | * Native Instruments Audio Kontrol 1 | 60 | * Native Instruments Audio Kontrol 1 |
59 | 61 | ||
60 | endmenu | 62 | 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) | |||
648 | dev->samplerates = dev->pcm_info.rates; | 648 | dev->samplerates = dev->pcm_info.rates; |
649 | switch (dev->chip.usb_id) { | 649 | switch (dev->chip.usb_id) { |
650 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): | 650 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): |
651 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): | ||
651 | dev->samplerates |= SNDRV_PCM_RATE_88200; | 652 | dev->samplerates |= SNDRV_PCM_RATE_88200; |
652 | dev->samplerates |= SNDRV_PCM_RATE_192000; | 653 | dev->samplerates |= SNDRV_PCM_RATE_192000; |
653 | break; | 654 | 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 @@ | |||
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); | 43 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); |
44 | MODULE_DESCRIPTION("caiaq USB audio, version 1.1.0"); | 44 | MODULE_DESCRIPTION("caiaq USB audio, version 1.2.0"); |
45 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
46 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," | 46 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," |
47 | "{Native Instruments, RigKontrol3}," | ||
47 | "{Native Instruments, Kore Controller}," | 48 | "{Native Instruments, Kore Controller}," |
48 | "{Native Instruments, Audio Kontrol 1}" | 49 | "{Native Instruments, Audio Kontrol 1}" |
49 | "{Native Instruments, Audio 8 DJ}}"); | 50 | "{Native Instruments, Audio 8 DJ}}"); |
@@ -85,6 +86,11 @@ static struct usb_device_id snd_usb_id_table[] = { | |||
85 | { | 86 | { |
86 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, | 87 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, |
87 | .idVendor = USB_VID_NATIVEINSTRUMENTS, | 88 | .idVendor = USB_VID_NATIVEINSTRUMENTS, |
89 | .idProduct = USB_PID_RIGKONTROL3 | ||
90 | }, | ||
91 | { | ||
92 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, | ||
93 | .idVendor = USB_VID_NATIVEINSTRUMENTS, | ||
88 | .idProduct = USB_PID_KORECONTROLLER | 94 | .idProduct = USB_PID_KORECONTROLLER |
89 | }, | 95 | }, |
90 | { | 96 | { |
@@ -226,7 +232,7 @@ int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, | |||
226 | static void setup_card(struct snd_usb_caiaqdev *dev) | 232 | static void setup_card(struct snd_usb_caiaqdev *dev) |
227 | { | 233 | { |
228 | int ret; | 234 | int ret; |
229 | char val[3]; | 235 | char val[4]; |
230 | 236 | ||
231 | /* device-specific startup specials */ | 237 | /* device-specific startup specials */ |
232 | switch (dev->chip.usb_id) { | 238 | switch (dev->chip.usb_id) { |
@@ -237,6 +243,14 @@ static void setup_card(struct snd_usb_caiaqdev *dev) | |||
237 | val[2] = 0x01; | 243 | val[2] = 0x01; |
238 | send_command(dev, EP1_CMD_WRITE_IO, val, 3); | 244 | send_command(dev, EP1_CMD_WRITE_IO, val, 3); |
239 | break; | 245 | break; |
246 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): | ||
247 | /* RigKontrol2 - display two centered dashes ('--') */ | ||
248 | val[0] = 0x00; | ||
249 | val[1] = 0x40; | ||
250 | val[2] = 0x40; | ||
251 | val[3] = 0x00; | ||
252 | send_command(dev, EP1_CMD_WRITE_IO, val, 4); | ||
253 | break; | ||
240 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): | 254 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): |
241 | /* Audio Kontrol 1 - make USB-LED stop blinking */ | 255 | /* Audio Kontrol 1 - make USB-LED stop blinking */ |
242 | val[0] = 0x00; | 256 | 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 @@ | |||
6 | #define USB_VID_NATIVEINSTRUMENTS 0x17cc | 6 | #define USB_VID_NATIVEINSTRUMENTS 0x17cc |
7 | 7 | ||
8 | #define USB_PID_RIGKONTROL2 0x1969 | 8 | #define USB_PID_RIGKONTROL2 0x1969 |
9 | #define USB_PID_RIGKONTROL3 0x1940 | ||
9 | #define USB_PID_KORECONTROLLER 0x4711 | 10 | #define USB_PID_KORECONTROLLER 0x4711 |
10 | #define USB_PID_AK1 0x0815 | 11 | #define USB_PID_AK1 0x0815 |
11 | #define USB_PID_AUDIO8DJ 0x1978 | 12 | #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 @@ | |||
34 | static unsigned char keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; | 34 | static unsigned char keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; |
35 | static unsigned char keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, | 35 | static unsigned char keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, |
36 | KEY_5, KEY_6, KEY_7 }; | 36 | KEY_5, KEY_6, KEY_7 }; |
37 | static unsigned char keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4, | ||
38 | KEY_5, KEY_6, KEY_7, KEY_5, KEY_6 }; | ||
37 | 39 | ||
38 | #define DEG90 (range/2) | 40 | #define DEG90 (range/2) |
39 | #define DEG180 (range) | 41 | #define DEG180 (range) |
@@ -107,7 +109,8 @@ static unsigned int decode_erp(unsigned char a, unsigned char b) | |||
107 | 109 | ||
108 | 110 | ||
109 | static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev, | 111 | static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev, |
110 | const char *buf, unsigned int len) | 112 | const unsigned char *buf, |
113 | unsigned int len) | ||
111 | { | 114 | { |
112 | switch(dev->input_dev->id.product) { | 115 | switch(dev->input_dev->id.product) { |
113 | case USB_PID_RIGKONTROL2: | 116 | case USB_PID_RIGKONTROL2: |
@@ -116,6 +119,12 @@ static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev, | |||
116 | input_report_abs(dev->input_dev, ABS_Z, (buf[2] << 8) |buf[3]); | 119 | input_report_abs(dev->input_dev, ABS_Z, (buf[2] << 8) |buf[3]); |
117 | input_sync(dev->input_dev); | 120 | input_sync(dev->input_dev); |
118 | break; | 121 | break; |
122 | case USB_PID_RIGKONTROL3: | ||
123 | input_report_abs(dev->input_dev, ABS_X, (buf[0] << 8) |buf[1]); | ||
124 | input_report_abs(dev->input_dev, ABS_Y, (buf[2] << 8) |buf[3]); | ||
125 | input_report_abs(dev->input_dev, ABS_Z, (buf[4] << 8) |buf[5]); | ||
126 | input_sync(dev->input_dev); | ||
127 | break; | ||
119 | } | 128 | } |
120 | } | 129 | } |
121 | 130 | ||
@@ -128,7 +137,7 @@ static void snd_caiaq_input_read_erp(struct snd_usb_caiaqdev *dev, | |||
128 | case USB_PID_AK1: | 137 | case USB_PID_AK1: |
129 | i = decode_erp(buf[0], buf[1]); | 138 | i = decode_erp(buf[0], buf[1]); |
130 | input_report_abs(dev->input_dev, ABS_X, i); | 139 | input_report_abs(dev->input_dev, ABS_X, i); |
131 | input_sync(dev->input_dev); | 140 | input_sync(dev->input_dev); |
132 | break; | 141 | break; |
133 | } | 142 | } |
134 | } | 143 | } |
@@ -204,6 +213,20 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
204 | input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); | 213 | input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); |
205 | snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); | 214 | snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); |
206 | break; | 215 | break; |
216 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): | ||
217 | input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | ||
218 | input->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_Z); | ||
219 | input->keycode = keycode_rk3; | ||
220 | input->keycodesize = sizeof(char); | ||
221 | input->keycodemax = ARRAY_SIZE(keycode_rk3); | ||
222 | for (i=0; i<ARRAY_SIZE(keycode_rk3); i++) | ||
223 | set_bit(keycode_rk3[i], input->keybit); | ||
224 | |||
225 | input_set_abs_params(input, ABS_X, 0, 1024, 0, 10); | ||
226 | input_set_abs_params(input, ABS_Y, 0, 1024, 0, 10); | ||
227 | input_set_abs_params(input, ABS_Z, 0, 1024, 0, 10); | ||
228 | snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); | ||
229 | break; | ||
207 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): | 230 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): |
208 | input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 231 | input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); |
209 | input->absbit[0] = BIT(ABS_X); | 232 | input->absbit[0] = BIT(ABS_X); |