// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Tascam US-16x08 ALSA driver
*
* Copyright (c) 2016 by Detlef Urban (onkel@paraair.de)
*/
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/usb/audio-v2.h>
#include <sound/core.h>
#include <sound/control.h>
#include "usbaudio.h"
#include "mixer.h"
#include "helper.h"
#include "mixer_us16x08.h"
/* USB control message templates */
static const char route_msg[] = {
0x61,
0x02,
0x03, /* input from master (0x02) or input from computer bus (0x03) */
0x62,
0x02,
0x01, /* input index (0x01/0x02 eq. left/right) or bus (0x01-0x08) */
0x41,
0x01,
0x61,
0x02,
0x01,
0x62,
0x02,
0x01, /* output index (0x01-0x08) */
0x42,
0x01,
0x43,
0x01,
0x00,
0x00
};
static const char mix_init_msg1[] = {
0x71, 0x01, 0x00, 0x00
};
static const char mix_init_msg2[] = {
0x62, 0x02, 0x00, 0x61, 0x02, 0x04, 0xb1, 0x01, 0x00, 0x00
};
static const char mix_msg_in[] = {
/* default message head, equal to all mixers */
0x61, 0x02, 0x04, 0x62, 0x02, 0x01,
0x81, /* 0x06: Controller ID */
0x02, /* 0x07: */
0x00, /* 0x08: Value of common mixer */
0x00,
0x00
};
static const char mix_msg_out[] = {
/* default message head, equal to all mixers */
0x61, 0x02, 0x02, 0x62, 0x02, 0x01,
0x81, /* 0x06: Controller ID */
0x02, /* 0x07: */
0x00, /* 0x08: Value of common mixer */
0x00,
0x00
};
static const char bypass_msg_out[] = {
0x45,
0x02,
0x01, /* on/off flag */
0x00,
0x00
};
static const char bus_msg_out[] = {
0x44,
0x02,
0x01, /* on/off flag */
0x00,
0x00
};
static const char comp_msg[] = {
/* default message head, equal to all mixers */
0x61, 0x02, 0x04, 0x62, 0x02, 0x01,
0x91,
0x02,
0xf0, /* 0x08: Threshold db (8) (e0 ... 00) (+-0dB -- -32dB) x-32 */
0x92,