1936e7d03SDaniel Mack /* 2936e7d03SDaniel Mack * Copyright (c) 2007 Daniel Mack 3936e7d03SDaniel Mack * friendly supported by NI. 4936e7d03SDaniel Mack * 5936e7d03SDaniel Mack * This program is free software; you can redistribute it and/or modify 6936e7d03SDaniel Mack * it under the terms of the GNU General Public License as published by 7936e7d03SDaniel Mack * the Free Software Foundation; either version 2 of the License, or 8936e7d03SDaniel Mack * (at your option) any later version. 9936e7d03SDaniel Mack * 10936e7d03SDaniel Mack * This program is distributed in the hope that it will be useful, 11936e7d03SDaniel Mack * but WITHOUT ANY WARRANTY; without even the implied warranty of 12936e7d03SDaniel Mack * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13936e7d03SDaniel Mack * GNU General Public License for more details. 14936e7d03SDaniel Mack * 15936e7d03SDaniel Mack * You should have received a copy of the GNU General Public License 16936e7d03SDaniel Mack * along with this program; if not, write to the Free Software 17936e7d03SDaniel Mack * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18936e7d03SDaniel Mack */ 19936e7d03SDaniel Mack 20936e7d03SDaniel Mack #include <linux/init.h> 21936e7d03SDaniel Mack #include <linux/usb.h> 22936e7d03SDaniel Mack #include <sound/control.h> 23936e7d03SDaniel Mack #include <sound/core.h> 24936e7d03SDaniel Mack #include <sound/pcm.h> 25936e7d03SDaniel Mack 26936e7d03SDaniel Mack #include "device.h" 27936e7d03SDaniel Mack #include "control.h" 28936e7d03SDaniel Mack 29936e7d03SDaniel Mack #define CNT_INTVAL 0x10000 30936e7d03SDaniel Mack 31936e7d03SDaniel Mack static int control_info(struct snd_kcontrol *kcontrol, 32936e7d03SDaniel Mack struct snd_ctl_elem_info *uinfo) 33936e7d03SDaniel Mack { 34936e7d03SDaniel Mack struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); 35*1c8470ceSDaniel Mack struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card); 36936e7d03SDaniel Mack int pos = kcontrol->private_value; 37936e7d03SDaniel Mack int is_intval = pos & CNT_INTVAL; 386da7a2aaSDaniel Mack int maxval = 63; 39936e7d03SDaniel Mack 40936e7d03SDaniel Mack uinfo->count = 1; 41936e7d03SDaniel Mack pos &= ~CNT_INTVAL; 42936e7d03SDaniel Mack 43*1c8470ceSDaniel Mack switch (cdev->chip.usb_id) { 446da7a2aaSDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): 45bd4cbf6cSMark Hills case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): 466da7a2aaSDaniel Mack if (pos == 0) { 47bd4cbf6cSMark Hills /* current input mode of A8DJ and A4DJ */ 48936e7d03SDaniel Mack uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 49936e7d03SDaniel Mack uinfo->value.integer.min = 0; 50936e7d03SDaniel Mack uinfo->value.integer.max = 2; 51936e7d03SDaniel Mack return 0; 52936e7d03SDaniel Mack } 536da7a2aaSDaniel Mack break; 54936e7d03SDaniel Mack 556da7a2aaSDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): 566da7a2aaSDaniel Mack maxval = 127; 576da7a2aaSDaniel Mack break; 5815c5ab60SDaniel Mack 5915c5ab60SDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): 6015c5ab60SDaniel Mack maxval = 31; 6115c5ab60SDaniel Mack break; 626da7a2aaSDaniel Mack } 63936e7d03SDaniel Mack 64936e7d03SDaniel Mack if (is_intval) { 65936e7d03SDaniel Mack uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 66936e7d03SDaniel Mack uinfo->value.integer.min = 0; 676da7a2aaSDaniel Mack uinfo->value.integer.max = maxval; 68936e7d03SDaniel Mack } else { 69936e7d03SDaniel Mack uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 70936e7d03SDaniel Mack uinfo->value.integer.min = 0; 71936e7d03SDaniel Mack uinfo->value.integer.max = 1; 72936e7d03SDaniel Mack } 73936e7d03SDaniel Mack 74936e7d03SDaniel Mack return 0; 75936e7d03SDaniel Mack } 76936e7d03SDaniel Mack 77936e7d03SDaniel Mack static int control_get(struct snd_kcontrol *kcontrol, 78936e7d03SDaniel Mack struct snd_ctl_elem_value *ucontrol) 79936e7d03SDaniel Mack { 80936e7d03SDaniel Mack struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); 81*1c8470ceSDaniel Mack struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card); 82936e7d03SDaniel Mack int pos = kcontrol->private_value; 83936e7d03SDaniel Mack 84936e7d03SDaniel Mack if (pos & CNT_INTVAL) 85936e7d03SDaniel Mack ucontrol->value.integer.value[0] 86*1c8470ceSDaniel Mack = cdev->control_state[pos & ~CNT_INTVAL]; 87936e7d03SDaniel Mack else 88936e7d03SDaniel Mack ucontrol->value.integer.value[0] 89*1c8470ceSDaniel Mack = !!(cdev->control_state[pos / 8] & (1 << pos % 8)); 90936e7d03SDaniel Mack 91936e7d03SDaniel Mack return 0; 92936e7d03SDaniel Mack } 93936e7d03SDaniel Mack 94936e7d03SDaniel Mack static int control_put(struct snd_kcontrol *kcontrol, 95936e7d03SDaniel Mack struct snd_ctl_elem_value *ucontrol) 96936e7d03SDaniel Mack { 97936e7d03SDaniel Mack struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); 98*1c8470ceSDaniel Mack struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card); 99936e7d03SDaniel Mack int pos = kcontrol->private_value; 10015c5ab60SDaniel Mack int v = ucontrol->value.integer.value[0]; 1016da7a2aaSDaniel Mack unsigned char cmd = EP1_CMD_WRITE_IO; 102936e7d03SDaniel Mack 103*1c8470ceSDaniel Mack if (cdev->chip.usb_id == 1044efd7d8fSMark Hills USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1)) 1056da7a2aaSDaniel Mack cmd = EP1_CMD_DIMM_LEDS; 1066da7a2aaSDaniel Mack 107936e7d03SDaniel Mack if (pos & CNT_INTVAL) { 10815c5ab60SDaniel Mack int i = pos & ~CNT_INTVAL; 10915c5ab60SDaniel Mack 110*1c8470ceSDaniel Mack cdev->control_state[i] = v; 11115c5ab60SDaniel Mack 112*1c8470ceSDaniel Mack if (cdev->chip.usb_id == 11315c5ab60SDaniel Mack USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4)) { 11415c5ab60SDaniel Mack int actual_len; 11515c5ab60SDaniel Mack 116*1c8470ceSDaniel Mack cdev->ep8_out_buf[0] = i; 117*1c8470ceSDaniel Mack cdev->ep8_out_buf[1] = v; 11815c5ab60SDaniel Mack 119*1c8470ceSDaniel Mack usb_bulk_msg(cdev->chip.dev, 120*1c8470ceSDaniel Mack usb_sndbulkpipe(cdev->chip.dev, 8), 121*1c8470ceSDaniel Mack cdev->ep8_out_buf, sizeof(cdev->ep8_out_buf), 12215c5ab60SDaniel Mack &actual_len, 200); 12315c5ab60SDaniel Mack } else { 124*1c8470ceSDaniel Mack snd_usb_caiaq_send_command(cdev, cmd, 125*1c8470ceSDaniel Mack cdev->control_state, sizeof(cdev->control_state)); 12615c5ab60SDaniel Mack } 127936e7d03SDaniel Mack } else { 12815c5ab60SDaniel Mack if (v) 129*1c8470ceSDaniel Mack cdev->control_state[pos / 8] |= 1 << (pos % 8); 130936e7d03SDaniel Mack else 131*1c8470ceSDaniel Mack cdev->control_state[pos / 8] &= ~(1 << (pos % 8)); 132936e7d03SDaniel Mack 133*1c8470ceSDaniel Mack snd_usb_caiaq_send_command(cdev, cmd, 134*1c8470ceSDaniel Mack cdev->control_state, sizeof(cdev->control_state)); 135936e7d03SDaniel Mack } 136936e7d03SDaniel Mack 137936e7d03SDaniel Mack return 1; 138936e7d03SDaniel Mack } 139936e7d03SDaniel Mack 14014c56706SBill Pemberton static struct snd_kcontrol_new kcontrol_template = { 141936e7d03SDaniel Mack .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, 142936e7d03SDaniel Mack .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 143936e7d03SDaniel Mack .index = 0, 144936e7d03SDaniel Mack .info = control_info, 145936e7d03SDaniel Mack .get = control_get, 146936e7d03SDaniel Mack .put = control_put, 147936e7d03SDaniel Mack /* name and private_value filled later */ 148936e7d03SDaniel Mack }; 149936e7d03SDaniel Mack 150936e7d03SDaniel Mack struct caiaq_controller { 151936e7d03SDaniel Mack char *name; 152936e7d03SDaniel Mack int index; 153936e7d03SDaniel Mack }; 154936e7d03SDaniel Mack 155936e7d03SDaniel Mack static struct caiaq_controller ak1_controller[] = { 156936e7d03SDaniel Mack { "LED left", 2 }, 157936e7d03SDaniel Mack { "LED middle", 1 }, 158936e7d03SDaniel Mack { "LED right", 0 }, 159936e7d03SDaniel Mack { "LED ring", 3 } 160936e7d03SDaniel Mack }; 161936e7d03SDaniel Mack 162936e7d03SDaniel Mack static struct caiaq_controller rk2_controller[] = { 163936e7d03SDaniel Mack { "LED 1", 5 }, 164936e7d03SDaniel Mack { "LED 2", 4 }, 165936e7d03SDaniel Mack { "LED 3", 3 }, 166936e7d03SDaniel Mack { "LED 4", 2 }, 167936e7d03SDaniel Mack { "LED 5", 1 }, 168936e7d03SDaniel Mack { "LED 6", 0 }, 169936e7d03SDaniel Mack { "LED pedal", 6 }, 170936e7d03SDaniel Mack { "LED 7seg_1b", 8 }, 171936e7d03SDaniel Mack { "LED 7seg_1c", 9 }, 172936e7d03SDaniel Mack { "LED 7seg_2a", 10 }, 173936e7d03SDaniel Mack { "LED 7seg_2b", 11 }, 174936e7d03SDaniel Mack { "LED 7seg_2c", 12 }, 175936e7d03SDaniel Mack { "LED 7seg_2d", 13 }, 176936e7d03SDaniel Mack { "LED 7seg_2e", 14 }, 177936e7d03SDaniel Mack { "LED 7seg_2f", 15 }, 178936e7d03SDaniel Mack { "LED 7seg_2g", 16 }, 179936e7d03SDaniel Mack { "LED 7seg_3a", 17 }, 180936e7d03SDaniel Mack { "LED 7seg_3b", 18 }, 181936e7d03SDaniel Mack { "LED 7seg_3c", 19 }, 182936e7d03SDaniel Mack { "LED 7seg_3d", 20 }, 183936e7d03SDaniel Mack { "LED 7seg_3e", 21 }, 184936e7d03SDaniel Mack { "LED 7seg_3f", 22 }, 185936e7d03SDaniel Mack { "LED 7seg_3g", 23 } 186936e7d03SDaniel Mack }; 187936e7d03SDaniel Mack 188936e7d03SDaniel Mack static struct caiaq_controller rk3_controller[] = { 189936e7d03SDaniel Mack { "LED 7seg_1a", 0 + 0 }, 190936e7d03SDaniel Mack { "LED 7seg_1b", 0 + 1 }, 191936e7d03SDaniel Mack { "LED 7seg_1c", 0 + 2 }, 192936e7d03SDaniel Mack { "LED 7seg_1d", 0 + 3 }, 193936e7d03SDaniel Mack { "LED 7seg_1e", 0 + 4 }, 194936e7d03SDaniel Mack { "LED 7seg_1f", 0 + 5 }, 195936e7d03SDaniel Mack { "LED 7seg_1g", 0 + 6 }, 196936e7d03SDaniel Mack { "LED 7seg_1p", 0 + 7 }, 197936e7d03SDaniel Mack 198936e7d03SDaniel Mack { "LED 7seg_2a", 8 + 0 }, 199936e7d03SDaniel Mack { "LED 7seg_2b", 8 + 1 }, 200936e7d03SDaniel Mack { "LED 7seg_2c", 8 + 2 }, 201936e7d03SDaniel Mack { "LED 7seg_2d", 8 + 3 }, 202936e7d03SDaniel Mack { "LED 7seg_2e", 8 + 4 }, 203936e7d03SDaniel Mack { "LED 7seg_2f", 8 + 5 }, 204936e7d03SDaniel Mack { "LED 7seg_2g", 8 + 6 }, 205936e7d03SDaniel Mack { "LED 7seg_2p", 8 + 7 }, 206936e7d03SDaniel Mack 207936e7d03SDaniel Mack { "LED 7seg_3a", 16 + 0 }, 208936e7d03SDaniel Mack { "LED 7seg_3b", 16 + 1 }, 209936e7d03SDaniel Mack { "LED 7seg_3c", 16 + 2 }, 210936e7d03SDaniel Mack { "LED 7seg_3d", 16 + 3 }, 211936e7d03SDaniel Mack { "LED 7seg_3e", 16 + 4 }, 212936e7d03SDaniel Mack { "LED 7seg_3f", 16 + 5 }, 213936e7d03SDaniel Mack { "LED 7seg_3g", 16 + 6 }, 214936e7d03SDaniel Mack { "LED 7seg_3p", 16 + 7 }, 215936e7d03SDaniel Mack 216936e7d03SDaniel Mack { "LED 7seg_4a", 24 + 0 }, 217936e7d03SDaniel Mack { "LED 7seg_4b", 24 + 1 }, 218936e7d03SDaniel Mack { "LED 7seg_4c", 24 + 2 }, 219936e7d03SDaniel Mack { "LED 7seg_4d", 24 + 3 }, 220936e7d03SDaniel Mack { "LED 7seg_4e", 24 + 4 }, 221936e7d03SDaniel Mack { "LED 7seg_4f", 24 + 5 }, 222936e7d03SDaniel Mack { "LED 7seg_4g", 24 + 6 }, 223936e7d03SDaniel Mack { "LED 7seg_4p", 24 + 7 }, 224936e7d03SDaniel Mack 225936e7d03SDaniel Mack { "LED 1", 32 + 0 }, 226936e7d03SDaniel Mack { "LED 2", 32 + 1 }, 227936e7d03SDaniel Mack { "LED 3", 32 + 2 }, 228936e7d03SDaniel Mack { "LED 4", 32 + 3 }, 229936e7d03SDaniel Mack { "LED 5", 32 + 4 }, 230936e7d03SDaniel Mack { "LED 6", 32 + 5 }, 231936e7d03SDaniel Mack { "LED 7", 32 + 6 }, 232936e7d03SDaniel Mack { "LED 8", 32 + 7 }, 233936e7d03SDaniel Mack { "LED pedal", 32 + 8 } 234936e7d03SDaniel Mack }; 235936e7d03SDaniel Mack 236936e7d03SDaniel Mack static struct caiaq_controller kore_controller[] = { 237936e7d03SDaniel Mack { "LED F1", 8 | CNT_INTVAL }, 238936e7d03SDaniel Mack { "LED F2", 12 | CNT_INTVAL }, 239936e7d03SDaniel Mack { "LED F3", 0 | CNT_INTVAL }, 240936e7d03SDaniel Mack { "LED F4", 4 | CNT_INTVAL }, 241936e7d03SDaniel Mack { "LED F5", 11 | CNT_INTVAL }, 242936e7d03SDaniel Mack { "LED F6", 15 | CNT_INTVAL }, 243936e7d03SDaniel Mack { "LED F7", 3 | CNT_INTVAL }, 244936e7d03SDaniel Mack { "LED F8", 7 | CNT_INTVAL }, 245936e7d03SDaniel Mack { "LED touch1", 10 | CNT_INTVAL }, 246936e7d03SDaniel Mack { "LED touch2", 14 | CNT_INTVAL }, 247936e7d03SDaniel Mack { "LED touch3", 2 | CNT_INTVAL }, 248936e7d03SDaniel Mack { "LED touch4", 6 | CNT_INTVAL }, 249936e7d03SDaniel Mack { "LED touch5", 9 | CNT_INTVAL }, 250936e7d03SDaniel Mack { "LED touch6", 13 | CNT_INTVAL }, 251936e7d03SDaniel Mack { "LED touch7", 1 | CNT_INTVAL }, 252936e7d03SDaniel Mack { "LED touch8", 5 | CNT_INTVAL }, 253936e7d03SDaniel Mack { "LED left", 18 | CNT_INTVAL }, 254936e7d03SDaniel Mack { "LED right", 22 | CNT_INTVAL }, 255936e7d03SDaniel Mack { "LED up", 16 | CNT_INTVAL }, 256936e7d03SDaniel Mack { "LED down", 20 | CNT_INTVAL }, 257936e7d03SDaniel Mack { "LED stop", 23 | CNT_INTVAL }, 258936e7d03SDaniel Mack { "LED play", 21 | CNT_INTVAL }, 259936e7d03SDaniel Mack { "LED record", 19 | CNT_INTVAL }, 260936e7d03SDaniel Mack { "LED listen", 17 | CNT_INTVAL }, 261936e7d03SDaniel Mack { "LED lcd", 30 | CNT_INTVAL }, 262936e7d03SDaniel Mack { "LED menu", 28 | CNT_INTVAL }, 263936e7d03SDaniel Mack { "LED sound", 31 | CNT_INTVAL }, 264936e7d03SDaniel Mack { "LED esc", 29 | CNT_INTVAL }, 265936e7d03SDaniel Mack { "LED view", 27 | CNT_INTVAL }, 266936e7d03SDaniel Mack { "LED enter", 24 | CNT_INTVAL }, 267936e7d03SDaniel Mack { "LED control", 26 | CNT_INTVAL } 268936e7d03SDaniel Mack }; 269936e7d03SDaniel Mack 270936e7d03SDaniel Mack static struct caiaq_controller a8dj_controller[] = { 271936e7d03SDaniel Mack { "Current input mode", 0 | CNT_INTVAL }, 272936e7d03SDaniel Mack { "GND lift for TC Vinyl mode", 24 + 0 }, 273936e7d03SDaniel Mack { "GND lift for TC CD/Line mode", 24 + 1 }, 274936e7d03SDaniel Mack { "GND lift for phono mode", 24 + 2 }, 275936e7d03SDaniel Mack { "Software lock", 40 } 276936e7d03SDaniel Mack }; 277936e7d03SDaniel Mack 278936e7d03SDaniel Mack static struct caiaq_controller a4dj_controller[] = { 279936e7d03SDaniel Mack { "Current input mode", 0 | CNT_INTVAL } 280936e7d03SDaniel Mack }; 281936e7d03SDaniel Mack 2826da7a2aaSDaniel Mack static struct caiaq_controller kontrolx1_controller[] = { 2836da7a2aaSDaniel Mack { "LED FX A: ON", 7 | CNT_INTVAL }, 2846da7a2aaSDaniel Mack { "LED FX A: 1", 6 | CNT_INTVAL }, 2856da7a2aaSDaniel Mack { "LED FX A: 2", 5 | CNT_INTVAL }, 2866da7a2aaSDaniel Mack { "LED FX A: 3", 4 | CNT_INTVAL }, 2876da7a2aaSDaniel Mack { "LED FX B: ON", 3 | CNT_INTVAL }, 2886da7a2aaSDaniel Mack { "LED FX B: 1", 2 | CNT_INTVAL }, 2896da7a2aaSDaniel Mack { "LED FX B: 2", 1 | CNT_INTVAL }, 2906da7a2aaSDaniel Mack { "LED FX B: 3", 0 | CNT_INTVAL }, 2916da7a2aaSDaniel Mack 2926da7a2aaSDaniel Mack { "LED Hotcue", 28 | CNT_INTVAL }, 2936da7a2aaSDaniel Mack { "LED Shift (white)", 29 | CNT_INTVAL }, 2946da7a2aaSDaniel Mack { "LED Shift (green)", 30 | CNT_INTVAL }, 2956da7a2aaSDaniel Mack 2966da7a2aaSDaniel Mack { "LED Deck A: FX1", 24 | CNT_INTVAL }, 2976da7a2aaSDaniel Mack { "LED Deck A: FX2", 25 | CNT_INTVAL }, 2986da7a2aaSDaniel Mack { "LED Deck A: IN", 17 | CNT_INTVAL }, 2996da7a2aaSDaniel Mack { "LED Deck A: OUT", 16 | CNT_INTVAL }, 3006da7a2aaSDaniel Mack { "LED Deck A: < BEAT", 19 | CNT_INTVAL }, 3016da7a2aaSDaniel Mack { "LED Deck A: BEAT >", 18 | CNT_INTVAL }, 3026da7a2aaSDaniel Mack { "LED Deck A: CUE/ABS", 21 | CNT_INTVAL }, 3036da7a2aaSDaniel Mack { "LED Deck A: CUP/REL", 20 | CNT_INTVAL }, 3046da7a2aaSDaniel Mack { "LED Deck A: PLAY", 23 | CNT_INTVAL }, 3056da7a2aaSDaniel Mack { "LED Deck A: SYNC", 22 | CNT_INTVAL }, 3066da7a2aaSDaniel Mack 3076da7a2aaSDaniel Mack { "LED Deck B: FX1", 26 | CNT_INTVAL }, 3086da7a2aaSDaniel Mack { "LED Deck B: FX2", 27 | CNT_INTVAL }, 3096da7a2aaSDaniel Mack { "LED Deck B: IN", 15 | CNT_INTVAL }, 3106da7a2aaSDaniel Mack { "LED Deck B: OUT", 14 | CNT_INTVAL }, 3116da7a2aaSDaniel Mack { "LED Deck B: < BEAT", 13 | CNT_INTVAL }, 3126da7a2aaSDaniel Mack { "LED Deck B: BEAT >", 12 | CNT_INTVAL }, 3136da7a2aaSDaniel Mack { "LED Deck B: CUE/ABS", 11 | CNT_INTVAL }, 3146da7a2aaSDaniel Mack { "LED Deck B: CUP/REL", 10 | CNT_INTVAL }, 3156da7a2aaSDaniel Mack { "LED Deck B: PLAY", 9 | CNT_INTVAL }, 3166da7a2aaSDaniel Mack { "LED Deck B: SYNC", 8 | CNT_INTVAL }, 3176da7a2aaSDaniel Mack }; 3186da7a2aaSDaniel Mack 31915c5ab60SDaniel Mack static struct caiaq_controller kontrols4_controller[] = { 32015c5ab60SDaniel Mack { "LED: Master: Quant", 10 | CNT_INTVAL }, 32115c5ab60SDaniel Mack { "LED: Master: Headphone", 11 | CNT_INTVAL }, 32215c5ab60SDaniel Mack { "LED: Master: Master", 12 | CNT_INTVAL }, 32315c5ab60SDaniel Mack { "LED: Master: Snap", 14 | CNT_INTVAL }, 32415c5ab60SDaniel Mack { "LED: Master: Warning", 15 | CNT_INTVAL }, 32515c5ab60SDaniel Mack { "LED: Master: Master button", 112 | CNT_INTVAL }, 32615c5ab60SDaniel Mack { "LED: Master: Snap button", 113 | CNT_INTVAL }, 32715c5ab60SDaniel Mack { "LED: Master: Rec", 118 | CNT_INTVAL }, 32815c5ab60SDaniel Mack { "LED: Master: Size", 119 | CNT_INTVAL }, 32915c5ab60SDaniel Mack { "LED: Master: Quant button", 120 | CNT_INTVAL }, 33015c5ab60SDaniel Mack { "LED: Master: Browser button", 121 | CNT_INTVAL }, 33115c5ab60SDaniel Mack { "LED: Master: Play button", 126 | CNT_INTVAL }, 33215c5ab60SDaniel Mack { "LED: Master: Undo button", 127 | CNT_INTVAL }, 33315c5ab60SDaniel Mack 33415c5ab60SDaniel Mack { "LED: Channel A: >", 4 | CNT_INTVAL }, 33515c5ab60SDaniel Mack { "LED: Channel A: <", 5 | CNT_INTVAL }, 33615c5ab60SDaniel Mack { "LED: Channel A: Meter 1", 97 | CNT_INTVAL }, 33715c5ab60SDaniel Mack { "LED: Channel A: Meter 2", 98 | CNT_INTVAL }, 33815c5ab60SDaniel Mack { "LED: Channel A: Meter 3", 99 | CNT_INTVAL }, 33915c5ab60SDaniel Mack { "LED: Channel A: Meter 4", 100 | CNT_INTVAL }, 34015c5ab60SDaniel Mack { "LED: Channel A: Meter 5", 101 | CNT_INTVAL }, 34115c5ab60SDaniel Mack { "LED: Channel A: Meter 6", 102 | CNT_INTVAL }, 34215c5ab60SDaniel Mack { "LED: Channel A: Meter clip", 103 | CNT_INTVAL }, 34315c5ab60SDaniel Mack { "LED: Channel A: Active", 114 | CNT_INTVAL }, 34415c5ab60SDaniel Mack { "LED: Channel A: Cue", 116 | CNT_INTVAL }, 34515c5ab60SDaniel Mack { "LED: Channel A: FX1", 149 | CNT_INTVAL }, 34615c5ab60SDaniel Mack { "LED: Channel A: FX2", 148 | CNT_INTVAL }, 34715c5ab60SDaniel Mack 34815c5ab60SDaniel Mack { "LED: Channel B: >", 2 | CNT_INTVAL }, 34915c5ab60SDaniel Mack { "LED: Channel B: <", 3 | CNT_INTVAL }, 35015c5ab60SDaniel Mack { "LED: Channel B: Meter 1", 89 | CNT_INTVAL }, 35115c5ab60SDaniel Mack { "LED: Channel B: Meter 2", 90 | CNT_INTVAL }, 35215c5ab60SDaniel Mack { "LED: Channel B: Meter 3", 91 | CNT_INTVAL }, 35315c5ab60SDaniel Mack { "LED: Channel B: Meter 4", 92 | CNT_INTVAL }, 35415c5ab60SDaniel Mack { "LED: Channel B: Meter 5", 93 | CNT_INTVAL }, 35515c5ab60SDaniel Mack { "LED: Channel B: Meter 6", 94 | CNT_INTVAL }, 35615c5ab60SDaniel Mack { "LED: Channel B: Meter clip", 95 | CNT_INTVAL }, 35715c5ab60SDaniel Mack { "LED: Channel B: Active", 122 | CNT_INTVAL }, 35815c5ab60SDaniel Mack { "LED: Channel B: Cue", 125 | CNT_INTVAL }, 35915c5ab60SDaniel Mack { "LED: Channel B: FX1", 147 | CNT_INTVAL }, 36015c5ab60SDaniel Mack { "LED: Channel B: FX2", 146 | CNT_INTVAL }, 36115c5ab60SDaniel Mack 36215c5ab60SDaniel Mack { "LED: Channel C: >", 6 | CNT_INTVAL }, 36315c5ab60SDaniel Mack { "LED: Channel C: <", 7 | CNT_INTVAL }, 36415c5ab60SDaniel Mack { "LED: Channel C: Meter 1", 105 | CNT_INTVAL }, 36515c5ab60SDaniel Mack { "LED: Channel C: Meter 2", 106 | CNT_INTVAL }, 36615c5ab60SDaniel Mack { "LED: Channel C: Meter 3", 107 | CNT_INTVAL }, 36715c5ab60SDaniel Mack { "LED: Channel C: Meter 4", 108 | CNT_INTVAL }, 36815c5ab60SDaniel Mack { "LED: Channel C: Meter 5", 109 | CNT_INTVAL }, 36915c5ab60SDaniel Mack { "LED: Channel C: Meter 6", 110 | CNT_INTVAL }, 37015c5ab60SDaniel Mack { "LED: Channel C: Meter clip", 111 | CNT_INTVAL }, 37115c5ab60SDaniel Mack { "LED: Channel C: Active", 115 | CNT_INTVAL }, 37215c5ab60SDaniel Mack { "LED: Channel C: Cue", 117 | CNT_INTVAL }, 37315c5ab60SDaniel Mack { "LED: Channel C: FX1", 151 | CNT_INTVAL }, 37415c5ab60SDaniel Mack { "LED: Channel C: FX2", 150 | CNT_INTVAL }, 37515c5ab60SDaniel Mack 37615c5ab60SDaniel Mack { "LED: Channel D: >", 0 | CNT_INTVAL }, 37715c5ab60SDaniel Mack { "LED: Channel D: <", 1 | CNT_INTVAL }, 37815c5ab60SDaniel Mack { "LED: Channel D: Meter 1", 81 | CNT_INTVAL }, 37915c5ab60SDaniel Mack { "LED: Channel D: Meter 2", 82 | CNT_INTVAL }, 38015c5ab60SDaniel Mack { "LED: Channel D: Meter 3", 83 | CNT_INTVAL }, 38115c5ab60SDaniel Mack { "LED: Channel D: Meter 4", 84 | CNT_INTVAL }, 38215c5ab60SDaniel Mack { "LED: Channel D: Meter 5", 85 | CNT_INTVAL }, 38315c5ab60SDaniel Mack { "LED: Channel D: Meter 6", 86 | CNT_INTVAL }, 38415c5ab60SDaniel Mack { "LED: Channel D: Meter clip", 87 | CNT_INTVAL }, 38515c5ab60SDaniel Mack { "LED: Channel D: Active", 123 | CNT_INTVAL }, 38615c5ab60SDaniel Mack { "LED: Channel D: Cue", 124 | CNT_INTVAL }, 38715c5ab60SDaniel Mack { "LED: Channel D: FX1", 145 | CNT_INTVAL }, 38815c5ab60SDaniel Mack { "LED: Channel D: FX2", 144 | CNT_INTVAL }, 38915c5ab60SDaniel Mack 39015c5ab60SDaniel Mack { "LED: Deck A: 1 (blue)", 22 | CNT_INTVAL }, 39115c5ab60SDaniel Mack { "LED: Deck A: 1 (green)", 23 | CNT_INTVAL }, 39215c5ab60SDaniel Mack { "LED: Deck A: 2 (blue)", 20 | CNT_INTVAL }, 39315c5ab60SDaniel Mack { "LED: Deck A: 2 (green)", 21 | CNT_INTVAL }, 39415c5ab60SDaniel Mack { "LED: Deck A: 3 (blue)", 18 | CNT_INTVAL }, 39515c5ab60SDaniel Mack { "LED: Deck A: 3 (green)", 19 | CNT_INTVAL }, 39615c5ab60SDaniel Mack { "LED: Deck A: 4 (blue)", 16 | CNT_INTVAL }, 39715c5ab60SDaniel Mack { "LED: Deck A: 4 (green)", 17 | CNT_INTVAL }, 39815c5ab60SDaniel Mack { "LED: Deck A: Load", 44 | CNT_INTVAL }, 39915c5ab60SDaniel Mack { "LED: Deck A: Deck C button", 45 | CNT_INTVAL }, 40015c5ab60SDaniel Mack { "LED: Deck A: In", 47 | CNT_INTVAL }, 40115c5ab60SDaniel Mack { "LED: Deck A: Out", 46 | CNT_INTVAL }, 40215c5ab60SDaniel Mack { "LED: Deck A: Shift", 24 | CNT_INTVAL }, 40315c5ab60SDaniel Mack { "LED: Deck A: Sync", 27 | CNT_INTVAL }, 40415c5ab60SDaniel Mack { "LED: Deck A: Cue", 26 | CNT_INTVAL }, 40515c5ab60SDaniel Mack { "LED: Deck A: Play", 25 | CNT_INTVAL }, 40615c5ab60SDaniel Mack { "LED: Deck A: Tempo up", 33 | CNT_INTVAL }, 40715c5ab60SDaniel Mack { "LED: Deck A: Tempo down", 32 | CNT_INTVAL }, 40815c5ab60SDaniel Mack { "LED: Deck A: Master", 34 | CNT_INTVAL }, 40915c5ab60SDaniel Mack { "LED: Deck A: Keylock", 35 | CNT_INTVAL }, 41015c5ab60SDaniel Mack { "LED: Deck A: Deck A", 37 | CNT_INTVAL }, 41115c5ab60SDaniel Mack { "LED: Deck A: Deck C", 36 | CNT_INTVAL }, 41215c5ab60SDaniel Mack { "LED: Deck A: Samples", 38 | CNT_INTVAL }, 41315c5ab60SDaniel Mack { "LED: Deck A: On Air", 39 | CNT_INTVAL }, 41415c5ab60SDaniel Mack { "LED: Deck A: Sample 1", 31 | CNT_INTVAL }, 41515c5ab60SDaniel Mack { "LED: Deck A: Sample 2", 30 | CNT_INTVAL }, 41615c5ab60SDaniel Mack { "LED: Deck A: Sample 3", 29 | CNT_INTVAL }, 41715c5ab60SDaniel Mack { "LED: Deck A: Sample 4", 28 | CNT_INTVAL }, 41815c5ab60SDaniel Mack { "LED: Deck A: Digit 1 - A", 55 | CNT_INTVAL }, 41915c5ab60SDaniel Mack { "LED: Deck A: Digit 1 - B", 54 | CNT_INTVAL }, 42015c5ab60SDaniel Mack { "LED: Deck A: Digit 1 - C", 53 | CNT_INTVAL }, 42115c5ab60SDaniel Mack { "LED: Deck A: Digit 1 - D", 52 | CNT_INTVAL }, 42215c5ab60SDaniel Mack { "LED: Deck A: Digit 1 - E", 51 | CNT_INTVAL }, 42315c5ab60SDaniel Mack { "LED: Deck A: Digit 1 - F", 50 | CNT_INTVAL }, 42415c5ab60SDaniel Mack { "LED: Deck A: Digit 1 - G", 49 | CNT_INTVAL }, 42515c5ab60SDaniel Mack { "LED: Deck A: Digit 1 - dot", 48 | CNT_INTVAL }, 42615c5ab60SDaniel Mack { "LED: Deck A: Digit 2 - A", 63 | CNT_INTVAL }, 42715c5ab60SDaniel Mack { "LED: Deck A: Digit 2 - B", 62 | CNT_INTVAL }, 42815c5ab60SDaniel Mack { "LED: Deck A: Digit 2 - C", 61 | CNT_INTVAL }, 42915c5ab60SDaniel Mack { "LED: Deck A: Digit 2 - D", 60 | CNT_INTVAL }, 43015c5ab60SDaniel Mack { "LED: Deck A: Digit 2 - E", 59 | CNT_INTVAL }, 43115c5ab60SDaniel Mack { "LED: Deck A: Digit 2 - F", 58 | CNT_INTVAL }, 43215c5ab60SDaniel Mack { "LED: Deck A: Digit 2 - G", 57 | CNT_INTVAL }, 43315c5ab60SDaniel Mack { "LED: Deck A: Digit 2 - dot", 56 | CNT_INTVAL }, 43415c5ab60SDaniel Mack 43515c5ab60SDaniel Mack { "LED: Deck B: 1 (blue)", 78 | CNT_INTVAL }, 43615c5ab60SDaniel Mack { "LED: Deck B: 1 (green)", 79 | CNT_INTVAL }, 43715c5ab60SDaniel Mack { "LED: Deck B: 2 (blue)", 76 | CNT_INTVAL }, 43815c5ab60SDaniel Mack { "LED: Deck B: 2 (green)", 77 | CNT_INTVAL }, 43915c5ab60SDaniel Mack { "LED: Deck B: 3 (blue)", 74 | CNT_INTVAL }, 44015c5ab60SDaniel Mack { "LED: Deck B: 3 (green)", 75 | CNT_INTVAL }, 44115c5ab60SDaniel Mack { "LED: Deck B: 4 (blue)", 72 | CNT_INTVAL }, 44215c5ab60SDaniel Mack { "LED: Deck B: 4 (green)", 73 | CNT_INTVAL }, 44315c5ab60SDaniel Mack { "LED: Deck B: Load", 180 | CNT_INTVAL }, 44415c5ab60SDaniel Mack { "LED: Deck B: Deck D button", 181 | CNT_INTVAL }, 44515c5ab60SDaniel Mack { "LED: Deck B: In", 183 | CNT_INTVAL }, 44615c5ab60SDaniel Mack { "LED: Deck B: Out", 182 | CNT_INTVAL }, 44715c5ab60SDaniel Mack { "LED: Deck B: Shift", 64 | CNT_INTVAL }, 44815c5ab60SDaniel Mack { "LED: Deck B: Sync", 67 | CNT_INTVAL }, 44915c5ab60SDaniel Mack { "LED: Deck B: Cue", 66 | CNT_INTVAL }, 45015c5ab60SDaniel Mack { "LED: Deck B: Play", 65 | CNT_INTVAL }, 45115c5ab60SDaniel Mack { "LED: Deck B: Tempo up", 185 | CNT_INTVAL }, 45215c5ab60SDaniel Mack { "LED: Deck B: Tempo down", 184 | CNT_INTVAL }, 45315c5ab60SDaniel Mack { "LED: Deck B: Master", 186 | CNT_INTVAL }, 45415c5ab60SDaniel Mack { "LED: Deck B: Keylock", 187 | CNT_INTVAL }, 45515c5ab60SDaniel Mack { "LED: Deck B: Deck B", 189 | CNT_INTVAL }, 45615c5ab60SDaniel Mack { "LED: Deck B: Deck D", 188 | CNT_INTVAL }, 45715c5ab60SDaniel Mack { "LED: Deck B: Samples", 190 | CNT_INTVAL }, 45815c5ab60SDaniel Mack { "LED: Deck B: On Air", 191 | CNT_INTVAL }, 45915c5ab60SDaniel Mack { "LED: Deck B: Sample 1", 71 | CNT_INTVAL }, 46015c5ab60SDaniel Mack { "LED: Deck B: Sample 2", 70 | CNT_INTVAL }, 46115c5ab60SDaniel Mack { "LED: Deck B: Sample 3", 69 | CNT_INTVAL }, 46215c5ab60SDaniel Mack { "LED: Deck B: Sample 4", 68 | CNT_INTVAL }, 46315c5ab60SDaniel Mack { "LED: Deck B: Digit 1 - A", 175 | CNT_INTVAL }, 46415c5ab60SDaniel Mack { "LED: Deck B: Digit 1 - B", 174 | CNT_INTVAL }, 46515c5ab60SDaniel Mack { "LED: Deck B: Digit 1 - C", 173 | CNT_INTVAL }, 46615c5ab60SDaniel Mack { "LED: Deck B: Digit 1 - D", 172 | CNT_INTVAL }, 46715c5ab60SDaniel Mack { "LED: Deck B: Digit 1 - E", 171 | CNT_INTVAL }, 46815c5ab60SDaniel Mack { "LED: Deck B: Digit 1 - F", 170 | CNT_INTVAL }, 46915c5ab60SDaniel Mack { "LED: Deck B: Digit 1 - G", 169 | CNT_INTVAL }, 47015c5ab60SDaniel Mack { "LED: Deck B: Digit 1 - dot", 168 | CNT_INTVAL }, 47115c5ab60SDaniel Mack { "LED: Deck B: Digit 2 - A", 167 | CNT_INTVAL }, 47215c5ab60SDaniel Mack { "LED: Deck B: Digit 2 - B", 166 | CNT_INTVAL }, 47315c5ab60SDaniel Mack { "LED: Deck B: Digit 2 - C", 165 | CNT_INTVAL }, 47415c5ab60SDaniel Mack { "LED: Deck B: Digit 2 - D", 164 | CNT_INTVAL }, 47515c5ab60SDaniel Mack { "LED: Deck B: Digit 2 - E", 163 | CNT_INTVAL }, 47615c5ab60SDaniel Mack { "LED: Deck B: Digit 2 - F", 162 | CNT_INTVAL }, 47715c5ab60SDaniel Mack { "LED: Deck B: Digit 2 - G", 161 | CNT_INTVAL }, 47815c5ab60SDaniel Mack { "LED: Deck B: Digit 2 - dot", 160 | CNT_INTVAL }, 47915c5ab60SDaniel Mack 48015c5ab60SDaniel Mack { "LED: FX1: dry/wet", 153 | CNT_INTVAL }, 48115c5ab60SDaniel Mack { "LED: FX1: 1", 154 | CNT_INTVAL }, 48215c5ab60SDaniel Mack { "LED: FX1: 2", 155 | CNT_INTVAL }, 48315c5ab60SDaniel Mack { "LED: FX1: 3", 156 | CNT_INTVAL }, 48415c5ab60SDaniel Mack { "LED: FX1: Mode", 157 | CNT_INTVAL }, 48515c5ab60SDaniel Mack { "LED: FX2: dry/wet", 129 | CNT_INTVAL }, 48615c5ab60SDaniel Mack { "LED: FX2: 1", 130 | CNT_INTVAL }, 48715c5ab60SDaniel Mack { "LED: FX2: 2", 131 | CNT_INTVAL }, 48815c5ab60SDaniel Mack { "LED: FX2: 3", 132 | CNT_INTVAL }, 48915c5ab60SDaniel Mack { "LED: FX2: Mode", 133 | CNT_INTVAL }, 49015c5ab60SDaniel Mack }; 49115c5ab60SDaniel Mack 49214c56706SBill Pemberton static int add_controls(struct caiaq_controller *c, int num, 493*1c8470ceSDaniel Mack struct snd_usb_caiaqdev *cdev) 494936e7d03SDaniel Mack { 495936e7d03SDaniel Mack int i, ret; 496936e7d03SDaniel Mack struct snd_kcontrol *kc; 497936e7d03SDaniel Mack 498936e7d03SDaniel Mack for (i = 0; i < num; i++, c++) { 499936e7d03SDaniel Mack kcontrol_template.name = c->name; 500936e7d03SDaniel Mack kcontrol_template.private_value = c->index; 501*1c8470ceSDaniel Mack kc = snd_ctl_new1(&kcontrol_template, cdev); 502*1c8470ceSDaniel Mack ret = snd_ctl_add(cdev->chip.card, kc); 503936e7d03SDaniel Mack if (ret < 0) 504936e7d03SDaniel Mack return ret; 505936e7d03SDaniel Mack } 506936e7d03SDaniel Mack 507936e7d03SDaniel Mack return 0; 508936e7d03SDaniel Mack } 509936e7d03SDaniel Mack 510*1c8470ceSDaniel Mack int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *cdev) 511936e7d03SDaniel Mack { 512936e7d03SDaniel Mack int ret = 0; 513936e7d03SDaniel Mack 514*1c8470ceSDaniel Mack switch (cdev->chip.usb_id) { 515936e7d03SDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): 516936e7d03SDaniel Mack ret = add_controls(ak1_controller, 517*1c8470ceSDaniel Mack ARRAY_SIZE(ak1_controller), cdev); 518936e7d03SDaniel Mack break; 519936e7d03SDaniel Mack 520936e7d03SDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): 521936e7d03SDaniel Mack ret = add_controls(rk2_controller, 522*1c8470ceSDaniel Mack ARRAY_SIZE(rk2_controller), cdev); 523936e7d03SDaniel Mack break; 524936e7d03SDaniel Mack 525936e7d03SDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): 526936e7d03SDaniel Mack ret = add_controls(rk3_controller, 527*1c8470ceSDaniel Mack ARRAY_SIZE(rk3_controller), cdev); 528936e7d03SDaniel Mack break; 529936e7d03SDaniel Mack 530936e7d03SDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): 531936e7d03SDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): 532936e7d03SDaniel Mack ret = add_controls(kore_controller, 533*1c8470ceSDaniel Mack ARRAY_SIZE(kore_controller), cdev); 534936e7d03SDaniel Mack break; 535936e7d03SDaniel Mack 536936e7d03SDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): 537936e7d03SDaniel Mack ret = add_controls(a8dj_controller, 538*1c8470ceSDaniel Mack ARRAY_SIZE(a8dj_controller), cdev); 539936e7d03SDaniel Mack break; 5406da7a2aaSDaniel Mack 541936e7d03SDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): 542936e7d03SDaniel Mack ret = add_controls(a4dj_controller, 543*1c8470ceSDaniel Mack ARRAY_SIZE(a4dj_controller), cdev); 544936e7d03SDaniel Mack break; 5456da7a2aaSDaniel Mack 5466da7a2aaSDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): 5476da7a2aaSDaniel Mack ret = add_controls(kontrolx1_controller, 548*1c8470ceSDaniel Mack ARRAY_SIZE(kontrolx1_controller), cdev); 5496da7a2aaSDaniel Mack break; 55015c5ab60SDaniel Mack 55115c5ab60SDaniel Mack case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): 55215c5ab60SDaniel Mack ret = add_controls(kontrols4_controller, 553*1c8470ceSDaniel Mack ARRAY_SIZE(kontrols4_controller), cdev); 55415c5ab60SDaniel Mack break; 555936e7d03SDaniel Mack } 556936e7d03SDaniel Mack 557936e7d03SDaniel Mack return ret; 558936e7d03SDaniel Mack } 559936e7d03SDaniel Mack 560