// SPDX-License-Identifier: GPL-2.0
/*
 *   Focusrite Scarlett 2 Protocol Driver for ALSA
 *   (including Scarlett 2nd Gen, 3rd Gen, 4th Gen, Clarett USB, and
 *   Clarett+ series products)
 *
 *   Supported models:
 *   - 6i6/18i8/18i20 Gen 2
 *   - Solo/2i2/4i4/8i6/18i8/18i20 Gen 3
 *   - Solo/2i2/4i4 Gen 4
 *   - Clarett 2Pre/4Pre/8Pre USB
 *   - Clarett+ 2Pre/4Pre/8Pre
 *
 *   Copyright (c) 2018-2023 by Geoffrey D. Bennett <g at b4.vu>
 *   Copyright (c) 2020-2021 by Vladimir Sadovnikov <sadko4u@gmail.com>
 *   Copyright (c) 2022 by Christian Colglazier <christian@cacolglazier.com>
 *
 *   Based on the Scarlett (Gen 1) Driver for ALSA:
 *
 *   Copyright (c) 2013 by Tobias Hoffmann
 *   Copyright (c) 2013 by Robin Gareus <robin at gareus.org>
 *   Copyright (c) 2002 by Takashi Iwai <tiwai at suse.de>
 *   Copyright (c) 2014 by Chris J Arges <chris.j.arges at canonical.com>
 *
 *   Many codes borrowed from audio.c by
 *     Alan Cox (alan at lxorguk.ukuu.org.uk)
 *     Thomas Sailer (sailer at ife.ee.ethz.ch)
 *
 *   Code cleanup:
 *   David Henningsson <david.henningsson at canonical.com>
 */

/* The protocol was reverse engineered by looking at the communication
 * between Focusrite Control 2.3.4 and the Focusrite(R) Scarlett 18i20
 * (firmware 1083) using usbmon in July-August 2018.
 *
 * Scarlett 18i8 support added in April 2019.
 *
 * Scarlett 6i6 support added in June 2019 (thanks to Martin Wittmann
 * for providing usbmon output and testing).
 *
 * Scarlett 4i4/8i6 Gen 3 support added in May 2020 (thanks to Laurent
 * Debricon for donating a 4i4 and to Fredrik Unger for providing 8i6
 * usbmon output and testing).
 *
 * Scarlett 18i8/18i20 Gen 3 support added in June 2020 (thanks to
 * Darren Jaeckel, Alex Sedlack, and Clovis Lunel for providing usbmon
 * output, protocol traces and testing).
 *
 * Support for loading mixer volume and mux configuration from the
 * interface during driver initialisation added in May 2021 (thanks to
 * Vladimir Sadovnikov for figuring out how).
 *
 * Support for Solo/2i2 Gen 3 added in May 2021 (thanks to Alexander
 * Vorona for 2i2 protocol traces).
 *
 * Support for phantom power, direct monitoring, speaker switching,
 * and talkback added in May-June 2021.
 *
 * Support for Clarett+ 8Pre added in Aug 2022 by Christian
 * Colglazier.
 *
 * Support for Clarett 8Pre USB added in Sep 2023 (thanks to Philippe
 * Perrot for confirmation).
 *
 * Support for Clarett+ 4Pre and 2Pre added in Sep 2023 (thanks to
 * Gregory Rozzo for donating a 4Pre, and David Sherwood and Patrice
 * Peterson for usbmon output).
 *
 * Support for Clarett 2Pre and 4Pre USB added in Oct 2023.
 *
 * Support for firmware updates added in Dec 2023.
 *
 * Support for Scarlett Solo/2i2/4i4 Gen 4 added in Dec 2023 (thanks
 * to many LinuxMusicians people and to Focusrite for hardware
 * donations).
 *
 * This ALSA mixer gives access to (model-dependent):
 *  - input, output, mixer-matrix muxes
 *  - mixer-matrix gain stages
 *  - gain/volume/mute controls
 *  - level meters
 *  - line/inst level, pad, and air controls
 *  - phantom power, direct monitor, speaker switching, and talkback
 *    controls
 *  - disable/enable MSD mode
 *  - disable/enable standalone mode
 *  - input mute, gain, autogain, safe mode
 *  - direct monitor mixes
 *  - compressor and EQ
 *  - Bluetooth volume
 *
 * <ditaa>
 *    /--------------\    18chn            20chn     /--------------\
 *    | Hardware  in +--+------\    /-------------+--+ ALSA PCM out |
 *    \--------------/  |      |    |             |  \--------------/
 *                      |      |    |    /-----\  |
 *                      |      |    |    |     |  |
 *                      |      v    v    v     |  |
 *                      |   +---------------+  |  |
 *                      |    \ Matrix  Mux /   |  |
 *                      |     +-----+-----+    |  |
 *                      |           |          |  |
 *                      |           |18chn     |  |
 *                      |           |          |  |
 *                      |           |     10chn|  |
 *                      |           v          |  |
 *                      |     +------------+   |  |
 *                      |     | Mixer      |   |  |
 *                      |     |     Matrix |   |  |
 *                      |     |            |   |  |
 *                      |     | 18x10 Gain |   |  |
 *                      |     |   stages   |   |  |
 *                      |     +-----+------+   |  |
 *                      |           |          |  |
 *                      |18chn      |10chn     |  |20chn
 *                      |           |          |  |
 *                      |           +----------/  |
 *                      |           |             |
 *                      v           v             v
 *                      ===========================
 *               +---------------+       +--—------------+
 *                \ Output  Mux /         \ Capture Mux /
 *                 +---+---+---+           +-----+-----+
 *                     |   |                     |
 *                10chn|   |                     |18chn
 *                     |   |                     |
 *  /--------------\   |   |                     |   /--------------\
 *  | S/PDIF, ADAT |<--/   |10chn                \-->| ALSA PCM in  |
 *  | Hardware out |       |                         \--------------/
 *  \--------------/       |
 *                         v
 *                  +-------------+    Software gain per channel.
 *                  | Master Gain |<-- 18i20 only: Switch per channel
 *                  +------+------+    to select HW or SW gain control.
 *                         |
 *                         |10chn
 *  /--------------\       |
 *  | Analogue     |<------/
 *  | Hardware out |
 *  \--------------/
 * </ditaa>
 *
 * Gen 3/4 devices have a Mass Storage Device (MSD) mode where a small
 * disk with registration and driver download information is presented
 * to the host. To access the full functionality of the device without
 * proprietary software, MSD mode can be disabled by:
 * - holding down the 48V button for five seconds while powering on
 *   the device, or
 * - using this driver and alsamixer to change the "MSD Mode" setting
 *   to Off and power-cycling the device
 */

#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/moduleparam.h>

#include <sound/control.h>
#include <sound/tlv.h>
#include <sound/hwdep.h>

#include <uapi/sound/scarlett2.h>

#include "usbaudio.h"
#include "mixer.h"
#include "helper.h"

#include "mixer_scarlett2.h"

/* device_setup value to allow turning MSD mode back on */
#define SCARLETT2_MSD_ENABLE 0x02

/* device_setup value to disable this mixer driver */
#define SCARLETT2_DISABLE 0x04

/* some gui mixers can't handle negative ctl values */
#define SCARLETT2_VOLUME_BIAS 127

/* maximum preamp input gain value
 * (the corresponding value in dB is per-device)
 */
#define SCARLETT2_MAX_GAIN_VALUE 70

/* maximum Bluetooth volume value */
#define SCARLETT2_MAX_BLUETOOTH_VOLUME 30

/* mixer range from -80dB to +12dB in 0.5dB steps */
#define SCARLETT2_MIXER_MIN_DB -80
#define SCARLETT2_MIXER_BIAS (-SCARLETT2_MIXER_MIN_DB * 2)
#define SCARLETT2_MIXER_MAX_DB 12
#define SCARLETT2_MIXER_MAX_VALUE \
	((SCARLETT2_MIXER_MAX_DB - SCARLETT2_MIXER_MIN_DB) * 2)
#define SCARLETT2_MIXER_VALUE_COUNT (SCARLETT2_MIXER_MAX_VALUE + 1)

/* map from (dB + 80) * 2 to mixer value
 * for dB in 0 .. 184: int(8192 * pow(10, ((dB - 160) / 2 / 20)))
 */
static const u16 scarlett2_mixer_values[SCARLETT2_MIXER_VALUE_COUNT] = {
	0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
	2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8,
	9, 9, 10, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
	23, 24, 25, 27, 29, 30, 32, 34, 36, 38, 41, 43, 46, 48, 51,
	54, 57, 61, 65, 68, 73, 77, 81, 86, 91, 97, 103, 109, 115,
	122, 129, 137, 145, 154, 163, 173, 183, 194, 205, 217, 230,
	244, 259, 274, 290, 307, 326, 345, 365, 387, 410, 434, 460,
	487, 516, 547, 579, 614, 650, 689, 730, 773, 819, 867, 919,
	973, 1031, 1092, 1157, 1225, 1298, 1375, 1456, 1543, 1634,
	1731, 1833, 1942, 2057, 2179, 2308, 2445, 2590, 2744, 2906,
	3078, 3261, 3454, 3659, 3876, 4105, 4349, 4606, 4879, 5168,
	5475, 5799, 6143, 6507, 6892, 7301, 7733, 8192, 8677, 9191,
	9736, 10313, 10924, 11571, 12257, 12983, 13752, 14567, 15430,
	16345, 17313, 18339, 19426, 20577, 21796, 23088, 24456, 25905,
	27440, 29066, 30788, 32612
};

/* Maximum number of analogue outputs */
#define SCARLETT2_ANALOGUE_MAX 10

/* Maximum number of various input controls */
#define SCARLETT2_LEVEL_SWITCH_MAX 2
#define SCARLETT2_PAD_SWITCH_MAX 8
#define SCARLETT2_AIR_SWITCH_MAX 8
#define SCARLETT2_DSP_SWITCH_MAX 2
#define SCARLETT2_INPUT_MUTE_SWITCH_MAX 2
#define SCARLETT2_PHANTOM_SWITCH_MAX 2
#define SCARLETT2_INPUT_GAIN_MAX 2

/* Maximum number of inputs to the mixer */
#define SCARLETT2_INPUT_MIX_MAX 25

/* Maximum number of outputs from the mixer */
#define SCARLETT2_OUTPUT_MIX_MAX 12

/* Maximum number of mixer gain controls */
#define SCARLETT2_MIX_MAX (SCARLETT2_INPUT_MIX_MAX * SCARLETT2_OUTPUT_MIX_MAX)

/* Maximum number of direct monitor mixer gain controls
 * 1 (Solo) or 2 (2i2) direct monitor selections (Mono & Stereo)
 * 2 Mix outputs (A/Left & B/Right)
 * 4 Mix inputs
 */
#define SCARLETT2_MONITOR_MIX_MAX (2 * 2 * 4)

/* Maximum size of the data in the USB mux assignment message:
 * 20 inputs, 20 outputs, 25 matrix inputs, 12 spare
 */
#define SCARLETT2_MUX_MAX 77

/* Maximum number of sources (sum of input port counts) */
#define SCARLETT2_MAX_SRCS 52

/* Maximum number of meters (sum of output port counts) */
#define SCARLETT2_MAX_METERS 65

/* Compressor parameter data
 *
 * The compressor parameters are 32-bit fixed point values with 24
 * bits of fraction. Integer values are sufficient for the parameters
 * except for ratio which we can set in 0.5:1 steps.
 */
struct compressor_param {
	const char          *name;
	snd_ctl_elem_type_t  type;
	s32                  min;
	s32                  max;
	int                  scale_bits;
};

/* The available compressor parameters on the Vocaster:
 * - Enable: Off, On
 * - Threshold: -40dB to 0dB
 * - Ratio: 1:1 to 50:1 in 0.5:1 steps
 * - Knee Width: 0dB to 10dB
 * - Attack: 30ms to 127ms
 * - Release: 30ms to 127ms
 * - Makeup Gain: 0dB to 24dB
 */
static const struct compressor_param compressor_params[] = {
	{ "Enable",      SNDRV_CTL_ELEM_TYPE_BOOLEAN,   0,   1,  0 },
	{ "Threshold",   SNDRV_CTL_ELEM_TYPE_INTEGER, -40,   0, 24 },
	{ "Ratio",       SNDRV_CTL_ELEM_TYPE_INTEGER,   2, 100, 23 },
	{ "Knee Width",  SNDRV_CTL_ELEM_TYPE_INTEGER,   0,  10, 24 },
	{ "Attack",      SNDRV_CTL_ELEM_TYPE_INTEGER,  30, 127, 24 },
	{ "Release",     SNDRV_CTL_ELEM_TYPE_INTEGER,  30, 127, 24 },
	{ "Makeup Gain", SNDRV_CTL_ELEM_TYPE_INTEGER,   0,  24, 24 },
};

#define SCARLETT2_COMPRESSOR_PARAM_COUNT ARRAY_SIZE(compressor_params)
#define SCARLETT2_COMPRESSOR_CTLS_MAX \
	(SCARLETT2_COMPRESSOR_PARAM_COUNT * SCARLETT2_DSP_SWITCH_MAX)

/* Maximum number of filter controls */
#define SCARLETT2_PRECOMP_FLT_CTLS_MAX (2 * SCARLETT2_DSP_SWITCH_MAX)
#define SCARLETT2_PEQ_FLT_CTLS_MAX (3 * SCARLETT2_DSP_SWITCH_MAX)

/* Number of biquad filter coefficients */
#define SCARLETT2_BIQUAD_COEFFS 5

/* Maximum number of filter coefficient values */
#define SCARLETT2_PRECOMP_FLT_VALUES_MAX \
	(SCARLETT2_PRECOMP_FLT_CTLS_MAX * SCARLETT2_BIQUAD_COEFFS)
#define SCARLETT2_PEQ_FLT_VALUES_MAX \
	(SCARLETT2_PEQ_FLT_CTLS_MAX * SCARLETT2_BIQUAD_COEFFS)

/* Maximum number of PEQ filter slots */
#define SCARLETT2_PEQ_FLT_SLOTS_MAX 4

/* Hardware port types:
 * - None (no input to mux)
 * - Analogue I/O
 * - S/PDIF I/O
 * - ADAT I/O
 * - Mixer I/O
 * - PCM I/O
 */
enum {
	SCARLETT2_PORT_TYPE_NONE,
	SCARLETT2_PORT_TYPE_ANALOGUE,
	SCARLETT2_PORT_TYPE_SPDIF,
	SCARLETT2_PORT_TYPE_ADAT,
	SCARLETT2_PORT_TYPE_MIX,
	SCARLETT2_PORT_TYPE_PCM,
	SCARLETT2_PORT_TYPE_COUNT
};

/* I/O count of each port type kept in struct scarlett2_ports */
enum {
	SCARLETT2_PORT_IN,
	SCARLETT2_PORT_OUT,
	SCARLETT2_PORT_DIRNS
};

/* Dim/Mute buttons on the 18i20 */
enum {
	SCARLETT2_BUTTON_MUTE,
	SCARLETT2_BUTTON_DIM,
	SCARLETT2_DIM_MUTE_COUNT
};

/* Autogain target values */

#define SCARLETT2_AG_TARGET_MIN (-30)

enum {
	SCARLETT2_AG_HOT_TARGET,
	SCARLETT2_AG_MEAN_TARGET,
	SCARLETT2_AG_PEAK_TARGET,
	SCARLETT2_AG_TARGET_COUNT
};

/* Flash Write State */
enum {
	SCARLETT2_FLASH_WRITE_STATE_IDLE,
	SCARLETT2_FLASH_WRITE_STATE_SELECTED,
	SCARLETT2_FLASH_WRITE_STATE_ERASING,
	SCARLETT2_FLASH_WRITE_STATE_WRITE
};

static const char *const scarlett2_dim_mute_names[SCARLETT2_DIM_MUTE_COUNT] = {
	"Mute Playback Switch", "Dim Playback Switch"
};

/* The autogain_status is set based on the autogain_switch and
 * raw_autogain_status values.
 *
 * If autogain_switch is set, autogain_status is set to 0 (Running).
 * The other status values are from the raw_autogain_status value + 1.
 */
static const char *const scarlett2_autogain_status_gen4[] = {
	"Running",
	"Success",
	"SuccessDRover",
	"WarnMinGainLimit",
	"FailDRunder",
	"FailMaxGainLimit",
	"FailClipped",
	"Cancelled",
	"Invalid",
	NULL
};

static const char *const scarlett2_autogain_status_vocaster[] = {
	"Running",
	"Success",
	"FailPG",
	"FailRange",
	"WarnMaxCap",
	"WarnMinCap",
	"Cancelled",
	"Invalid",
	NULL
};

/* Power Status Values */
enum {
	SCARLETT2_POWER_STATUS_EXT,
	SCARLETT2_POWER_STATUS_BUS,
	SCARLETT2_POWER_STATUS_FAIL,
	SCARLETT2_POWER_STATUS_COUNT
};

/* Notification callback functions */
struct scarlett2_notification {
	u32 mask;
	void (*func)(struct usb_mixer_interface *mixer);
};

static void scarlett2_notify_ack(struct usb_mixer_interface *mixer);
static void scarlett2_notify_sync(struct usb_mixer_interface *mixer);
static void scarlett2_notify_dim_mute(struct usb_mixer_interface *mixer);
static void scarlett2_notify_monitor(struct usb_mixer_interface *mixer);
static void scarlett2_notify_volume(struct usb_mixer_interface *mixer);
static void scarlett2_notify_input_level(struct usb_mixer_interface *mixer);
static void scarlett2_notify_input_pad(struct usb_mixer_interface *mixer);
static void scarlett2_notify_input_air(struct usb_mixer_interface *mixer);
static void scarlett2_notify_input_dsp(struct usb_mixer_interface *mixer);
static void scarlett2_notify_input_mute(struct usb_mixer_interface *mixer);
static void scarlett2_notify_input_phantom(struct usb_mixer_interface *mixer);
static void scarlett2_notify_input_other(struct usb_mixer_interface *mixer);
static void scarlett2_notify_input_select(struct usb_mixer_interface *mixer);
static void scarlett2_notify_input_gain(struct usb_mixer_interface *mixer);
static void scarlett2_notify_autogain(struct usb_mixer_interface *mixer);
static void scarlett2_notify_input_safe(struct usb_mixer_interface *mixer);
static void scarlett2_notify_monitor_other(struct usb_mixer_interface *mixer);
static void scarlett2_notify_direct_monitor(struct usb_mixer_interface *mixer);
static void scarlett2_notify_power_status(struct usb_mixer_interface *mixer);
static void scarlett2_notify_pcm_input_switch(
					struct usb_mixer_interface *mixer);
static void scarlett2_notify_bluetooth(struct usb_mixer_interface *mixer);

/* Arrays of notification callback functions */

static const struct scarlett2_notification scarlett2_notifications[] = {
	{ 0x00000001, scarlett2_notify_ack },
	{ 0x00000008, scarlett2_notify_sync },
	{ 0x00200000, scarlett2_notify_dim_mute },
	{ 0x00400000, scarlett2_notify_monitor },
	{ 0x00800000, scarlett2_notify_input_other },
	{ 0x01000000, scarlett2_notify_monitor_other },
	{ 0, NULL }
};

static const struct scarlett2_notification scarlett3a_notifications[] = {
	{ 0x00000001, scarlett2_notify_ack },
	{ 0x00800000, scarlett2_notify_input_other },
	{ 0x01000000, scarlett2_notify_direct_monitor },
	{ 0, NULL }
};

static const struct scarlett2_notification vocaster_notifications[] = {
	{ 0x00000001, scarlett2_notify_ack },
	{ 0x00000008, scarlett2_notify_sync },
	{ 0x00200000, scarlett2_notify_input_mute },
	{ 0x00400000, scarlett2_notify_autogain },
	{ 0x04000000, scarlett2_notify_input_dsp },
	{ 0x08000000, scarlett2_notify_input_gain },
	{ 0x10000000, scarlett2_notify_input_phantom },
	{ 0x20000000, scarlett2_notify_bluetooth },
	{ 0, NULL }
};

static const struct scarlett2_notification scarlett4_solo_notifications[] = {
	{ 0x00000001, scarlett2_notify_ack },
	{ 0x00000008, scarlett2_notify_sync },
	{ 0x00400000, scarlett2_notify_input_air },
	{ 0x00800000, scarlett2_notify_direct_monitor },
	{ 0x01000000, scarlett2_notify_input_level },
	{ 0x02000000, scarlett2_notify_input_phantom },
	{ 0x04000000, scarlett2_notify_pcm_input_switch },
	{ 0, NULL }
};

static const struct scarlett2_notification scarlett4_2i2_notifications[] = {
	{ 0x00000001, scarlett2_notify_ack },
	{ 0x00000008, scarlett2_notify_sync },
	{ 0x00200000, scarlett2_notify_input_safe },
	{ 0x00400000, scarlett2_notify_autogain },
	{ 0x00800000, scarlett2_notify_input_air },
	{ 0x01000000, scarlett2_notify_direct_monitor },
	{ 0x02000000, scarlett2_notify_input_select },
	{ 0x04000000, scarlett2_notify_input_level },
	{ 0x08000000, scarlett2_notify_input_phantom },
	{ 0x10000000, NULL }, /* power status, ignored */
	{ 0x40000000, scarlett2_notify_input_gain },
	{ 0x80000000, NULL }, /* power status, ignored */
	{ 0, NULL }
};

static const struct scarlett2_notification scarlett4_4i4_notifications[] = {
	{ 0x00000001, scarlett2_notify_ack },
	{ 0x00000008, scarlett2_notify_sync },
	{ 0x00200000, scarlett2_notify_input_safe },
	{ 0x00400000, scarlett2_notify_autogain },
	{ 0x00800000, scarlett2_notify_input_air },
	{ 0x01000000, scarlett2_notify_input_select },
	{ 0x02000000, scarlett2_notify_input_level },
	{ 0x04000000, scarlett2_notify_input_phantom },
	{ 0x08000000, scarlett2_notify_power_status }, /* power external */
	{ 0x20000000, scarlett2_notify_input_gain },
	{ 0x40000000, scarlett2_notify_power_status }, /* power status */
	{ 0x80000000, scarlett2_notify_volume },
	{ 0, NULL }
};

/* Configuration parameters that can be read and written */
enum {
	SCARLETT2_CONFIG_DIM_MUTE,
	SCARLETT2_CONFIG_LINE_OUT_VOLUME,
	SCARLETT2_CONFIG_MUTE_SWITCH,
	SCARLETT2_CONFIG_SW_HW_SWITCH,
	SCARLETT2_CONFIG_MASTER_VOLUME,
	SCARLETT2_CONFIG_HEADPHONE_VOLUME,
	SCARLETT2_CONFIG_LEVEL_SWITCH,
	SCARLETT2_CONFIG_PAD_SWITCH,
	SCARLETT2_CONFIG_MSD_SWITCH,
	SCARLETT2_CONFIG_AIR_SWITCH,
	SCARLETT2_CONFIG_DSP_SWITCH,
	SCARLETT2_CONFIG_COMPRESSOR_PARAMS,
	SCARLETT2_CONFIG_PRECOMP_FLT_SWITCH,
	SCARLETT2_CONFIG_PRECOMP_FLT_PARAMS,
	SCARLETT2_CONFIG_PEQ_FLT_SWITCH,
	SCARLETT2_CONFIG_PEQ_FLT_PARAMS,
	SCARLETT2_CONFIG_INPUT_MUTE_SWITCH,
	SCARLETT2_CONFIG_STANDALONE_SWITCH,
	SCARLETT2_CONFIG_PHANTOM_SWITCH,
	SCARLETT2_CONFIG_PHANTOM_PERSISTENCE,
	SCARLETT2_CONFIG_DIRECT_MONITOR,
	SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH,
	SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE,
	SCARLETT2_CONFIG_TALKBACK_MAP,
	SCARLETT2_CONFIG_AUTOGAIN_SWITCH,
	SCARLETT2_CONFIG_AUTOGAIN_STATUS,
	SCARLETT2_CONFIG_AG_HOT_TARGET,
	SCARLETT2_CONFIG_AG_MEAN_TARGET,
	SCARLETT2_CONFIG_AG_PEAK_TARGET,
	SCARLETT2_CONFIG_INPUT_GAIN,
	SCARLETT2_CONFIG_SAFE_SWITCH,
	SCARLETT2_CONFIG_INPUT_SELECT_SWITCH,
	SCARLETT2_CONFIG_INPUT_LINK_SWITCH,
	SCARLETT2_CONFIG_POWER_EXT,
	SCARLETT2_CONFIG_POWER_LOW,
	SCARLETT2_CONFIG_PCM_INPUT_SWITCH,
	SCARLETT2_CONFIG_DIRECT_MONITOR_GAIN,
	SCARLETT2_CONFIG_BLUETOOTH_VOLUME,
	SCARLETT2_CONFIG_SPDIF_MODE,
	SCARLETT2_CONFIG_COUNT
};

/* Autogain target configuration parameters and names */

static const int scarlett2_ag_target_configs[] = {
	[SCARLETT2_AG_HOT_TARGET]  = SCARLETT2_CONFIG_AG_HOT_TARGET,
	[SCARLETT2_AG_MEAN_TARGET] = SCARLETT2_CONFIG_AG_MEAN_TARGET,
	[SCARLETT2_AG_PEAK_TARGET] = SCARLETT2_CONFIG_AG_PEAK_TARGET
};

static const char *const scarlett2_ag_target_names[] = {
	"Hot", "Mean", "Peak"
};

/* Location, size, and activation command number for the configuration
 * parameters. Size is in bits and may be 1, 8, 16, or 32.
 *
 * Vocaster and 4th Gen devices have a parameter buffer to set certain
 * configuration parameters. When pbuf is set, rather than writing to
 * the given offset, the channel and value are written to the
 * parameter buffer and the activate command is sent to the device.
 *
 * Some Gen 4 configuration parameters are written with 0x02 for a
 * desired value of 0x01, and 0x03 for 0x00. These are indicated with
 * mute set to 1. 0x02 and 0x03 are temporary values while the device
 * makes the change and the channel and/or corresponding DSP channel
 * output is muted.
 */
struct scarlett2_config {
	u16 offset;
	u8 size;
	u8 activate;
	u8 pbuf;
	u8 mute;
};

struct scarlett2_config_set {
	const struct scarlett2_notification *notifications;
	u16 param_buf_addr;
	const unsigned int *input_gain_tlv;
	const char *const *autogain_status_texts;
	const struct scarlett2_config items[SCARLETT2_CONFIG_COUNT];
};

/* Input gain TLV dB ranges */

static const DECLARE_TLV_DB_MINMAX(
	db_scale_vocaster_gain, 0, 70 * 100
);

static const DECLARE_TLV_DB_MINMAX(
	db_scale_gen4_gain, 0, 69 * 100
);

/* Gen 2 devices without SW/HW volume switch: 6i6, 18i8 */

static const struct scarlett2_config_set scarlett2_config_set_gen2a = {
	.notifications = scarlett2_notifications,
	.items = {
		[SCARLETT2_CONFIG_LINE_OUT_VOLUME] = {
			.offset = 0x34, .size = 16, .activate = 1 },

		[SCARLETT2_CONFIG_MUTE_SWITCH] = {
			.offset = 0x5c, .size = 8, .activate = 1 },

		[SCARLETT2_CONFIG_LEVEL_SWITCH] = {
			.offset = 0x7c, .size = 8, .activate = 7 },

		[SCARLETT2_CONFIG_PAD_SWITCH] = {
			.offset = 0x84, .size = 8, .activate = 8 },

		[SCARLETT2_CONFIG_STANDALONE_SWITCH] = {
			.offset = 0x8d, .size = 8, .activate = 6 },
	}
};

/* Gen 2 devices with SW/HW volume switch: 18i20 */

static const struct scarlett2_config_set scarlett2_config_set_gen2b = {
	.notifications = scarlett2_notifications,
	.items = {
		[SCARLETT2_CONFIG_DIM_MUTE] = {
			.offset = 0x31, .size = 8, .activate = 2 },

		[SCARLETT2_CONFIG_LINE_OUT_VOLUME] = {
			.offset = 0x34, .size = 16, .activate = 1 },

		[SCARLETT2_CONFIG_MUTE_SWITCH] = {
			.offset = 0x5c, .size = 8, .activate = 1 },

		[SCARLETT2_CONFIG_SW_HW_SWITCH] = {
			.offset = 0x66, .size = 8, .activate = 3 },

		[SCARLETT2_CONFIG_MASTER_VOLUME] = {
			.offset = 0x76, .size = 16 },

		[SCARLETT2_CONFIG_LEVEL_SWITCH] = {
			.offset = 0x7c, .size = 8, .activate = 7 },

		[SCARLETT2_CONFIG_PAD_SWITCH] = {
			.offset = 0x84, .size = 8, .activate = 8 },

		[SCARLETT2_CONFIG_STANDALONE_SWITCH] = {
			.offset = 0x8d, .size = 8, .activate = 6 },
	}
};

/* Gen 3 devices without a mixer (Solo and 2i2) */
static const struct scarlett2_config_set scarlett2_config_set_gen3a = {
	.notifications = scarlett3a_notifications,
	.items = {
		[SCARLETT2_CONFIG_MSD_SWITCH] = {
			.offset = 0x04, .size = 8, .activate = 6 },

		[SCARLETT2_CONFIG_PHANTOM_PERSISTENCE] = {
			.offset = 0x05, .size = 8, .activate = 6 },

		[SCARLETT2_CONFIG_PHANTOM_SWITCH] = {
			.offset = 0x06, .size = 8, .activate = 3 },

		[SCARLETT2_CONFIG_DIRECT_MONITOR] = {
			.offset = 0x07, .size = 8, .activate = 4 },

		[SCARLETT2_CONFIG_LEVEL_SWITCH] = {
			.offset = 0x08, .size = 1, .activate = 7 },

		[SCARLETT2_CONFIG_AIR_SWITCH] = {
			.offset = 0x09, .size = 1, .activate = 8 },
	}
};

/* Gen 3 devices without SW/HW volume switch: 4i4, 8i6 */
static const struct scarlett2_config_set scarlett2_config_set_gen3b = {
	.notifications = scarlett2_notifications,
	.items = {
		[SCARLETT2_CONFIG_LINE_OUT_VOLUME] = {
			.offset = 0x34, .size = 16, .activate = 1 },

		[SCARLETT2_CONFIG_MUTE_SWITCH] = {
			.offset = 0x5c, .size = 8, .activate = 1 },

		[SCARLETT2_CONFIG_LEVEL_SWITCH] = {
			.offset = 0x7c, .size = 8, .activate = 7 },

		[SCARLETT2_CONFIG_PAD_SWITCH] = {
			.offset = 0x84, .size = 8, .activate = 8 },

		[SCARLETT2_CONFIG_AIR_SWITCH] = {
			.offset = 0x8c, .size = 8, .activate = 8 },

		[SCARLETT2_CONFIG_STANDALONE_SWITCH] = {
			.offset = 0x95, .size = 8, .activate = 6 },

		[SCARLETT2_CONFIG_PHANTOM_SWITCH] = {
			.offset = 0x9c, .size = 1, .activate = 8 },

		[SCARLETT2_CONFIG_MSD_SWITCH] = {
			.offset = 0x9d, .size = 8, .activate = 6 },

		[SCARLETT2_CONFIG_PHANTOM_PERSISTENCE] = {
			.offset = 0x9e, .size = 8, .activate = 6 },
	}
};

/* Gen 3 devices with SW/HW volume switch: 18i8, 18i20 */
static const struct scarlett2_config_set scarlett2_config_set_gen3c = {
	.notifications = scarlett2_notifications,
	.items = {
		[SCARLETT2_CONFIG_DIM_MUTE] = {
			.offset = 0x31, .size = 8, .activate = 2 },

		[SCARLETT2_CONFIG_LINE_OUT_VOLUME] = {
			.offset = 0x34, .size = 16, .activate = 1 },

		[SCARLETT2_CONFIG_MUTE_SWITCH] = {
			.offset = 0x5c, .size = 8, .activate = 1 },

		[SCARLETT2_CONFIG_SW_HW_SWITCH] = {
			.offset = 0x66, .size = 8, .activate = 3 },

		[SCARLETT2_CONFIG_MASTER_VOLUME] = {
			.offset = 0x76, .size = 16 },

		[SCARLETT2_CONFIG_LEVEL_SWITCH] = {
			.offset = 0x7c, .size = 8, .activate = 7 },

		[SCARLETT2_CONFIG_PAD_SWITCH] = {
			.offset = 0x84, .size = 8, .activate = 8 },

		[SCARLETT2_CONFIG_AIR_SWITCH] = {
			.offset = 0x8c, .size = 8, .activate = 8 },

		[SCARLETT2_CONFIG_STANDALONE_SWITCH] = {
			.offset = 0x95, .size = 8, .activate = 6 },

		[SCARLETT2_CONFIG_PHANTOM_SWITCH] = {
			.offset = 0x9c, .size = 1, .activate = 8 },

		[SCARLETT2_CONFIG_MSD_SWITCH] = {
			.offset = 0x9d, .size = 8, .activate = 6 },

		[SCARLETT2_CONFIG_PHANTOM_PERSISTENCE] = {
			.offset = 0x9e, .size = 8, .activate = 6 },

		[SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH] = {
			.offset = 0x9f, .size = 1, .activate = 10 },

		[SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE] = {
			.offset = 0xa0, .size = 1, .activate = 10 },

		[SCARLETT2_CONFIG_TALKBACK_MAP] = {
			.offset = 0xb0, .size = 16, .activate = 10 },

		[SCARLETT2_CONFIG_SPDIF_MODE] = {
			.offset = 0x94, .size = 8, .activate = 6 },
	}
};

/* Vocaster */
static const struct scarlett2_config_set scarlett2_config_set_vocaster = {
	.notifications = vocaster_notifications,
	.param_buf_addr = 0x1bc,
	.input_gain_tlv = db_scale_vocaster_gain,
	.autogain_status_texts = scarlett2_autogain_status_vocaster,
	.items = {
		[SCARLETT2_CONFIG_MSD_SWITCH] = {
			.offset = 0x9d, .size = 8, .activate = 6 },

		[SCARLETT2_CONFIG_AUTOGAIN_SWITCH] = {
			.offset = 0x1c0, .size = 8, .activate = 19, .pbuf = 1 },

		[SCARLETT2_CONFIG_AUTOGAIN_STATUS] = {
			.offset = 0x1c2, .size = 8, },

		[SCARLETT2_CONFIG_AG_HOT_TARGET] = {
			.offset = 0xc1, .size = 8, .activate = 29, .pbuf = 1 },

		[SCARLETT2_CONFIG_INPUT_GAIN] = {
			.offset = 0x9f, .size = 8, .activate = 21, .pbuf = 1 },

		[SCARLETT2_CONFIG_PHANTOM_SWITCH] = {
			.offset = 0x9c, .size = 1, .activate = 20, .pbuf = 1 },

		[SCARLETT2_CONFIG_DSP_SWITCH] = {
			.offset = 0x1c4, .size = 8, .activate = 22, .pbuf = 1 },

		[SCARLETT2_CONFIG_COMPRESSOR_PARAMS] = {
			.offset = 0x1c8, .size = 32, .activate = 23 },

		[SCARLETT2_CONFIG_PRECOMP_FLT_SWITCH] = {
			.offset = 0x7c, .size = 32, .activate = 27 },

		[SCARLETT2_CONFIG_PRECOMP_FLT_PARAMS] = {
			.offset = 0x200, .size = 32, .activate = 27 },

		[SCARLETT2_CONFIG_PEQ_FLT_SWITCH] = {
			.offset = 0x84, .size = 32, .activate = 27 },

		[SCARLETT2_CONFIG_PEQ_FLT_PARAMS] = {
			.offset = 0x250, .size = 32, .activate = 27 },

		[SCARLETT2_CONFIG_INPUT_MUTE_SWITCH] = {
			.offset = 0x1be, .size = 8, .activate = 17, .pbuf = 1 },

		[SCARLETT2_CONFIG_BLUETOOTH_VOLUME] = {
			.offset = 0xbf, .size = 8, .activate = 28 },
	}
};

/* Solo Gen 4 */
static const struct scarlett2_config_set scarlett2_config_set_gen4_solo = {
	.notifications = scarlett4_solo_notifications,
	.param_buf_addr = 0xd8,
	.items = {
		[SCARLETT2_CONFIG_MSD_SWITCH] = {
			.offset = 0x47, .size = 8, .activate = 4 },

		[SCARLETT2_CONFIG_DIRECT_MONITOR] = {
			.offset = 0x108, .size = 8, .activate = 12, .pbuf = 1 },

		[SCARLETT2_CONFIG_PHANTOM_SWITCH] = {
			.offset = 0x46, .size = 8, .activate = 9, .pbuf = 1,
			.mute = 1 },

		[SCARLETT2_CONFIG_LEVEL_SWITCH] = {
			.offset = 0x3d, .size = 8, .activate = 10, .pbuf = 1,
			.mute = 1 },

		[SCARLETT2_CONFIG_AIR_SWITCH] = {
			.offset = 0x3e, .size = 8, .activate = 11, .pbuf = 1 },

		[SCARLETT2_CONFIG_PCM_INPUT_SWITCH] = {
			.offset = 0x206, .size = 8, .activate = 25, .pbuf = 1 },

		[SCARLETT2_CONFIG_DIRECT_MONITOR_GAIN] = {
			.offset = 0x232, .size = 16, .activate = 26 }
	}
};

/* 2i2 Gen 4 */
static const struct scarlett2_config_set scarlett2_config_set_gen4_2i2 = {
	.notifications = scarlett4_2i2_notifications,
	.param_buf_addr = 0xfc,
	.input_gain_tlv = db_scale_gen4_gain,
	.autogain_status_texts = scarlett2_autogain_status_gen4,
	.items = {
		[SCARLETT2_CONFIG_MSD_SWITCH] = {
			.offset = 0x49, .size = 8, .activate = 4 },

		[SCARLETT2_CONFIG_DIRECT_MONITOR] = {
			.offset = 0x14a, .size = 8, .activate = 16, .pbuf = 1 },

		[SCARLETT2_CONFIG_AUTOGAIN_SWITCH] = {
			.offset = 0x135, .size = 8, .activate = 10, .pbuf = 1 },

		[SCARLETT2_CONFIG_AUTOGAIN_STATUS] = {
			.offset = 0x137, .size = 8 },

		[SCARLETT2_CONFIG_AG_MEAN_TARGET] = {
			.offset = 0x131, .size = 8, .activate = 29, .pbuf = 1 },

		[SCARLETT2_CONFIG_AG_PEAK_TARGET] = {
			.offset = 0x132, .size = 8, .activate = 30, .pbuf = 1 },

		[SCARLETT2_CONFIG_PHANTOM_SWITCH] = {
			.offset = 0x48, .size = 8, .activate = 11, .pbuf = 1,
			.mute = 1 },

		[SCARLETT2_CONFIG_INPUT_GAIN] = {
			.offset = 0x4b, .size = 8, .activate = 12, .pbuf = 1 },

		[SCARLETT2_CONFIG_LEVEL_SWITCH] = {
			.offset = 0x3c, .size = 8, .activate = 13, .pbuf = 1,
			.mute = 1 },

		[SCARLETT2_CONFIG_SAFE_SWITCH] = {
			.offset = 0x147, .size = 8, .activate = 14, .pbuf = 1 },

		[SCARLETT2_CONFIG_AIR_SWITCH] = {
			.offset = 0x3e, .size = 8, .activate = 15, .pbuf = 1 },

		[SCARLETT2_CONFIG_INPUT_SELECT_SWITCH] = {
			.offset = 0x14b, .size = 8, .activate = 17, .pbuf = 1 },

		[SCARLETT2_CONFIG_INPUT_LINK_SWITCH] = {
			.offset = 0x14e, .size = 8, .activate = 18, .pbuf = 1 },

		[SCARLETT2_CONFIG_DIRECT_MONITOR_GAIN] = {
			.offset = 0x2a0, .size = 16, .activate = 36 }
	}
};

/* 4i4 Gen 4 */
static const struct scarlett2_config_set scarlett2_config_set_gen4_4i4 = {
	.notifications = scarlett4_4i4_notifications,
	.param_buf_addr = 0x130,
	.input_gain_tlv = db_scale_gen4_gain,
	.autogain_status_texts = scarlett2_autogain_status_gen4,
	.items = {
		[SCARLETT2_CONFIG_MSD_SWITCH] = {
			.offset = 0x5c, .size = 8, .activate = 4 },

		[SCARLETT2_CONFIG_AUTOGAIN_SWITCH] = {
			.offset = 0x13e, .size = 8, .activate = 10, .pbuf = 1 },

		[SCARLETT2_CONFIG_AUTOGAIN_STATUS] = {
			.offset = 0x140, .size = 8 },

		[SCARLETT2_CONFIG_AG_MEAN_TARGET] = {
			.offset = 0x13a, .size = 8, .activate = 23, .pbuf = 1 },

		[SCARLETT2_CONFIG_AG_PEAK_TARGET] = {
			.offset = 0x13b, .size = 8, .activate = 24, .pbuf = 1 },

		[SCARLETT2_CONFIG_PHANTOM_SWITCH] = {
			.offset = 0x5a, .size = 8, .activate = 11, .pbuf = 1,
			.mute = 1 },

		[SCARLETT2_CONFIG_INPUT_GAIN] = {
			.offset = 0x5e, .size = 8, .activate = 12, .pbuf = 1 },

		[SCARLETT2_CONFIG_LEVEL_SWITCH] = {
			.offset = 0x4e, .size = 8, .activate = 13, .pbuf = 1,
			.mute = 1 },

		[SCARLETT2_CONFIG_SAFE_SWITCH] = {
			.offset = 0x150, .size = 8, .activate = 14, .pbuf = 1 },

		[SCARLETT2_CONFIG_AIR_SWITCH] = {
			.offset = 0x50, .size = 8, .activate = 15, .pbuf = 1 },

		[SCARLETT2_CONFIG_INPUT_SELECT_SWITCH] = {
			.offset = 0x153, .size = 8, .activate = 16, .pbuf = 1 },

		[SCARLETT2_CONFIG_INPUT_LINK_SWITCH] = {
			.offset = 0x156, .size = 8, .activate = 17, .pbuf = 1 },

		[SCARLETT2_CONFIG_MASTER_VOLUME] = {
			.offset = 0x32, .size = 16 },

		[SCARLETT2_CONFIG_HEADPHONE_VOLUME] = {
			.offset = 0x3a, .size = 16 },

		[SCARLETT2_CONFIG_POWER_EXT] = {
			.offset = 0x168, .size = 8 },

		[SCARLETT2_CONFIG_POWER_LOW] = {
			.offset = 0x16d, .size = 8 }
	}
};

/* Clarett USB and Clarett+ devices: 2Pre, 4Pre, 8Pre */
static const struct scarlett2_config_set scarlett2_config_set_clarett = {
	.notifications = scarlett2_notifications,
	.items = {
		[SCARLETT2_CONFIG_DIM_MUTE] = {
			.offset = 0x31, .size = 8, .activate = 2 },

		[SCARLETT2_CONFIG_LINE_OUT_VOLUME] = {
			.offset = 0x34, .size = 16, .activate = 1 },

		[SCARLETT2_CONFIG_MUTE_SWITCH] = {
			.offset = 0x5c, .size = 8, .activate = 1 },

		[SCARLETT2_CONFIG_SW_HW_SWITCH] = {
			.offset = 0x66, .size = 8, .activate = 3 },

		[SCARLETT2_CONFIG_MASTER_VOLUME] = {
			.offset = 0x76, .size = 16 },

		[SCARLETT2_CONFIG_LEVEL_SWITCH] = {
			.offset = 0x7c, .size = 8, .activate = 7 },

		[SCARLETT2_CONFIG_AIR_SWITCH] = {
			.offset = 0x95, .size = 8, .activate = 8 },

		[SCARLETT2_CONFIG_STANDALONE_SWITCH] = {
			.offset = 0x8d, .size = 8, .activate = 6 },

		[SCARLETT2_CONFIG_SPDIF_MODE] = {
			.offset = 0x9e, .size = 8, .activate = 4 },
	}
};

/* Description of each hardware port type:
 * - id: hardware ID of this port type
 * - src_descr: printf format string for mux input selections
 * - src_num_offset: added to channel number for the fprintf
 * - dst_descr: printf format string for mixer controls
 */
struct scarlett2_port {
	u16 id;
	const char * const src_descr;
	int src_num_offset;
	const char * const dst_descr;
	const char * const dsp_src_descr;
	const char * const dsp_dst_descr;
};

static const struct scarlett2_port scarlett2_ports[SCARLETT2_PORT_TYPE_COUNT] = {
	[SCARLETT2_PORT_TYPE_NONE] = {
		.id = 0x000,
		.src_descr = "Off"
	},
	[SCARLETT2_PORT_TYPE_ANALOGUE] = {
		.id = 0x080,
		.src_descr = "Analogue %d",
		.src_num_offset = 1,
		.dst_descr = "Analogue Output %02d Playback"
	},
	[SCARLETT2_PORT_TYPE_SPDIF] = {
		.id = 0x180,
		.src_descr = "S/PDIF %d",
		.src_num_offset = 1,
		.dst_descr = "S/PDIF Output %d Playback"
	},
	[SCARLETT2_PORT_TYPE_ADAT] = {
		.id = 0x200,
		.src_descr = "ADAT %d",
		.src_num_offset = 1,
		.dst_descr = "ADAT Output %d Playback"
	},
	[SCARLETT2_PORT_TYPE_MIX] = {
		.id = 0x300,
		.src_descr = "Mix %c",
		.src_num_offset = 'A',
		.dst_descr = "Mixer Input %02d Capture",
		.dsp_src_descr = "DSP %d",
		.dsp_dst_descr = "DSP Input %d Capture"
	},
	[SCARLETT2_PORT_TYPE_PCM] = {
		.id = 0x600,
		.src_descr = "PCM %d",
		.src_num_offset = 1,
		.dst_descr = "PCM %02d Capture"
	},
};

/* Number of mux tables: one for each band of sample rates
 * (44.1/48kHz, 88.2/96kHz, and 176.4/176kHz)
 */
#define SCARLETT2_MUX_TABLES 3

/* Maximum number of entries in a mux table */
#define SCARLETT2_MAX_MUX_ENTRIES 10

/* One entry within mux_assignment defines the port type and range of
 * ports to add to the set_mux message. The end of the list is marked
 * with count == 0.
 */
struct scarlett2_mux_entry {
	u8 port_type;
	u8 start;
	u8 count;
};

/* Maximum number of entries in a mux table */
#define SCARLETT2_MAX_METER_ENTRIES 9

/* One entry within meter_assignment defines the range of mux outputs
 * that consecutive meter entries are mapped to. The end of the list
 * is marked with count == 0.
 */
struct scarlett2_meter_entry {
	u8 start;
	u8 count;
};

struct scarlett2_device_info {
	/* which set of configuration parameters the device uses */
	const struct scarlett2_config_set *config_set;

	/* minimum firmware version required */
	u16 min_firmware_version;

	/* support for main/alt speaker switching */
	u8 has_speaker_switching;

	/* support for talkback microphone */
	u8 has_talkback;

	/* the number of analogue inputs with a software switchable
	 * level control that can be set to line or instrument
	 */
	u8 level_input_count;

	/* the first input with a level control (0-based) */
	u8 level_input_first;

	/* the number of analogue inputs with a software switchable
	 * 10dB pad control
	 */
	u8 pad_input_count;

	/* the number of analogue inputs with a software switchable
	 * "air" control
	 */
	u8 air_input_count;

	/* the first input with an air control (0-based) */
	u8 air_input_first;

	/* number of additional air options
	 * 0 for air presence only (Gen 3)
	 * 1 for air presence+drive (Gen 4)
	 */
	u8 air_option;

	/* the number of analogue inputs with DSP control */
	u8 dsp_input_count;

	/* number of pre-compressor filters */
	u8 precomp_flt_count;

	/* number of parametric EQ filters */
	u8 peq_flt_count;

	/* number of PEQ filters plus unused slots */
	u8 peq_flt_total_count;

	/* the number of analogue inputs with a software switchable
	 * mute control
	 */
	u8 mute_input_count;

	/* the number of phantom (48V) software switchable controls */
	u8 phantom_count;

	/* the first input with phantom power control (0-based) */
	u8 phantom_first;

	/* the number of inputs each phantom switch controls */
	u8 inputs_per_phantom;

	/* the number of inputs with software-controllable gain */
	u8 gain_input_count;

	/* the number of inputs with safe mode */
	u8 safe_input_count;

	/* the number of direct monitor options
	 * (0 = none, 1 = mono only, 2 = mono/stereo)
	 */
	u8 direct_monitor;

	/* the number of DSP channels */
	u8 dsp_count;

	/* has a Bluetooth module with volume control */
	u8 has_bluetooth;

	/* S/PDIF Source/Digital I/O mode control */
	const char * const spdif_mode_control_name;
	const u8 *spdif_mode_values;
	const char * const *spdif_mode_texts;

	/* remap analogue outputs; 18i8 Gen 3 has "line 3/4" connected
	 * internally to the analogue 7/8 outputs
	 */
	u8 line_out_remap_enable;
	u8 line_out_remap[SCARLETT2_ANALOGUE_MAX];
	u8 line_out_unmap[SCARLETT2_ANALOGUE_MAX];

	/* additional description for the line out volume controls */
	const char * const line_out_descrs[SCARLETT2_ANALOGUE_MAX];

	/* number of sources/destinations of each port type */
	const int port_count[SCARLETT2_PORT_TYPE_COUNT][SCARLETT2_PORT_DIRNS];

	/* layout/order of the entries in the set_mux message */
	struct scarlett2_mux_entry mux_assignment[SCARLETT2_MUX_TABLES]
						 [SCARLETT2_MAX_MUX_ENTRIES];

	/* map from meter level order returned by
	 * SCARLETT2_USB_GET_METER to index into mux[] entries (same
	 * as the order returned by scarlett2_meter_ctl_get())
	 */
	struct scarlett2_meter_entry meter_map[SCARLETT2_MAX_METER_ENTRIES];
};

struct scarlett2_data {
	struct usb_mixer_interface *mixer;
	struct mutex usb_mutex; /* prevent sending concurrent USB requests */
	struct completion cmd_done;
	struct mutex data_mutex; /* lock access to this data */
	u8 running;
	u8 hwdep_in_use;
	u8 selected_flash_segment_id;
	u8 flash_write_state;
	struct delayed_work work;
	const struct scarlett2_device_info *info;
	const struct scarlett2_config_set *config_set;
	const char *series_name;
	__u8 bInterfaceNumber;
	__u8 bEndpointAddress;
	__u16 wMaxPacketSize;
	__u8 bInterval;
	u8 num_mux_srcs;
	u8 num_mux_dsts;
	u8 num_mix_in;
	u8 num_mix_out;
	u8 num_line_out;
	u8 num_monitor_mix_ctls;
	u8 num_autogain_status_texts;
	u32 firmware_version;
	u8 flash_segment_nums[SCARLETT2_SEGMENT_ID_COUNT];
	u8 flash_segment_blocks[SCARLETT2_SEGMENT_ID_COUNT];
	u16 scarlett2_seq;
	u8 sync_updated;
	u8 vol_updated;
	u8 dim_mute_updated;
	u8 input_level_updated;
	u8 input_pad_updated;
	u8 input_air_updated;
	u8 input_dsp_updated;
	u8 input_mute_updated;
	u8 input_phantom_updated;
	u8 input_select_updated;
	u8 input_gain_updated;
	u8 autogain_updated;
	u8 input_safe_updated;
	u8 pcm_input_switch_updated;
	u8 monitor_other_updated;
	u8 direct_monitor_updated;
	u8 mux_updated;
	u8 mix_updated;
	u8 speaker_switching_switched;
	u8 power_status_updated;
	u8 bluetooth_updated;
	u8 sync;
	u8 master_vol;
	u8 headphone_vol;
	u8 vol[SCARLETT2_ANALOGUE_MAX];
	u8 vol_sw_hw_switch[SCARLETT2_ANALOGUE_MAX];
	u8 mute_switch[SCARLETT2_ANALOGUE_MAX];
	u8 level_switch[SCARLETT2_LEVEL_SWITCH_MAX];
	u8 pad_switch[SCARLETT2_PAD_SWITCH_MAX];
	u8 dim_mute[SCARLETT2_DIM_MUTE_COUNT];
	u8 air_switch[SCARLETT2_AIR_SWITCH_MAX];
	u8 dsp_switch[SCARLETT2_DSP_SWITCH_MAX];
	s32 compressor_values[SCARLETT2_COMPRESSOR_CTLS_MAX];
	s32 precomp_flt_values[SCARLETT2_PRECOMP_FLT_VALUES_MAX];
	s32 peq_flt_values[SCARLETT2_PEQ_FLT_VALUES_MAX];
	u8 precomp_flt_switch[SCARLETT2_DSP_SWITCH_MAX];
	u8 peq_flt_switch[SCARLETT2_DSP_SWITCH_MAX];
	u8 input_mute_switch[SCARLETT2_INPUT_MUTE_SWITCH_MAX];
	u8 phantom_switch[SCARLETT2_PHANTOM_SWITCH_MAX];
	u8 phantom_persistence;
	u8 input_select_switch;
	u8 input_link_switch[SCARLETT2_INPUT_GAIN_MAX / 2];
	u8 gain[SCARLETT2_INPUT_GAIN_MAX];
	u8 autogain_switch[SCARLETT2_INPUT_GAIN_MAX];
	u8 autogain_status[SCARLETT2_INPUT_GAIN_MAX];
	s8 ag_targets[SCARLETT2_AG_TARGET_COUNT];
	u8 safe_switch[SCARLETT2_INPUT_GAIN_MAX];
	u8 pcm_input_switch;
	u8 direct_monitor_switch;
	u8 speaker_switching_switch;
	u8 talkback_switch;
	u8 talkback_map[SCARLETT2_OUTPUT_MIX_MAX];
	u8 msd_switch;
	u8 standalone_switch;
	u8 power_status;
	u8 bluetooth_volume;
	u8 spdif_mode;
	u8 meter_level_map[SCARLETT2_MAX_METERS];
	struct snd_kcontrol *sync_ctl;
	struct snd_kcontrol *master_vol_ctl;
	struct snd_kcontrol *headphone_vol_ctl;
	struct snd_kcontrol *vol_ctls[SCARLETT2_ANALOGUE_MAX];
	struct snd_kcontrol *sw_hw_ctls[SCARLETT2_ANALOGUE_MAX];
	struct snd_kcontrol *mute_ctls[SCARLETT2_ANALOGUE_MAX];
	struct snd_kcontrol *dim_mute_ctls[SCARLETT2_DIM_MUTE_COUNT];
	struct snd_kcontrol *level_ctls[SCARLETT2_LEVEL_SWITCH_MAX];
	struct snd_kcontrol *pad_ctls[SCARLETT2_PAD_SWITCH_MAX];
	struct snd_kcontrol *air_ctls[SCARLETT2_AIR_SWITCH_MAX];
	struct snd_kcontrol *dsp_ctls[SCARLETT2_DSP_SWITCH_MAX];
	struct snd_kcontrol *input_mute_ctls[SCARLETT2_INPUT_MUTE_SWITCH_MAX];
	struct snd_kcontrol *phantom_ctls[SCARLETT2_PHANTOM_SWITCH_MAX];
	struct snd_kcontrol *input_select_ctl;
	struct snd_kcontrol *input_link_ctls[SCARLETT2_INPUT_GAIN_MAX / 2];
	struct snd_kcontrol *input_gain_ctls[SCARLETT2_INPUT_GAIN_MAX];
	struct snd_kcontrol *autogain_ctls[SCARLETT2_INPUT_GAIN_MAX];
	struct snd_kcontrol *autogain_status_ctls[SCARLETT2_INPUT_GAIN_MAX];
	struct snd_kcontrol *ag_target_ctls[SCARLETT2_AG_TARGET_COUNT];
	struct snd_kcontrol *safe_ctls[SCARLETT2_INPUT_GAIN_MAX];
	struct snd_kcontrol *pcm_input_switch_ctl;
	struct snd_kcontrol *mux_ctls[SCARLETT2_MUX_MAX];
	struct snd_kcontrol *mix_ctls[SCARLETT2_MIX_MAX];
	struct snd_kcontrol *compressor_ctls[SCARLETT2_COMPRESSOR_CTLS_MAX];
	struct snd_kcontrol *precomp_flt_ctls[SCARLETT2_PRECOMP_FLT_CTLS_MAX];
	struct snd_kcontrol *peq_flt_ctls[SCARLETT2_PEQ_FLT_CTLS_MAX];
	struct snd_kcontrol *precomp_flt_switch_ctls[SCARLETT2_DSP_SWITCH_MAX];
	struct snd_kcontrol *peq_flt_switch_ctls[SCARLETT2_DSP_SWITCH_MAX];
	struct snd_kcontrol *direct_monitor_ctl;
	struct snd_kcontrol *speaker_switching_ctl;
	struct snd_kcontrol *talkback_ctl;
	struct snd_kcontrol *power_status_ctl;
	struct snd_kcontrol *bluetooth_volume_ctl;
	u8 mux[SCARLETT2_MUX_MAX];
	u8 mix[SCARLETT2_MIX_MAX];
	u8 monitor_mix[SCARLETT2_MONITOR_MIX_MAX];
};

/*** Model-specific data ***/

static const struct scarlett2_device_info s6i6_gen2_info = {
	.config_set = &scarlett2_config_set_gen2a,
	.level_input_count = 2,
	.pad_input_count = 2,

	.line_out_descrs = {
		"Headphones 1 L",
		"Headphones 1 R",
		"Headphones 2 L",
		"Headphones 2 R",
	},

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = {  1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = {  4,  4 },
		[SCARLETT2_PORT_TYPE_SPDIF]    = {  2,  2 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 10, 18 },
		[SCARLETT2_PORT_TYPE_PCM]      = {  6,  6 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  6 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  6 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  6 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	} },

	.meter_map = {
		{ 24,  6 },
		{  0, 24 },
		{  0,  0 },
	}
};

static const struct scarlett2_device_info s18i8_gen2_info = {
	.config_set = &scarlett2_config_set_gen2a,
	.level_input_count = 2,
	.pad_input_count = 4,

	.line_out_descrs = {
		"Monitor L",
		"Monitor R",
		"Headphones 1 L",
		"Headphones 1 R",
		"Headphones 2 L",
		"Headphones 2 R",
	},

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = {  1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = {  8,  6 },
		[SCARLETT2_PORT_TYPE_SPDIF]    = {  2,  2 },
		[SCARLETT2_PORT_TYPE_ADAT]     = {  8,  0 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 10, 18 },
		[SCARLETT2_PORT_TYPE_PCM]      = {  8, 18 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 18 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  6 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 14 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  6 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 10 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  6 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  4 },
		{ 0,                            0,  0 },
	} },

	.meter_map = {
		{ 26, 18 },
		{  0, 26 },
		{  0,  0 },
	}
};

static const struct scarlett2_device_info s18i20_gen2_info = {
	.config_set = &scarlett2_config_set_gen2b,

	.line_out_descrs = {
		"Monitor L",
		"Monitor R",
		NULL,
		NULL,
		NULL,
		NULL,
		"Headphones 1 L",
		"Headphones 1 R",
		"Headphones 2 L",
		"Headphones 2 R",
	},

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = {  1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = {  8, 10 },
		[SCARLETT2_PORT_TYPE_SPDIF]    = {  2,  2 },
		[SCARLETT2_PORT_TYPE_ADAT]     = {  8,  8 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 10, 18 },
		[SCARLETT2_PORT_TYPE_PCM]      = { 20, 18 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 18 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0, 10 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_ADAT,     0,  8 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 14 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0, 10 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_ADAT,     0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 10 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0, 10 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  6 },
		{ 0,                            0,  0 },
	} },

	.meter_map = {
		{ 38, 18 },
		{  0, 38 },
		{  0,  0 },
	}
};

static const struct scarlett2_device_info solo_gen3_info = {
	.config_set = &scarlett2_config_set_gen3a,
	.level_input_count = 1,
	.level_input_first = 1,
	.air_input_count = 1,
	.phantom_count = 1,
	.inputs_per_phantom = 1,
	.direct_monitor = 1,
};

static const struct scarlett2_device_info s2i2_gen3_info = {
	.config_set = &scarlett2_config_set_gen3a,
	.level_input_count = 2,
	.air_input_count = 2,
	.phantom_count = 1,
	.inputs_per_phantom = 2,
	.direct_monitor = 2,
};

static const struct scarlett2_device_info s4i4_gen3_info = {
	.config_set = &scarlett2_config_set_gen3b,
	.level_input_count = 2,
	.pad_input_count = 2,
	.air_input_count = 2,
	.phantom_count = 1,
	.inputs_per_phantom = 2,

	.line_out_descrs = {
		"Monitor L",
		"Monitor R",
		"Headphones L",
		"Headphones R",
	},

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = { 1, 0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = { 4, 4 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 6, 8 },
		[SCARLETT2_PORT_TYPE_PCM]      = { 4, 6 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  6 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,      0,  8 },
		{ SCARLETT2_PORT_TYPE_NONE,     0, 16 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  6 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,      0,  8 },
		{ SCARLETT2_PORT_TYPE_NONE,     0, 16 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  6 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,      0,  8 },
		{ SCARLETT2_PORT_TYPE_NONE,     0, 16 },
		{ 0,                            0,  0 },
	} },

	.meter_map = {
		{ 12,  6 },
		{  0, 12 },
		{  0,  0 },
	}
};

static const struct scarlett2_device_info s8i6_gen3_info = {
	.config_set = &scarlett2_config_set_gen3b,
	.level_input_count = 2,
	.pad_input_count = 2,
	.air_input_count = 2,
	.phantom_count = 1,
	.inputs_per_phantom = 2,

	.line_out_descrs = {
		"Headphones 1 L",
		"Headphones 1 R",
		"Headphones 2 L",
		"Headphones 2 R",
	},

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = { 1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = { 6,  4 },
		[SCARLETT2_PORT_TYPE_SPDIF]    = { 2,  2 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 8,  8 },
		[SCARLETT2_PORT_TYPE_PCM]      = { 6, 10 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  8 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,      8,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0,  8 },
		{ SCARLETT2_PORT_TYPE_NONE,     0, 18 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  8 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,      8,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0,  8 },
		{ SCARLETT2_PORT_TYPE_NONE,     0, 18 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  8 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,      8,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0,  8 },
		{ SCARLETT2_PORT_TYPE_NONE,     0, 18 },
		{ 0,                            0,  0 },
	} },

	.meter_map = {
		{ 14, 8 },
		{  0, 6 },
		{ 22, 2 },
		{  6, 8 },
		{  0, 0 },
	}
};

static const u8 scarlett2_spdif_s18i8_gen3_values[] = { 0, 2, 0xff };

static const char * const scarlett2_spdif_s18i8_gen3_texts[] = {
	"RCA",
	"Optical",
	NULL
};

static const struct scarlett2_device_info s18i8_gen3_info = {
	.config_set = &scarlett2_config_set_gen3c,
	.has_speaker_switching = 1,
	.level_input_count = 2,
	.pad_input_count = 4,
	.air_input_count = 4,
	.phantom_count = 2,
	.inputs_per_phantom = 2,

	.spdif_mode_control_name = "S/PDIF Mode Capture Enum",
	.spdif_mode_values = scarlett2_spdif_s18i8_gen3_values,
	.spdif_mode_texts = scarlett2_spdif_s18i8_gen3_texts,

	.line_out_remap_enable = 1,
	.line_out_remap = { 0, 1, 6, 7, 2, 3, 4, 5 },
	.line_out_unmap = { 0, 1, 4, 5, 6, 7, 2, 3 },

	.line_out_descrs = {
		"Monitor L",
		"Monitor R",
		"Alt Monitor L",
		"Alt Monitor R",
		"Headphones 1 L",
		"Headphones 1 R",
		"Headphones 2 L",
		"Headphones 2 R",
	},

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = {  1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = {  8,  8 },
		[SCARLETT2_PORT_TYPE_SPDIF]    = {  2,  2 },
		[SCARLETT2_PORT_TYPE_ADAT]     = {  8,  0 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 10, 20 },
		[SCARLETT2_PORT_TYPE_PCM]      = {  8, 20 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_PCM,       0, 10 },
		{ SCARLETT2_PORT_TYPE_PCM,      12,  8 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  6,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  2,  4 },
		{ SCARLETT2_PORT_TYPE_SPDIF,     0,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,      10,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       0, 20 },
		{ SCARLETT2_PORT_TYPE_NONE,      0, 10 },
		{ 0,                             0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,       0, 10 },
		{ SCARLETT2_PORT_TYPE_PCM,      12,  4 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  6,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  2,  4 },
		{ SCARLETT2_PORT_TYPE_SPDIF,     0,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,      10,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       0, 20 },
		{ SCARLETT2_PORT_TYPE_NONE,      0, 10 },
		{ 0,                             0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,       0, 10 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  6,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  2,  4 },
		{ SCARLETT2_PORT_TYPE_SPDIF,     0,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       0, 20 },
		{ SCARLETT2_PORT_TYPE_NONE,      0, 10 },
		{ 0,                             0,  0 },
	} },

	.meter_map = {
		{ 30, 10 },
		{ 42,  8 },
		{  0,  2 },
		{  6,  2 },
		{  2,  4 },
		{  8,  2 },
		{ 40,  2 },
		{ 10, 20 },
		{  0,  0 }
	}
};

static const u8 scarlett2_spdif_s18i20_gen3_values[] = { 0, 6, 1, 0xff };

static const char * const scarlett2_spdif_s18i20_gen3_texts[] = {
	"S/PDIF RCA",
	"S/PDIF Optical",
	"Dual ADAT",
	NULL
};

static const struct scarlett2_device_info s18i20_gen3_info = {
	.config_set = &scarlett2_config_set_gen3c,
	.has_speaker_switching = 1,
	.has_talkback = 1,
	.level_input_count = 2,
	.pad_input_count = 8,
	.air_input_count = 8,
	.phantom_count = 2,
	.inputs_per_phantom = 4,

	.spdif_mode_control_name = "Digital I/O Mode Capture Enum",
	.spdif_mode_values = scarlett2_spdif_s18i20_gen3_values,
	.spdif_mode_texts = scarlett2_spdif_s18i20_gen3_texts,

	.line_out_descrs = {
		"Monitor 1 L",
		"Monitor 1 R",
		"Monitor 2 L",
		"Monitor 2 R",
		NULL,
		NULL,
		"Headphones 1 L",
		"Headphones 1 R",
		"Headphones 2 L",
		"Headphones 2 R",
	},

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = {  1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = {  9, 10 },
		[SCARLETT2_PORT_TYPE_SPDIF]    = {  2,  2 },
		[SCARLETT2_PORT_TYPE_ADAT]     = {  8,  8 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 12, 25 },
		[SCARLETT2_PORT_TYPE_PCM]      = { 20, 20 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_PCM,       0,  8 },
		{ SCARLETT2_PORT_TYPE_PCM,      10, 10 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0, 10 },
		{ SCARLETT2_PORT_TYPE_SPDIF,     0,  2 },
		{ SCARLETT2_PORT_TYPE_ADAT,      0,  8 },
		{ SCARLETT2_PORT_TYPE_PCM,       8,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       0, 25 },
		{ SCARLETT2_PORT_TYPE_NONE,      0, 12 },
		{ 0,                             0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,       0,  8 },
		{ SCARLETT2_PORT_TYPE_PCM,      10,  8 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0, 10 },
		{ SCARLETT2_PORT_TYPE_SPDIF,     0,  2 },
		{ SCARLETT2_PORT_TYPE_ADAT,      0,  8 },
		{ SCARLETT2_PORT_TYPE_PCM,       8,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       0, 25 },
		{ SCARLETT2_PORT_TYPE_NONE,      0, 10 },
		{ 0,                             0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,       0, 10 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0, 10 },
		{ SCARLETT2_PORT_TYPE_SPDIF,     0,  2 },
		{ SCARLETT2_PORT_TYPE_NONE,      0, 24 },
		{ 0,                             0,  0 },
	} },

	.meter_map = {
		{ 45,  8 },
		{ 55, 10 },
		{  0, 20 },
		{ 53,  2 },
		{ 20, 25 },
		{  0,  0 },
	}
};

static const struct scarlett2_device_info vocaster_one_info = {
	.config_set = &scarlett2_config_set_vocaster,
	.min_firmware_version = 1769,

	.phantom_count = 1,
	.inputs_per_phantom = 1,
	.dsp_count = 1,
	.dsp_input_count = 1,
	.precomp_flt_count = 2,
	.peq_flt_count = 3,
	.peq_flt_total_count = 4,
	.mute_input_count = 1,
	.gain_input_count = 1,

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = { 1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = { 2,  4 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 9,  9 },
		[SCARLETT2_PORT_TYPE_PCM]      = { 4, 10 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_MIX,      8, 1 },
		{ SCARLETT2_PORT_TYPE_PCM,      5, 5 },
		{ SCARLETT2_PORT_TYPE_MIX,      6, 2 },
		{ SCARLETT2_PORT_TYPE_PCM,      0, 5 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 6 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0, 4 },
		{ 0, 0, 0 },
	} },

	.meter_map = {
		{ 12, 1 },
		{ 18, 5 },
		{ 10, 2 },
		{ 13, 5 },
		{  4, 6 },
		{  0, 4 },
		{  0, 0 }
	}
};

static const struct scarlett2_device_info vocaster_two_info = {
	.config_set = &scarlett2_config_set_vocaster,
	.min_firmware_version = 1769,

	.phantom_count = 2,
	.inputs_per_phantom = 1,
	.dsp_count = 2,
	.dsp_input_count = 2,
	.precomp_flt_count = 2,
	.peq_flt_count = 3,
	.peq_flt_total_count = 4,
	.mute_input_count = 2,
	.gain_input_count = 2,
	.has_bluetooth = 1,

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = {  1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = {  6,  6 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 12, 14 },
		[SCARLETT2_PORT_TYPE_PCM]      = {  4, 14 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_MIX,      12,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       6,  8 },
		{ SCARLETT2_PORT_TYPE_MIX,      10,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       0,  6 },
		{ SCARLETT2_PORT_TYPE_MIX,       0, 10 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  6 },
		{ 0, 0, 0 },
	} },

	.meter_map = {
		{ 18,  2 },
		{ 26,  8 },
		{ 16,  2 },
		{ 20,  6 },
		{  6, 10 },
		{  0,  6 },
		{  0,  0 }
	}
};

static const struct scarlett2_device_info solo_gen4_info = {
	.config_set = &scarlett2_config_set_gen4_solo,
	.min_firmware_version = 2115,

	.level_input_count = 1,
	.air_input_count = 1,
	.air_input_first = 1,
	.air_option = 1,
	.phantom_count = 1,
	.phantom_first = 1,
	.inputs_per_phantom = 1,
	.direct_monitor = 1,
	.dsp_count = 2,

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = { 1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = { 2,  2 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 8,  6 },
		[SCARLETT2_PORT_TYPE_PCM]      = { 2,  4 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_MIX,       4,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       2,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,       0,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  2 },
		{ 0,                             0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_MIX,       4,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       2,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,       0,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  2 },
		{ 0,                             0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_MIX,       4,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       2,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,       0,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  2 },
		{ 0,                             0,  0 },
	} },

	.meter_map = {
		{  6,  2 },
		{  4,  2 },
		{  8,  4 },
		{  2,  2 },
		{  0,  2 },
		{  0,  0 }
	}
};

static const struct scarlett2_device_info s2i2_gen4_info = {
	.config_set = &scarlett2_config_set_gen4_2i2,
	.min_firmware_version = 2115,

	.level_input_count = 2,
	.air_input_count = 2,
	.air_option = 1,
	.phantom_count = 1,
	.inputs_per_phantom = 2,
	.gain_input_count = 2,
	.safe_input_count = 2,
	.direct_monitor = 2,
	.dsp_count = 2,

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = { 1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = { 2,  2 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 6,  6 },
		[SCARLETT2_PORT_TYPE_PCM]      = { 2,  4 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_MIX,       4,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       2,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,       0,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  2 },
		{ 0,                             0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_MIX,       4,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       2,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,       0,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  2 },
		{ 0,                             0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_MIX,       4,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,       2,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,       0,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  2 },
		{ 0,                             0,  0 },
	} },

	.meter_map = {
		{  6,  2 },
		{  4,  2 },
		{  8,  4 },
		{  2,  2 },
		{  0,  2 },
		{  0,  0 }
	}
};

static const struct scarlett2_device_info s4i4_gen4_info = {
	.config_set = &scarlett2_config_set_gen4_4i4,
	.min_firmware_version = 2089,

	.level_input_count = 2,
	.air_input_count = 2,
	.air_option = 1,
	.phantom_count = 2,
	.inputs_per_phantom = 1,
	.gain_input_count = 2,
	.safe_input_count = 2,
	.dsp_count = 2,

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = { 1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = { 4,  6 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 8, 12 },
		[SCARLETT2_PORT_TYPE_PCM]      = { 6,  6 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_MIX,      10,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       0,  6 },
		{ SCARLETT2_PORT_TYPE_MIX,       0, 10 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  6 },
		{ 0,                             0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_MIX,      10,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       0,  6 },
		{ SCARLETT2_PORT_TYPE_MIX,       0, 10 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  6 },
		{ 0,                             0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_MIX,      10,  2 },
		{ SCARLETT2_PORT_TYPE_PCM,       0,  6 },
		{ SCARLETT2_PORT_TYPE_MIX,       0, 10 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE,  0,  6 },
		{ 0,                             0,  0 },
	} },

	.meter_map = {
		{ 16,  8 },
		{  6, 10 },
		{  0,  6 },
		{  0,  0 }
	}
};

static const struct scarlett2_device_info clarett_2pre_info = {
	.config_set = &scarlett2_config_set_clarett,
	.level_input_count = 2,
	.air_input_count = 2,

	.line_out_descrs = {
		"Monitor L",
		"Monitor R",
		"Headphones L",
		"Headphones R",
	},

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = {  1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = {  2,  4 },
		[SCARLETT2_PORT_TYPE_SPDIF]    = {  2,  0 },
		[SCARLETT2_PORT_TYPE_ADAT]     = {  8,  0 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 10, 18 },
		[SCARLETT2_PORT_TYPE_PCM]      = {  4, 12 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 12 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  8 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0,  2 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  4 },
		{ SCARLETT2_PORT_TYPE_NONE,     0, 26 },
		{ 0,                            0,  0 },
	} },

	.meter_map = {
		{ 22, 12 },
		{  0, 22 },
		{  0,  0 }
	}
};

static const u8 scarlett2_spdif_clarett_values[] = { 0, 1, 2, 0xff };

static const char * const scarlett2_spdif_clarett_texts[] = {
	"None",
	"Optical",
	"RCA",
	NULL
};

static const struct scarlett2_device_info clarett_4pre_info = {
	.config_set = &scarlett2_config_set_clarett,
	.level_input_count = 2,
	.air_input_count = 4,

	.spdif_mode_control_name = "S/PDIF Source Capture Enum",
	.spdif_mode_values = scarlett2_spdif_clarett_values,
	.spdif_mode_texts = scarlett2_spdif_clarett_texts,

	.line_out_descrs = {
		"Monitor L",
		"Monitor R",
		"Headphones 1 L",
		"Headphones 1 R",
		"Headphones 2 L",
		"Headphones 2 R",
	},

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = {  1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = {  8,  6 },
		[SCARLETT2_PORT_TYPE_SPDIF]    = {  2,  2 },
		[SCARLETT2_PORT_TYPE_ADAT]     = {  8,  0 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 10, 18 },
		[SCARLETT2_PORT_TYPE_PCM]      = {  8, 18 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 18 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  6 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 14 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  6 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 12 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0,  6 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_NONE,     0, 24 },
		{ 0,                            0,  0 },
	} },

	.meter_map = {
		{ 26, 18 },
		{  0, 26 },
		{  0,  0 }
	}
};

static const struct scarlett2_device_info clarett_8pre_info = {
	.config_set = &scarlett2_config_set_clarett,
	.level_input_count = 2,
	.air_input_count = 8,

	.spdif_mode_control_name = "S/PDIF Source Capture Enum",
	.spdif_mode_values = scarlett2_spdif_clarett_values,
	.spdif_mode_texts = scarlett2_spdif_clarett_texts,

	.line_out_descrs = {
		"Monitor L",
		"Monitor R",
		NULL,
		NULL,
		NULL,
		NULL,
		"Headphones 1 L",
		"Headphones 1 R",
		"Headphones 2 L",
		"Headphones 2 R",
	},

	.port_count = {
		[SCARLETT2_PORT_TYPE_NONE]     = {  1,  0 },
		[SCARLETT2_PORT_TYPE_ANALOGUE] = {  8, 10 },
		[SCARLETT2_PORT_TYPE_SPDIF]    = {  2,  2 },
		[SCARLETT2_PORT_TYPE_ADAT]     = {  8,  8 },
		[SCARLETT2_PORT_TYPE_MIX]      = { 10, 18 },
		[SCARLETT2_PORT_TYPE_PCM]      = { 20, 18 },
	},

	.mux_assignment = { {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 18 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0, 10 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_ADAT,     0,  8 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 14 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0, 10 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_ADAT,     0,  4 },
		{ SCARLETT2_PORT_TYPE_MIX,      0, 18 },
		{ SCARLETT2_PORT_TYPE_NONE,     0,  8 },
		{ 0,                            0,  0 },
	}, {
		{ SCARLETT2_PORT_TYPE_PCM,      0, 12 },
		{ SCARLETT2_PORT_TYPE_ANALOGUE, 0, 10 },
		{ SCARLETT2_PORT_TYPE_SPDIF,    0,  2 },
		{ SCARLETT2_PORT_TYPE_NONE,     0, 22 },
		{ 0,                            0,  0 },
	} },

	.meter_map = {
		{ 38, 18 },
		{  0, 38 },
		{  0,  0 }
	}
};

struct scarlett2_device_entry {
	const u32 usb_id; /* USB device identifier */
	const struct scarlett2_device_info *info;
	const char *series_name;
};

static const struct scarlett2_device_entry scarlett2_devices[] = {
	/* Supported Gen 2 devices */
	{ USB_ID(0x1235, 0x8203), &s6i6_gen2_info, "Scarlett Gen 2" },
	{ USB_ID(0x1235, 0x8204), &s18i8_gen2_info, "Scarlett Gen 2" },
	{ USB_ID(0x1235, 0x8201), &s18i20_gen2_info, "Scarlett Gen 2" },

	/* Supported Gen 3 devices */
	{ USB_ID(0x1235, 0x8211), &solo_gen3_info, "Scarlett Gen 3" },
	{ USB_ID(0x1235, 0x8210), &s2i2_gen3_info, "Scarlett Gen 3" },
	{ USB_ID(0x1235, 0x8212), &s4i4_gen3_info, "Scarlett Gen 3" },
	{ USB_ID(0x1235, 0x8213), &s8i6_gen3_info, "Scarlett Gen 3" },
	{ USB_ID(0x1235, 0x8214), &s18i8_gen3_info, "Scarlett Gen 3" },
	{ USB_ID(0x1235, 0x8215), &s18i20_gen3_info, "Scarlett Gen 3" },

	/* Supported Vocaster devices */
	{ USB_ID(0x1235, 0x8216), &vocaster_one_info, "Vocaster" },
	{ USB_ID(0x1235, 0x8217), &vocaster_two_info, "Vocaster" },

	/* Supported Gen 4 devices */
	{ USB_ID(0x1235, 0x8218), &solo_gen4_info, "Scarlett Gen 4" },
	{ USB_ID(0x1235, 0x8219), &s2i2_gen4_info, "Scarlett Gen 4" },
	{ USB_ID(0x1235, 0x821a), &s4i4_gen4_info, "Scarlett Gen 4" },

	/* Supported Clarett USB/Clarett+ devices */
	{ USB_ID(0x1235, 0x8206), &clarett_2pre_info, "Clarett USB" },
	{ USB_ID(0x1235, 0x8207), &clarett_4pre_info, "Clarett USB" },
	{ USB_ID(0x1235, 0x8208), &clarett_8pre_info, "Clarett USB" },
	{ USB_ID(0x1235, 0x820a), &clarett_2pre_info, "Clarett+" },
	{ USB_ID(0x1235, 0x820b), &clarett_4pre_info, "Clarett+" },
	{ USB_ID(0x1235, 0x820c), &clarett_8pre_info, "Clarett+" },

	/* End of list */
	{ 0, NULL },
};

/* get the starting port index number for a given port type/direction */
static int scarlett2_get_port_start_num(
	const int port_count[][SCARLETT2_PORT_DIRNS],
	int direction, int port_type)
{
	int i, num = 0;

	for (i = 0; i < port_type; i++)
		num += port_count[i][direction];

	return num;
}

/*** USB Interactions ***/

/* Commands for sending/receiving requests/responses */
#define SCARLETT2_USB_CMD_INIT 0
#define SCARLETT2_USB_CMD_REQ  2
#define SCARLETT2_USB_CMD_RESP 3

#define SCARLETT2_USB_INIT_1        0x00000000
#define SCARLETT2_USB_INIT_2        0x00000002
#define SCARLETT2_USB_REBOOT        0x00000003
#define SCARLETT2_USB_GET_METER     0x00001001
#define SCARLETT2_USB_GET_MIX       0x00002001
#define SCARLETT2_USB_SET_MIX       0x00002002
#define SCARLETT2_USB_GET_MUX       0x00003001
#define SCARLETT2_USB_SET_MUX       0x00003002
#define SCARLETT2_USB_INFO_FLASH    0x00004000
#define SCARLETT2_USB_INFO_SEGMENT  0x00004001
#define SCARLETT2_USB_ERASE_SEGMENT 0x00004002
#define SCARLETT2_USB_GET_ERASE     0x00004003
#define SCARLETT2_USB_WRITE_SEGMENT 0x00004004
#define SCARLETT2_USB_READ_SEGMENT  0x00004005
#define SCARLETT2_USB_GET_SYNC      0x00006004
#define SCARLETT2_USB_GET_DATA      0x00800000
#define SCARLETT2_USB_SET_DATA      0x00800001
#define SCARLETT2_USB_DATA_CMD      0x00800002

#define SCARLETT2_USB_CONFIG_SAVE 6

#define SCARLETT2_USB_METER_LEVELS_GET_MAGIC 1

#define SCARLETT2_FLASH_BLOCK_SIZE 4096
#define SCARLETT2_FLASH_RW_MAX 1024
#define SCARLETT2_SEGMENT_NUM_MIN 1
#define SCARLETT2_SEGMENT_NUM_MAX 4

#define SCARLETT2_SEGMENT_SETTINGS_NAME "App_Settings"
#define SCARLETT2_SEGMENT_FIRMWARE_NAME "App_Upgrade"

/* proprietary request/response format */
struct scarlett2_usb_packet {
	__le32 cmd;
	__le16 size;
	__le16 seq;
	__le32 error;
	__le32 pad;
	u8 data[];
};

static void scarlett2_fill_request_header(struct scarlett2_data *private,
					  struct scarlett2_usb_packet *req,
					  u32 cmd, u16 req_size)
{
	/* sequence must go up by 1 for each request */
	u16 seq = private->scarlett2_seq++;

	req->cmd = cpu_to_le32(cmd);
	req->size = cpu_to_le16(req_size);
	req->seq = cpu_to_le16(seq);
	req->error = 0;
	req->pad = 0;
}

static int scarlett2_usb_tx(struct usb_device *dev, int interface,
			    void *buf, u16 size)
{
	return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
			SCARLETT2_USB_CMD_REQ,
			USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
			0, interface, buf, size);
}

static int scarlett2_usb_rx(struct usb_device *dev, int interface,
			    u32 usb_req, void *buf, u16 size)
{
	return snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0),
			usb_req,
			USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
			0, interface, buf, size);
}

/* Send a proprietary format request to the Scarlett interface */
static int scarlett2_usb(
	struct usb_mixer_interface *mixer, u32 cmd,
	void *req_data, u16 req_size, void *resp_data, u16 resp_size)
{
	struct scarlett2_data *private = mixer->private_data;
	struct usb_device *dev = mixer->chip->dev;
	struct scarlett2_usb_packet *req, *resp = NULL;
	size_t req_buf_size = struct_size(req, data, req_size);
	size_t resp_buf_size = struct_size(resp, data, resp_size);
	int err;

	req = kmalloc(req_buf_size, GFP_KERNEL);
	if (!req) {
		err = -ENOMEM;
		goto error;
	}

	resp = kmalloc(resp_buf_size, GFP_KERNEL);
	if (!resp) {
		err = -ENOMEM;
		goto error;
	}

	mutex_lock(&private->usb_mutex);

	/* build request message and send it */

	scarlett2_fill_request_header(private, req, cmd, req_size);

	if (req_size)
		memcpy(req->data, req_data, req_size);

	err = scarlett2_usb_tx(dev, private->bInterfaceNumber,
			       req, req_buf_size);

	if (err != req_buf_size) {
		usb_audio_err(
			mixer->chip,
			"%s USB request result cmd %x was %d\n",
			private->series_name, cmd, err);
		err = -EINVAL;
		goto unlock;
	}

	if (!wait_for_completion_timeout(&private->cmd_done,
					 msecs_to_jiffies(1000))) {
		usb_audio_err(
			mixer->chip,
			"%s USB request timed out, cmd %x\n",
			private->series_name, cmd);

		err = -ETIMEDOUT;
		goto unlock;
	}

	/* send a second message to get the response */

	err = scarlett2_usb_rx(dev, private->bInterfaceNumber,
			       SCARLETT2_USB_CMD_RESP,
			       resp, resp_buf_size);

	/* validate the response */

	if (err != resp_buf_size) {

		/* ESHUTDOWN and EPROTO are valid responses to a
		 * reboot request
		 */
		if (cmd == SCARLETT2_USB_REBOOT &&
		    (err == -ESHUTDOWN || err == -EPROTO)) {
			err = 0;
			goto unlock;
		}

		usb_audio_err(
			mixer->chip,
			"%s USB response result cmd %x was %d expected %zu\n",
			private->series_name, cmd, err, resp_buf_size);
		err = -EINVAL;
		goto unlock;
	}

	/* cmd/seq/size should match except when initialising
	 * seq sent = 1, response = 0
	 */
	if (resp->cmd != req->cmd ||
	    (resp->seq != req->seq &&
		(le16_to_cpu(req->seq) != 1 || resp->seq != 0)) ||
	    resp_size != le16_to_cpu(resp->size) ||
	    resp->error ||
	    resp->pad) {
		usb_audio_err(
			mixer->chip,
			"%s USB invalid response; "
			   "cmd tx/rx %d/%d seq %d/%d size %d/%d "
			   "error %d pad %d\n",
			private->series_name,
			le32_to_cpu(req->cmd), le32_to_cpu(resp->cmd),
			le16_to_cpu(req->seq), le16_to_cpu(resp->seq),
			resp_size, le16_to_cpu(resp->size),
			le32_to_cpu(resp->error),
			le32_to_cpu(resp->pad));
		err = -EINVAL;
		goto unlock;
	}

	if (resp_data && resp_size > 0)
		memcpy(resp_data, resp->data, resp_size);

unlock:
	mutex_unlock(&private->usb_mutex);
error:
	kfree(req);
	kfree(resp);
	return err;
}

/* Send a USB message to get data; result placed in *buf */
static int scarlett2_usb_get(
	struct usb_mixer_interface *mixer,
	int offset, void *buf, int size)
{
	struct {
		__le32 offset;
		__le32 size;
	} __packed req;

	req.offset = cpu_to_le32(offset);
	req.size = cpu_to_le32(size);
	return scarlett2_usb(mixer, SCARLETT2_USB_GET_DATA,
			     &req, sizeof(req), buf, size);
}

/* Return true if the given configuration item is present in the
 * configuration set used by this device.
 */
static int scarlett2_has_config_item(
	struct scarlett2_data *private, int config_item_num)
{
	return !!private->config_set->items[config_item_num].offset;
}

/* Send a USB message to get configuration parameters; result placed in *buf */
static int scarlett2_usb_get_config(
	struct usb_mixer_interface *mixer,
	int config_item_num, int count, void *buf)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_config *config_item =
		&private->config_set->items[config_item_num];
	int size, err, i;
	u8 *buf_8;
	u8 value;

	/* Check that the configuration item is present in the
	 * configuration set used by this device
	 */
	if (!config_item->offset)
		return -EFAULT;

	/* Writes to the parameter buffer are always 1 byte */
	size = config_item->size ? config_item->size : 8;

	/* For byte-sized parameters, retrieve directly into buf */
	if (size >= 8) {
		size = size / 8 * count;
		err = scarlett2_usb_get(mixer, config_item->offset, buf, size);
		if (err < 0)
			return err;
		if (size == 2) {
			u16 *buf_16 = buf;

			for (i = 0; i < count; i++, buf_16++)
				*buf_16 = le16_to_cpu(*(__le16 *)buf_16);
		} else if (size == 4) {
			u32 *buf_32 = buf;

			for (i = 0; i < count; i++, buf_32++)
				*buf_32 = le32_to_cpu(*(__le32 *)buf_32);
		}
		return 0;
	}

	/* For bit-sized parameters, retrieve into value */
	err = scarlett2_usb_get(mixer, config_item->offset, &value, 1);
	if (err < 0)
		return err;

	/* then unpack from value into buf[] */
	buf_8 = buf;
	for (i = 0; i < 8 && i < count; i++, value >>= 1)
		*buf_8++ = value & 1;

	return 0;
}

/* Send a SCARLETT2_USB_SET_DATA command.
 * offset: location in the device's data space
 * size: size in bytes of the value (1, 2, 4)
 */
static int scarlett2_usb_set_data(
	struct usb_mixer_interface *mixer,
	int offset, int size, int value)
{
	struct scarlett2_data *private = mixer->private_data;
	struct {
		__le32 offset;
		__le32 size;
		__le32 value;
	} __packed req;

	req.offset = cpu_to_le32(offset);
	req.size = cpu_to_le32(size);
	req.value = cpu_to_le32(value);
	return scarlett2_usb(private->mixer, SCARLETT2_USB_SET_DATA,
			     &req, sizeof(u32) * 2 + size, NULL, 0);
}

/* Send a SCARLETT2_USB_SET_DATA command with multiple values.
 * offset: location in the device's data space
 * size: size in bytes of each value (1, 2, 4)
 * count: number of values
 */
static int scarlett2_usb_set_data_buf(
	struct usb_mixer_interface *mixer,
	int offset, int size, int count, void *buf)
{
	struct scarlett2_data *private = mixer->private_data;
	int bytes = size * count;
	struct {
		__le32 offset;
		__le32 size;
		u8 data[];
	} __packed *req;
	int err;
	int buf_size = struct_size(req, data, bytes);

	req = kmalloc(buf_size, GFP_KERNEL);
	if (!req)
		return -ENOMEM;

	req->offset = cpu_to_le32(offset);
	req->size = cpu_to_le32(bytes);
	if (size == 1) {
		memcpy(req->data, buf, count);
	} else if (size == 2) {
		u16 *buf_16 = buf;
		int i;

		for (i = 0; i < count; i++)
			((__le16 *)req->data)[i] = cpu_to_le16(buf_16[i]);
	} else {
		u32 *buf_32 = buf;
		int i;

		for (i = 0; i < count; i++)
			((__le32 *)req->data)[i] = cpu_to_le32(buf_32[i]);
	}

	err = scarlett2_usb(private->mixer, SCARLETT2_USB_SET_DATA,
			    req, buf_size, NULL, 0);

	kfree(req);
	return err;
}

/* Send a SCARLETT2_USB_DATA_CMD command.
 * Configuration changes require activation with this after they have
 * been uploaded by a previous SCARLETT2_USB_SET_DATA.
 * The value for activate needed is determined by the configuration
 * item.
 */
static int scarlett2_usb_activate_config(
	struct usb_mixer_interface *mixer, int activate)
{
	__le32 req;

	req = cpu_to_le32(activate);
	return scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD,
			     &req, sizeof(req), NULL, 0);
}

/* Send USB messages to set a SCARLETT2_CONFIG_* parameter */
static int scarlett2_usb_set_config(
	struct usb_mixer_interface *mixer,
	int config_item_num, int index, int value)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_config_set *config_set = private->config_set;
	const struct scarlett2_config *config_item =
		&config_set->items[config_item_num];
	int offset, size;
	int err;

	/* Check that the configuration item is present in the
	 * configuration set used by this device
	 */
	if (!config_item->offset)
		return -EFAULT;

	/* Write via the parameter buffer? */
	if (config_item->pbuf) {
		if (!config_set->param_buf_addr)
			return -EFAULT;

		/* Place index in param_buf_addr + 1 */
		err = scarlett2_usb_set_data(
			mixer, config_set->param_buf_addr + 1, 1, index);
		if (err < 0)
			return err;

		/* Place value in param_buf_addr */
		err = scarlett2_usb_set_data(
			mixer, config_set->param_buf_addr, 1, value);
		if (err < 0)
			return err;

		/* Activate the write through the parameter buffer */
		return scarlett2_usb_activate_config(
			mixer, config_item->activate);
	}

	/* Direct writes (not via the parameter buffer) need NVRAM
	 * save and support bit-modification
	 */

	/* Cancel any pending NVRAM save */
	cancel_delayed_work_sync(&private->work);

	/* Convert config_item->size in bits to size in bytes and
	 * calculate offset
	 */
	if (config_item->size >= 8) {
		size = config_item->size / 8;
		offset = config_item->offset + index * size;

	/* If updating a bit, retrieve the old value, set/clear the
	 * bit as needed, and update value
	 */
	} else {
		u8 tmp;

		size = 1;
		offset = config_item->offset;

		err = scarlett2_usb_get(mixer, offset, &tmp, 1);
		if (err < 0)
			return err;

		if (value)
			tmp |= (1 << index);
		else
			tmp &= ~(1 << index);

		value = tmp;
	}

	/* Write the new value */
	err = scarlett2_usb_set_data(mixer, offset, size, value);
	if (err < 0)
		return err;

	/* Activate the change */
	err = scarlett2_usb_activate_config(mixer, config_item->activate);
	if (err < 0)
		return err;

	/* Interfaces with parameter buffer writes don't need a
	 * separate save step
	 */
	if (config_set->param_buf_addr)
		return 0;

	/* Schedule the change to be written to NVRAM */
	if (config_item->activate != SCARLETT2_USB_CONFIG_SAVE)
		schedule_delayed_work(&private->work, msecs_to_jiffies(2000));

	return 0;
}

/* Send USB messages to set a SCARLETT2_CONFIG_* parameter with
 * multiple values
 */
static int scarlett2_usb_set_config_buf(
	struct usb_mixer_interface *mixer,
	int config_item_num, int index, int count, void *buf)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_config_set *config_set = private->config_set;
	const struct scarlett2_config *config_item =
		&config_set->items[config_item_num];
	int offset, size;
	int err;

	/* Check that the configuration item is present in the
	 * configuration set used by this device
	 */
	if (!config_item->offset)
		return -EFAULT;

	/* Convert config_item->size in bits to size in bytes and
	 * calculate offset
	 */
	if (config_item->size >= 8) {
		size = config_item->size / 8;
		offset = config_item->offset + index * size;

	/* Bit updates not supported */
	} else {
		return -EFAULT;
	}

	/* Write the new values */
	err = scarlett2_usb_set_data_buf(mixer, offset, size, count, buf);
	if (err < 0)
		return err;

	/* Activate the change */
	return scarlett2_usb_activate_config(mixer, config_item->activate);
}

/* Send SCARLETT2_USB_DATA_CMD SCARLETT2_USB_CONFIG_SAVE */
static void scarlett2_config_save(struct usb_mixer_interface *mixer)
{
	int err;

	err = scarlett2_usb_activate_config(mixer, SCARLETT2_USB_CONFIG_SAVE);
	if (err < 0)
		usb_audio_err(mixer->chip, "config save failed: %d\n", err);
}

/* Delayed work to save config */
static void scarlett2_config_save_work(struct work_struct *work)
{
	struct scarlett2_data *private =
		container_of(work, struct scarlett2_data, work.work);

	scarlett2_config_save(private->mixer);
}

/* Send a USB message to get sync status; result placed in *sync */
static int scarlett2_usb_get_sync_status(
	struct usb_mixer_interface *mixer,
	u8 *sync)
{
	__le32 data;
	int err;

	err = scarlett2_usb(mixer, SCARLETT2_USB_GET_SYNC,
			    NULL, 0, &data, sizeof(data));
	if (err < 0)
		return err;

	*sync = !!data;
	return 0;
}

/* Return true if the device has a mixer that we can control */
static int scarlett2_has_mixer(struct scarlett2_data *private)
{
	return !!private->info->mux_assignment[0][0].count;
}

/* Map from mixer value to (db + 80) * 2
 * (reverse of scarlett2_mixer_values[])
 */
static int scarlett2_mixer_value_to_db(int value)
{
	int i;

	for (i = 0; i < SCARLETT2_MIXER_VALUE_COUNT; i++)
		if (scarlett2_mixer_values[i] >= value)
			return i;
	return SCARLETT2_MIXER_MAX_VALUE;
}

/* Send a USB message to get the volumes for all inputs of one mix
 * and put the values into private->mix[]
 */
static int scarlett2_usb_get_mix(struct usb_mixer_interface *mixer,
				 int mix_num)
{
	struct scarlett2_data *private = mixer->private_data;

	int num_mixer_in = private->num_mix_in;
	int err, i, j;

	struct {
		__le16 mix_num;
		__le16 count;
	} __packed req;

	__le16 data[SCARLETT2_INPUT_MIX_MAX];

	req.mix_num = cpu_to_le16(mix_num);
	req.count = cpu_to_le16(num_mixer_in);

	err = scarlett2_usb(mixer, SCARLETT2_USB_GET_MIX,
			    &req, sizeof(req),
			    data, num_mixer_in * sizeof(u16));
	if (err < 0)
		return err;

	for (i = 0, j = mix_num * num_mixer_in; i < num_mixer_in; i++, j++)
		private->mix[j] = scarlett2_mixer_value_to_db(
			le16_to_cpu(data[i]));

	return 0;
}

/* Send a USB message to set the volumes for all inputs of one mix
 * (values obtained from private->mix[])
 */
static int scarlett2_usb_set_mix(struct usb_mixer_interface *mixer,
				 int mix_num)
{
	struct scarlett2_data *private = mixer->private_data;

	struct {
		__le16 mix_num;
		__le16 data[SCARLETT2_INPUT_MIX_MAX];
	} __packed req;

	int i, j;
	int num_mixer_in = private->num_mix_in;

	req.mix_num = cpu_to_le16(mix_num);

	for (i = 0, j = mix_num * num_mixer_in; i < num_mixer_in; i++, j++)
		req.data[i] = cpu_to_le16(
			scarlett2_mixer_values[private->mix[j]]
		);

	return scarlett2_usb(mixer, SCARLETT2_USB_SET_MIX,
			     &req, (num_mixer_in + 1) * sizeof(u16),
			     NULL, 0);
}

/* Convert a port number index (per info->port_count) to a hardware ID */
static u32 scarlett2_mux_src_num_to_id(
	const int port_count[][SCARLETT2_PORT_DIRNS], int num)
{
	int port_type;

	for (port_type = 0;
	     port_type < SCARLETT2_PORT_TYPE_COUNT;
	     port_type++) {
		if (num < port_count[port_type][SCARLETT2_PORT_IN])
			return scarlett2_ports[port_type].id | num;
		num -= port_count[port_type][SCARLETT2_PORT_IN];
	}

	/* Oops */
	return 0;
}

/* Convert a hardware ID to a port number index */
static u32 scarlett2_mux_id_to_num(
	const int port_count[][SCARLETT2_PORT_DIRNS], int direction, u32 id)
{
	int port_type;
	int port_num = 0;

	for (port_type = 0;
	     port_type < SCARLETT2_PORT_TYPE_COUNT;
	     port_type++) {
		int base = scarlett2_ports[port_type].id;
		int count = port_count[port_type][direction];

		if (id >= base && id < base + count)
			return port_num + id - base;
		port_num += count;
	}

	/* Oops */
	return -1;
}

/* Convert one mux entry from the interface and load into private->mux[] */
static void scarlett2_usb_populate_mux(struct scarlett2_data *private,
				       u32 mux_entry)
{
	const struct scarlett2_device_info *info = private->info;
	const int (*port_count)[SCARLETT2_PORT_DIRNS] = info->port_count;

	int dst_idx, src_idx;

	dst_idx = scarlett2_mux_id_to_num(port_count, SCARLETT2_PORT_OUT,
					  mux_entry & 0xFFF);
	if (dst_idx < 0)
		return;

	if (dst_idx >= private->num_mux_dsts) {
		usb_audio_err(private->mixer->chip,
			"BUG: scarlett2_mux_id_to_num(%06x, OUT): %d >= %d",
			mux_entry, dst_idx, private->num_mux_dsts);
		return;
	}

	src_idx = scarlett2_mux_id_to_num(port_count, SCARLETT2_PORT_IN,
					  mux_entry >> 12);
	if (src_idx < 0)
		return;

	if (src_idx >= private->num_mux_srcs) {
		usb_audio_err(private->mixer->chip,
			"BUG: scarlett2_mux_id_to_num(%06x, IN): %d >= %d",
			mux_entry, src_idx, private->num_mux_srcs);
		return;
	}

	private->mux[dst_idx] = src_idx;
}

/* Update the meter level map
 *
 * The meter level data from the interface (SCARLETT2_USB_GET_METER
 * request) is returned in mux_assignment order, but to avoid exposing
 * that to userspace, scarlett2_meter_ctl_get() rearranges the data
 * into scarlett2_ports order using the meter_level_map[] array which
 * is set up by this function.
 *
 * In addition, the meter level data values returned from the
 * interface are invalid for destinations where:
 *
 * - the source is "Off"; therefore we set those values to zero (map
 *   value of 255)
 *
 * - the source is assigned to a previous (with respect to the
 *   mux_assignment order) destination; therefore we set those values
 *   to the value previously reported for that source
 */
static void scarlett2_update_meter_level_map(struct scarlett2_data *private)
{
	const struct scarlett2_device_info *info = private->info;
	const struct scarlett2_meter_entry *entry;

	/* sources already assigned to a destination
	 * value is 255 for None, otherwise the value of i
	 * (index into array returned by
	 * scarlett2_usb_get_meter_levels())
	 */
	u8 seen_src[SCARLETT2_MAX_SRCS] = { 1 };
	u8 seen_src_value[SCARLETT2_MAX_SRCS] = { 255 };

	/* index in meter_map[] order */
	int i = 0;

	/* go through the meter_map[] entries */
	for (entry = info->meter_map;
	     entry->count;
	     entry++) {

		/* fill in each meter_level_map[] entry */
		int j, mux_idx;

		for (j = 0, mux_idx = entry->start;
		     j < entry->count;
		     i++, j++, mux_idx++) {

			/* convert mux_idx using line_out_unmap[] */
			int map_mux_idx = (
			    info->line_out_remap_enable &&
			    mux_idx < private->num_line_out
			) ? info->line_out_unmap[mux_idx]
			  : mux_idx;

			/* check which source is connected, and if
			 * that source is already connected elsewhere,
			 * use that existing connection's destination
			 * for this meter entry instead
			 */
			int mux_src = private->mux[mux_idx];

			if (!seen_src[mux_src]) {
				seen_src[mux_src] = 1;
				seen_src_value[mux_src] = i;
			}
			private->meter_level_map[map_mux_idx] =
				seen_src_value[mux_src];
		}
	}
}

/* Send USB message to get mux inputs and then populate private->mux[] */
static int scarlett2_usb_get_mux(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int count = private->num_mux_dsts;
	int err, i;

	struct {
		__le16 num;
		__le16 count;
	} __packed req;

	__le32 data[SCARLETT2_MUX_MAX];

	private->mux_updated = 0;

	req.num = 0;
	req.count = cpu_to_le16(count);

	err = scarlett2_usb(mixer, SCARLETT2_USB_GET_MUX,
			    &req, sizeof(req),
			    data, count * sizeof(u32));
	if (err < 0)
		return err;

	for (i = 0; i < count; i++)
		scarlett2_usb_populate_mux(private, le32_to_cpu(data[i]));

	scarlett2_update_meter_level_map(private);

	return 0;
}

/* Send USB messages to set mux inputs */
static int scarlett2_usb_set_mux(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	const int (*port_count)[SCARLETT2_PORT_DIRNS] = info->port_count;
	int table;

	struct {
		__le16 pad;
		__le16 num;
		__le32 data[SCARLETT2_MUX_MAX];
	} __packed req;

	req.pad = 0;

	/* set mux settings for each rate */
	for (table = 0; table < SCARLETT2_MUX_TABLES; table++) {
		const struct scarlett2_mux_entry *entry;

		/* i counts over the output array */
		int i = 0, err;

		req.num = cpu_to_le16(table);

		/* loop through each entry */
		for (entry = info->mux_assignment[table];
		     entry->count;
		     entry++) {
			int j;
			int port_type = entry->port_type;
			int port_idx = entry->start;
			int mux_idx = scarlett2_get_port_start_num(port_count,
				SCARLETT2_PORT_OUT, port_type) + port_idx;
			int dst_id = scarlett2_ports[port_type].id + port_idx;

			/* Empty slots */
			if (!dst_id) {
				for (j = 0; j < entry->count; j++)
					req.data[i++] = 0;
				continue;
			}

			/* Non-empty mux slots use the lower 12 bits
			 * for the destination and next 12 bits for
			 * the source
			 */
			for (j = 0; j < entry->count; j++) {
				int src_id = scarlett2_mux_src_num_to_id(
					port_count, private->mux[mux_idx++]);
				req.data[i++] = cpu_to_le32(dst_id |
							    src_id << 12);
				dst_id++;
			}
		}

		err = scarlett2_usb(mixer, SCARLETT2_USB_SET_MUX,
				    &req, (i + 1) * sizeof(u32),
				    NULL, 0);
		if (err < 0)
			return err;
	}

	scarlett2_update_meter_level_map(private);

	return 0;
}

/* Send USB message to get meter levels */
static int scarlett2_usb_get_meter_levels(struct usb_mixer_interface *mixer,
					  u16 num_meters, u16 *levels)
{
	struct {
		__le16 pad;
		__le16 num_meters;
		__le32 magic;
	} __packed req;
	__le32 resp[SCARLETT2_MAX_METERS];
	int i, err;

	req.pad = 0;
	req.num_meters = cpu_to_le16(num_meters);
	req.magic = cpu_to_le32(SCARLETT2_USB_METER_LEVELS_GET_MAGIC);
	err = scarlett2_usb(mixer, SCARLETT2_USB_GET_METER,
			    &req, sizeof(req), resp, num_meters * sizeof(u32));
	if (err < 0)
		return err;

	/* copy, convert to u16 */
	for (i = 0; i < num_meters; i++)
		levels[i] = le32_to_cpu(resp[i]);

	return 0;
}

/* For config items with mute=1, xor bits 0 & 1 together to get the
 * current/next state. This won't have any effect on values which are
 * only ever 0/1.
 */
static uint8_t scarlett2_decode_muteable(uint8_t v)
{
	return (v ^ (v >> 1)) & 1;
}

/*** Control Functions ***/

/* helper function to create a new control */
static int scarlett2_add_new_ctl(struct usb_mixer_interface *mixer,
				 const struct snd_kcontrol_new *ncontrol,
				 int index, int channels, const char *name,
				 struct snd_kcontrol **kctl_return)
{
	struct snd_kcontrol *kctl;
	struct usb_mixer_elem_info *elem;
	int err;

	elem = kzalloc(sizeof(*elem), GFP_KERNEL);
	if (!elem)
		return -ENOMEM;

	/* We set USB_MIXER_BESPOKEN type, so that the core USB mixer code
	 * ignores them for resume and other operations.
	 * Also, the head.id field is set to 0, as we don't use this field.
	 */
	elem->head.mixer = mixer;
	elem->control = index;
	elem->head.id = 0;
	elem->channels = channels;
	elem->val_type = USB_MIXER_BESPOKEN;

	kctl = snd_ctl_new1(ncontrol, elem);
	if (!kctl) {
		kfree(elem);
		return -ENOMEM;
	}
	kctl->private_free = snd_usb_mixer_elem_free;

	strscpy(kctl->id.name, name, sizeof(kctl->id.name));

	err = snd_usb_mixer_add_control(&elem->head, kctl);
	if (err < 0)
		return err;

	if (kctl_return)
		*kctl_return = kctl;

	return 0;
}

/*** Firmware Version Control ***/

static int scarlett2_firmware_version_ctl_get(
	struct snd_kcontrol *kctl,
	struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	ucontrol->value.integer.value[0] = private->firmware_version;

	return 0;
}

static int scarlett2_firmware_version_ctl_info(
	struct snd_kcontrol *kctl,
	struct snd_ctl_elem_info *uinfo)
{
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = 1;

	return 0;
}

static const struct snd_kcontrol_new scarlett2_firmware_version_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_CARD,
	.access = SNDRV_CTL_ELEM_ACCESS_READ,
	.name = "",
	.info = scarlett2_firmware_version_ctl_info,
	.get  = scarlett2_firmware_version_ctl_get
};

static int scarlett2_add_firmware_version_ctl(
	struct usb_mixer_interface *mixer)
{
	return scarlett2_add_new_ctl(mixer, &scarlett2_firmware_version_ctl,
				     0, 0, "Firmware Version", NULL);
}

/*** Minimum Firmware Version Control ***/

static int scarlett2_min_firmware_version_ctl_get(
	struct snd_kcontrol *kctl,
	struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	ucontrol->value.integer.value[0] = private->info->min_firmware_version;

	return 0;
}

static int scarlett2_min_firmware_version_ctl_info(
	struct snd_kcontrol *kctl,
	struct snd_ctl_elem_info *uinfo)
{
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = 1;

	return 0;
}

static const struct snd_kcontrol_new scarlett2_min_firmware_version_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_CARD,
	.access = SNDRV_CTL_ELEM_ACCESS_READ,
	.name = "",
	.info = scarlett2_min_firmware_version_ctl_info,
	.get  = scarlett2_min_firmware_version_ctl_get
};

static int scarlett2_add_min_firmware_version_ctl(
	struct usb_mixer_interface *mixer)
{
	return scarlett2_add_new_ctl(mixer, &scarlett2_min_firmware_version_ctl,
				     0, 0, "Minimum Firmware Version", NULL);
}

/*** Sync Control ***/

/* Update sync control after receiving notification that the status
 * has changed
 */
static int scarlett2_update_sync(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	private->sync_updated = 0;
	return scarlett2_usb_get_sync_status(mixer, &private->sync);
}

static int scarlett2_sync_ctl_info(struct snd_kcontrol *kctl,
				   struct snd_ctl_elem_info *uinfo)
{
	static const char *texts[2] = {
		"Unlocked", "Locked"
	};
	return snd_ctl_enum_info(uinfo, 1, 2, texts);
}

static int scarlett2_sync_ctl_get(struct snd_kcontrol *kctl,
				  struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->sync_updated) {
		err = scarlett2_update_sync(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.enumerated.item[0] = private->sync;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_sync_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READ,
	.name = "",
	.info = scarlett2_sync_ctl_info,
	.get  = scarlett2_sync_ctl_get
};

static int scarlett2_add_sync_ctl(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	/* devices without a mixer also don't support reporting sync status */
	if (!scarlett2_has_mixer(private))
		return 0;

	return scarlett2_add_new_ctl(mixer, &scarlett2_sync_ctl,
				     0, 1, "Sync Status", &private->sync_ctl);
}

/*** Autogain Switch and Status Controls ***/

/* Forward declarations as phantom power and autogain can disable each other */
static int scarlett2_check_input_phantom_updated(struct usb_mixer_interface *);
static int scarlett2_phantom_is_switching(struct scarlett2_data *, int);

/* Set the access mode of a control to read-only (val = 0) or
 * read-write (val = 1).
 */
static void scarlett2_set_ctl_access(struct snd_kcontrol *kctl, int val)
{
	if (val)
		kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_WRITE;
	else
		kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_WRITE;
}

/* Check if autogain is running on any input */
static int scarlett2_autogain_is_running(struct scarlett2_data *private)
{
	int i;

	/* autogain_status[] is 0 if autogain is running */
	for (i = 0; i < private->info->gain_input_count; i++)
		if (!private->autogain_status[i])
			return 1;

	return 0;
}

static int scarlett2_update_autogain(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int err, i;
	u8 raw_autogain_status[SCARLETT2_INPUT_GAIN_MAX];
	s8 ag_target_values[SCARLETT2_AG_TARGET_COUNT];

	private->autogain_updated = 0;

	if (!info->gain_input_count)
		return 0;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_AUTOGAIN_SWITCH,
		info->gain_input_count, private->autogain_switch);
	if (err < 0)
		return err;
	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_AUTOGAIN_STATUS,
		info->gain_input_count, raw_autogain_status);
	if (err < 0)
		return err;

	/* Translate autogain_switch and raw_autogain_status into
	 * autogain_status.
	 *
	 * When autogain_switch[] is set, the status is the first
	 * element in scarlett2_autogain_status_texts[] (Running). The
	 * subsequent elements correspond to the status value from the
	 * device (raw_autogain_status[]) + 1. The last element is
	 * "Invalid", in case the device reports a status outside the
	 * range of scarlett2_autogain_status_texts[].
	 */
	for (i = 0; i < info->gain_input_count; i++)
		if (private->autogain_switch[i])
			private->autogain_status[i] = 0;
		else if (raw_autogain_status[i] <
				private->num_autogain_status_texts - 1)
			private->autogain_status[i] =
				raw_autogain_status[i] + 1;
		else
			private->autogain_status[i] =
				private->num_autogain_status_texts - 1;


	for (int i = 0; i < SCARLETT2_AG_TARGET_COUNT; i++)
		if (scarlett2_has_config_item(private,
					      scarlett2_ag_target_configs[i])) {
			err = scarlett2_usb_get_config(
				mixer, scarlett2_ag_target_configs[i],
				1, &ag_target_values[i]);
			if (err < 0)
				return err;
		}

	/* convert from negative dBFS as used by the device */
	for (int i = 0; i < SCARLETT2_AG_TARGET_COUNT; i++)
		private->ag_targets[i] = -ag_target_values[i];

	return 0;
}

/* Update access mode for controls affected by autogain */
static void scarlett2_autogain_update_access(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int val = !scarlett2_autogain_is_running(private);
	int i;

	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_INPUT_SELECT_SWITCH))
		scarlett2_set_ctl_access(private->input_select_ctl, val);
	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_INPUT_LINK_SWITCH))
		for (i = 0; i < info->gain_input_count / 2; i++)
			scarlett2_set_ctl_access(private->input_link_ctls[i],
						 val);
	for (i = 0; i < info->gain_input_count; i++)
		scarlett2_set_ctl_access(private->input_gain_ctls[i], val);
	for (i = 0; i < info->safe_input_count; i++)
		scarlett2_set_ctl_access(private->safe_ctls[i], val);
	for (i = 0; i < info->level_input_count; i++)
		scarlett2_set_ctl_access(private->level_ctls[i], val);
	for (i = 0; i < info->air_input_count; i++)
		scarlett2_set_ctl_access(private->air_ctls[i], val);
	for (i = 0; i < info->mute_input_count; i++)
		scarlett2_set_ctl_access(private->input_mute_ctls[i], val);
	for (i = 0; i < info->phantom_count; i++)
		scarlett2_set_ctl_access(private->phantom_ctls[i], val);
	for (i = 0; i < info->dsp_input_count; i++)
		scarlett2_set_ctl_access(private->dsp_ctls[i], val);

	for (i = 0; i < SCARLETT2_AG_TARGET_COUNT; i++)
		if (scarlett2_has_config_item(private,
					      scarlett2_ag_target_configs[i]))
			scarlett2_set_ctl_access(
				private->ag_target_ctls[i], val);
}

/* Notify of access mode change for all controls read-only while
 * autogain runs.
 */
static void scarlett2_autogain_notify_access(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_INPUT_SELECT_SWITCH))
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
			       &private->input_select_ctl->id);
	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_INPUT_LINK_SWITCH))
		for (i = 0; i < info->gain_input_count / 2; i++)
			snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
				       &private->input_link_ctls[i]->id);
	for (i = 0; i < info->gain_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
			       &private->input_gain_ctls[i]->id);
	for (i = 0; i < info->safe_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
			       &private->safe_ctls[i]->id);
	for (i = 0; i < info->level_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
			       &private->level_ctls[i]->id);
	for (i = 0; i < info->air_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
			       &private->air_ctls[i]->id);
	for (i = 0; i < info->dsp_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
			       &private->dsp_ctls[i]->id);
	for (i = 0; i < info->mute_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
			       &private->input_mute_ctls[i]->id);
	for (i = 0; i < info->phantom_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
			       &private->phantom_ctls[i]->id);

	for (i = 0; i < SCARLETT2_AG_TARGET_COUNT; i++)
		if (scarlett2_has_config_item(private,
					      scarlett2_ag_target_configs[i]))
			snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
				       &private->ag_target_ctls[i]->id);
}

/* Call scarlett2_update_autogain() and
 * scarlett2_autogain_update_access() if autogain_updated is set.
 */
static int scarlett2_check_autogain_updated(
	struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int err;

	if (!private->autogain_updated)
		return 0;

	err = scarlett2_update_autogain(mixer);
	if (err < 0)
		return err;

	scarlett2_autogain_update_access(mixer);

	return 0;
}

/* If autogain_updated is set when a *_ctl_put() function for a
 * control that is meant to be read-only while autogain is running,
 * update the autogain status and access mode of affected controls.
 * Return -EPERM if autogain is running.
 */
static int scarlett2_check_put_during_autogain(
	struct usb_mixer_interface *mixer)
{
	int err = scarlett2_check_autogain_updated(mixer);

	if (err < 0)
		return err;

	if (scarlett2_autogain_is_running(mixer->private_data))
		return -EPERM;

	return 0;
}

static int scarlett2_autogain_switch_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err;

	mutex_lock(&private->data_mutex);

	err = scarlett2_check_input_phantom_updated(mixer);
	if (err < 0)
		goto unlock;

	err = snd_ctl_boolean_mono_info(kctl, uinfo);

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_autogain_switch_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_autogain_updated(mixer);
	if (err < 0)
		goto unlock;

	ucontrol->value.enumerated.item[0] =
		private->autogain_switch[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_autogain_status_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_autogain_updated(mixer);
	if (err < 0)
		goto unlock;

	ucontrol->value.enumerated.item[0] =
		private->autogain_status[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_autogain_switch_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_input_phantom_updated(mixer);
	if (err < 0)
		goto unlock;

	if (scarlett2_phantom_is_switching(private, index)) {
		err = -EPERM;
		goto unlock;
	}

	oval = private->autogain_switch[index];
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->autogain_switch[index] = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_AUTOGAIN_SWITCH, index, val);
	if (err == 0)
		err = 1;

	scarlett2_autogain_update_access(mixer);
	scarlett2_autogain_notify_access(mixer);

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_autogain_status_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	return snd_ctl_enum_info(
		uinfo, 1,
		private->num_autogain_status_texts,
		private->config_set->autogain_status_texts);
}

static const struct snd_kcontrol_new scarlett2_autogain_switch_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_autogain_switch_ctl_info,
	.get  = scarlett2_autogain_switch_ctl_get,
	.put  = scarlett2_autogain_switch_ctl_put
};

static const struct snd_kcontrol_new scarlett2_autogain_status_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READ,
	.name = "",
	.info = scarlett2_autogain_status_ctl_info,
	.get  = scarlett2_autogain_status_ctl_get,
};

/*** Autogain Target Controls ***/

static int scarlett2_ag_target_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_autogain_updated(mixer);
	if (err < 0)
		goto unlock;

	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = 1;
	uinfo->value.integer.min = SCARLETT2_AG_TARGET_MIN;
	uinfo->value.integer.max = 0;
	uinfo->value.integer.step = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_ag_target_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->autogain_updated) {
		err = scarlett2_update_autogain(mixer);
		if (err < 0)
			goto unlock;
	}

	ucontrol->value.integer.value[0] = private->ag_targets[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_ag_target_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->ag_targets[index];
	val = clamp(ucontrol->value.integer.value[0],
		    (long)SCARLETT2_AG_TARGET_MIN, 0L);

	if (oval == val)
		goto unlock;

	private->ag_targets[index] = val;

	/* Send new value to the device */
	err = scarlett2_usb_set_config(
		mixer, scarlett2_ag_target_configs[index], 1, -val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const DECLARE_TLV_DB_MINMAX(
	db_scale_ag_target, SCARLETT2_AG_TARGET_MIN * 100, 0
);

static const struct snd_kcontrol_new scarlett2_ag_target_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_CARD,
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
		  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
	.name = "",
	.info = scarlett2_ag_target_ctl_info,
	.get  = scarlett2_ag_target_ctl_get,
	.put  = scarlett2_ag_target_ctl_put,
	.tlv = { .p = db_scale_ag_target }
};

/*** Input Select Control ***/

static int scarlett2_update_input_select(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int link_count = info->gain_input_count / 2;
	int err;

	private->input_select_updated = 0;

	if (!scarlett2_has_config_item(private,
				       SCARLETT2_CONFIG_INPUT_SELECT_SWITCH) ||
	    !link_count)
		return 0;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_INPUT_SELECT_SWITCH,
		1, &private->input_select_switch);
	if (err < 0)
		return err;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_INPUT_LINK_SWITCH,
		link_count, private->input_link_switch);
	if (err < 0)
		return err;

	/* simplified because no model yet has link_count > 1 */
	if (private->input_link_switch[0])
		private->input_select_switch = 0;

	return 0;
}

static int scarlett2_input_select_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->input_select_updated) {
		err = scarlett2_update_input_select(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.enumerated.item[0] = private->input_select_switch;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_input_select_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int oval, val, err;
	int max_val = private->input_link_switch[0] ? 0 : 1;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->input_select_switch;
	val = ucontrol->value.integer.value[0];

	if (val < 0)
		val = 0;
	else if (val > max_val)
		val = max_val;

	if (oval == val)
		goto unlock;

	private->input_select_switch = val;

	/* Send switch change to the device if inputs not linked */
	if (!private->input_link_switch[0])
		err = scarlett2_usb_set_config(
			mixer, SCARLETT2_CONFIG_INPUT_SELECT_SWITCH,
			1, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_input_select_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int inputs = private->info->gain_input_count;
	int i, j;
	int err;
	char **values = kcalloc(inputs, sizeof(char *), GFP_KERNEL);

	if (!values)
		return -ENOMEM;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_autogain_updated(mixer);
	if (err < 0)
		goto unlock;

	/* Loop through each input
	 * Linked inputs have one value for the pair
	 */
	for (i = 0, j = 0; i < inputs; i++) {
		if (private->input_link_switch[i / 2]) {
			values[j++] = kasprintf(
				GFP_KERNEL, "Input %d-%d", i + 1, i + 2);
			i++;
		} else {
			values[j++] = kasprintf(
				GFP_KERNEL, "Input %d", i + 1);
		}
	}

	err = snd_ctl_enum_info(uinfo, 1, j,
				(const char * const *)values);

unlock:
	mutex_unlock(&private->data_mutex);

	for (i = 0; i < inputs; i++)
		kfree(values[i]);
	kfree(values);

	return err;
}

static const struct snd_kcontrol_new scarlett2_input_select_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_input_select_ctl_info,
	.get  = scarlett2_input_select_ctl_get,
	.put  = scarlett2_input_select_ctl_put,
};

/*** Input Link Switch Controls ***/

/* snd_ctl_boolean_mono_info() with autogain-updated check
 * (for controls that are read-only while autogain is running)
 */
static int scarlett2_autogain_disables_ctl_info(struct snd_kcontrol *kctl,
						struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_autogain_updated(mixer);
	if (err < 0)
		goto unlock;

	err = snd_ctl_boolean_mono_info(kctl, uinfo);

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_input_link_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->input_select_updated) {
		err = scarlett2_update_input_select(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.enumerated.item[0] =
		private->input_link_switch[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_input_link_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->input_link_switch[index];
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->input_link_switch[index] = val;

	/* Notify of change in input select options available */
	snd_ctl_notify(mixer->chip->card,
		       SNDRV_CTL_EVENT_MASK_VALUE | SNDRV_CTL_EVENT_MASK_INFO,
		       &private->input_select_ctl->id);
	private->input_select_updated = 1;

	/* Send switch change to the device
	 * Link for channels 1-2 is at index 1
	 * No device yet has more than 2 channels linked
	 */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_INPUT_LINK_SWITCH, index + 1, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_input_link_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_autogain_disables_ctl_info,
	.get  = scarlett2_input_link_ctl_get,
	.put  = scarlett2_input_link_ctl_put
};

/*** Input Gain Controls ***/

static int scarlett2_update_input_gain(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	private->input_gain_updated = 0;

	if (!info->gain_input_count)
		return 0;

	return scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_INPUT_GAIN,
		info->gain_input_count, private->gain);
}

static int scarlett2_input_gain_ctl_info(struct snd_kcontrol *kctl,
					 struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_autogain_updated(mixer);
	if (err < 0)
		goto unlock;

	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = elem->channels;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = SCARLETT2_MAX_GAIN_VALUE;
	uinfo->value.integer.step = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_input_gain_ctl_get(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->input_gain_updated) {
		err = scarlett2_update_input_gain(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] =
		private->gain[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_input_gain_ctl_put(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->gain[index];
	val = ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->gain[index] = val;

	/* Send gain change to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_INPUT_GAIN,
				       index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_input_gain_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
		  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
	.name = "",
	.info = scarlett2_input_gain_ctl_info,
	.get  = scarlett2_input_gain_ctl_get,
	.put  = scarlett2_input_gain_ctl_put,
	.private_value = 0, /* max value */
};

/*** Safe Controls ***/

static int scarlett2_update_input_safe(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	private->input_safe_updated = 0;

	if (!info->safe_input_count)
		return 0;

	return scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_SAFE_SWITCH,
		info->safe_input_count, private->safe_switch);
}

static int scarlett2_safe_ctl_get(struct snd_kcontrol *kctl,
				  struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->input_safe_updated) {
		err = scarlett2_update_input_safe(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] =
		private->safe_switch[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_safe_ctl_put(struct snd_kcontrol *kctl,
				  struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->safe_switch[index];
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->safe_switch[index] = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_SAFE_SWITCH,
				       index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_safe_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_autogain_disables_ctl_info,
	.get  = scarlett2_safe_ctl_get,
	.put  = scarlett2_safe_ctl_put,
};

/*** PCM Input Control ***/

static int scarlett2_update_pcm_input_switch(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int err;

	private->pcm_input_switch_updated = 0;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_PCM_INPUT_SWITCH,
		1, &private->pcm_input_switch);
	if (err < 0)
		return err;

	return 0;
}

static int scarlett2_pcm_input_switch_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = elem->head.mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->pcm_input_switch_updated) {
		err = scarlett2_update_pcm_input_switch(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.enumerated.item[0] = private->pcm_input_switch;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_pcm_input_switch_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->pcm_input_switch;
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->pcm_input_switch = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_PCM_INPUT_SWITCH,
		0, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_pcm_input_switch_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	static const char *const values[2] = {
		"Direct", "Mixer"
	};

	return snd_ctl_enum_info(
		uinfo, 1, 2, values);
}

static const struct snd_kcontrol_new scarlett2_pcm_input_switch_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_pcm_input_switch_ctl_info,
	.get  = scarlett2_pcm_input_switch_ctl_get,
	.put  = scarlett2_pcm_input_switch_ctl_put
};

/*** Analogue Line Out Volume Controls ***/

/* Update hardware volume controls after receiving notification that
 * they have changed
 */
static int scarlett2_update_volumes(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	s16 vol;
	int err, i;

	private->vol_updated = 0;

	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_MASTER_VOLUME)) {
		err = scarlett2_usb_get_config(
			mixer, SCARLETT2_CONFIG_MASTER_VOLUME,
			1, &vol);
		if (err < 0)
			return err;

		private->master_vol = clamp(vol + SCARLETT2_VOLUME_BIAS,
					    0, SCARLETT2_VOLUME_BIAS);

		if (scarlett2_has_config_item(private,
					      SCARLETT2_CONFIG_SW_HW_SWITCH))
			for (i = 0; i < private->num_line_out; i++)
				if (private->vol_sw_hw_switch[i])
					private->vol[i] = private->master_vol;
	}

	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_HEADPHONE_VOLUME)) {
		err = scarlett2_usb_get_config(
			mixer, SCARLETT2_CONFIG_HEADPHONE_VOLUME,
			1, &vol);
		if (err < 0)
			return err;

		private->headphone_vol = clamp(vol + SCARLETT2_VOLUME_BIAS,
					       0, SCARLETT2_VOLUME_BIAS);
	}

	return 0;
}

static int scarlett2_volume_ctl_info(struct snd_kcontrol *kctl,
				     struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;

	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = elem->channels;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = SCARLETT2_VOLUME_BIAS;
	uinfo->value.integer.step = 1;
	return 0;
}

static int scarlett2_master_volume_ctl_get(struct snd_kcontrol *kctl,
					   struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->vol_updated) {
		err = scarlett2_update_volumes(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] = private->master_vol;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_headphone_volume_ctl_get(
	struct snd_kcontrol *kctl,
	struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->vol_updated) {
		err = scarlett2_update_volumes(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] = private->headphone_vol;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int line_out_remap(struct scarlett2_data *private, int index)
{
	const struct scarlett2_device_info *info = private->info;

	if (!info->line_out_remap_enable)
		return index;

	if (index >= private->num_line_out)
		return index;

	return info->line_out_remap[index];
}

static int scarlett2_volume_ctl_get(struct snd_kcontrol *kctl,
				    struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int index = line_out_remap(private, elem->control);
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->vol_updated) {
		err = scarlett2_update_volumes(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] = private->vol[index];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_volume_ctl_put(struct snd_kcontrol *kctl,
				    struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int index = line_out_remap(private, elem->control);
	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->vol[index];
	val = ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->vol[index] = val;
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_LINE_OUT_VOLUME,
				       index, val - SCARLETT2_VOLUME_BIAS);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const DECLARE_TLV_DB_MINMAX(
	db_scale_scarlett2_volume, -SCARLETT2_VOLUME_BIAS * 100, 0
);

static const struct snd_kcontrol_new scarlett2_master_volume_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READ |
		  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
	.name = "",
	.info = scarlett2_volume_ctl_info,
	.get  = scarlett2_master_volume_ctl_get,
	.private_value = 0, /* max value */
	.tlv = { .p = db_scale_scarlett2_volume }
};

static const struct snd_kcontrol_new scarlett2_headphone_volume_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READ |
		  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
	.name = "",
	.info = scarlett2_volume_ctl_info,
	.get  = scarlett2_headphone_volume_ctl_get,
	.private_value = 0, /* max value */
	.tlv = { .p = db_scale_scarlett2_volume }
};

static const struct snd_kcontrol_new scarlett2_line_out_volume_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
		  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
	.name = "",
	.info = scarlett2_volume_ctl_info,
	.get  = scarlett2_volume_ctl_get,
	.put  = scarlett2_volume_ctl_put,
	.private_value = 0, /* max value */
	.tlv = { .p = db_scale_scarlett2_volume }
};

/*** Mute Switch Controls ***/

static int scarlett2_update_dim_mute(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int err, i;
	u8 mute;

	private->dim_mute_updated = 0;

	if (!scarlett2_has_config_item(private, SCARLETT2_CONFIG_SW_HW_SWITCH))
		return 0;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_DIM_MUTE,
		SCARLETT2_DIM_MUTE_COUNT, private->dim_mute);
	if (err < 0)
		return err;

	for (i = 0; i < SCARLETT2_DIM_MUTE_COUNT; i++)
		private->dim_mute[i] = !!private->dim_mute[i];

	mute = private->dim_mute[SCARLETT2_BUTTON_MUTE];

	for (i = 0; i < private->num_line_out; i++)
		if (private->vol_sw_hw_switch[i])
			private->mute_switch[i] = mute;

	return 0;
}

static int scarlett2_mute_ctl_get(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int index = line_out_remap(private, elem->control);
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->dim_mute_updated) {
		err = scarlett2_update_dim_mute(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] = private->mute_switch[index];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_mute_ctl_put(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int index = line_out_remap(private, elem->control);
	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->mute_switch[index];
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->mute_switch[index] = val;

	/* Send mute change to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_MUTE_SWITCH,
				       index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_mute_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = snd_ctl_boolean_mono_info,
	.get  = scarlett2_mute_ctl_get,
	.put  = scarlett2_mute_ctl_put,
};

/*** HW/SW Volume Switch Controls ***/

static void scarlett2_sw_hw_ctl_ro(struct scarlett2_data *private, int index)
{
	private->sw_hw_ctls[index]->vd[0].access &=
		~SNDRV_CTL_ELEM_ACCESS_WRITE;
}

static void scarlett2_sw_hw_ctl_rw(struct scarlett2_data *private, int index)
{
	private->sw_hw_ctls[index]->vd[0].access |=
		SNDRV_CTL_ELEM_ACCESS_WRITE;
}

static int scarlett2_sw_hw_enum_ctl_info(struct snd_kcontrol *kctl,
					 struct snd_ctl_elem_info *uinfo)
{
	static const char *const values[2] = {
		"SW", "HW"
	};

	return snd_ctl_enum_info(uinfo, 1, 2, values);
}

static int scarlett2_sw_hw_enum_ctl_get(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;
	int index = line_out_remap(private, elem->control);

	ucontrol->value.enumerated.item[0] = private->vol_sw_hw_switch[index];
	return 0;
}

static void scarlett2_vol_ctl_set_writable(struct usb_mixer_interface *mixer,
					   int index, int value)
{
	struct scarlett2_data *private = mixer->private_data;
	struct snd_card *card = mixer->chip->card;

	/* Set/Clear write bits */
	if (value) {
		private->vol_ctls[index]->vd[0].access |=
			SNDRV_CTL_ELEM_ACCESS_WRITE;
		private->mute_ctls[index]->vd[0].access |=
			SNDRV_CTL_ELEM_ACCESS_WRITE;
	} else {
		private->vol_ctls[index]->vd[0].access &=
			~SNDRV_CTL_ELEM_ACCESS_WRITE;
		private->mute_ctls[index]->vd[0].access &=
			~SNDRV_CTL_ELEM_ACCESS_WRITE;
	}

	/* Notify of write bit and possible value change */
	snd_ctl_notify(card,
		       SNDRV_CTL_EVENT_MASK_VALUE | SNDRV_CTL_EVENT_MASK_INFO,
		       &private->vol_ctls[index]->id);
	snd_ctl_notify(card,
		       SNDRV_CTL_EVENT_MASK_VALUE | SNDRV_CTL_EVENT_MASK_INFO,
		       &private->mute_ctls[index]->id);
}

static int scarlett2_sw_hw_change(struct usb_mixer_interface *mixer,
				  int ctl_index, int val)
{
	struct scarlett2_data *private = mixer->private_data;
	int index = line_out_remap(private, ctl_index);
	int err;

	private->vol_sw_hw_switch[index] = val;

	/* Change access mode to RO (hardware controlled volume)
	 * or RW (software controlled volume)
	 */
	scarlett2_vol_ctl_set_writable(mixer, ctl_index, !val);

	/* Reset volume/mute to master volume/mute */
	private->vol[index] = private->master_vol;
	private->mute_switch[index] = private->dim_mute[SCARLETT2_BUTTON_MUTE];

	/* Set SW volume to current HW volume */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_LINE_OUT_VOLUME,
		index, private->master_vol - SCARLETT2_VOLUME_BIAS);
	if (err < 0)
		return err;

	/* Set SW mute to current HW mute */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_MUTE_SWITCH,
		index, private->dim_mute[SCARLETT2_BUTTON_MUTE]);
	if (err < 0)
		return err;

	/* Send SW/HW switch change to the device */
	return scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_SW_HW_SWITCH,
					index, val);
}

static int scarlett2_sw_hw_enum_ctl_put(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int ctl_index = elem->control;
	int index = line_out_remap(private, ctl_index);
	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->vol_sw_hw_switch[index];
	val = !!ucontrol->value.enumerated.item[0];

	if (oval == val)
		goto unlock;

	err = scarlett2_sw_hw_change(mixer, ctl_index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_sw_hw_enum_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_sw_hw_enum_ctl_info,
	.get  = scarlett2_sw_hw_enum_ctl_get,
	.put  = scarlett2_sw_hw_enum_ctl_put,
};

/*** Line Level/Instrument Level Switch Controls ***/

static int scarlett2_update_input_level(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	private->input_level_updated = 0;

	if (!info->level_input_count)
		return 0;

	return scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_LEVEL_SWITCH,
		info->level_input_count + info->level_input_first,
		private->level_switch);
}

static int scarlett2_level_enum_ctl_info(struct snd_kcontrol *kctl,
					 struct snd_ctl_elem_info *uinfo)
{
	static const char *const values[2] = {
		"Line", "Inst"
	};
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_autogain_updated(mixer);
	if (err < 0)
		goto unlock;

	err = snd_ctl_enum_info(uinfo, 1, 2, values);

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_level_enum_ctl_get(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	int index = elem->control + info->level_input_first;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->input_level_updated) {
		err = scarlett2_update_input_level(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.enumerated.item[0] = scarlett2_decode_muteable(
		private->level_switch[index]);

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_level_enum_ctl_put(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	int index = elem->control + info->level_input_first;
	int oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->level_switch[index];
	val = !!ucontrol->value.enumerated.item[0];

	if (oval == val)
		goto unlock;

	private->level_switch[index] = val;

	/* To set the Gen 4 muteable controls, bit 1 gets set instead */
	if (private->config_set->items[SCARLETT2_CONFIG_LEVEL_SWITCH].mute)
		val = (!val) | 0x02;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_LEVEL_SWITCH,
				       index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_level_enum_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_level_enum_ctl_info,
	.get  = scarlett2_level_enum_ctl_get,
	.put  = scarlett2_level_enum_ctl_put,
};

/*** Pad Switch Controls ***/

static int scarlett2_update_input_pad(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	private->input_pad_updated = 0;

	if (!info->pad_input_count)
		return 0;

	return scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_PAD_SWITCH,
		info->pad_input_count, private->pad_switch);
}

static int scarlett2_pad_ctl_get(struct snd_kcontrol *kctl,
				 struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->input_pad_updated) {
		err = scarlett2_update_input_pad(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] =
		private->pad_switch[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_pad_ctl_put(struct snd_kcontrol *kctl,
				 struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->pad_switch[index];
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->pad_switch[index] = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_PAD_SWITCH,
				       index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_pad_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = snd_ctl_boolean_mono_info,
	.get  = scarlett2_pad_ctl_get,
	.put  = scarlett2_pad_ctl_put,
};

/*** Air Switch Controls ***/

static int scarlett2_update_input_air(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	private->input_air_updated = 0;

	if (!info->air_input_count)
		return 0;

	return scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_AIR_SWITCH,
		info->air_input_count, private->air_switch);
}

static int scarlett2_air_ctl_get(struct snd_kcontrol *kctl,
				 struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->input_air_updated) {
		err = scarlett2_update_input_air(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] = private->air_switch[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_air_ctl_put(struct snd_kcontrol *kctl,
				 struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->air_switch[index];
	val = ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->air_switch[index] = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_AIR_SWITCH,
				       index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_air_with_drive_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	static const char *const values[3] = {
		"Off", "Presence", "Presence + Drive"
	};
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_autogain_updated(mixer);
	if (err < 0)
		goto unlock;

	err = snd_ctl_enum_info(uinfo, 1, 3, values);

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_air_ctl[2] = {
	{
		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
		.name = "",
		.info = snd_ctl_boolean_mono_info,
		.get  = scarlett2_air_ctl_get,
		.put  = scarlett2_air_ctl_put,
	},
	{
		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
		.name = "",
		.info = scarlett2_air_with_drive_ctl_info,
		.get  = scarlett2_air_ctl_get,
		.put  = scarlett2_air_ctl_put,
	}
};

/*** DSP Switch Control ***/

static int scarlett2_update_input_dsp(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	private->input_dsp_updated = 0;

	if (!info->dsp_input_count)
		return 0;

	return scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_DSP_SWITCH,
		info->dsp_input_count, private->dsp_switch);
}

static int scarlett2_dsp_ctl_get(struct snd_kcontrol *kctl,
				 struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->input_dsp_updated) {
		err = scarlett2_update_input_dsp(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] = private->dsp_switch[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_dsp_ctl_put(struct snd_kcontrol *kctl,
				 struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->dsp_switch[index];
	val = ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->dsp_switch[index] = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_DSP_SWITCH,
				       index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_dsp_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_autogain_disables_ctl_info,
	.get  = scarlett2_dsp_ctl_get,
	.put  = scarlett2_dsp_ctl_put,
};

/*** DSP Compressor Parameter Controls ***/

static int scarlett2_update_compressor_values(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int err, i, j;

	if (!info->dsp_input_count)
		return 0;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_COMPRESSOR_PARAMS,
		SCARLETT2_COMPRESSOR_PARAM_COUNT * info->dsp_input_count,
		private->compressor_values);

	if (err < 0)
		return err;

	for (i = 0; i < SCARLETT2_COMPRESSOR_PARAM_COUNT; i++) {
		const struct compressor_param *param = &compressor_params[i];

		for (j = 0; j < info->dsp_input_count; j++) {
			int idx = i + j * SCARLETT2_COMPRESSOR_PARAM_COUNT;
			int val = private->compressor_values[idx];

			val >>= param->scale_bits;
			val = clamp(val, param->min, param->max);
			private->compressor_values[idx] = val;
		}
	}

	return 0;
}

static int scarlett2_compressor_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	ucontrol->value.integer.value[0] =
		private->compressor_values[elem->control];
	return 0;
}

static int scarlett2_compressor_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int channel = index / SCARLETT2_COMPRESSOR_PARAM_COUNT;
	int param_index = index % SCARLETT2_COMPRESSOR_PARAM_COUNT;
	int oval, val, err;
	s32 scaled_val;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->compressor_values[index];
	val = ucontrol->value.integer.value[0];
	if (oval == val)
		goto unlock;

	private->compressor_values[index] = val;

	const struct compressor_param *param = &compressor_params[param_index];

	scaled_val = val << param->scale_bits;

	/* Send change to the device */

	/* The channel needs to be put in the parameter buffer index
	 * field (param_buf_addr + 1); the value field isn't used in
	 * this case.
	 */
	err = scarlett2_usb_set_data(
		mixer, private->config_set->param_buf_addr + 1, 1, channel);
	if (err < 0)
		goto unlock;

	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_COMPRESSOR_PARAMS, index, scaled_val);
	if (err < 0)
		goto unlock;

	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_compressor_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	int control = elem->control % SCARLETT2_COMPRESSOR_PARAM_COUNT;

	uinfo->type = compressor_params[control].type;
	uinfo->count = 1;
	uinfo->value.integer.min = compressor_params[control].min;
	uinfo->value.integer.max = compressor_params[control].max;
	uinfo->value.integer.step = 1;
	return 0;
}

static const struct snd_kcontrol_new scarlett2_compressor_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_CARD,
	.name = "",
	.info = scarlett2_compressor_ctl_info,
	.get  = scarlett2_compressor_ctl_get,
	.put  = scarlett2_compressor_ctl_put,
};

/*** DSP Pre-Compressor and PEQ Filter Controls ***/

static int scarlett2_precomp_flt_switch_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	ucontrol->value.integer.value[0] = private->precomp_flt_switch[elem->control];

	return 0;
}

static int scarlett2_peq_flt_switch_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	ucontrol->value.integer.value[0] =
		private->peq_flt_switch[elem->control];

	return 0;
}

static int scarlett2_precomp_flt_switch_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->precomp_flt_switch[elem->control];
	val = ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->precomp_flt_switch[elem->control] = val;

	/* Send change to the device */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_PRECOMP_FLT_SWITCH,
		elem->control, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_peq_flt_switch_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->peq_flt_switch[elem->control];
	val = ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->peq_flt_switch[elem->control] = val;

	/* Send change to the device */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_PEQ_FLT_SWITCH,
		elem->control, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_precomp_flt_switch_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_CARD,
	.name = "",
	.info = snd_ctl_boolean_mono_info,
	.get  = scarlett2_precomp_flt_switch_ctl_get,
	.put  = scarlett2_precomp_flt_switch_ctl_put,
};

static const struct snd_kcontrol_new scarlett2_peq_flt_switch_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_CARD,
	.name = "",
	.info = snd_ctl_boolean_mono_info,
	.get  = scarlett2_peq_flt_switch_ctl_get,
	.put  = scarlett2_peq_flt_switch_ctl_put,
};

static int scarlett2_update_filter_values(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int err, i, j, k, src_idx, dst_idx;
	s32 peq_flt_values[SCARLETT2_DSP_SWITCH_MAX *
			   SCARLETT2_PEQ_FLT_SLOTS_MAX *
			   SCARLETT2_BIQUAD_COEFFS];

	if (!info->dsp_input_count)
		return 0;

	/* Get filter switch values */
	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_PRECOMP_FLT_SWITCH,
		info->dsp_input_count, private->precomp_flt_switch);
	if (err < 0)
		return err;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_PEQ_FLT_SWITCH,
		info->dsp_input_count * info->peq_flt_count,
		private->peq_flt_switch);
	if (err < 0)
		return err;

	/* Get pre-compressor filter values directly */
	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_PRECOMP_FLT_PARAMS,
		info->dsp_input_count *
			info->precomp_flt_count *
			SCARLETT2_BIQUAD_COEFFS,
		private->precomp_flt_values);

	if (err < 0)
		return err;

	/* PEQ filter values need to be copied via buffer because of
	 * padding after peq_flt_count up to peq_flt_total_count
	 */
	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_PEQ_FLT_PARAMS,
		info->dsp_input_count *
			info->peq_flt_total_count *
			SCARLETT2_BIQUAD_COEFFS,
		peq_flt_values);

	for (i = 0, dst_idx = 0; i < info->dsp_input_count; i++) {
		src_idx = i *
			  info->peq_flt_total_count *
			  SCARLETT2_BIQUAD_COEFFS;
		for (j = 0; j < info->peq_flt_count; j++)
			for (k = 0;
			     k < SCARLETT2_BIQUAD_COEFFS;
			     k++, src_idx++, dst_idx++)
				private->peq_flt_values[dst_idx] =
					peq_flt_values[src_idx];
	}

	return 0;
}

static int scarlett2_precomp_flt_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;
	int i, idx;

	for (i = 0, idx = elem->control * SCARLETT2_BIQUAD_COEFFS;
	     i < SCARLETT2_BIQUAD_COEFFS;
	     i++, idx++)
		ucontrol->value.integer.value[i] =
			private->precomp_flt_values[idx];

	return 0;
}

static int scarlett2_peq_flt_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;
	int i, idx;

	for (i = 0, idx = elem->control * SCARLETT2_BIQUAD_COEFFS;
	     i < SCARLETT2_BIQUAD_COEFFS;
	     i++, idx++)
		ucontrol->value.integer.value[i] =
			private->peq_flt_values[idx];

	return 0;
}

static int scarlett2_precomp_flt_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control * SCARLETT2_BIQUAD_COEFFS;
	int i, oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	/* Check if any of the values have changed; if not, return */
	for (i = 0; i < SCARLETT2_BIQUAD_COEFFS; i++) {
		oval = private->precomp_flt_values[index + i];
		val = ucontrol->value.integer.value[i];
		if (oval != val)
			break;
	}

	if (i == SCARLETT2_BIQUAD_COEFFS)
		goto unlock;

	/* Update the values */
	for (i = 0; i < SCARLETT2_BIQUAD_COEFFS; i++)
		private->precomp_flt_values[index + i] =
			ucontrol->value.integer.value[i];

	/* Send change to the device */
	err = scarlett2_usb_set_data(
		mixer, private->config_set->param_buf_addr, 1, index);
	if (err < 0)
		goto unlock;

	err = scarlett2_usb_set_config_buf(
		mixer, SCARLETT2_CONFIG_PRECOMP_FLT_PARAMS,
		index, SCARLETT2_BIQUAD_COEFFS,
		&private->precomp_flt_values[index]);

	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_peq_flt_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	int src_index = elem->control * SCARLETT2_BIQUAD_COEFFS;
	int dst_index = (
		elem->control /
		info->peq_flt_count *
		info->peq_flt_total_count +
		elem->control % info->peq_flt_count
	) * SCARLETT2_BIQUAD_COEFFS;
	int i, oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	/* Check if any of the values have changed; if not, return */
	for (i = 0; i < SCARLETT2_BIQUAD_COEFFS; i++) {
		oval = private->peq_flt_values[src_index + i];
		val = ucontrol->value.integer.value[i];
		if (oval != val)
			break;
	}

	if (i == SCARLETT2_BIQUAD_COEFFS)
		goto unlock;

	/* Update the values */
	for (i = 0; i < SCARLETT2_BIQUAD_COEFFS; i++)
		private->peq_flt_values[src_index + i] =
			ucontrol->value.integer.value[i];

	/* Send change to the device */
	err = scarlett2_usb_set_data(
		mixer, private->config_set->param_buf_addr, 1, dst_index);
	if (err < 0)
		goto unlock;

	err = scarlett2_usb_set_config_buf(
		mixer, SCARLETT2_CONFIG_PEQ_FLT_PARAMS,
		dst_index, SCARLETT2_BIQUAD_COEFFS,
		&private->peq_flt_values[src_index]);

	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_flt_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = SCARLETT2_BIQUAD_COEFFS;
	uinfo->value.integer.min = INT_MIN;
	uinfo->value.integer.max = INT_MAX;
	uinfo->value.integer.step = 1;
	return 0;
}

static const struct snd_kcontrol_new scarlett2_precomp_flt_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_CARD,
	.name = "",
	.info = scarlett2_flt_ctl_info,
	.get  = scarlett2_precomp_flt_ctl_get,
	.put  = scarlett2_precomp_flt_ctl_put,
};

static const struct snd_kcontrol_new scarlett2_peq_flt_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_CARD,
	.name = "",
	.info = scarlett2_flt_ctl_info,
	.get  = scarlett2_peq_flt_ctl_get,
	.put  = scarlett2_peq_flt_ctl_put,
};

/*** Input Mute Switch Controls ***/

static int scarlett2_update_input_mute(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	private->input_mute_updated = 0;

	if (!info->mute_input_count)
		return 0;

	return scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_INPUT_MUTE_SWITCH,
		info->mute_input_count, private->input_mute_switch);
}

static int scarlett2_input_mute_ctl_get(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->input_mute_updated) {
		err = scarlett2_update_input_mute(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] =
		private->input_mute_switch[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_input_mute_ctl_put(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->input_mute_switch[index];
	val = ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->input_mute_switch[index] = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_INPUT_MUTE_SWITCH,
			index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_input_mute_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_autogain_disables_ctl_info,
	.get  = scarlett2_input_mute_ctl_get,
	.put  = scarlett2_input_mute_ctl_put,
};

/*** Phantom Switch Controls ***/

static int scarlett2_update_input_phantom(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int err;

	private->input_phantom_updated = 0;

	if (!info->phantom_count)
		return 0;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_PHANTOM_SWITCH,
		info->phantom_count, private->phantom_switch);
	if (err < 0)
		return err;

	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_PHANTOM_PERSISTENCE)) {
		err = scarlett2_usb_get_config(
			mixer, SCARLETT2_CONFIG_PHANTOM_PERSISTENCE,
			1, &private->phantom_persistence);
		if (err < 0)
			return err;
	}

	return 0;
}

/* Check if phantom power on the given input is currently changing state */
static int scarlett2_phantom_is_switching(
	struct scarlett2_data *private, int line_num)
{
	const struct scarlett2_device_info *info = private->info;
	int index = line_num / info->inputs_per_phantom;

	return !!(private->phantom_switch[index] & 0x02);
}

/* Update autogain controls' access mode when phantom power changes state */
static void scarlett2_phantom_update_access(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	/* Disable autogain controls if phantom power is changing state */
	for (i = 0; i < info->gain_input_count; i++) {
		int val = !scarlett2_phantom_is_switching(private, i);

		scarlett2_set_ctl_access(private->autogain_ctls[i], val);
	}
}

/* Notify of access mode change for autogain which can't be enabled
 * while phantom power is changing.
 */
static void scarlett2_phantom_notify_access(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	for (i = 0; i < info->gain_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
			       &private->autogain_ctls[i]->id);
}

/* Call scarlett2_update_input_phantom() and
 * scarlett2_phantom_update_access() if input_phantom_updated is set.
 */
static int scarlett2_check_input_phantom_updated(
	struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int err;

	if (!private->input_phantom_updated)
		return 0;

	err = scarlett2_update_input_phantom(mixer);
	if (err < 0)
		return err;

	scarlett2_phantom_update_access(mixer);

	return 0;
}

static int scarlett2_phantom_ctl_get(struct snd_kcontrol *kctl,
				     struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_input_phantom_updated(mixer);
	if (err < 0)
		goto unlock;

	ucontrol->value.integer.value[0] = scarlett2_decode_muteable(
		private->phantom_switch[elem->control]);

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_phantom_ctl_put(struct snd_kcontrol *kctl,
				     struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	int index = elem->control;
	int oval, val, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_check_put_during_autogain(mixer);
	if (err < 0)
		goto unlock;

	oval = private->phantom_switch[index];
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->phantom_switch[index] = val;

	/* To set the Gen 4 muteable controls, bit 1 gets set */
	if (private->config_set->items[SCARLETT2_CONFIG_PHANTOM_SWITCH].mute)
		val = (!val) | 0x02;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_PHANTOM_SWITCH,
				       index + info->phantom_first, val);
	if (err == 0)
		err = 1;

	scarlett2_phantom_update_access(mixer);
	scarlett2_phantom_notify_access(mixer);

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_phantom_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_autogain_disables_ctl_info,
	.get  = scarlett2_phantom_ctl_get,
	.put  = scarlett2_phantom_ctl_put,
};

/*** Phantom Persistence Control ***/

static int scarlett2_phantom_persistence_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	ucontrol->value.integer.value[0] = private->phantom_persistence;
	return 0;
}

static int scarlett2_phantom_persistence_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->phantom_persistence;
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->phantom_persistence = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_PHANTOM_PERSISTENCE, index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_phantom_persistence_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = snd_ctl_boolean_mono_info,
	.get  = scarlett2_phantom_persistence_ctl_get,
	.put  = scarlett2_phantom_persistence_ctl_put,
};

/*** Speaker Switching Control ***/

static int scarlett2_update_monitor_other(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int err;

	/* monitor_other_enable[0] enables speaker switching
	 * monitor_other_enable[1] enables talkback
	 */
	u8 monitor_other_enable[2];

	/* monitor_other_switch[0] activates the alternate speakers
	 * monitor_other_switch[1] activates talkback
	 */
	u8 monitor_other_switch[2];

	private->monitor_other_updated = 0;

	/* if it doesn't do speaker switching then it also doesn't do
	 * talkback
	 */
	if (!info->has_speaker_switching)
		return 0;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE,
		2, monitor_other_enable);
	if (err < 0)
		return err;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH,
		2, monitor_other_switch);
	if (err < 0)
		return err;

	if (!monitor_other_enable[0])
		private->speaker_switching_switch = 0;
	else
		private->speaker_switching_switch = monitor_other_switch[0] + 1;

	if (info->has_talkback) {
		u16 bitmap;
		int i;

		if (!monitor_other_enable[1])
			private->talkback_switch = 0;
		else
			private->talkback_switch = monitor_other_switch[1] + 1;

		err = scarlett2_usb_get_config(mixer,
					       SCARLETT2_CONFIG_TALKBACK_MAP,
					       1, &bitmap);
		if (err < 0)
			return err;
		for (i = 0; i < private->num_mix_out; i++, bitmap >>= 1)
			private->talkback_map[i] = bitmap & 1;
	}

	return 0;
}

static int scarlett2_speaker_switch_enum_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	static const char *const values[3] = {
		"Off", "Main", "Alt"
	};

	return snd_ctl_enum_info(uinfo, 1, 3, values);
}

static int scarlett2_speaker_switch_enum_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->monitor_other_updated) {
		err = scarlett2_update_monitor_other(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.enumerated.item[0] = private->speaker_switching_switch;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

/* when speaker switching gets enabled, switch the main/alt speakers
 * to HW volume and disable those controls
 */
static int scarlett2_speaker_switch_enable(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	int i, err;

	for (i = 0; i < 4; i++) {
		int index = line_out_remap(private, i);

		/* switch the main/alt speakers to HW volume */
		if (!private->vol_sw_hw_switch[index]) {
			err = scarlett2_sw_hw_change(private->mixer, i, 1);
			if (err < 0)
				return err;
		}

		/* disable the line out SW/HW switch */
		scarlett2_sw_hw_ctl_ro(private, i);
		snd_ctl_notify(card,
			       SNDRV_CTL_EVENT_MASK_VALUE |
				 SNDRV_CTL_EVENT_MASK_INFO,
			       &private->sw_hw_ctls[i]->id);
	}

	/* when the next monitor-other notify comes in, update the mux
	 * configuration
	 */
	private->speaker_switching_switched = 1;

	return 0;
}

/* when speaker switching gets disabled, reenable the hw/sw controls
 * and invalidate the routing
 */
static void scarlett2_speaker_switch_disable(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	int i;

	/* enable the line out SW/HW switch */
	for (i = 0; i < 4; i++) {
		scarlett2_sw_hw_ctl_rw(private, i);
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
			       &private->sw_hw_ctls[i]->id);
	}

	/* when the next monitor-other notify comes in, update the mux
	 * configuration
	 */
	private->speaker_switching_switched = 1;
}

static int scarlett2_speaker_switch_enum_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->speaker_switching_switch;
	val = min(ucontrol->value.enumerated.item[0], 2U);

	if (oval == val)
		goto unlock;

	private->speaker_switching_switch = val;

	/* enable/disable speaker switching */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE,
		0, !!val);
	if (err < 0)
		goto unlock;

	/* if speaker switching is enabled, select main or alt */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH,
		0, val == 2);
	if (err < 0)
		goto unlock;

	/* update controls if speaker switching gets enabled or disabled */
	if (!oval && val)
		err = scarlett2_speaker_switch_enable(mixer);
	else if (oval && !val)
		scarlett2_speaker_switch_disable(mixer);

	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_speaker_switch_enum_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_speaker_switch_enum_ctl_info,
	.get  = scarlett2_speaker_switch_enum_ctl_get,
	.put  = scarlett2_speaker_switch_enum_ctl_put,
};

static int scarlett2_add_speaker_switch_ctl(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	if (!info->has_speaker_switching)
		return 0;

	return scarlett2_add_new_ctl(
		mixer, &scarlett2_speaker_switch_enum_ctl,
		0, 1, "Speaker Switching Playback Enum",
		&private->speaker_switching_ctl);
}

/*** Talkback and Talkback Map Controls ***/

static int scarlett2_talkback_enum_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	static const char *const values[3] = {
		"Disabled", "Off", "On"
	};

	return snd_ctl_enum_info(uinfo, 1, 3, values);
}

static int scarlett2_talkback_enum_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->monitor_other_updated) {
		err = scarlett2_update_monitor_other(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.enumerated.item[0] = private->talkback_switch;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_talkback_enum_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->talkback_switch;
	val = min(ucontrol->value.enumerated.item[0], 2U);

	if (oval == val)
		goto unlock;

	private->talkback_switch = val;

	/* enable/disable talkback */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE,
		1, !!val);
	if (err < 0)
		goto unlock;

	/* if talkback is enabled, select main or alt */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH,
		1, val == 2);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_talkback_enum_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_talkback_enum_ctl_info,
	.get  = scarlett2_talkback_enum_ctl_get,
	.put  = scarlett2_talkback_enum_ctl_put,
};

static int scarlett2_talkback_map_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int index = elem->control;

	ucontrol->value.integer.value[0] = private->talkback_map[index];

	return 0;
}

static int scarlett2_talkback_map_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int index = elem->control;
	int oval, val, err = 0, i;
	u16 bitmap = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->talkback_map[index];
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->talkback_map[index] = val;

	for (i = 0; i < private->num_mix_out; i++)
		bitmap |= private->talkback_map[i] << i;

	/* Send updated bitmap to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_TALKBACK_MAP,
				       0, bitmap);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_talkback_map_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = snd_ctl_boolean_mono_info,
	.get  = scarlett2_talkback_map_ctl_get,
	.put  = scarlett2_talkback_map_ctl_put,
};

static int scarlett2_add_talkback_ctls(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int err, i;
	char s[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];

	if (!info->has_talkback)
		return 0;

	err = scarlett2_add_new_ctl(
		mixer, &scarlett2_talkback_enum_ctl,
		0, 1, "Talkback Playback Enum",
		&private->talkback_ctl);
	if (err < 0)
		return err;

	for (i = 0; i < private->num_mix_out; i++) {
		snprintf(s, sizeof(s),
			 "Talkback Mix %c Playback Switch", i + 'A');
		err = scarlett2_add_new_ctl(mixer, &scarlett2_talkback_map_ctl,
					    i, 1, s, NULL);
		if (err < 0)
			return err;
	}

	return 0;
}

/*** Dim/Mute Controls ***/

static int scarlett2_dim_mute_ctl_get(struct snd_kcontrol *kctl,
				      struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->dim_mute_updated) {
		err = scarlett2_update_dim_mute(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] = private->dim_mute[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_dim_mute_ctl_put(struct snd_kcontrol *kctl,
				      struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int index = elem->control;
	int oval, val, err = 0, i;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->dim_mute[index];
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->dim_mute[index] = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_DIM_MUTE,
				       index, val);
	if (err == 0)
		err = 1;

	if (index == SCARLETT2_BUTTON_MUTE)
		for (i = 0; i < private->num_line_out; i++) {
			int line_index = line_out_remap(private, i);

			if (private->vol_sw_hw_switch[line_index]) {
				private->mute_switch[line_index] = val;
				snd_ctl_notify(mixer->chip->card,
					       SNDRV_CTL_EVENT_MASK_VALUE,
					       &private->mute_ctls[i]->id);
			}
		}

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_dim_mute_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = snd_ctl_boolean_mono_info,
	.get  = scarlett2_dim_mute_ctl_get,
	.put  = scarlett2_dim_mute_ctl_put
};

/*** Create the analogue output controls ***/

static int scarlett2_add_line_out_ctls(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int err, i;
	char s[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];

	/* Add R/O HW volume control */
	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_MASTER_VOLUME)) {
		snprintf(s, sizeof(s), "Master HW Playback Volume");
		err = scarlett2_add_new_ctl(mixer,
					    &scarlett2_master_volume_ctl,
					    0, 1, s, &private->master_vol_ctl);
		if (err < 0)
			return err;
	}

	/* Add R/O headphone volume control */
	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_HEADPHONE_VOLUME)) {
		snprintf(s, sizeof(s), "Headphone Playback Volume");
		err = scarlett2_add_new_ctl(mixer,
					    &scarlett2_headphone_volume_ctl,
					    0, 1, s,
					    &private->headphone_vol_ctl);
		if (err < 0)
			return err;
	}

	/* Remaining controls are only applicable if the device
	 * has per-channel line-out volume controls.
	 */
	if (!scarlett2_has_config_item(private,
				       SCARLETT2_CONFIG_LINE_OUT_VOLUME))
		return 0;

	/* Add volume controls */
	for (i = 0; i < private->num_line_out; i++) {
		int index = line_out_remap(private, i);

		/* Fader */
		if (info->line_out_descrs[i])
			snprintf(s, sizeof(s),
				 "Line %02d (%s) Playback Volume",
				 i + 1, info->line_out_descrs[i]);
		else
			snprintf(s, sizeof(s),
				 "Line %02d Playback Volume",
				 i + 1);
		err = scarlett2_add_new_ctl(mixer,
					    &scarlett2_line_out_volume_ctl,
					    i, 1, s, &private->vol_ctls[i]);
		if (err < 0)
			return err;

		/* Mute Switch */
		snprintf(s, sizeof(s),
			 "Line %02d Mute Playback Switch",
			 i + 1);
		err = scarlett2_add_new_ctl(mixer,
					    &scarlett2_mute_ctl,
					    i, 1, s,
					    &private->mute_ctls[i]);
		if (err < 0)
			return err;

		/* SW/HW Switch */
		if (scarlett2_has_config_item(private,
					      SCARLETT2_CONFIG_SW_HW_SWITCH)) {

			/* Make the fader and mute controls read-only if the
			 * SW/HW switch is set to HW
			 */
			if (private->vol_sw_hw_switch[index])
				scarlett2_vol_ctl_set_writable(mixer, i, 0);

			scnprintf(s, sizeof(s),
				  "Line Out %02d Volume Control Playback Enum",
				  i + 1);
			err = scarlett2_add_new_ctl(mixer,
						    &scarlett2_sw_hw_enum_ctl,
						    i, 1, s,
						    &private->sw_hw_ctls[i]);
			if (err < 0)
				return err;

			/* Make the switch read-only if the line is
			 * involved in speaker switching
			 */
			if (private->speaker_switching_switch && i < 4)
				scarlett2_sw_hw_ctl_ro(private, i);
		}
	}

	/* Add dim/mute controls */
	if (scarlett2_has_config_item(private, SCARLETT2_CONFIG_DIM_MUTE))
		for (i = 0; i < SCARLETT2_DIM_MUTE_COUNT; i++) {
			err = scarlett2_add_new_ctl(
				mixer, &scarlett2_dim_mute_ctl,
				i, 1, scarlett2_dim_mute_names[i],
				&private->dim_mute_ctls[i]);
			if (err < 0)
				return err;
		}

	return 0;
}

/*** Create the analogue input controls ***/

static int scarlett2_add_dsp_ctls(struct usb_mixer_interface *mixer, int i)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int j, err;
	char s[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
	const char *compr_fmt = "Line In %d Compressor %s";
	const char *flt_switch_fmt = "Line In %d %s Filter Enable";
	const char *flt_fmt = "Line In %d %s Coefficients %d";

	/* Add compressor controls */
	for (j = 0; j < SCARLETT2_COMPRESSOR_PARAM_COUNT; j++) {
		const struct compressor_param *param = &compressor_params[j];
		int idx = i * SCARLETT2_COMPRESSOR_PARAM_COUNT + j;

		scnprintf(s, sizeof(s), compr_fmt, i + 1, param->name);
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_compressor_ctl,
			i * SCARLETT2_COMPRESSOR_PARAM_COUNT + j,
			1, s, &private->compressor_ctls[idx]);
		if (err < 0)
			return err;
	}

	/* Add filter enable controls */
	scnprintf(s, sizeof(s), flt_switch_fmt, i + 1, "Pre-Comp");
	err = scarlett2_add_new_ctl(
		mixer, &scarlett2_precomp_flt_switch_ctl,
		i, 1, s, &private->precomp_flt_switch_ctls[i]);
	if (err < 0)
		return err;

	scnprintf(s, sizeof(s), flt_switch_fmt, i + 1, "PEQ");
	err = scarlett2_add_new_ctl(
		mixer, &scarlett2_peq_flt_switch_ctl,
		i, 1, s, &private->peq_flt_switch_ctls[i]);
	if (err < 0)
		return err;

	/* Add filter coefficient controls */
	for (j = 0; j < info->precomp_flt_count; j++) {
		scnprintf(s, sizeof(s), flt_fmt, i + 1, "Pre-Comp", j + 1);
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_precomp_flt_ctl,
			i * info->precomp_flt_count + j,
			1, s, &private->precomp_flt_switch_ctls[j]);
		if (err < 0)
			return err;
	}

	for (j = 0; j < info->peq_flt_count; j++) {
		scnprintf(s, sizeof(s), flt_fmt, i + 1, "PEQ", j + 1);
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_peq_flt_ctl,
			i * info->peq_flt_count + j,
			1, s, &private->peq_flt_switch_ctls[j]);
		if (err < 0)
			return err;
	}

	return 0;
}

static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int err, i;
	char s[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
	const char *fmt = "Line In %d %s Capture %s";
	const char *fmt2 = "Line In %d-%d %s Capture %s";

	/* Add input level (line/inst) controls */
	for (i = 0; i < info->level_input_count; i++) {
		scnprintf(s, sizeof(s), fmt, i + 1 + info->level_input_first,
			  "Level", "Enum");
		err = scarlett2_add_new_ctl(mixer, &scarlett2_level_enum_ctl,
					    i, 1, s, &private->level_ctls[i]);
		if (err < 0)
			return err;
	}

	/* Add input pad controls */
	for (i = 0; i < info->pad_input_count; i++) {
		scnprintf(s, sizeof(s), fmt, i + 1, "Pad", "Switch");
		err = scarlett2_add_new_ctl(mixer, &scarlett2_pad_ctl,
					    i, 1, s, &private->pad_ctls[i]);
		if (err < 0)
			return err;
	}

	/* Add input air controls */
	for (i = 0; i < info->air_input_count; i++) {
		scnprintf(s, sizeof(s), fmt, i + 1 + info->air_input_first,
			  "Air", info->air_option ? "Enum" : "Switch");
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_air_ctl[info->air_option],
			i, 1, s, &private->air_ctls[i]);
		if (err < 0)
			return err;
	}

	/* Add input DSP controls */
	for (i = 0; i < info->dsp_input_count; i++) {
		scnprintf(s, sizeof(s), fmt, i + 1, "DSP", "Switch");
		err = scarlett2_add_new_ctl(mixer, &scarlett2_dsp_ctl,
					    i, 1, s, &private->dsp_ctls[i]);
		if (err < 0)
			return err;

		err = scarlett2_add_dsp_ctls(mixer, i);
		if (err < 0)
			return err;
	}

	/* Add input mute controls */
	for (i = 0; i < info->mute_input_count; i++) {
		scnprintf(s, sizeof(s), fmt, i + 1, "Mute", "Switch");
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_input_mute_ctl,
			i, 1, s, &private->input_mute_ctls[i]);
		if (err < 0)
			return err;
	}

	/* Add input phantom controls */
	if (info->inputs_per_phantom == 1) {
		for (i = 0; i < info->phantom_count; i++) {
			scnprintf(s, sizeof(s), fmt,
				  i + 1 + info->phantom_first,
				  "Phantom Power", "Switch");
			err = scarlett2_add_new_ctl(
				mixer, &scarlett2_phantom_ctl,
				i, 1, s, &private->phantom_ctls[i]);
			if (err < 0)
				return err;
		}
	} else if (info->inputs_per_phantom > 1) {
		for (i = 0; i < info->phantom_count; i++) {
			int from = i * info->inputs_per_phantom + 1;
			int to = (i + 1) * info->inputs_per_phantom;

			scnprintf(s, sizeof(s), fmt2, from, to,
				  "Phantom Power", "Switch");
			err = scarlett2_add_new_ctl(
				mixer, &scarlett2_phantom_ctl,
				i, 1, s, &private->phantom_ctls[i]);
			if (err < 0)
				return err;
		}
	}
	if (info->phantom_count &&
	    scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_PHANTOM_PERSISTENCE)) {
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_phantom_persistence_ctl, 0, 1,
			"Phantom Power Persistence Capture Switch", NULL);
		if (err < 0)
			return err;
	}

	/* Add input select/link controls */
	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_INPUT_SELECT_SWITCH)) {
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_input_select_ctl, 0, 1,
			"Input Select Capture Enum",
			&private->input_select_ctl);
		if (err < 0)
			return err;
	}

	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_INPUT_LINK_SWITCH)) {
		for (i = 0; i < info->gain_input_count / 2; i++) {
			scnprintf(s, sizeof(s),
				  "Line In %d-%d Link Capture Switch",
				  (i * 2) + 1, (i * 2) + 2);
			err = scarlett2_add_new_ctl(
				mixer, &scarlett2_input_link_ctl,
				i, 1, s, &private->input_link_ctls[i]);
			if (err < 0)
				return err;
		}
	}

	/* Add software-controllable input gain controls */
	for (i = 0; i < info->gain_input_count; i++) {
		scnprintf(s, sizeof(s), fmt, i + 1,
			  "Gain", "Volume");
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_input_gain_ctl,
			i, 1, s, &private->input_gain_ctls[i]);
		if (err < 0)
			return err;
		private->input_gain_ctls[i]->tlv.p =
			private->config_set->input_gain_tlv;

		scnprintf(s, sizeof(s), fmt, i + 1,
			  "Autogain", "Switch");
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_autogain_switch_ctl,
			i, 1, s, &private->autogain_ctls[i]);
		if (err < 0)
			return err;

		scnprintf(s, sizeof(s), fmt, i + 1,
			  "Autogain Status", "Enum");
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_autogain_status_ctl,
			i, 1, s, &private->autogain_status_ctls[i]);
	}

	/* Add autogain target controls */
	for (i = 0; i < SCARLETT2_AG_TARGET_COUNT; i++)
		if (scarlett2_has_config_item(private,
					      scarlett2_ag_target_configs[i])) {

			scnprintf(s, sizeof(s), "Autogain %s Target",
				  scarlett2_ag_target_names[i]);
			err = scarlett2_add_new_ctl(
				mixer, &scarlett2_ag_target_ctl,
				i, 1, s, &private->ag_target_ctls[i]);
			if (err < 0)
				return err;
		}

	/* Add safe-mode input switch controls */
	for (i = 0; i < info->safe_input_count; i++) {
		scnprintf(s, sizeof(s), fmt, i + 1,
			  "Safe", "Switch");
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_safe_ctl,
			i, 1, s, &private->safe_ctls[i]);
		if (err < 0)
			return err;
	}

	/* Add PCM Input Switch control */
	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_PCM_INPUT_SWITCH)) {
		err = scarlett2_add_new_ctl(
			mixer, &scarlett2_pcm_input_switch_ctl, 0, 1,
			"PCM Input Capture Switch",
			&private->pcm_input_switch_ctl);
		if (err < 0)
			return err;
	}

	return 0;
}

/*** Mixer Volume Controls ***/

static int scarlett2_update_mix(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int i, err;

	private->mix_updated = 0;

	for (i = 0; i < private->num_mix_out; i++) {
		err = scarlett2_usb_get_mix(mixer, i);
		if (err < 0)
			return err;
	}

	return 1;
}

static int scarlett2_mixer_ctl_info(struct snd_kcontrol *kctl,
				    struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;

	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = elem->channels;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = SCARLETT2_MIXER_MAX_VALUE;
	uinfo->value.integer.step = 1;
	return 0;
}

static int scarlett2_mixer_ctl_get(struct snd_kcontrol *kctl,
				   struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->mix_updated) {
		err = scarlett2_update_mix(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] = private->mix[elem->control];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_mixer_ctl_put(struct snd_kcontrol *kctl,
				   struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int oval, val, mix_num, err = 0;
	int index = elem->control;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->mix[index];
	val = clamp(ucontrol->value.integer.value[0],
		    0L, (long)SCARLETT2_MIXER_MAX_VALUE);
	mix_num = index / private->num_mix_in;

	if (oval == val)
		goto unlock;

	private->mix[index] = val;
	err = scarlett2_usb_set_mix(mixer, mix_num);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const DECLARE_TLV_DB_MINMAX(
	db_scale_scarlett2_mixer,
	SCARLETT2_MIXER_MIN_DB * 100,
	SCARLETT2_MIXER_MAX_DB * 100
);

static const struct snd_kcontrol_new scarlett2_mixer_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
		  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
	.name = "",
	.info = scarlett2_mixer_ctl_info,
	.get  = scarlett2_mixer_ctl_get,
	.put  = scarlett2_mixer_ctl_put,
	.private_value = SCARLETT2_MIXER_MAX_DB, /* max value */
	.tlv = { .p = db_scale_scarlett2_mixer }
};

static int scarlett2_add_mixer_ctls(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int err, i, j;
	int index;
	char s[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];

	for (i = 0, index = 0; i < private->num_mix_out; i++)
		for (j = 0; j < private->num_mix_in; j++, index++) {
			snprintf(s, sizeof(s),
				 "Mix %c Input %02d Playback Volume",
				 'A' + i, j + 1);
			err = scarlett2_add_new_ctl(mixer, &scarlett2_mixer_ctl,
						    index, 1, s,
						    &private->mix_ctls[index]);
			if (err < 0)
				return err;
		}

	return 0;
}

/*** Direct Monitor Control ***/

static int scarlett2_update_direct_monitor(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	private->direct_monitor_updated = 0;

	if (!private->info->direct_monitor)
		return 0;

	return scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_DIRECT_MONITOR,
		1, &private->direct_monitor_switch);
}

static int scarlett2_update_monitor_mix(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int err, i;
	u16 mix_values[SCARLETT2_MONITOR_MIX_MAX];

	if (!private->num_monitor_mix_ctls)
		return 0;

	err = scarlett2_usb_get_config(
		mixer, SCARLETT2_CONFIG_DIRECT_MONITOR_GAIN,
		private->num_monitor_mix_ctls, mix_values);
	if (err < 0)
		return err;

	for (i = 0; i < private->num_monitor_mix_ctls; i++)
		private->monitor_mix[i] = scarlett2_mixer_value_to_db(
			mix_values[i]);

	return 0;
}

static int scarlett2_direct_monitor_ctl_get(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->direct_monitor_updated) {
		err = scarlett2_update_direct_monitor(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.enumerated.item[0] = private->direct_monitor_switch;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_direct_monitor_ctl_put(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int index = elem->control;
	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->direct_monitor_switch;
	val = min(ucontrol->value.enumerated.item[0], 2U);

	if (oval == val)
		goto unlock;

	private->direct_monitor_switch = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_DIRECT_MONITOR, index, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_direct_monitor_stereo_enum_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	static const char *const values[3] = {
		"Off", "Mono", "Stereo"
	};

	return snd_ctl_enum_info(uinfo, 1, 3, values);
}

/* Direct Monitor for Solo is mono-only and only needs a boolean control
 * Direct Monitor for 2i2 is selectable between Off/Mono/Stereo
 */
static const struct snd_kcontrol_new scarlett2_direct_monitor_ctl[2] = {
	{
		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
		.name = "",
		.info = snd_ctl_boolean_mono_info,
		.get  = scarlett2_direct_monitor_ctl_get,
		.put  = scarlett2_direct_monitor_ctl_put,
	},
	{
		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
		.name = "",
		.info = scarlett2_direct_monitor_stereo_enum_ctl_info,
		.get  = scarlett2_direct_monitor_ctl_get,
		.put  = scarlett2_direct_monitor_ctl_put,
	}
};

static int scarlett2_monitor_mix_ctl_get(struct snd_kcontrol *kctl,
					 struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	ucontrol->value.integer.value[0] = private->monitor_mix[elem->control];

	return 0;
}

static int scarlett2_monitor_mix_ctl_put(struct snd_kcontrol *kctl,
					 struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int oval, val, err = 0;
	int index = elem->control;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->monitor_mix[index];
	val = clamp(ucontrol->value.integer.value[0],
		    0L, (long)SCARLETT2_MIXER_MAX_VALUE);

	if (oval == val)
		goto unlock;

	private->monitor_mix[index] = val;
	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_DIRECT_MONITOR_GAIN,
		index, scarlett2_mixer_values[val]);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_monitor_mix_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
		  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
	.name = "",
	.info = scarlett2_mixer_ctl_info,
	.get  = scarlett2_monitor_mix_ctl_get,
	.put  = scarlett2_monitor_mix_ctl_put,
	.private_value = SCARLETT2_MIXER_MAX_DB, /* max value */
	.tlv = { .p = db_scale_scarlett2_mixer }
};

static int scarlett2_add_direct_monitor_ctls(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	const char *s;
	int err, i, j, k, index;

	if (!info->direct_monitor)
		return 0;

	s = info->direct_monitor == 1
	      ? "Direct Monitor Playback Switch"
	      : "Direct Monitor Playback Enum";

	err = scarlett2_add_new_ctl(
		mixer, &scarlett2_direct_monitor_ctl[info->direct_monitor - 1],
		0, 1, s, &private->direct_monitor_ctl);
	if (err < 0)
		return err;

	if (!private->num_monitor_mix_ctls)
		return 0;

	/* 1 or 2 direct monitor selections (Mono & Stereo) */
	for (i = 0, index = 0; i < info->direct_monitor; i++) {
		const char * const format =
			"Monitor %sMix %c Input %02d Playback Volume";
		const char *mix_type;

		if (info->direct_monitor == 1)
			mix_type = "";
		else if (i == 0)
			mix_type = "1 ";
		else
			mix_type = "2 ";

		/* 2 Mix outputs, A/Left & B/Right */
		for (j = 0; j < 2; j++)

			/* Mix inputs */
			for (k = 0; k < private->num_mix_in; k++, index++) {
				char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];

				scnprintf(name, sizeof(name), format,
					  mix_type, 'A' + j, k + 1);

				err = scarlett2_add_new_ctl(
					mixer, &scarlett2_monitor_mix_ctl,
					index, 1, name, NULL);
				if (err < 0)
					return err;
			}
	}

	return 0;
}

/*** Mux Source Selection Controls ***/

static int scarlett2_mux_src_enum_ctl_info(struct snd_kcontrol *kctl,
					   struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	const int (*port_count)[SCARLETT2_PORT_DIRNS] = info->port_count;
	unsigned int item = uinfo->value.enumerated.item;
	int items = private->num_mux_srcs;
	int port_type;

	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
	uinfo->count = elem->channels;
	uinfo->value.enumerated.items = items;

	if (item >= items)
		item = uinfo->value.enumerated.item = items - 1;

	for (port_type = 0;
	     port_type < SCARLETT2_PORT_TYPE_COUNT;
	     port_type++) {
		if (item < port_count[port_type][SCARLETT2_PORT_IN]) {
			const struct scarlett2_port *port =
				&scarlett2_ports[port_type];

			if (port_type == SCARLETT2_PORT_TYPE_MIX &&
			    item >= private->num_mix_out)
				sprintf(uinfo->value.enumerated.name,
					port->dsp_src_descr,
					item - private->num_mix_out + 1);
			else
				sprintf(uinfo->value.enumerated.name,
					port->src_descr,
					item + port->src_num_offset);

			return 0;
		}
		item -= port_count[port_type][SCARLETT2_PORT_IN];
	}

	return -EINVAL;
}

static int scarlett2_mux_src_enum_ctl_get(struct snd_kcontrol *kctl,
					  struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int index = line_out_remap(private, elem->control);
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->mux_updated) {
		err = scarlett2_usb_get_mux(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.enumerated.item[0] = private->mux[index];

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_mux_src_enum_ctl_put(struct snd_kcontrol *kctl,
					  struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int index = line_out_remap(private, elem->control);
	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->mux[index];
	val = min(ucontrol->value.enumerated.item[0],
		  private->num_mux_srcs - 1U);

	if (oval == val)
		goto unlock;

	private->mux[index] = val;
	err = scarlett2_usb_set_mux(mixer);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_mux_src_enum_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_mux_src_enum_ctl_info,
	.get  = scarlett2_mux_src_enum_ctl_get,
	.put  = scarlett2_mux_src_enum_ctl_put,
};

static int scarlett2_add_mux_enums(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	const int (*port_count)[SCARLETT2_PORT_DIRNS] = info->port_count;
	int port_type, channel, i;

	for (i = 0, port_type = 0;
	     port_type < SCARLETT2_PORT_TYPE_COUNT;
	     port_type++) {
		for (channel = 0;
		     channel < port_count[port_type][SCARLETT2_PORT_OUT];
		     channel++, i++) {
			int err;
			char s[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
			int channel_num = channel + 1;
			const struct scarlett2_port *port =
				&scarlett2_ports[port_type];
			const char *descr = port->dst_descr;

			if (port_type == SCARLETT2_PORT_TYPE_MIX &&
			    channel >= private->num_mix_in) {
				channel_num -= private->num_mix_in;
				descr = port->dsp_dst_descr;
			}

			snprintf(s, sizeof(s) - 5, descr, channel_num);
			strcat(s, " Enum");

			err = scarlett2_add_new_ctl(mixer,
						    &scarlett2_mux_src_enum_ctl,
						    i, 1, s,
						    &private->mux_ctls[i]);
			if (err < 0)
				return err;
		}
	}

	return 0;
}

/*** Meter Controls ***/

static int scarlett2_meter_ctl_info(struct snd_kcontrol *kctl,
				    struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;

	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = elem->channels;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = 4095;
	uinfo->value.integer.step = 1;
	return 0;
}

static int scarlett2_meter_ctl_get(struct snd_kcontrol *kctl,
				   struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	u8 *meter_level_map = private->meter_level_map;
	u16 meter_levels[SCARLETT2_MAX_METERS];
	int i, err;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	err = scarlett2_usb_get_meter_levels(mixer, elem->channels,
					     meter_levels);
	if (err < 0)
		goto unlock;

	/* copy & translate from meter_levels[] using meter_level_map[] */
	for (i = 0; i < elem->channels; i++) {
		int idx = meter_level_map[i];
		int value;

		if (idx == 255)
			value = 0;
		else
			value = meter_levels[idx];

		ucontrol->value.integer.value[i] = value;
	}

unlock:
	mutex_unlock(&private->data_mutex);

	return err;
}

static const struct snd_kcontrol_new scarlett2_meter_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_PCM,
	.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
	.name = "",
	.info = scarlett2_meter_ctl_info,
	.get  = scarlett2_meter_ctl_get
};

static int scarlett2_add_meter_ctl(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	/* devices without a mixer also don't support reporting levels */
	if (!scarlett2_has_mixer(private))
		return 0;

	return scarlett2_add_new_ctl(mixer, &scarlett2_meter_ctl,
				     0, private->num_mux_dsts,
				     "Level Meter", NULL);
}

/*** MSD Controls ***/

static int scarlett2_msd_ctl_get(struct snd_kcontrol *kctl,
				 struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	ucontrol->value.integer.value[0] = private->msd_switch;
	return 0;
}

static int scarlett2_msd_ctl_put(struct snd_kcontrol *kctl,
				 struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->msd_switch;
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->msd_switch = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_MSD_SWITCH,
				       0, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_msd_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = snd_ctl_boolean_mono_info,
	.get  = scarlett2_msd_ctl_get,
	.put  = scarlett2_msd_ctl_put,
};

static int scarlett2_add_msd_ctl(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	if (!scarlett2_has_config_item(private, SCARLETT2_CONFIG_MSD_SWITCH))
		return 0;

	/* If MSD mode is off, hide the switch by default */
	if (!private->msd_switch && !(mixer->chip->setup & SCARLETT2_MSD_ENABLE))
		return 0;

	/* Add MSD control */
	return scarlett2_add_new_ctl(mixer, &scarlett2_msd_ctl,
				     0, 1, "MSD Mode Switch", NULL);
}

/*** Standalone Control ***/

static int scarlett2_standalone_ctl_get(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	ucontrol->value.integer.value[0] = private->standalone_switch;
	return 0;
}

static int scarlett2_standalone_ctl_put(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;

	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->standalone_switch;
	val = !!ucontrol->value.integer.value[0];

	if (oval == val)
		goto unlock;

	private->standalone_switch = val;

	/* Send switch change to the device */
	err = scarlett2_usb_set_config(mixer,
				       SCARLETT2_CONFIG_STANDALONE_SWITCH,
				       0, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_standalone_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = snd_ctl_boolean_mono_info,
	.get  = scarlett2_standalone_ctl_get,
	.put  = scarlett2_standalone_ctl_put,
};

static int scarlett2_add_standalone_ctl(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	if (!scarlett2_has_config_item(private,
				       SCARLETT2_CONFIG_STANDALONE_SWITCH))
		return 0;

	/* Add standalone control */
	return scarlett2_add_new_ctl(mixer, &scarlett2_standalone_ctl,
				     0, 1, "Standalone Switch", NULL);
}

/*** Power Status ***/

static int scarlett2_update_power_status(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int err;
	u8 power_ext, power_low;

	private->power_status_updated = 0;

	err = scarlett2_usb_get_config(mixer, SCARLETT2_CONFIG_POWER_EXT,
				       1, &power_ext);
	if (err < 0)
		return err;

	err = scarlett2_usb_get_config(mixer, SCARLETT2_CONFIG_POWER_LOW,
				       1, &power_low);
	if (err < 0)
		return err;

	if (power_low)
		private->power_status = SCARLETT2_POWER_STATUS_FAIL;
	else if (power_ext)
		private->power_status = SCARLETT2_POWER_STATUS_EXT;
	else
		private->power_status = SCARLETT2_POWER_STATUS_BUS;

	return 0;
}

static int scarlett2_power_status_ctl_get(struct snd_kcontrol *kctl,
					  struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->power_status_updated) {
		err = scarlett2_update_power_status(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] = private->power_status;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_power_status_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	static const char *const values[3] = {
		"External", "Bus", "Fail"
	};

	return snd_ctl_enum_info(uinfo, 1, 3, values);
}

static const struct snd_kcontrol_new scarlett2_power_status_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_CARD,
	.access = SNDRV_CTL_ELEM_ACCESS_READ,
	.name = "",
	.info = scarlett2_power_status_ctl_info,
	.get  = scarlett2_power_status_ctl_get,
};

static int scarlett2_add_power_status_ctl(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	if (!scarlett2_has_config_item(private,
				       SCARLETT2_CONFIG_POWER_EXT))
		return 0;

	/* Add power status control */
	return scarlett2_add_new_ctl(mixer, &scarlett2_power_status_ctl,
				     0, 1, "Power Status Card Enum",
				     &private->power_status_ctl);
}

/*** Bluetooth Volume ***/

static int scarlett2_update_bluetooth_volume(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int err;

	private->bluetooth_updated = 0;

	if (!private->info->has_bluetooth)
		return 0;

	err = scarlett2_usb_get_config(mixer,
				       SCARLETT2_CONFIG_BLUETOOTH_VOLUME,
				       1, &private->bluetooth_volume);
	if (err < 0)
		return err;

	return 0;
}

static int scarlett2_bluetooth_volume_ctl_get(struct snd_kcontrol *kctl,
					     struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	if (private->bluetooth_updated) {
		err = scarlett2_update_bluetooth_volume(mixer);
		if (err < 0)
			goto unlock;
	}
	ucontrol->value.integer.value[0] = private->bluetooth_volume;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_bluetooth_volume_ctl_put(struct snd_kcontrol *kctl,
					     struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int oval, val, err = 0;

	mutex_lock(&private->data_mutex);

	if (private->hwdep_in_use) {
		err = -EBUSY;
		goto unlock;
	}

	oval = private->bluetooth_volume;
	val = clamp(ucontrol->value.integer.value[0],
		    0L, (long)SCARLETT2_MAX_BLUETOOTH_VOLUME);

	if (oval == val)
		goto unlock;

	private->bluetooth_volume = val;
	err = scarlett2_usb_set_config(mixer,
				       SCARLETT2_CONFIG_BLUETOOTH_VOLUME,
				       0, val);
	if (err == 0)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static int scarlett2_bluetooth_volume_ctl_info(
	struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
{
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = 1;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = SCARLETT2_MAX_BLUETOOTH_VOLUME;
	uinfo->value.integer.step = 1;
	return 0;
}

static const struct snd_kcontrol_new scarlett2_bluetooth_volume_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_bluetooth_volume_ctl_info,
	.get  = scarlett2_bluetooth_volume_ctl_get,
	.put  = scarlett2_bluetooth_volume_ctl_put,
};

static int scarlett2_add_bluetooth_volume_ctl(
	struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	if (!private->info->has_bluetooth)
		return 0;

	/* Add Bluetooth volume control */
	return scarlett2_add_new_ctl(mixer, &scarlett2_bluetooth_volume_ctl,
				     0, 1, "Bluetooth Capture Volume",
				     &private->bluetooth_volume_ctl);
}

/*** S/PDIF Mode Controls ***/

static int scarlett2_update_spdif_mode(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int err, i;
	u8 mode;
	const u8 *mode_values = private->info->spdif_mode_values;

	if (!private->info->spdif_mode_control_name)
		return 0;

	err = scarlett2_usb_get_config(mixer, SCARLETT2_CONFIG_SPDIF_MODE,
				       1, &mode);
	if (err < 0)
		return err;

	private->spdif_mode = 0;

	for (i = 0; *mode_values != 0xff; i++, mode_values++)
		if (*mode_values == mode) {
			private->spdif_mode = i;
			break;
		}

	return 0;
}

static int scarlett2_spdif_mode_ctl_info(struct snd_kcontrol *kctl,
					   struct snd_ctl_elem_info *uinfo)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;
	const char * const *mode_texts = private->info->spdif_mode_texts;
	int count = 0;

	while (*mode_texts++)
		count++;

	return snd_ctl_enum_info(uinfo, 1, count,
				 private->info->spdif_mode_texts);
}

static int scarlett2_spdif_mode_ctl_get(struct snd_kcontrol *kctl,
					  struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct scarlett2_data *private = elem->head.mixer->private_data;

	ucontrol->value.enumerated.item[0] = private->spdif_mode;
	return 0;
}

static int scarlett2_spdif_mode_ctl_put(struct snd_kcontrol *kctl,
					  struct snd_ctl_elem_value *ucontrol)
{
	struct usb_mixer_elem_info *elem = kctl->private_data;
	struct usb_mixer_interface *mixer = elem->head.mixer;
	struct scarlett2_data *private = mixer->private_data;
	int oval, val, err = 0;
	int i;

	mutex_lock(&private->data_mutex);

	oval = private->spdif_mode;
	val = ucontrol->value.enumerated.item[0];

	if (val < 0) {
		err = -EINVAL;
		goto unlock;
	}

	for (i = 0; i <= val; i++)
		if (private->info->spdif_mode_values[i] == 0xff) {
			err = -EINVAL;
			goto unlock;
		}

	if (oval == val)
		goto unlock;

	private->spdif_mode = val;

	err = scarlett2_usb_set_config(
		mixer, SCARLETT2_CONFIG_SPDIF_MODE, 0,
		private->info->spdif_mode_values[val]);
	if (!err)
		err = 1;

unlock:
	mutex_unlock(&private->data_mutex);
	return err;
}

static const struct snd_kcontrol_new scarlett2_spdif_mode_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "",
	.info = scarlett2_spdif_mode_ctl_info,
	.get  = scarlett2_spdif_mode_ctl_get,
	.put  = scarlett2_spdif_mode_ctl_put,
};

static int scarlett2_add_spdif_mode_ctl(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	if (!private->info->spdif_mode_control_name)
		return 0;

	return scarlett2_add_new_ctl(mixer, &scarlett2_spdif_mode_ctl,
				     0, 1,
				     private->info->spdif_mode_control_name,
				     NULL);
}

/*** Notification Handlers ***/

/* Notify on sync change */
static void scarlett2_notify_sync(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	private->sync_updated = 1;

	snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
		       &private->sync_ctl->id);
}

/* Notify on monitor change (Gen 2/3) */
static void scarlett2_notify_monitor(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	int i;

	if (!scarlett2_has_config_item(private, SCARLETT2_CONFIG_SW_HW_SWITCH))
		return;

	private->vol_updated = 1;

	snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
		       &private->master_vol_ctl->id);

	for (i = 0; i < private->num_line_out; i++)
		if (private->vol_sw_hw_switch[line_out_remap(private, i)])
			snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
				       &private->vol_ctls[i]->id);
}

/* Notify on volume change (Gen 4) */
static void scarlett2_notify_volume(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	private->vol_updated = 1;

	snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
		       &private->master_vol_ctl->id);
	snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
		       &private->headphone_vol_ctl->id);
}

/* Notify on dim/mute change */
static void scarlett2_notify_dim_mute(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	int i;

	if (!scarlett2_has_config_item(private, SCARLETT2_CONFIG_SW_HW_SWITCH))
		return;

	private->dim_mute_updated = 1;

	for (i = 0; i < SCARLETT2_DIM_MUTE_COUNT; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->dim_mute_ctls[i]->id);

	for (i = 0; i < private->num_line_out; i++)
		if (private->vol_sw_hw_switch[line_out_remap(private, i)])
			snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
				       &private->mute_ctls[i]->id);
}

/* Notify on input level switch change */
static void scarlett2_notify_input_level(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	private->input_level_updated = 1;

	for (i = 0; i < info->level_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->level_ctls[i]->id);
}

/* Notify on input pad switch change */
static void scarlett2_notify_input_pad(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	private->input_pad_updated = 1;

	for (i = 0; i < info->pad_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->pad_ctls[i]->id);
}

/* Notify on input air switch change */
static void scarlett2_notify_input_air(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	private->input_air_updated = 1;

	for (i = 0; i < info->air_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->air_ctls[i]->id);
}

/* Notify on input DSP switch change */
static void scarlett2_notify_input_dsp(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	private->input_dsp_updated = 1;

	for (i = 0; i < info->dsp_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->dsp_ctls[i]->id);
}

/* Notify on input mute switch change */
static void scarlett2_notify_input_mute(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	private->input_mute_updated = 1;

	for (i = 0; i < info->mute_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->input_mute_ctls[i]->id);
}

/* Notify on input phantom switch change */
static void scarlett2_notify_input_phantom(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	private->input_phantom_updated = 1;

	for (i = 0; i < info->phantom_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->phantom_ctls[i]->id);

	scarlett2_phantom_notify_access(mixer);
}

/* Notify on "input other" change (level/pad/air/phantom) */
static void scarlett2_notify_input_other(struct usb_mixer_interface *mixer)
{
	scarlett2_notify_input_level(mixer);
	scarlett2_notify_input_pad(mixer);
	scarlett2_notify_input_air(mixer);
	scarlett2_notify_input_phantom(mixer);
}

/* Notify on input select change */
static void scarlett2_notify_input_select(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	if (!scarlett2_has_config_item(private,
				       SCARLETT2_CONFIG_INPUT_SELECT_SWITCH))
		return;

	private->input_select_updated = 1;

	snd_ctl_notify(card,
		       SNDRV_CTL_EVENT_MASK_VALUE | SNDRV_CTL_EVENT_MASK_INFO,
		       &private->input_select_ctl->id);

	for (i = 0; i < info->gain_input_count / 2; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->input_link_ctls[i]->id);
}

/* Notify on input gain change */
static void scarlett2_notify_input_gain(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	if (!info->gain_input_count)
		return;

	private->input_gain_updated = 1;

	for (i = 0; i < info->gain_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->input_gain_ctls[i]->id);
}

/* Notify on autogain change */
static void scarlett2_notify_autogain(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	if (!info->gain_input_count)
		return;

	private->autogain_updated = 1;

	for (i = 0; i < info->gain_input_count; i++) {
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->autogain_ctls[i]->id);
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->autogain_status_ctls[i]->id);
	}

	for (i = 0; i < SCARLETT2_AG_TARGET_COUNT; i++)
		if (scarlett2_has_config_item(private,
					      scarlett2_ag_target_configs[i]))
			snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO,
				       &private->ag_target_ctls[i]->id);

	scarlett2_autogain_notify_access(mixer);
}

/* Notify on input safe switch change */
static void scarlett2_notify_input_safe(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int i;

	if (!info->safe_input_count)
		return;

	private->input_safe_updated = 1;

	for (i = 0; i < info->safe_input_count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->safe_ctls[i]->id);
}

/* Notify on "monitor other" change (speaker switching, talkback) */
static void scarlett2_notify_monitor_other(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;

	private->monitor_other_updated = 1;

	if (info->has_speaker_switching)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->speaker_switching_ctl->id);

	if (info->has_talkback)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->talkback_ctl->id);

	/* if speaker switching was recently enabled or disabled,
	 * invalidate the dim/mute and mux enum controls
	 */
	if (private->speaker_switching_switched) {
		int i;

		scarlett2_notify_dim_mute(mixer);

		private->speaker_switching_switched = 0;
		private->mux_updated = 1;

		for (i = 0; i < private->num_mux_dsts; i++)
			snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
				       &private->mux_ctls[i]->id);
	}
}

/* Notify on direct monitor switch change */
static void scarlett2_notify_direct_monitor(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	int count = private->num_mix_in * private->num_mix_out;
	int i;

	private->direct_monitor_updated = 1;

	snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
		       &private->direct_monitor_ctl->id);

	if (!scarlett2_has_mixer(private))
		return;

	private->mix_updated = 1;

	/* Notify of change to the mix controls */
	for (i = 0; i < count; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->mix_ctls[i]->id);
}

/* Notify on power change */
static void scarlett2_notify_power_status(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;

	private->power_status_updated = 1;

	snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
		       &private->power_status_ctl->id);
}

/* Notify on mux change */
static void scarlett2_notify_mux(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;
	int i;

	private->mux_updated = 1;

	for (i = 0; i < private->num_mux_dsts; i++)
		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
			       &private->mux_ctls[i]->id);
}

/* Notify on PCM input switch change */
static void scarlett2_notify_pcm_input_switch(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;

	private->pcm_input_switch_updated = 1;

	snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
		       &private->pcm_input_switch_ctl->id);

	scarlett2_notify_mux(mixer);
}

/* Notify on Bluetooth change */
static void scarlett2_notify_bluetooth(struct usb_mixer_interface *mixer)
{
	struct snd_card *card = mixer->chip->card;
	struct scarlett2_data *private = mixer->private_data;

	if (!private->info->has_bluetooth)
		return;

	private->bluetooth_updated = 1;

	snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
		       &private->bluetooth_volume_ctl->id);
}

/* Handle acknowledgement that a command was received; let
 * scarlett2_usb() know that it can proceed
 */
static void scarlett2_notify_ack(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	/* if running == 0, ignore ACKs */
	if (private->running)
		complete(&private->cmd_done);
}

/* Interrupt callback */
static void scarlett2_notify(struct urb *urb)
{
	struct usb_mixer_interface *mixer = urb->context;
	int len = urb->actual_length;
	int ustatus = urb->status;
	u32 data;
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_notification *notifications =
		private->config_set->notifications;

	if (ustatus != 0 || len != 8)
		goto requeue;

	data = le32_to_cpu(*(__le32 *)urb->transfer_buffer);

	/* Ignore notifications except ACK during initialisation.
	 * ACK is 0x00000001 on every device.
	 */
	if (private->running < 2)
		data &= 1;

	while (data && notifications->mask) {
		if (data & notifications->mask) {
			data &= ~notifications->mask;
			if (notifications->func)
				notifications->func(mixer);
		}
		notifications++;
	}

	if (data)
		usb_audio_warn(mixer->chip,
			       "%s: Unhandled notification: 0x%08x\n",
			       __func__, data);

requeue:
	if (ustatus != -ENOENT &&
	    ustatus != -ECONNRESET &&
	    ustatus != -ESHUTDOWN) {
		urb->dev = mixer->chip->dev;
		usb_submit_urb(urb, GFP_ATOMIC);
	} else {
		complete(&private->cmd_done);
	}
}

/*** Cleanup/Suspend Callbacks ***/

static void scarlett2_private_free(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	cancel_delayed_work_sync(&private->work);
	kfree(private);
	mixer->private_data = NULL;
}

static void scarlett2_private_suspend(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	if (cancel_delayed_work_sync(&private->work))
		scarlett2_config_save(private->mixer);
}

/*** Initialisation ***/

static void scarlett2_count_io(struct scarlett2_data *private)
{
	const struct scarlett2_device_info *info = private->info;
	const struct scarlett2_config_set *config_set = info->config_set;
	const int (*port_count)[SCARLETT2_PORT_DIRNS] = info->port_count;
	int port_type, srcs = 0, dsts = 0, i;

	/* Count the number of mux sources and destinations */
	for (port_type = 0;
	     port_type < SCARLETT2_PORT_TYPE_COUNT;
	     port_type++) {
		srcs += port_count[port_type][SCARLETT2_PORT_IN];
		dsts += port_count[port_type][SCARLETT2_PORT_OUT];
	}

	private->num_mux_srcs = srcs;
	private->num_mux_dsts = dsts;

	/* Mixer inputs are mux outputs and vice versa.
	 * Scarlett Gen 4 DSP I/O uses SCARLETT2_PORT_TYPE_MIX but
	 * doesn't have mixer controls.
	 */
	private->num_mix_in =
		port_count[SCARLETT2_PORT_TYPE_MIX][SCARLETT2_PORT_OUT] -
			info->dsp_count;

	private->num_mix_out =
		port_count[SCARLETT2_PORT_TYPE_MIX][SCARLETT2_PORT_IN] -
			info->dsp_count;

	/* Number of analogue line outputs */
	private->num_line_out =
		port_count[SCARLETT2_PORT_TYPE_ANALOGUE][SCARLETT2_PORT_OUT];

	/* Number of monitor mix controls */
	private->num_monitor_mix_ctls =
		info->direct_monitor * 2 * private->num_mix_in;

	/* Number of autogain status texts */
	if (config_set->autogain_status_texts) {
		const char * const *texts = config_set->autogain_status_texts;

		for (i = 0; texts[i]; i++)
			;
		private->num_autogain_status_texts = i;
	}
}

/* Look through the interface descriptors for the Focusrite Control
 * interface (bInterfaceClass = 255 Vendor Specific Class) and set
 * bInterfaceNumber, bEndpointAddress, wMaxPacketSize, and bInterval
 * in private
 */
static int scarlett2_find_fc_interface(struct usb_device *dev,
				       struct scarlett2_data *private)
{
	struct usb_host_config *config = dev->actconfig;
	int i;

	for (i = 0; i < config->desc.bNumInterfaces; i++) {
		struct usb_interface *intf = config->interface[i];
		struct usb_interface_descriptor *desc =
			&intf->altsetting[0].desc;
		struct usb_endpoint_descriptor *epd;

		if (desc->bInterfaceClass != 255)
			continue;

		epd = get_endpoint(intf->altsetting, 0);
		private->bInterfaceNumber = desc->bInterfaceNumber;
		private->bEndpointAddress = epd->bEndpointAddress &
			USB_ENDPOINT_NUMBER_MASK;
		private->wMaxPacketSize = le16_to_cpu(epd->wMaxPacketSize);
		private->bInterval = epd->bInterval;
		return 0;
	}

	return -EINVAL;
}

/* Initialise private data */
static int scarlett2_init_private(struct usb_mixer_interface *mixer,
				  const struct scarlett2_device_entry *entry)
{
	struct scarlett2_data *private =
		kzalloc(sizeof(struct scarlett2_data), GFP_KERNEL);

	if (!private)
		return -ENOMEM;

	mutex_init(&private->usb_mutex);
	mutex_init(&private->data_mutex);
	INIT_DELAYED_WORK(&private->work, scarlett2_config_save_work);

	mixer->private_data = private;
	mixer->private_free = scarlett2_private_free;
	mixer->private_suspend = scarlett2_private_suspend;

	private->info = entry->info;
	private->config_set = entry->info->config_set;
	private->series_name = entry->series_name;
	scarlett2_count_io(private);
	private->scarlett2_seq = 0;
	private->mixer = mixer;

	return scarlett2_find_fc_interface(mixer->chip->dev, private);
}

/* Submit a URB to receive notifications from the device */
static int scarlett2_init_notify(struct usb_mixer_interface *mixer)
{
	struct usb_device *dev = mixer->chip->dev;
	struct scarlett2_data *private = mixer->private_data;
	unsigned int pipe = usb_rcvintpipe(dev, private->bEndpointAddress);
	void *transfer_buffer;

	if (mixer->urb) {
		usb_audio_err(mixer->chip,
			      "%s: mixer urb already in use!\n", __func__);
		return 0;
	}

	if (usb_pipe_type_check(dev, pipe))
		return -EINVAL;

	mixer->urb = usb_alloc_urb(0, GFP_KERNEL);
	if (!mixer->urb)
		return -ENOMEM;

	transfer_buffer = kmalloc(private->wMaxPacketSize, GFP_KERNEL);
	if (!transfer_buffer)
		return -ENOMEM;

	usb_fill_int_urb(mixer->urb, dev, pipe,
			 transfer_buffer, private->wMaxPacketSize,
			 scarlett2_notify, mixer, private->bInterval);

	init_completion(&private->cmd_done);

	return usb_submit_urb(mixer->urb, GFP_KERNEL);
}

/* Cargo cult proprietary initialisation sequence */
static int scarlett2_usb_init(struct usb_mixer_interface *mixer)
{
	struct usb_device *dev = mixer->chip->dev;
	struct scarlett2_data *private = mixer->private_data;
	u8 step0_buf[24];
	u8 step2_buf[84];
	int err;

	if (usb_pipe_type_check(dev, usb_sndctrlpipe(dev, 0)))
		return -EINVAL;

	/* step 0 */
	err = scarlett2_usb_rx(dev, private->bInterfaceNumber,
			       SCARLETT2_USB_CMD_INIT,
			       step0_buf, sizeof(step0_buf));
	if (err < 0)
		return err;

	/* Set up the interrupt polling for notifications.
	 * When running is:
	 * 0: all notifications are ignored
	 * 1: only ACKs are handled
	 * 2: all notifications are handled
	 */
	err = scarlett2_init_notify(mixer);
	if (err < 0)
		return err;

	/* sleep for a moment in case of an outstanding ACK */
	msleep(20);

	/* start handling ACKs, but no other notifications until the
	 * ALSA controls have been created
	 */
	private->running = 1;

	/* step 1 */
	private->scarlett2_seq = 1;
	err = scarlett2_usb(mixer, SCARLETT2_USB_INIT_1, NULL, 0, NULL, 0);
	if (err < 0)
		return err;

	/* step 2 */
	private->scarlett2_seq = 1;
	err = scarlett2_usb(mixer, SCARLETT2_USB_INIT_2,
			    NULL, 0,
			    step2_buf, sizeof(step2_buf));
	if (err < 0)
		return err;

	/* extract 4-byte firmware version from step2_buf[8] */
	private->firmware_version = le32_to_cpu(*(__le32 *)(step2_buf + 8));
	usb_audio_info(mixer->chip,
		       "Firmware version %d\n",
		       private->firmware_version);

	return 0;
}

/* Get the flash segment numbers for the App_Settings and App_Upgrade
 * segments and put them in the private data
 */
static int scarlett2_get_flash_segment_nums(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int err, count, i;

	struct {
		__le32 size;
		__le32 count;
		u8 unknown[8];
	} __packed flash_info;

	struct {
		__le32 size;
		__le32 flags;
		char name[16];
	} __packed segment_info;

	err = scarlett2_usb(mixer, SCARLETT2_USB_INFO_FLASH,
			    NULL, 0,
			    &flash_info, sizeof(flash_info));
	if (err < 0)
		return err;

	count = le32_to_cpu(flash_info.count);

	/* sanity check count */
	if (count < SCARLETT2_SEGMENT_NUM_MIN ||
	    count > SCARLETT2_SEGMENT_NUM_MAX + 1) {
		usb_audio_err(mixer->chip,
			      "invalid flash segment count: %d\n", count);
		return -EINVAL;
	}

	for (i = 0; i < count; i++) {
		__le32 segment_num_req = cpu_to_le32(i);
		int flash_segment_id;

		err = scarlett2_usb(mixer, SCARLETT2_USB_INFO_SEGMENT,
				    &segment_num_req, sizeof(segment_num_req),
				    &segment_info, sizeof(segment_info));
		if (err < 0) {
			usb_audio_err(mixer->chip,
				"failed to get flash segment info %d: %d\n",
				i, err);
			return err;
		}

		if (!strncmp(segment_info.name,
			     SCARLETT2_SEGMENT_SETTINGS_NAME, 16))
			flash_segment_id = SCARLETT2_SEGMENT_ID_SETTINGS;
		else if (!strncmp(segment_info.name,
				  SCARLETT2_SEGMENT_FIRMWARE_NAME, 16))
			flash_segment_id = SCARLETT2_SEGMENT_ID_FIRMWARE;
		else
			continue;

		private->flash_segment_nums[flash_segment_id] = i;
		private->flash_segment_blocks[flash_segment_id] =
			le32_to_cpu(segment_info.size) /
				SCARLETT2_FLASH_BLOCK_SIZE;
	}

	/* segment 0 is App_Gold and we never want to touch that, so
	 * use 0 as the "not-found" value
	 */
	if (!private->flash_segment_nums[SCARLETT2_SEGMENT_ID_SETTINGS]) {
		usb_audio_err(mixer->chip,
			      "failed to find flash segment %s\n",
			      SCARLETT2_SEGMENT_SETTINGS_NAME);
		return -EINVAL;
	}
	if (!private->flash_segment_nums[SCARLETT2_SEGMENT_ID_FIRMWARE]) {
		usb_audio_err(mixer->chip,
			      "failed to find flash segment %s\n",
			      SCARLETT2_SEGMENT_FIRMWARE_NAME);
		return -EINVAL;
	}

	return 0;
}

/* Read configuration from the interface on start */
static int scarlett2_read_configs(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	const struct scarlett2_device_info *info = private->info;
	int err, i;

	if (scarlett2_has_config_item(private, SCARLETT2_CONFIG_MSD_SWITCH)) {
		err = scarlett2_usb_get_config(
			mixer, SCARLETT2_CONFIG_MSD_SWITCH,
			1, &private->msd_switch);
		if (err < 0)
			return err;
	}

	if (private->firmware_version < info->min_firmware_version) {
		usb_audio_err(mixer->chip,
			      "Focusrite %s firmware version %d is too old; "
			      "need %d",
			      private->series_name,
			      private->firmware_version,
			      info->min_firmware_version);
		return 0;
	}

	/* no other controls are created if MSD mode is on */
	if (private->msd_switch)
		return 0;

	err = scarlett2_update_input_level(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_input_pad(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_input_air(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_input_dsp(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_compressor_values(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_filter_values(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_input_mute(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_input_phantom(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_direct_monitor(mixer);
	if (err < 0)
		return err;

	/* the rest of the configuration is for devices with a mixer */
	if (!scarlett2_has_mixer(private))
		return 0;

	err = scarlett2_update_monitor_mix(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_monitor_other(mixer);
	if (err < 0)
		return err;

	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_STANDALONE_SWITCH)) {
		err = scarlett2_usb_get_config(
			mixer, SCARLETT2_CONFIG_STANDALONE_SWITCH,
			1, &private->standalone_switch);
		if (err < 0)
			return err;
	}

	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_POWER_EXT)) {
		err = scarlett2_update_power_status(mixer);
		if (err < 0)
			return err;
	}

	err = scarlett2_update_sync(mixer);
	if (err < 0)
		return err;

	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_LINE_OUT_VOLUME)) {
		s16 sw_vol[SCARLETT2_ANALOGUE_MAX];

		/* read SW line out volume */
		err = scarlett2_usb_get_config(
			mixer, SCARLETT2_CONFIG_LINE_OUT_VOLUME,
			private->num_line_out, &sw_vol);
		if (err < 0)
			return err;

		for (i = 0; i < private->num_line_out; i++)
			private->vol[i] = clamp(
				sw_vol[i] + SCARLETT2_VOLUME_BIAS,
				0, SCARLETT2_VOLUME_BIAS);

		/* read SW mute */
		err = scarlett2_usb_get_config(
			mixer, SCARLETT2_CONFIG_MUTE_SWITCH,
			private->num_line_out, &private->mute_switch);
		if (err < 0)
			return err;

		for (i = 0; i < private->num_line_out; i++)
			private->mute_switch[i] =
				!!private->mute_switch[i];

		/* read SW/HW switches */
		if (scarlett2_has_config_item(private,
					      SCARLETT2_CONFIG_SW_HW_SWITCH)) {
			err = scarlett2_usb_get_config(
				mixer, SCARLETT2_CONFIG_SW_HW_SWITCH,
				private->num_line_out,
				&private->vol_sw_hw_switch);
			if (err < 0)
				return err;

			for (i = 0; i < private->num_line_out; i++)
				private->vol_sw_hw_switch[i] =
					!!private->vol_sw_hw_switch[i];
		}
	}

	err = scarlett2_update_volumes(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_dim_mute(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_input_select(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_input_gain(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_autogain(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_input_safe(mixer);
	if (err < 0)
		return err;

	if (scarlett2_has_config_item(private,
				      SCARLETT2_CONFIG_PCM_INPUT_SWITCH)) {
		err = scarlett2_update_pcm_input_switch(mixer);
		if (err < 0)
			return err;
	}

	err = scarlett2_update_bluetooth_volume(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_spdif_mode(mixer);
	if (err < 0)
		return err;

	err = scarlett2_update_mix(mixer);
	if (err < 0)
		return err;

	return scarlett2_usb_get_mux(mixer);
}

static const struct scarlett2_device_entry *get_scarlett2_device_entry(
	struct usb_mixer_interface *mixer)
{
	const struct scarlett2_device_entry *entry = scarlett2_devices;

	/* Find entry in scarlett2_devices */
	while (entry->usb_id && entry->usb_id != mixer->chip->usb_id)
		entry++;
	if (!entry->usb_id)
		return NULL;

	return entry;
}

static int snd_scarlett2_controls_create(
	struct usb_mixer_interface *mixer,
	const struct scarlett2_device_entry *entry)
{
	struct scarlett2_data *private;
	int err;

	/* Initialise private data */
	err = scarlett2_init_private(mixer, entry);
	if (err < 0)
		return err;

	private = mixer->private_data;

	/* Send proprietary USB initialisation sequence */
	err = scarlett2_usb_init(mixer);
	if (err < 0)
		return err;

	/* Get the upgrade & settings flash segment numbers */
	err = scarlett2_get_flash_segment_nums(mixer);
	if (err < 0)
		return err;

	/* Add firmware version control */
	err = scarlett2_add_firmware_version_ctl(mixer);
	if (err < 0)
		return err;

	/* Add minimum firmware version control */
	err = scarlett2_add_min_firmware_version_ctl(mixer);
	if (err < 0)
		return err;

	/* Read volume levels and controls from the interface */
	err = scarlett2_read_configs(mixer);
	if (err < 0)
		return err;

	/* Create the MSD control */
	err = scarlett2_add_msd_ctl(mixer);
	if (err < 0)
		return err;

	/* If MSD mode is enabled, or if the firmware version is too
	 * old, don't create any other controls
	 */
	if (private->msd_switch ||
	    private->firmware_version < private->info->min_firmware_version)
		return 0;

	/* Create the analogue output controls */
	err = scarlett2_add_line_out_ctls(mixer);
	if (err < 0)
		return err;

	/* Create the analogue input controls */
	err = scarlett2_add_line_in_ctls(mixer);
	if (err < 0)
		return err;

	/* Create the input, output, and mixer mux input selections */
	err = scarlett2_add_mux_enums(mixer);
	if (err < 0)
		return err;

	/* Create the matrix mixer controls */
	err = scarlett2_add_mixer_ctls(mixer);
	if (err < 0)
		return err;

	/* Create the level meter controls */
	err = scarlett2_add_meter_ctl(mixer);
	if (err < 0)
		return err;

	/* Create the sync control */
	err = scarlett2_add_sync_ctl(mixer);
	if (err < 0)
		return err;

	/* Create the direct monitor control(s) */
	err = scarlett2_add_direct_monitor_ctls(mixer);
	if (err < 0)
		return err;

	/* Create the speaker switching control */
	err = scarlett2_add_speaker_switch_ctl(mixer);
	if (err < 0)
		return err;

	/* Create the talkback controls */
	err = scarlett2_add_talkback_ctls(mixer);
	if (err < 0)
		return err;

	/* Create the standalone control */
	err = scarlett2_add_standalone_ctl(mixer);
	if (err < 0)
		return err;

	/* Create the power status control */
	err = scarlett2_add_power_status_ctl(mixer);
	if (err < 0)
		return err;

	/* Create the Bluetooth volume control */
	err = scarlett2_add_bluetooth_volume_ctl(mixer);
	if (err < 0)
		return err;

	/* Create the S/PDIF mode control */
	err = scarlett2_add_spdif_mode_ctl(mixer);
	if (err < 0)
		return err;

	/* Set the access mode of controls disabled during
	 * autogain/phantom power switching.
	 */
	if (private->info->gain_input_count) {
		scarlett2_autogain_update_access(mixer);
		scarlett2_phantom_update_access(mixer);
	}

	/* Start handling all notifications */
	private->running = 2;

	return 0;
}

/*** hwdep interface ***/

/* Set private->hwdep_in_use; prevents access to the ALSA controls
 * while doing a config erase/firmware upgrade.
 */
static void scarlett2_lock(struct scarlett2_data *private)
{
	mutex_lock(&private->data_mutex);
	private->hwdep_in_use = 1;
	mutex_unlock(&private->data_mutex);
}

/* Call SCARLETT2_USB_GET_ERASE to get the erase progress */
static int scarlett2_get_erase_progress(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int segment_id, segment_num, err;
	u8 erase_resp;

	struct {
		__le32 segment_num;
		__le32 pad;
	} __packed erase_req;

	segment_id = private->selected_flash_segment_id;
	segment_num = private->flash_segment_nums[segment_id];

	if (segment_num < SCARLETT2_SEGMENT_NUM_MIN ||
	    segment_num > SCARLETT2_SEGMENT_NUM_MAX)
		return -EFAULT;

	/* Send the erase progress request */
	erase_req.segment_num = cpu_to_le32(segment_num);
	erase_req.pad = 0;

	err = scarlett2_usb(mixer, SCARLETT2_USB_GET_ERASE,
			    &erase_req, sizeof(erase_req),
			    &erase_resp, sizeof(erase_resp));
	if (err < 0)
		return err;

	return erase_resp;
}

/* Repeatedly call scarlett2_get_erase_progress() until it returns
 * 0xff (erase complete) or we've waited 10 seconds (it usually takes
 * <3 seconds).
 */
static int scarlett2_wait_for_erase(struct usb_mixer_interface *mixer)
{
	int i, err;

	for (i = 0; i < 100; i++) {
		err = scarlett2_get_erase_progress(mixer);
		if (err < 0)
			return err;

		if (err == 0xff)
			return 0;

		msleep(100);
	}

	return -ETIMEDOUT;
}

/* Reboot the device; wait for the erase to complete if one is in
 * progress.
 */
static int scarlett2_reboot(struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;

	if (private->flash_write_state ==
	      SCARLETT2_FLASH_WRITE_STATE_ERASING) {
		int err = scarlett2_wait_for_erase(mixer);

		if (err < 0)
			return err;
	}

	return scarlett2_usb(mixer, SCARLETT2_USB_REBOOT, NULL, 0, NULL, 0);
}

/* Select a flash segment for reading/erasing/writing */
static int scarlett2_ioctl_select_flash_segment(
	struct usb_mixer_interface *mixer,
	unsigned long arg)
{
	struct scarlett2_data *private = mixer->private_data;
	int segment_id, segment_num;

	if (get_user(segment_id, (int __user *)arg))
		return -EFAULT;

	/* Check the segment ID and segment number */
	if (segment_id < 0 || segment_id >= SCARLETT2_SEGMENT_ID_COUNT)
		return -EINVAL;

	segment_num = private->flash_segment_nums[segment_id];
	if (segment_num < SCARLETT2_SEGMENT_NUM_MIN ||
	    segment_num > SCARLETT2_SEGMENT_NUM_MAX) {
		usb_audio_err(mixer->chip,
			      "%s: invalid segment number %d\n",
			      __func__, segment_id);
		return -EFAULT;
	}

	/* If erasing, wait for it to complete */
	if (private->flash_write_state == SCARLETT2_FLASH_WRITE_STATE_ERASING) {
		int err = scarlett2_wait_for_erase(mixer);

		if (err < 0)
			return err;
	}

	/* Save the selected segment ID and set the state to SELECTED */
	private->selected_flash_segment_id = segment_id;
	private->flash_write_state = SCARLETT2_FLASH_WRITE_STATE_SELECTED;

	return 0;
}

/* Erase the previously-selected flash segment */
static int scarlett2_ioctl_erase_flash_segment(
	struct usb_mixer_interface *mixer)
{
	struct scarlett2_data *private = mixer->private_data;
	int segment_id, segment_num, err;

	struct {
		__le32 segment_num;
		__le32 pad;
	} __packed erase_req;

	if (private->flash_write_state != SCARLETT2_FLASH_WRITE_STATE_SELECTED)
		return -EINVAL;

	segment_id = private->selected_flash_segment_id;
	segment_num = private->flash_segment_nums[segment_id];

	if (segment_num < SCARLETT2_SEGMENT_NUM_MIN ||
	    segment_num > SCARLETT2_SEGMENT_NUM_MAX)
		return -EFAULT;

	/* Prevent access to ALSA controls that access the device from
	 * here on
	 */
	scarlett2_lock(private);

	/* Send the erase request */
	erase_req.segment_num = cpu_to_le32(segment_num);
	erase_req.pad = 0;

	err = scarlett2_usb(mixer, SCARLETT2_USB_ERASE_SEGMENT,
			    &erase_req, sizeof(erase_req),
			    NULL, 0);
	if (err < 0)
		return err;

	/* On success, change the state from SELECTED to ERASING */
	private->flash_write_state = SCARLETT2_FLASH_WRITE_STATE_ERASING;

	return 0;
}

/* Get the erase progress from the device */
static int scarlett2_ioctl_get_erase_progress(
	struct usb_mixer_interface *mixer,
	unsigned long arg)
{
	struct scarlett2_data *private = mixer->private_data;
	struct scarlett2_flash_segment_erase_progress progress;
	int segment_id, segment_num, err;
	u8 erase_resp;

	struct {
		__le32 segment_num;
		__le32 pad;
	} __packed erase_req;

	/* Check that we're erasing */
	if (private->flash_write_state != SCARLETT2_FLASH_WRITE_STATE_ERASING)
		return -EINVAL;

	segment_id = private->selected_flash_segment_id;
	segment_num = private->flash_segment_nums[segment_id];

	if (segment_num < SCARLETT2_SEGMENT_NUM_MIN ||
	    segment_num > SCARLETT2_SEGMENT_NUM_MAX)
		return -EFAULT;

	/* Send the erase progress request */
	erase_req.segment_num = cpu_to_le32(segment_num);
	erase_req.pad = 0;

	err = scarlett2_usb(mixer, SCARLETT2_USB_GET_ERASE,
			    &erase_req, sizeof(erase_req),
			    &erase_resp, sizeof(erase_resp));
	if (err < 0)
		return err;

	progress.progress = erase_resp;
	progress.num_blocks = private->flash_segment_blocks[segment_id];

	if (copy_to_user((void __user *)arg, &progress, sizeof(progress)))
		return -EFAULT;

	/* If the erase is complete, change the state from ERASING to
	 * WRITE.
	 */
	if (progress.progress == 0xff)
		private->flash_write_state = SCARLETT2_FLASH_WRITE_STATE_WRITE;

	return 0;
}

static int scarlett2_hwdep_open(struct snd_hwdep *hw, struct file *file)
{
	struct usb_mixer_interface *mixer = hw->private_data;
	struct scarlett2_data *private = mixer->private_data;

	/* If erasing, wait for it to complete */
	if (private->flash_write_state ==
	      SCARLETT2_FLASH_WRITE_STATE_ERASING) {
		int err = scarlett2_wait_for_erase(mixer);

		if (err < 0)
			return err;
	}

	/* Set the state to IDLE */
	private->flash_write_state = SCARLETT2_FLASH_WRITE_STATE_IDLE;

	return 0;
}

static int scarlett2_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
				 unsigned int cmd, unsigned long arg)
{
	struct usb_mixer_interface *mixer = hw->private_data;

	switch (cmd) {

	case SCARLETT2_IOCTL_PVERSION:
		return put_user(SCARLETT2_HWDEP_VERSION,
				(int __user *)arg) ? -EFAULT : 0;

	case SCARLETT2_IOCTL_REBOOT:
		return scarlett2_reboot(mixer);

	case SCARLETT2_IOCTL_SELECT_FLASH_SEGMENT:
		return scarlett2_ioctl_select_flash_segment(mixer, arg);

	case SCARLETT2_IOCTL_ERASE_FLASH_SEGMENT:
		return scarlett2_ioctl_erase_flash_segment(mixer);

	case SCARLETT2_IOCTL_GET_ERASE_PROGRESS:
		return scarlett2_ioctl_get_erase_progress(mixer, arg);

	default:
		return -ENOIOCTLCMD;
	}
}

static long scarlett2_hwdep_read(struct snd_hwdep *hw,
				 char __user *buf,
				 long count, loff_t *offset)
{
	struct usb_mixer_interface *mixer = hw->private_data;
	struct scarlett2_data *private = mixer->private_data;
	int segment_id, segment_num, err;
	int flash_size;

	/* SCARLETT2_USB_READ_SEGMENT request data */
	struct {
		__le32 segment_num;
		__le32 offset;
		__le32 len;
	} __packed req;

	u8 *resp;

	/* Flash segment must first be selected */
	if (private->flash_write_state != SCARLETT2_FLASH_WRITE_STATE_SELECTED)
		return -EINVAL;

	/* Get the selected flash segment number */
	segment_id = private->selected_flash_segment_id;
	if (segment_id < 0 || segment_id >= SCARLETT2_SEGMENT_ID_COUNT)
		return -EINVAL;

	segment_num = private->flash_segment_nums[segment_id];
	if (segment_num < 0 ||
	    segment_num > SCARLETT2_SEGMENT_NUM_MAX)
		return -EFAULT;

	/* Validate the offset and count */
	if (count < 0 || *offset < 0)
		return -EINVAL;

	/* Reached EOF? */
	flash_size = private->flash_segment_blocks[segment_id] *
		     SCARLETT2_FLASH_BLOCK_SIZE;
	if (!count || *offset >= flash_size)
		return 0;

	/* Limit the numbers of bytes read to SCARLETT2_FLASH_RW_MAX */
	if (count > SCARLETT2_FLASH_RW_MAX)
		count = SCARLETT2_FLASH_RW_MAX;

	/* Limit read to EOF */
	if (*offset + count >= flash_size)
		count = flash_size - *offset;

	/* Create and send the request */
	req.segment_num = cpu_to_le32(segment_num);
	req.offset = cpu_to_le32(*offset);
	req.len = cpu_to_le32(count);

	resp = kzalloc(count, GFP_KERNEL);
	if (!resp)
		return -ENOMEM;

	err = scarlett2_usb(mixer, SCARLETT2_USB_READ_SEGMENT,
			    &req, sizeof(req), resp, count);
	if (err < 0)
		goto error;

	/* Copy the response to userspace */
	if (copy_to_user(buf, resp, count)) {
		err = -EFAULT;
		goto error;
	}

	*offset += count;
	err = count;

error:
	kfree(resp);
	return err;
}

static long scarlett2_hwdep_write(struct snd_hwdep *hw,
				  const char __user *buf,
				  long count, loff_t *offset)
{
	struct usb_mixer_interface *mixer = hw->private_data;
	struct scarlett2_data *private = mixer->private_data;
	int segment_id, segment_num, err, len;
	int flash_size;

	/* SCARLETT2_USB_WRITE_SEGMENT request data */
	struct {
		__le32 segment_num;
		__le32 offset;
		__le32 pad;
		u8 data[];
	} __packed *req;

	/* Calculate the maximum permitted in data[] */
	const size_t max_data_size = SCARLETT2_FLASH_RW_MAX -
				     offsetof(typeof(*req), data);

	/* If erasing, wait for it to complete */
	if (private->flash_write_state ==
	      SCARLETT2_FLASH_WRITE_STATE_ERASING) {
		err = scarlett2_wait_for_erase(mixer);
		if (err < 0)
			return err;
		private->flash_write_state = SCARLETT2_FLASH_WRITE_STATE_WRITE;

	/* Check that an erase has been done & completed */
	} else if (private->flash_write_state !=
		     SCARLETT2_FLASH_WRITE_STATE_WRITE) {
		return -EINVAL;
	}

	/* Check that we're writing to the upgrade firmware */
	segment_id = private->selected_flash_segment_id;
	if (segment_id != SCARLETT2_SEGMENT_ID_FIRMWARE)
		return -EINVAL;

	segment_num = private->flash_segment_nums[segment_id];
	if (segment_num < SCARLETT2_SEGMENT_NUM_MIN ||
	    segment_num > SCARLETT2_SEGMENT_NUM_MAX)
		return -EFAULT;

	/* Validate the offset and count */
	flash_size = private->flash_segment_blocks[segment_id] *
		     SCARLETT2_FLASH_BLOCK_SIZE;

	if (count < 0 || *offset < 0 || *offset + count >= flash_size)
		return -EINVAL;

	if (!count)
		return 0;

	/* Limit the *req size to SCARLETT2_FLASH_RW_MAX */
	if (count > max_data_size)
		count = max_data_size;

	/* Create and send the request */
	len = struct_size(req, data, count);
	req = kzalloc(len, GFP_KERNEL);
	if (!req)
		return -ENOMEM;

	req->segment_num = cpu_to_le32(segment_num);
	req->offset = cpu_to_le32(*offset);
	req->pad = 0;

	if (copy_from_user(req->data, buf, count)) {
		err = -EFAULT;
		goto error;
	}

	err = scarlett2_usb(mixer, SCARLETT2_USB_WRITE_SEGMENT,
			    req, len, NULL, 0);
	if (err < 0)
		goto error;

	*offset += count;
	err = count;

error:
	kfree(req);
	return err;
}

static int scarlett2_hwdep_release(struct snd_hwdep *hw, struct file *file)
{
	struct usb_mixer_interface *mixer = hw->private_data;
	struct scarlett2_data *private = mixer->private_data;

	/* Return from the SELECTED or WRITE state to IDLE.
	 * The ERASING state is left as-is, and checked on next open.
	 */
	if (private &&
	    private->hwdep_in_use &&
	    private->flash_write_state != SCARLETT2_FLASH_WRITE_STATE_ERASING)
		private->flash_write_state = SCARLETT2_FLASH_WRITE_STATE_IDLE;

	return 0;
}

static int scarlett2_hwdep_init(struct usb_mixer_interface *mixer)
{
	struct snd_hwdep *hw;
	int err;

	err = snd_hwdep_new(mixer->chip->card, "Focusrite Control", 0, &hw);
	if (err < 0)
		return err;

	hw->private_data = mixer;
	hw->exclusive = 1;
	hw->ops.open = scarlett2_hwdep_open;
	hw->ops.ioctl = scarlett2_hwdep_ioctl;
	hw->ops.read = scarlett2_hwdep_read;
	hw->ops.write = scarlett2_hwdep_write;
	hw->ops.release = scarlett2_hwdep_release;

	return 0;
}

int snd_scarlett2_init(struct usb_mixer_interface *mixer)
{
	struct snd_usb_audio *chip = mixer->chip;
	const struct scarlett2_device_entry *entry;
	int err;

	/* only use UAC_VERSION_2 */
	if (!mixer->protocol)
		return 0;

	/* find entry in scarlett2_devices */
	entry = get_scarlett2_device_entry(mixer);
	if (!entry) {
		usb_audio_err(mixer->chip,
			      "%s: missing device entry for %04x:%04x\n",
			      __func__,
			      USB_ID_VENDOR(chip->usb_id),
			      USB_ID_PRODUCT(chip->usb_id));
		return 0;
	}

	if (chip->setup & SCARLETT2_DISABLE) {
		usb_audio_info(chip,
			"Focusrite %s Mixer Driver disabled "
			"by modprobe options (snd_usb_audio "
			"vid=0x%04x pid=0x%04x device_setup=%d)\n",
			entry->series_name,
			USB_ID_VENDOR(chip->usb_id),
			USB_ID_PRODUCT(chip->usb_id),
			SCARLETT2_DISABLE);
		return 0;
	}

	usb_audio_info(chip,
		"Focusrite %s Mixer Driver enabled (pid=0x%04x); "
		"report any issues to "
		"https://github.com/geoffreybennett/scarlett-gen2/issues",
		entry->series_name,
		USB_ID_PRODUCT(chip->usb_id));

	err = snd_scarlett2_controls_create(mixer, entry);
	if (err < 0) {
		usb_audio_err(mixer->chip,
			      "Error initialising %s Mixer Driver: %d",
			      entry->series_name,
			      err);
		return err;
	}

	err = scarlett2_hwdep_init(mixer);
	if (err < 0)
		usb_audio_err(mixer->chip,
			      "Error creating %s hwdep device: %d",
			      entry->series_name,
			      err);

	return err;
}
