18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *   Copyright (c) 2007 Daniel Mack
48c2ecf20Sopenharmony_ci *   friendly supported by NI.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <linux/device.h>
88c2ecf20Sopenharmony_ci#include <linux/init.h>
98c2ecf20Sopenharmony_ci#include <linux/usb.h>
108c2ecf20Sopenharmony_ci#include <sound/control.h>
118c2ecf20Sopenharmony_ci#include <sound/core.h>
128c2ecf20Sopenharmony_ci#include <sound/pcm.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "device.h"
158c2ecf20Sopenharmony_ci#include "control.h"
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define CNT_INTVAL 0x10000
188c2ecf20Sopenharmony_ci#define MASCHINE_BANK_SIZE 32
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistatic int control_info(struct snd_kcontrol *kcontrol,
218c2ecf20Sopenharmony_ci			struct snd_ctl_elem_info *uinfo)
228c2ecf20Sopenharmony_ci{
238c2ecf20Sopenharmony_ci	struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol);
248c2ecf20Sopenharmony_ci	struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card);
258c2ecf20Sopenharmony_ci	int pos = kcontrol->private_value;
268c2ecf20Sopenharmony_ci	int is_intval = pos & CNT_INTVAL;
278c2ecf20Sopenharmony_ci	int maxval = 63;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	uinfo->count = 1;
308c2ecf20Sopenharmony_ci	pos &= ~CNT_INTVAL;
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci	switch (cdev->chip.usb_id) {
338c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ):
348c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ):
358c2ecf20Sopenharmony_ci		if (pos == 0) {
368c2ecf20Sopenharmony_ci			/* current input mode of A8DJ and A4DJ */
378c2ecf20Sopenharmony_ci			uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
388c2ecf20Sopenharmony_ci			uinfo->value.integer.min = 0;
398c2ecf20Sopenharmony_ci			uinfo->value.integer.max = 2;
408c2ecf20Sopenharmony_ci			return 0;
418c2ecf20Sopenharmony_ci		}
428c2ecf20Sopenharmony_ci		break;
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1):
458c2ecf20Sopenharmony_ci		maxval = 127;
468c2ecf20Sopenharmony_ci		break;
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4):
498c2ecf20Sopenharmony_ci		maxval = 31;
508c2ecf20Sopenharmony_ci		break;
518c2ecf20Sopenharmony_ci	}
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	if (is_intval) {
548c2ecf20Sopenharmony_ci		uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
558c2ecf20Sopenharmony_ci		uinfo->value.integer.min = 0;
568c2ecf20Sopenharmony_ci		uinfo->value.integer.max = maxval;
578c2ecf20Sopenharmony_ci	} else {
588c2ecf20Sopenharmony_ci		uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
598c2ecf20Sopenharmony_ci		uinfo->value.integer.min = 0;
608c2ecf20Sopenharmony_ci		uinfo->value.integer.max = 1;
618c2ecf20Sopenharmony_ci	}
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	return 0;
648c2ecf20Sopenharmony_ci}
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_cistatic int control_get(struct snd_kcontrol *kcontrol,
678c2ecf20Sopenharmony_ci		       struct snd_ctl_elem_value *ucontrol)
688c2ecf20Sopenharmony_ci{
698c2ecf20Sopenharmony_ci	struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol);
708c2ecf20Sopenharmony_ci	struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card);
718c2ecf20Sopenharmony_ci	int pos = kcontrol->private_value;
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci	if (pos & CNT_INTVAL)
748c2ecf20Sopenharmony_ci		ucontrol->value.integer.value[0]
758c2ecf20Sopenharmony_ci			= cdev->control_state[pos & ~CNT_INTVAL];
768c2ecf20Sopenharmony_ci	else
778c2ecf20Sopenharmony_ci		ucontrol->value.integer.value[0]
788c2ecf20Sopenharmony_ci			= !!(cdev->control_state[pos / 8] & (1 << pos % 8));
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci	return 0;
818c2ecf20Sopenharmony_ci}
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_cistatic int control_put(struct snd_kcontrol *kcontrol,
848c2ecf20Sopenharmony_ci		       struct snd_ctl_elem_value *ucontrol)
858c2ecf20Sopenharmony_ci{
868c2ecf20Sopenharmony_ci	struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol);
878c2ecf20Sopenharmony_ci	struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card);
888c2ecf20Sopenharmony_ci	int pos = kcontrol->private_value;
898c2ecf20Sopenharmony_ci	int v = ucontrol->value.integer.value[0];
908c2ecf20Sopenharmony_ci	unsigned char cmd;
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci	switch (cdev->chip.usb_id) {
938c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER):
948c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1):
958c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2):
968c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER):
978c2ecf20Sopenharmony_ci		cmd = EP1_CMD_DIMM_LEDS;
988c2ecf20Sopenharmony_ci		break;
998c2ecf20Sopenharmony_ci	default:
1008c2ecf20Sopenharmony_ci		cmd = EP1_CMD_WRITE_IO;
1018c2ecf20Sopenharmony_ci		break;
1028c2ecf20Sopenharmony_ci	}
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci	if (pos & CNT_INTVAL) {
1058c2ecf20Sopenharmony_ci		int i = pos & ~CNT_INTVAL;
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci		cdev->control_state[i] = v;
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci		if (cdev->chip.usb_id ==
1108c2ecf20Sopenharmony_ci			USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4)) {
1118c2ecf20Sopenharmony_ci			int actual_len;
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci			cdev->ep8_out_buf[0] = i;
1148c2ecf20Sopenharmony_ci			cdev->ep8_out_buf[1] = v;
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci			usb_bulk_msg(cdev->chip.dev,
1178c2ecf20Sopenharmony_ci				     usb_sndbulkpipe(cdev->chip.dev, 8),
1188c2ecf20Sopenharmony_ci				     cdev->ep8_out_buf, sizeof(cdev->ep8_out_buf),
1198c2ecf20Sopenharmony_ci				     &actual_len, 200);
1208c2ecf20Sopenharmony_ci		} else if (cdev->chip.usb_id ==
1218c2ecf20Sopenharmony_ci			USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER)) {
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci			int bank = 0;
1248c2ecf20Sopenharmony_ci			int offset = 0;
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci			if (i >= MASCHINE_BANK_SIZE) {
1278c2ecf20Sopenharmony_ci				bank = 0x1e;
1288c2ecf20Sopenharmony_ci				offset = MASCHINE_BANK_SIZE;
1298c2ecf20Sopenharmony_ci			}
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci			snd_usb_caiaq_send_command_bank(cdev, cmd, bank,
1328c2ecf20Sopenharmony_ci					cdev->control_state + offset,
1338c2ecf20Sopenharmony_ci					MASCHINE_BANK_SIZE);
1348c2ecf20Sopenharmony_ci		} else {
1358c2ecf20Sopenharmony_ci			snd_usb_caiaq_send_command(cdev, cmd,
1368c2ecf20Sopenharmony_ci					cdev->control_state, sizeof(cdev->control_state));
1378c2ecf20Sopenharmony_ci		}
1388c2ecf20Sopenharmony_ci	} else {
1398c2ecf20Sopenharmony_ci		if (v)
1408c2ecf20Sopenharmony_ci			cdev->control_state[pos / 8] |= 1 << (pos % 8);
1418c2ecf20Sopenharmony_ci		else
1428c2ecf20Sopenharmony_ci			cdev->control_state[pos / 8] &= ~(1 << (pos % 8));
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci		snd_usb_caiaq_send_command(cdev, cmd,
1458c2ecf20Sopenharmony_ci				cdev->control_state, sizeof(cdev->control_state));
1468c2ecf20Sopenharmony_ci	}
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci	return 1;
1498c2ecf20Sopenharmony_ci}
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_cistatic struct snd_kcontrol_new kcontrol_template = {
1528c2ecf20Sopenharmony_ci	.iface = SNDRV_CTL_ELEM_IFACE_HWDEP,
1538c2ecf20Sopenharmony_ci	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
1548c2ecf20Sopenharmony_ci	.index = 0,
1558c2ecf20Sopenharmony_ci	.info = control_info,
1568c2ecf20Sopenharmony_ci	.get  = control_get,
1578c2ecf20Sopenharmony_ci	.put  = control_put,
1588c2ecf20Sopenharmony_ci	/* name and private_value filled later */
1598c2ecf20Sopenharmony_ci};
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_cistruct caiaq_controller {
1628c2ecf20Sopenharmony_ci	char *name;
1638c2ecf20Sopenharmony_ci	int index;
1648c2ecf20Sopenharmony_ci};
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_cistatic const struct caiaq_controller ak1_controller[] = {
1678c2ecf20Sopenharmony_ci	{ "LED left", 	2 },
1688c2ecf20Sopenharmony_ci	{ "LED middle", 1 },
1698c2ecf20Sopenharmony_ci	{ "LED right", 	0 },
1708c2ecf20Sopenharmony_ci	{ "LED ring", 	3 }
1718c2ecf20Sopenharmony_ci};
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_cistatic const struct caiaq_controller rk2_controller[] = {
1748c2ecf20Sopenharmony_ci	{ "LED 1",		5  },
1758c2ecf20Sopenharmony_ci	{ "LED 2",		4  },
1768c2ecf20Sopenharmony_ci	{ "LED 3",		3  },
1778c2ecf20Sopenharmony_ci	{ "LED 4",		2  },
1788c2ecf20Sopenharmony_ci	{ "LED 5",		1  },
1798c2ecf20Sopenharmony_ci	{ "LED 6",		0  },
1808c2ecf20Sopenharmony_ci	{ "LED pedal",		6  },
1818c2ecf20Sopenharmony_ci	{ "LED 7seg_1b",	8  },
1828c2ecf20Sopenharmony_ci	{ "LED 7seg_1c",	9  },
1838c2ecf20Sopenharmony_ci	{ "LED 7seg_2a",	10 },
1848c2ecf20Sopenharmony_ci	{ "LED 7seg_2b",	11 },
1858c2ecf20Sopenharmony_ci	{ "LED 7seg_2c",	12 },
1868c2ecf20Sopenharmony_ci	{ "LED 7seg_2d",	13 },
1878c2ecf20Sopenharmony_ci	{ "LED 7seg_2e",	14 },
1888c2ecf20Sopenharmony_ci	{ "LED 7seg_2f",	15 },
1898c2ecf20Sopenharmony_ci	{ "LED 7seg_2g",	16 },
1908c2ecf20Sopenharmony_ci	{ "LED 7seg_3a",	17 },
1918c2ecf20Sopenharmony_ci	{ "LED 7seg_3b",	18 },
1928c2ecf20Sopenharmony_ci	{ "LED 7seg_3c",	19 },
1938c2ecf20Sopenharmony_ci	{ "LED 7seg_3d",	20 },
1948c2ecf20Sopenharmony_ci	{ "LED 7seg_3e",	21 },
1958c2ecf20Sopenharmony_ci	{ "LED 7seg_3f",	22 },
1968c2ecf20Sopenharmony_ci	{ "LED 7seg_3g",	23 }
1978c2ecf20Sopenharmony_ci};
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_cistatic const struct caiaq_controller rk3_controller[] = {
2008c2ecf20Sopenharmony_ci	{ "LED 7seg_1a",        0 + 0 },
2018c2ecf20Sopenharmony_ci	{ "LED 7seg_1b",        0 + 1 },
2028c2ecf20Sopenharmony_ci	{ "LED 7seg_1c",        0 + 2 },
2038c2ecf20Sopenharmony_ci	{ "LED 7seg_1d",        0 + 3 },
2048c2ecf20Sopenharmony_ci	{ "LED 7seg_1e",        0 + 4 },
2058c2ecf20Sopenharmony_ci	{ "LED 7seg_1f",        0 + 5 },
2068c2ecf20Sopenharmony_ci	{ "LED 7seg_1g",        0 + 6 },
2078c2ecf20Sopenharmony_ci	{ "LED 7seg_1p",        0 + 7 },
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci	{ "LED 7seg_2a",        8 + 0 },
2108c2ecf20Sopenharmony_ci	{ "LED 7seg_2b",        8 + 1 },
2118c2ecf20Sopenharmony_ci	{ "LED 7seg_2c",        8 + 2 },
2128c2ecf20Sopenharmony_ci	{ "LED 7seg_2d",        8 + 3 },
2138c2ecf20Sopenharmony_ci	{ "LED 7seg_2e",        8 + 4 },
2148c2ecf20Sopenharmony_ci	{ "LED 7seg_2f",        8 + 5 },
2158c2ecf20Sopenharmony_ci	{ "LED 7seg_2g",        8 + 6 },
2168c2ecf20Sopenharmony_ci	{ "LED 7seg_2p",        8 + 7 },
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci	{ "LED 7seg_3a",        16 + 0 },
2198c2ecf20Sopenharmony_ci	{ "LED 7seg_3b",        16 + 1 },
2208c2ecf20Sopenharmony_ci	{ "LED 7seg_3c",        16 + 2 },
2218c2ecf20Sopenharmony_ci	{ "LED 7seg_3d",        16 + 3 },
2228c2ecf20Sopenharmony_ci	{ "LED 7seg_3e",        16 + 4 },
2238c2ecf20Sopenharmony_ci	{ "LED 7seg_3f",        16 + 5 },
2248c2ecf20Sopenharmony_ci	{ "LED 7seg_3g",        16 + 6 },
2258c2ecf20Sopenharmony_ci	{ "LED 7seg_3p",        16 + 7 },
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci	{ "LED 7seg_4a",        24 + 0 },
2288c2ecf20Sopenharmony_ci	{ "LED 7seg_4b",        24 + 1 },
2298c2ecf20Sopenharmony_ci	{ "LED 7seg_4c",        24 + 2 },
2308c2ecf20Sopenharmony_ci	{ "LED 7seg_4d",        24 + 3 },
2318c2ecf20Sopenharmony_ci	{ "LED 7seg_4e",        24 + 4 },
2328c2ecf20Sopenharmony_ci	{ "LED 7seg_4f",        24 + 5 },
2338c2ecf20Sopenharmony_ci	{ "LED 7seg_4g",        24 + 6 },
2348c2ecf20Sopenharmony_ci	{ "LED 7seg_4p",        24 + 7 },
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	{ "LED 1",		32 + 0 },
2378c2ecf20Sopenharmony_ci	{ "LED 2",		32 + 1 },
2388c2ecf20Sopenharmony_ci	{ "LED 3",		32 + 2 },
2398c2ecf20Sopenharmony_ci	{ "LED 4",		32 + 3 },
2408c2ecf20Sopenharmony_ci	{ "LED 5",		32 + 4 },
2418c2ecf20Sopenharmony_ci	{ "LED 6",		32 + 5 },
2428c2ecf20Sopenharmony_ci	{ "LED 7",		32 + 6 },
2438c2ecf20Sopenharmony_ci	{ "LED 8",		32 + 7 },
2448c2ecf20Sopenharmony_ci	{ "LED pedal",		32 + 8 }
2458c2ecf20Sopenharmony_ci};
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_cistatic const struct caiaq_controller kore_controller[] = {
2488c2ecf20Sopenharmony_ci	{ "LED F1",		8   | CNT_INTVAL },
2498c2ecf20Sopenharmony_ci	{ "LED F2",		12  | CNT_INTVAL },
2508c2ecf20Sopenharmony_ci	{ "LED F3",		0   | CNT_INTVAL },
2518c2ecf20Sopenharmony_ci	{ "LED F4",		4   | CNT_INTVAL },
2528c2ecf20Sopenharmony_ci	{ "LED F5",		11  | CNT_INTVAL },
2538c2ecf20Sopenharmony_ci	{ "LED F6",		15  | CNT_INTVAL },
2548c2ecf20Sopenharmony_ci	{ "LED F7",		3   | CNT_INTVAL },
2558c2ecf20Sopenharmony_ci	{ "LED F8",		7   | CNT_INTVAL },
2568c2ecf20Sopenharmony_ci	{ "LED touch1",	     	10  | CNT_INTVAL },
2578c2ecf20Sopenharmony_ci	{ "LED touch2",	     	14  | CNT_INTVAL },
2588c2ecf20Sopenharmony_ci	{ "LED touch3",	     	2   | CNT_INTVAL },
2598c2ecf20Sopenharmony_ci	{ "LED touch4",	     	6   | CNT_INTVAL },
2608c2ecf20Sopenharmony_ci	{ "LED touch5",	     	9   | CNT_INTVAL },
2618c2ecf20Sopenharmony_ci	{ "LED touch6",	     	13  | CNT_INTVAL },
2628c2ecf20Sopenharmony_ci	{ "LED touch7",	     	1   | CNT_INTVAL },
2638c2ecf20Sopenharmony_ci	{ "LED touch8",	     	5   | CNT_INTVAL },
2648c2ecf20Sopenharmony_ci	{ "LED left",	       	18  | CNT_INTVAL },
2658c2ecf20Sopenharmony_ci	{ "LED right",	     	22  | CNT_INTVAL },
2668c2ecf20Sopenharmony_ci	{ "LED up",		16  | CNT_INTVAL },
2678c2ecf20Sopenharmony_ci	{ "LED down",	       	20  | CNT_INTVAL },
2688c2ecf20Sopenharmony_ci	{ "LED stop",	       	23  | CNT_INTVAL },
2698c2ecf20Sopenharmony_ci	{ "LED play",	       	21  | CNT_INTVAL },
2708c2ecf20Sopenharmony_ci	{ "LED record",	     	19  | CNT_INTVAL },
2718c2ecf20Sopenharmony_ci	{ "LED listen",		17  | CNT_INTVAL },
2728c2ecf20Sopenharmony_ci	{ "LED lcd",		30  | CNT_INTVAL },
2738c2ecf20Sopenharmony_ci	{ "LED menu",		28  | CNT_INTVAL },
2748c2ecf20Sopenharmony_ci	{ "LED sound",	 	31  | CNT_INTVAL },
2758c2ecf20Sopenharmony_ci	{ "LED esc",		29  | CNT_INTVAL },
2768c2ecf20Sopenharmony_ci	{ "LED view",		27  | CNT_INTVAL },
2778c2ecf20Sopenharmony_ci	{ "LED enter",		24  | CNT_INTVAL },
2788c2ecf20Sopenharmony_ci	{ "LED control",	26  | CNT_INTVAL }
2798c2ecf20Sopenharmony_ci};
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_cistatic const struct caiaq_controller a8dj_controller[] = {
2828c2ecf20Sopenharmony_ci	{ "Current input mode",			0 | CNT_INTVAL 	},
2838c2ecf20Sopenharmony_ci	{ "GND lift for TC Vinyl mode", 	24 + 0 		},
2848c2ecf20Sopenharmony_ci	{ "GND lift for TC CD/Line mode", 	24 + 1 		},
2858c2ecf20Sopenharmony_ci	{ "GND lift for phono mode", 		24 + 2 		},
2868c2ecf20Sopenharmony_ci	{ "Software lock", 			40 		}
2878c2ecf20Sopenharmony_ci};
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_cistatic const struct caiaq_controller a4dj_controller[] = {
2908c2ecf20Sopenharmony_ci	{ "Current input mode",	0 | CNT_INTVAL 	}
2918c2ecf20Sopenharmony_ci};
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_cistatic const struct caiaq_controller kontrolx1_controller[] = {
2948c2ecf20Sopenharmony_ci	{ "LED FX A: ON",		7 | CNT_INTVAL	},
2958c2ecf20Sopenharmony_ci	{ "LED FX A: 1",		6 | CNT_INTVAL	},
2968c2ecf20Sopenharmony_ci	{ "LED FX A: 2",		5 | CNT_INTVAL	},
2978c2ecf20Sopenharmony_ci	{ "LED FX A: 3",		4 | CNT_INTVAL	},
2988c2ecf20Sopenharmony_ci	{ "LED FX B: ON",		3 | CNT_INTVAL	},
2998c2ecf20Sopenharmony_ci	{ "LED FX B: 1",		2 | CNT_INTVAL	},
3008c2ecf20Sopenharmony_ci	{ "LED FX B: 2",		1 | CNT_INTVAL	},
3018c2ecf20Sopenharmony_ci	{ "LED FX B: 3",		0 | CNT_INTVAL	},
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci	{ "LED Hotcue",			28 | CNT_INTVAL	},
3048c2ecf20Sopenharmony_ci	{ "LED Shift (white)",		29 | CNT_INTVAL	},
3058c2ecf20Sopenharmony_ci	{ "LED Shift (green)",		30 | CNT_INTVAL	},
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci	{ "LED Deck A: FX1",		24 | CNT_INTVAL	},
3088c2ecf20Sopenharmony_ci	{ "LED Deck A: FX2",		25 | CNT_INTVAL	},
3098c2ecf20Sopenharmony_ci	{ "LED Deck A: IN",		17 | CNT_INTVAL	},
3108c2ecf20Sopenharmony_ci	{ "LED Deck A: OUT",		16 | CNT_INTVAL	},
3118c2ecf20Sopenharmony_ci	{ "LED Deck A: < BEAT",		19 | CNT_INTVAL	},
3128c2ecf20Sopenharmony_ci	{ "LED Deck A: BEAT >",		18 | CNT_INTVAL	},
3138c2ecf20Sopenharmony_ci	{ "LED Deck A: CUE/ABS",	21 | CNT_INTVAL	},
3148c2ecf20Sopenharmony_ci	{ "LED Deck A: CUP/REL",	20 | CNT_INTVAL	},
3158c2ecf20Sopenharmony_ci	{ "LED Deck A: PLAY",		23 | CNT_INTVAL	},
3168c2ecf20Sopenharmony_ci	{ "LED Deck A: SYNC",		22 | CNT_INTVAL	},
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci	{ "LED Deck B: FX1",		26 | CNT_INTVAL	},
3198c2ecf20Sopenharmony_ci	{ "LED Deck B: FX2",		27 | CNT_INTVAL	},
3208c2ecf20Sopenharmony_ci	{ "LED Deck B: IN",		15 | CNT_INTVAL	},
3218c2ecf20Sopenharmony_ci	{ "LED Deck B: OUT",		14 | CNT_INTVAL	},
3228c2ecf20Sopenharmony_ci	{ "LED Deck B: < BEAT",		13 | CNT_INTVAL	},
3238c2ecf20Sopenharmony_ci	{ "LED Deck B: BEAT >",		12 | CNT_INTVAL	},
3248c2ecf20Sopenharmony_ci	{ "LED Deck B: CUE/ABS",	11 | CNT_INTVAL	},
3258c2ecf20Sopenharmony_ci	{ "LED Deck B: CUP/REL",	10 | CNT_INTVAL	},
3268c2ecf20Sopenharmony_ci	{ "LED Deck B: PLAY",		9  | CNT_INTVAL	},
3278c2ecf20Sopenharmony_ci	{ "LED Deck B: SYNC",		8  | CNT_INTVAL	},
3288c2ecf20Sopenharmony_ci};
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_cistatic const struct caiaq_controller kontrols4_controller[] = {
3318c2ecf20Sopenharmony_ci	{ "LED: Master: Quant",			10  | CNT_INTVAL },
3328c2ecf20Sopenharmony_ci	{ "LED: Master: Headphone",		11  | CNT_INTVAL },
3338c2ecf20Sopenharmony_ci	{ "LED: Master: Master",		12  | CNT_INTVAL },
3348c2ecf20Sopenharmony_ci	{ "LED: Master: Snap",			14  | CNT_INTVAL },
3358c2ecf20Sopenharmony_ci	{ "LED: Master: Warning",		15  | CNT_INTVAL },
3368c2ecf20Sopenharmony_ci	{ "LED: Master: Master button",		112 | CNT_INTVAL },
3378c2ecf20Sopenharmony_ci	{ "LED: Master: Snap button",		113 | CNT_INTVAL },
3388c2ecf20Sopenharmony_ci	{ "LED: Master: Rec",			118 | CNT_INTVAL },
3398c2ecf20Sopenharmony_ci	{ "LED: Master: Size",			119 | CNT_INTVAL },
3408c2ecf20Sopenharmony_ci	{ "LED: Master: Quant button",		120 | CNT_INTVAL },
3418c2ecf20Sopenharmony_ci	{ "LED: Master: Browser button",	121 | CNT_INTVAL },
3428c2ecf20Sopenharmony_ci	{ "LED: Master: Play button",		126 | CNT_INTVAL },
3438c2ecf20Sopenharmony_ci	{ "LED: Master: Undo button",		127 | CNT_INTVAL },
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci	{ "LED: Channel A: >",			4   | CNT_INTVAL },
3468c2ecf20Sopenharmony_ci	{ "LED: Channel A: <",			5   | CNT_INTVAL },
3478c2ecf20Sopenharmony_ci	{ "LED: Channel A: Meter 1",		97  | CNT_INTVAL },
3488c2ecf20Sopenharmony_ci	{ "LED: Channel A: Meter 2",		98  | CNT_INTVAL },
3498c2ecf20Sopenharmony_ci	{ "LED: Channel A: Meter 3",		99  | CNT_INTVAL },
3508c2ecf20Sopenharmony_ci	{ "LED: Channel A: Meter 4",		100 | CNT_INTVAL },
3518c2ecf20Sopenharmony_ci	{ "LED: Channel A: Meter 5",		101 | CNT_INTVAL },
3528c2ecf20Sopenharmony_ci	{ "LED: Channel A: Meter 6",		102 | CNT_INTVAL },
3538c2ecf20Sopenharmony_ci	{ "LED: Channel A: Meter clip",		103 | CNT_INTVAL },
3548c2ecf20Sopenharmony_ci	{ "LED: Channel A: Active",		114 | CNT_INTVAL },
3558c2ecf20Sopenharmony_ci	{ "LED: Channel A: Cue",		116 | CNT_INTVAL },
3568c2ecf20Sopenharmony_ci	{ "LED: Channel A: FX1",		149 | CNT_INTVAL },
3578c2ecf20Sopenharmony_ci	{ "LED: Channel A: FX2",		148 | CNT_INTVAL },
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci	{ "LED: Channel B: >",			2   | CNT_INTVAL },
3608c2ecf20Sopenharmony_ci	{ "LED: Channel B: <",			3   | CNT_INTVAL },
3618c2ecf20Sopenharmony_ci	{ "LED: Channel B: Meter 1",		89  | CNT_INTVAL },
3628c2ecf20Sopenharmony_ci	{ "LED: Channel B: Meter 2",		90  | CNT_INTVAL },
3638c2ecf20Sopenharmony_ci	{ "LED: Channel B: Meter 3",		91  | CNT_INTVAL },
3648c2ecf20Sopenharmony_ci	{ "LED: Channel B: Meter 4",		92  | CNT_INTVAL },
3658c2ecf20Sopenharmony_ci	{ "LED: Channel B: Meter 5",		93  | CNT_INTVAL },
3668c2ecf20Sopenharmony_ci	{ "LED: Channel B: Meter 6",		94  | CNT_INTVAL },
3678c2ecf20Sopenharmony_ci	{ "LED: Channel B: Meter clip",		95  | CNT_INTVAL },
3688c2ecf20Sopenharmony_ci	{ "LED: Channel B: Active",		122 | CNT_INTVAL },
3698c2ecf20Sopenharmony_ci	{ "LED: Channel B: Cue",		125 | CNT_INTVAL },
3708c2ecf20Sopenharmony_ci	{ "LED: Channel B: FX1",		147 | CNT_INTVAL },
3718c2ecf20Sopenharmony_ci	{ "LED: Channel B: FX2",		146 | CNT_INTVAL },
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci	{ "LED: Channel C: >",			6   | CNT_INTVAL },
3748c2ecf20Sopenharmony_ci	{ "LED: Channel C: <",			7   | CNT_INTVAL },
3758c2ecf20Sopenharmony_ci	{ "LED: Channel C: Meter 1",		105 | CNT_INTVAL },
3768c2ecf20Sopenharmony_ci	{ "LED: Channel C: Meter 2",		106 | CNT_INTVAL },
3778c2ecf20Sopenharmony_ci	{ "LED: Channel C: Meter 3",		107 | CNT_INTVAL },
3788c2ecf20Sopenharmony_ci	{ "LED: Channel C: Meter 4",		108 | CNT_INTVAL },
3798c2ecf20Sopenharmony_ci	{ "LED: Channel C: Meter 5",		109 | CNT_INTVAL },
3808c2ecf20Sopenharmony_ci	{ "LED: Channel C: Meter 6",		110 | CNT_INTVAL },
3818c2ecf20Sopenharmony_ci	{ "LED: Channel C: Meter clip",		111 | CNT_INTVAL },
3828c2ecf20Sopenharmony_ci	{ "LED: Channel C: Active",		115 | CNT_INTVAL },
3838c2ecf20Sopenharmony_ci	{ "LED: Channel C: Cue",		117 | CNT_INTVAL },
3848c2ecf20Sopenharmony_ci	{ "LED: Channel C: FX1",		151 | CNT_INTVAL },
3858c2ecf20Sopenharmony_ci	{ "LED: Channel C: FX2",		150 | CNT_INTVAL },
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci	{ "LED: Channel D: >",			0   | CNT_INTVAL },
3888c2ecf20Sopenharmony_ci	{ "LED: Channel D: <",			1   | CNT_INTVAL },
3898c2ecf20Sopenharmony_ci	{ "LED: Channel D: Meter 1",		81  | CNT_INTVAL },
3908c2ecf20Sopenharmony_ci	{ "LED: Channel D: Meter 2",		82  | CNT_INTVAL },
3918c2ecf20Sopenharmony_ci	{ "LED: Channel D: Meter 3",		83  | CNT_INTVAL },
3928c2ecf20Sopenharmony_ci	{ "LED: Channel D: Meter 4",		84  | CNT_INTVAL },
3938c2ecf20Sopenharmony_ci	{ "LED: Channel D: Meter 5",		85  | CNT_INTVAL },
3948c2ecf20Sopenharmony_ci	{ "LED: Channel D: Meter 6",		86  | CNT_INTVAL },
3958c2ecf20Sopenharmony_ci	{ "LED: Channel D: Meter clip",		87  | CNT_INTVAL },
3968c2ecf20Sopenharmony_ci	{ "LED: Channel D: Active",		123 | CNT_INTVAL },
3978c2ecf20Sopenharmony_ci	{ "LED: Channel D: Cue",		124 | CNT_INTVAL },
3988c2ecf20Sopenharmony_ci	{ "LED: Channel D: FX1",		145 | CNT_INTVAL },
3998c2ecf20Sopenharmony_ci	{ "LED: Channel D: FX2",		144 | CNT_INTVAL },
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci	{ "LED: Deck A: 1 (blue)",		22  | CNT_INTVAL },
4028c2ecf20Sopenharmony_ci	{ "LED: Deck A: 1 (green)",		23  | CNT_INTVAL },
4038c2ecf20Sopenharmony_ci	{ "LED: Deck A: 2 (blue)",		20  | CNT_INTVAL },
4048c2ecf20Sopenharmony_ci	{ "LED: Deck A: 2 (green)",		21  | CNT_INTVAL },
4058c2ecf20Sopenharmony_ci	{ "LED: Deck A: 3 (blue)",		18  | CNT_INTVAL },
4068c2ecf20Sopenharmony_ci	{ "LED: Deck A: 3 (green)",		19  | CNT_INTVAL },
4078c2ecf20Sopenharmony_ci	{ "LED: Deck A: 4 (blue)",		16  | CNT_INTVAL },
4088c2ecf20Sopenharmony_ci	{ "LED: Deck A: 4 (green)",		17  | CNT_INTVAL },
4098c2ecf20Sopenharmony_ci	{ "LED: Deck A: Load",			44  | CNT_INTVAL },
4108c2ecf20Sopenharmony_ci	{ "LED: Deck A: Deck C button",		45  | CNT_INTVAL },
4118c2ecf20Sopenharmony_ci	{ "LED: Deck A: In",			47  | CNT_INTVAL },
4128c2ecf20Sopenharmony_ci	{ "LED: Deck A: Out",			46  | CNT_INTVAL },
4138c2ecf20Sopenharmony_ci	{ "LED: Deck A: Shift",			24  | CNT_INTVAL },
4148c2ecf20Sopenharmony_ci	{ "LED: Deck A: Sync",			27  | CNT_INTVAL },
4158c2ecf20Sopenharmony_ci	{ "LED: Deck A: Cue",			26  | CNT_INTVAL },
4168c2ecf20Sopenharmony_ci	{ "LED: Deck A: Play",			25  | CNT_INTVAL },
4178c2ecf20Sopenharmony_ci	{ "LED: Deck A: Tempo up",		33  | CNT_INTVAL },
4188c2ecf20Sopenharmony_ci	{ "LED: Deck A: Tempo down",		32  | CNT_INTVAL },
4198c2ecf20Sopenharmony_ci	{ "LED: Deck A: Master",		34  | CNT_INTVAL },
4208c2ecf20Sopenharmony_ci	{ "LED: Deck A: Keylock",		35  | CNT_INTVAL },
4218c2ecf20Sopenharmony_ci	{ "LED: Deck A: Deck A",		37  | CNT_INTVAL },
4228c2ecf20Sopenharmony_ci	{ "LED: Deck A: Deck C",		36  | CNT_INTVAL },
4238c2ecf20Sopenharmony_ci	{ "LED: Deck A: Samples",		38  | CNT_INTVAL },
4248c2ecf20Sopenharmony_ci	{ "LED: Deck A: On Air",		39  | CNT_INTVAL },
4258c2ecf20Sopenharmony_ci	{ "LED: Deck A: Sample 1",		31  | CNT_INTVAL },
4268c2ecf20Sopenharmony_ci	{ "LED: Deck A: Sample 2",		30  | CNT_INTVAL },
4278c2ecf20Sopenharmony_ci	{ "LED: Deck A: Sample 3",		29  | CNT_INTVAL },
4288c2ecf20Sopenharmony_ci	{ "LED: Deck A: Sample 4",		28  | CNT_INTVAL },
4298c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 1 - A",		55  | CNT_INTVAL },
4308c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 1 - B",		54  | CNT_INTVAL },
4318c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 1 - C",		53  | CNT_INTVAL },
4328c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 1 - D",		52  | CNT_INTVAL },
4338c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 1 - E",		51  | CNT_INTVAL },
4348c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 1 - F",		50  | CNT_INTVAL },
4358c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 1 - G",		49  | CNT_INTVAL },
4368c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 1 - dot",		48  | CNT_INTVAL },
4378c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 2 - A",		63  | CNT_INTVAL },
4388c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 2 - B",		62  | CNT_INTVAL },
4398c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 2 - C",		61  | CNT_INTVAL },
4408c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 2 - D",		60  | CNT_INTVAL },
4418c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 2 - E",		59  | CNT_INTVAL },
4428c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 2 - F",		58  | CNT_INTVAL },
4438c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 2 - G",		57  | CNT_INTVAL },
4448c2ecf20Sopenharmony_ci	{ "LED: Deck A: Digit 2 - dot",		56  | CNT_INTVAL },
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci	{ "LED: Deck B: 1 (blue)",		78  | CNT_INTVAL },
4478c2ecf20Sopenharmony_ci	{ "LED: Deck B: 1 (green)",		79  | CNT_INTVAL },
4488c2ecf20Sopenharmony_ci	{ "LED: Deck B: 2 (blue)",		76  | CNT_INTVAL },
4498c2ecf20Sopenharmony_ci	{ "LED: Deck B: 2 (green)",		77  | CNT_INTVAL },
4508c2ecf20Sopenharmony_ci	{ "LED: Deck B: 3 (blue)",		74  | CNT_INTVAL },
4518c2ecf20Sopenharmony_ci	{ "LED: Deck B: 3 (green)",		75  | CNT_INTVAL },
4528c2ecf20Sopenharmony_ci	{ "LED: Deck B: 4 (blue)",		72  | CNT_INTVAL },
4538c2ecf20Sopenharmony_ci	{ "LED: Deck B: 4 (green)",		73  | CNT_INTVAL },
4548c2ecf20Sopenharmony_ci	{ "LED: Deck B: Load",			180 | CNT_INTVAL },
4558c2ecf20Sopenharmony_ci	{ "LED: Deck B: Deck D button",		181 | CNT_INTVAL },
4568c2ecf20Sopenharmony_ci	{ "LED: Deck B: In",			183 | CNT_INTVAL },
4578c2ecf20Sopenharmony_ci	{ "LED: Deck B: Out",			182 | CNT_INTVAL },
4588c2ecf20Sopenharmony_ci	{ "LED: Deck B: Shift",			64  | CNT_INTVAL },
4598c2ecf20Sopenharmony_ci	{ "LED: Deck B: Sync",			67  | CNT_INTVAL },
4608c2ecf20Sopenharmony_ci	{ "LED: Deck B: Cue",			66  | CNT_INTVAL },
4618c2ecf20Sopenharmony_ci	{ "LED: Deck B: Play",			65  | CNT_INTVAL },
4628c2ecf20Sopenharmony_ci	{ "LED: Deck B: Tempo up",		185 | CNT_INTVAL },
4638c2ecf20Sopenharmony_ci	{ "LED: Deck B: Tempo down",		184 | CNT_INTVAL },
4648c2ecf20Sopenharmony_ci	{ "LED: Deck B: Master",		186 | CNT_INTVAL },
4658c2ecf20Sopenharmony_ci	{ "LED: Deck B: Keylock",		187 | CNT_INTVAL },
4668c2ecf20Sopenharmony_ci	{ "LED: Deck B: Deck B",		189 | CNT_INTVAL },
4678c2ecf20Sopenharmony_ci	{ "LED: Deck B: Deck D",		188 | CNT_INTVAL },
4688c2ecf20Sopenharmony_ci	{ "LED: Deck B: Samples",		190 | CNT_INTVAL },
4698c2ecf20Sopenharmony_ci	{ "LED: Deck B: On Air",		191 | CNT_INTVAL },
4708c2ecf20Sopenharmony_ci	{ "LED: Deck B: Sample 1",		71  | CNT_INTVAL },
4718c2ecf20Sopenharmony_ci	{ "LED: Deck B: Sample 2",		70  | CNT_INTVAL },
4728c2ecf20Sopenharmony_ci	{ "LED: Deck B: Sample 3",		69  | CNT_INTVAL },
4738c2ecf20Sopenharmony_ci	{ "LED: Deck B: Sample 4",		68  | CNT_INTVAL },
4748c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 1 - A",		175 | CNT_INTVAL },
4758c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 1 - B",		174 | CNT_INTVAL },
4768c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 1 - C",		173 | CNT_INTVAL },
4778c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 1 - D",		172 | CNT_INTVAL },
4788c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 1 - E",		171 | CNT_INTVAL },
4798c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 1 - F",		170 | CNT_INTVAL },
4808c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 1 - G",		169 | CNT_INTVAL },
4818c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 1 - dot",		168 | CNT_INTVAL },
4828c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 2 - A",		167 | CNT_INTVAL },
4838c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 2 - B",		166 | CNT_INTVAL },
4848c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 2 - C",		165 | CNT_INTVAL },
4858c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 2 - D",		164 | CNT_INTVAL },
4868c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 2 - E",		163 | CNT_INTVAL },
4878c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 2 - F",		162 | CNT_INTVAL },
4888c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 2 - G",		161 | CNT_INTVAL },
4898c2ecf20Sopenharmony_ci	{ "LED: Deck B: Digit 2 - dot",		160 | CNT_INTVAL },
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci	{ "LED: FX1: dry/wet",			153 | CNT_INTVAL },
4928c2ecf20Sopenharmony_ci	{ "LED: FX1: 1",			154 | CNT_INTVAL },
4938c2ecf20Sopenharmony_ci	{ "LED: FX1: 2",			155 | CNT_INTVAL },
4948c2ecf20Sopenharmony_ci	{ "LED: FX1: 3",			156 | CNT_INTVAL },
4958c2ecf20Sopenharmony_ci	{ "LED: FX1: Mode",			157 | CNT_INTVAL },
4968c2ecf20Sopenharmony_ci	{ "LED: FX2: dry/wet",			129 | CNT_INTVAL },
4978c2ecf20Sopenharmony_ci	{ "LED: FX2: 1",			130 | CNT_INTVAL },
4988c2ecf20Sopenharmony_ci	{ "LED: FX2: 2",			131 | CNT_INTVAL },
4998c2ecf20Sopenharmony_ci	{ "LED: FX2: 3",			132 | CNT_INTVAL },
5008c2ecf20Sopenharmony_ci	{ "LED: FX2: Mode",			133 | CNT_INTVAL },
5018c2ecf20Sopenharmony_ci};
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_cistatic const struct caiaq_controller maschine_controller[] = {
5048c2ecf20Sopenharmony_ci	{ "LED: Pad 1",				3  | CNT_INTVAL },
5058c2ecf20Sopenharmony_ci	{ "LED: Pad 2",				2  | CNT_INTVAL },
5068c2ecf20Sopenharmony_ci	{ "LED: Pad 3",				1  | CNT_INTVAL },
5078c2ecf20Sopenharmony_ci	{ "LED: Pad 4",				0  | CNT_INTVAL },
5088c2ecf20Sopenharmony_ci	{ "LED: Pad 5",				7  | CNT_INTVAL },
5098c2ecf20Sopenharmony_ci	{ "LED: Pad 6",				6  | CNT_INTVAL },
5108c2ecf20Sopenharmony_ci	{ "LED: Pad 7",				5  | CNT_INTVAL },
5118c2ecf20Sopenharmony_ci	{ "LED: Pad 8",				4  | CNT_INTVAL },
5128c2ecf20Sopenharmony_ci	{ "LED: Pad 9",				11 | CNT_INTVAL },
5138c2ecf20Sopenharmony_ci	{ "LED: Pad 10",			10 | CNT_INTVAL },
5148c2ecf20Sopenharmony_ci	{ "LED: Pad 11",			9  | CNT_INTVAL },
5158c2ecf20Sopenharmony_ci	{ "LED: Pad 12",			8  | CNT_INTVAL },
5168c2ecf20Sopenharmony_ci	{ "LED: Pad 13",			15 | CNT_INTVAL },
5178c2ecf20Sopenharmony_ci	{ "LED: Pad 14",			14 | CNT_INTVAL },
5188c2ecf20Sopenharmony_ci	{ "LED: Pad 15",			13 | CNT_INTVAL },
5198c2ecf20Sopenharmony_ci	{ "LED: Pad 16",			12 | CNT_INTVAL },
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci	{ "LED: Mute",				16 | CNT_INTVAL },
5228c2ecf20Sopenharmony_ci	{ "LED: Solo",				17 | CNT_INTVAL },
5238c2ecf20Sopenharmony_ci	{ "LED: Select",			18 | CNT_INTVAL },
5248c2ecf20Sopenharmony_ci	{ "LED: Duplicate",			19 | CNT_INTVAL },
5258c2ecf20Sopenharmony_ci	{ "LED: Navigate",			20 | CNT_INTVAL },
5268c2ecf20Sopenharmony_ci	{ "LED: Pad Mode",			21 | CNT_INTVAL },
5278c2ecf20Sopenharmony_ci	{ "LED: Pattern",			22 | CNT_INTVAL },
5288c2ecf20Sopenharmony_ci	{ "LED: Scene",				23 | CNT_INTVAL },
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_ci	{ "LED: Shift",				24 | CNT_INTVAL },
5318c2ecf20Sopenharmony_ci	{ "LED: Erase",				25 | CNT_INTVAL },
5328c2ecf20Sopenharmony_ci	{ "LED: Grid",				26 | CNT_INTVAL },
5338c2ecf20Sopenharmony_ci	{ "LED: Right Bottom",			27 | CNT_INTVAL },
5348c2ecf20Sopenharmony_ci	{ "LED: Rec",				28 | CNT_INTVAL },
5358c2ecf20Sopenharmony_ci	{ "LED: Play",				29 | CNT_INTVAL },
5368c2ecf20Sopenharmony_ci	{ "LED: Left Bottom",			32 | CNT_INTVAL },
5378c2ecf20Sopenharmony_ci	{ "LED: Restart",			33 | CNT_INTVAL },
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci	{ "LED: Group A",			41 | CNT_INTVAL },
5408c2ecf20Sopenharmony_ci	{ "LED: Group B",			40 | CNT_INTVAL },
5418c2ecf20Sopenharmony_ci	{ "LED: Group C",			37 | CNT_INTVAL },
5428c2ecf20Sopenharmony_ci	{ "LED: Group D",			36 | CNT_INTVAL },
5438c2ecf20Sopenharmony_ci	{ "LED: Group E",			39 | CNT_INTVAL },
5448c2ecf20Sopenharmony_ci	{ "LED: Group F",			38 | CNT_INTVAL },
5458c2ecf20Sopenharmony_ci	{ "LED: Group G",			35 | CNT_INTVAL },
5468c2ecf20Sopenharmony_ci	{ "LED: Group H",			34 | CNT_INTVAL },
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci	{ "LED: Auto Write",			42 | CNT_INTVAL },
5498c2ecf20Sopenharmony_ci	{ "LED: Snap",				43 | CNT_INTVAL },
5508c2ecf20Sopenharmony_ci	{ "LED: Right Top",			44 | CNT_INTVAL },
5518c2ecf20Sopenharmony_ci	{ "LED: Left Top",			45 | CNT_INTVAL },
5528c2ecf20Sopenharmony_ci	{ "LED: Sampling",			46 | CNT_INTVAL },
5538c2ecf20Sopenharmony_ci	{ "LED: Browse",			47 | CNT_INTVAL },
5548c2ecf20Sopenharmony_ci	{ "LED: Step",				48 | CNT_INTVAL },
5558c2ecf20Sopenharmony_ci	{ "LED: Control",			49 | CNT_INTVAL },
5568c2ecf20Sopenharmony_ci
5578c2ecf20Sopenharmony_ci	{ "LED: Top Button 1",			57 | CNT_INTVAL },
5588c2ecf20Sopenharmony_ci	{ "LED: Top Button 2",			56 | CNT_INTVAL },
5598c2ecf20Sopenharmony_ci	{ "LED: Top Button 3",			55 | CNT_INTVAL },
5608c2ecf20Sopenharmony_ci	{ "LED: Top Button 4",			54 | CNT_INTVAL },
5618c2ecf20Sopenharmony_ci	{ "LED: Top Button 5",			53 | CNT_INTVAL },
5628c2ecf20Sopenharmony_ci	{ "LED: Top Button 6",			52 | CNT_INTVAL },
5638c2ecf20Sopenharmony_ci	{ "LED: Top Button 7",			51 | CNT_INTVAL },
5648c2ecf20Sopenharmony_ci	{ "LED: Top Button 8",			50 | CNT_INTVAL },
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ci	{ "LED: Note Repeat",			58 | CNT_INTVAL },
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci	{ "Backlight Display",			59 | CNT_INTVAL }
5698c2ecf20Sopenharmony_ci};
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_cistatic int add_controls(const struct caiaq_controller *c, int num,
5728c2ecf20Sopenharmony_ci			struct snd_usb_caiaqdev *cdev)
5738c2ecf20Sopenharmony_ci{
5748c2ecf20Sopenharmony_ci	int i, ret;
5758c2ecf20Sopenharmony_ci	struct snd_kcontrol *kc;
5768c2ecf20Sopenharmony_ci
5778c2ecf20Sopenharmony_ci	for (i = 0; i < num; i++, c++) {
5788c2ecf20Sopenharmony_ci		kcontrol_template.name = c->name;
5798c2ecf20Sopenharmony_ci		kcontrol_template.private_value = c->index;
5808c2ecf20Sopenharmony_ci		kc = snd_ctl_new1(&kcontrol_template, cdev);
5818c2ecf20Sopenharmony_ci		ret = snd_ctl_add(cdev->chip.card, kc);
5828c2ecf20Sopenharmony_ci		if (ret < 0)
5838c2ecf20Sopenharmony_ci			return ret;
5848c2ecf20Sopenharmony_ci	}
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci	return 0;
5878c2ecf20Sopenharmony_ci}
5888c2ecf20Sopenharmony_ci
5898c2ecf20Sopenharmony_ciint snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *cdev)
5908c2ecf20Sopenharmony_ci{
5918c2ecf20Sopenharmony_ci	int ret = 0;
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci	switch (cdev->chip.usb_id) {
5948c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1):
5958c2ecf20Sopenharmony_ci		ret = add_controls(ak1_controller,
5968c2ecf20Sopenharmony_ci			ARRAY_SIZE(ak1_controller), cdev);
5978c2ecf20Sopenharmony_ci		break;
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2):
6008c2ecf20Sopenharmony_ci		ret = add_controls(rk2_controller,
6018c2ecf20Sopenharmony_ci			ARRAY_SIZE(rk2_controller), cdev);
6028c2ecf20Sopenharmony_ci		break;
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3):
6058c2ecf20Sopenharmony_ci		ret = add_controls(rk3_controller,
6068c2ecf20Sopenharmony_ci			ARRAY_SIZE(rk3_controller), cdev);
6078c2ecf20Sopenharmony_ci		break;
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER):
6108c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2):
6118c2ecf20Sopenharmony_ci		ret = add_controls(kore_controller,
6128c2ecf20Sopenharmony_ci			ARRAY_SIZE(kore_controller), cdev);
6138c2ecf20Sopenharmony_ci		break;
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ):
6168c2ecf20Sopenharmony_ci		ret = add_controls(a8dj_controller,
6178c2ecf20Sopenharmony_ci			ARRAY_SIZE(a8dj_controller), cdev);
6188c2ecf20Sopenharmony_ci		break;
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ):
6218c2ecf20Sopenharmony_ci		ret = add_controls(a4dj_controller,
6228c2ecf20Sopenharmony_ci			ARRAY_SIZE(a4dj_controller), cdev);
6238c2ecf20Sopenharmony_ci		break;
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1):
6268c2ecf20Sopenharmony_ci		ret = add_controls(kontrolx1_controller,
6278c2ecf20Sopenharmony_ci			ARRAY_SIZE(kontrolx1_controller), cdev);
6288c2ecf20Sopenharmony_ci		break;
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4):
6318c2ecf20Sopenharmony_ci		ret = add_controls(kontrols4_controller,
6328c2ecf20Sopenharmony_ci			ARRAY_SIZE(kontrols4_controller), cdev);
6338c2ecf20Sopenharmony_ci		break;
6348c2ecf20Sopenharmony_ci
6358c2ecf20Sopenharmony_ci	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER):
6368c2ecf20Sopenharmony_ci		ret = add_controls(maschine_controller,
6378c2ecf20Sopenharmony_ci			ARRAY_SIZE(maschine_controller), cdev);
6388c2ecf20Sopenharmony_ci		break;
6398c2ecf20Sopenharmony_ci	}
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ci	return ret;
6428c2ecf20Sopenharmony_ci}
6438c2ecf20Sopenharmony_ci
644