* - 6i6/18i8/18i20 Gen 2
* - Solo/2i2/4i4/8i6/18i8/18i20 Gen 3
*
- * Copyright (c) 2018-2021 by Geoffrey D. Bennett <g at b4.vu>
+ * Copyright (c) 2018-2022 by Geoffrey D. Bennett <g at b4.vu>
* Copyright (c) 2020-2021 by Vladimir Sadovnikov <sadko4u@gmail.com>
*
* Based on the Scarlett (Gen 1) Driver for ALSA:
/* Maximum number of meters (sum of output port counts) */
#define SCARLETT2_MAX_METERS 65
+/* There are three different sets of configuration parameters across
+ * the devices
+ */
+enum {
+ SCARLETT2_CONFIG_SET_NO_MIXER = 0,
+ SCARLETT2_CONFIG_SET_GEN_2 = 1,
+ SCARLETT2_CONFIG_SET_GEN_3 = 2,
+ SCARLETT2_CONFIG_SET_COUNT = 3
+};
+
/* Hardware port types:
* - None (no input to mux)
* - Analogue I/O
*/
u8 has_msd_mode;
- /* Gen 3 devices without a mixer have a different
- * configuration set
- */
- u8 has_mixer;
+ /* which set of configuration parameters the device uses */
+ u8 config_set;
/* line out hw volume is sw controlled */
u8 line_out_hw_vol;
static const struct scarlett2_device_info s6i6_gen2_info = {
.usb_id = USB_ID(0x1235, 0x8203),
- .has_mixer = 1,
+ .config_set = SCARLETT2_CONFIG_SET_GEN_2,
.level_input_count = 2,
.pad_input_count = 2,
static const struct scarlett2_device_info s18i8_gen2_info = {
.usb_id = USB_ID(0x1235, 0x8204),
- .has_mixer = 1,
+ .config_set = SCARLETT2_CONFIG_SET_GEN_2,
.level_input_count = 2,
.pad_input_count = 4,
static const struct scarlett2_device_info s18i20_gen2_info = {
.usb_id = USB_ID(0x1235, 0x8201),
- .has_mixer = 1,
+ .config_set = SCARLETT2_CONFIG_SET_GEN_2,
.line_out_hw_vol = 1,
.line_out_descrs = {
.usb_id = USB_ID(0x1235, 0x8211),
.has_msd_mode = 1,
+ .config_set = SCARLETT2_CONFIG_SET_NO_MIXER,
.level_input_count = 1,
.level_input_first = 1,
.air_input_count = 1,
.usb_id = USB_ID(0x1235, 0x8210),
.has_msd_mode = 1,
+ .config_set = SCARLETT2_CONFIG_SET_NO_MIXER,
.level_input_count = 2,
.air_input_count = 2,
.phantom_count = 1,
.usb_id = USB_ID(0x1235, 0x8212),
.has_msd_mode = 1,
- .has_mixer = 1,
+ .config_set = SCARLETT2_CONFIG_SET_GEN_3,
.level_input_count = 2,
.pad_input_count = 2,
.air_input_count = 2,
.usb_id = USB_ID(0x1235, 0x8213),
.has_msd_mode = 1,
- .has_mixer = 1,
+ .config_set = SCARLETT2_CONFIG_SET_GEN_3,
.level_input_count = 2,
.pad_input_count = 2,
.air_input_count = 2,
.usb_id = USB_ID(0x1235, 0x8214),
.has_msd_mode = 1,
- .has_mixer = 1,
+ .config_set = SCARLETT2_CONFIG_SET_GEN_3,
.line_out_hw_vol = 1,
.has_speaker_switching = 1,
.level_input_count = 2,
.usb_id = USB_ID(0x1235, 0x8215),
.has_msd_mode = 1,
- .has_mixer = 1,
+ .config_set = SCARLETT2_CONFIG_SET_GEN_3,
.line_out_hw_vol = 1,
.has_speaker_switching = 1,
.has_talkback = 1,
u8 activate;
};
-/* scarlett2_config_items[0] is for devices without a mixer
- * scarlett2_config_items[1] is for devices with a mixer
- */
static const struct scarlett2_config
- scarlett2_config_items[2][SCARLETT2_CONFIG_COUNT] =
+ scarlett2_config_items[SCARLETT2_CONFIG_SET_COUNT]
+ [SCARLETT2_CONFIG_COUNT] =
-/* Devices without a mixer (Solo and 2i2 Gen 3) */
+/* Devices without a mixer (Gen 3 Solo and 2i2) */
{ {
[SCARLETT2_CONFIG_MSD_SWITCH] = {
.offset = 0x04, .size = 8, .activate = 6 },
[SCARLETT2_CONFIG_AIR_SWITCH] = {
.offset = 0x09, .size = 1, .activate = 8 },
-/* Devices with a mixer (Gen 2 and all other Gen 3) */
+/* Gen 2 devices: 6i6, 18i8, 18i20 */
+}, {
+ [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_LEVEL_SWITCH] = {
+ .offset = 0x7c, .size = 8, .activate = 7 },
+
+ [SCARLETT2_CONFIG_PAD_SWITCH] = {
+ .offset = 0x84, .size = 8, .activate = 8 },
+
+/* Gen 3 devices: 4i4, 8i6, 18i8, 18i20 */
}, {
[SCARLETT2_CONFIG_DIM_MUTE] = {
.offset = 0x31, .size = 8, .activate = 2 },
struct scarlett2_data *private = mixer->private_data;
const struct scarlett2_device_info *info = private->info;
const struct scarlett2_config *config_item =
- &scarlett2_config_items[info->has_mixer][config_item_num];
+ &scarlett2_config_items[info->config_set][config_item_num];
int size, err, i;
u8 *buf_8;
u8 value;
struct scarlett2_data *private = mixer->private_data;
const struct scarlett2_device_info *info = private->info;
const struct scarlett2_config *config_item =
- &scarlett2_config_items[info->has_mixer][config_item_num];
+ &scarlett2_config_items[info->config_set][config_item_num];
struct {
__le32 offset;
__le32 bytes;
struct scarlett2_data *private = mixer->private_data;
/* devices without a mixer also don't support reporting sync status */
- if (!private->info->has_mixer)
+ if (private->info->config_set == SCARLETT2_CONFIG_SET_NO_MIXER)
return 0;
return scarlett2_add_new_ctl(mixer, &scarlett2_sync_ctl,
struct scarlett2_data *private = mixer->private_data;
/* devices without a mixer also don't support reporting levels */
- if (!private->info->has_mixer)
+ if (private->info->config_set == SCARLETT2_CONFIG_SET_NO_MIXER)
return 0;
return scarlett2_add_new_ctl(mixer, &scarlett2_meter_ctl,
return err;
/* the rest of the configuration is for devices with a mixer */
- if (!info->has_mixer)
+ if (info->config_set == SCARLETT2_CONFIG_SET_NO_MIXER)
return 0;
err = scarlett2_update_sync(mixer);