Commit c0a7e1d8 authored by Geoffrey D. Bennett's avatar Geoffrey D. Bennett Committed by Takashi Iwai

ALSA: scarlett2: Add config set struct

Add struct scarlett2_config_set so that data which is common to all
devices in a config set can be stored there rather than in the
model-specific data.

Accordingly, rename scarlett2_config_items[] to
scarlett2_config_sets[].
Signed-off-by: default avatarGeoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/bfdb04cd6239af9a8c26a52da0537980f77c0437.1703444932.git.g@b4.vuSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c13d43a8
...@@ -1226,12 +1226,16 @@ struct scarlett2_config { ...@@ -1226,12 +1226,16 @@ struct scarlett2_config {
u8 activate; u8 activate;
}; };
static const struct scarlett2_config struct scarlett2_config_set {
scarlett2_config_items[SCARLETT2_CONFIG_SET_COUNT] const struct scarlett2_config items[SCARLETT2_CONFIG_COUNT];
[SCARLETT2_CONFIG_COUNT] = };
static const struct scarlett2_config_set
scarlett2_config_sets[SCARLETT2_CONFIG_SET_COUNT] =
/* Gen 2 devices: 6i6, 18i8, 18i20 */ /* Gen 2 devices: 6i6, 18i8, 18i20 */
{ { { [SCARLETT2_CONFIG_SET_GEN_2] = {
.items = {
[SCARLETT2_CONFIG_DIM_MUTE] = { [SCARLETT2_CONFIG_DIM_MUTE] = {
.offset = 0x31, .size = 8, .activate = 2 }, .offset = 0x31, .size = 8, .activate = 2 },
...@@ -1252,9 +1256,11 @@ static const struct scarlett2_config ...@@ -1252,9 +1256,11 @@ static const struct scarlett2_config
[SCARLETT2_CONFIG_STANDALONE_SWITCH] = { [SCARLETT2_CONFIG_STANDALONE_SWITCH] = {
.offset = 0x8d, .size = 8, .activate = 6 }, .offset = 0x8d, .size = 8, .activate = 6 },
},
/* Gen 3 devices without a mixer (Solo and 2i2) */ /* Gen 3 devices without a mixer (Solo and 2i2) */
}, { }, [SCARLETT2_CONFIG_SET_GEN_3A] = {
.items = {
[SCARLETT2_CONFIG_MSD_SWITCH] = { [SCARLETT2_CONFIG_MSD_SWITCH] = {
.offset = 0x04, .size = 8, .activate = 6 }, .offset = 0x04, .size = 8, .activate = 6 },
...@@ -1272,9 +1278,11 @@ static const struct scarlett2_config ...@@ -1272,9 +1278,11 @@ static const struct scarlett2_config
[SCARLETT2_CONFIG_AIR_SWITCH] = { [SCARLETT2_CONFIG_AIR_SWITCH] = {
.offset = 0x09, .size = 1, .activate = 8 }, .offset = 0x09, .size = 1, .activate = 8 },
},
/* Gen 3 devices: 4i4, 8i6, 18i8, 18i20 */ /* Gen 3 devices: 4i4, 8i6, 18i8, 18i20 */
}, { }, [SCARLETT2_CONFIG_SET_GEN_3B] = {
.items = {
[SCARLETT2_CONFIG_DIM_MUTE] = { [SCARLETT2_CONFIG_DIM_MUTE] = {
.offset = 0x31, .size = 8, .activate = 2 }, .offset = 0x31, .size = 8, .activate = 2 },
...@@ -1316,9 +1324,11 @@ static const struct scarlett2_config ...@@ -1316,9 +1324,11 @@ static const struct scarlett2_config
[SCARLETT2_CONFIG_TALKBACK_MAP] = { [SCARLETT2_CONFIG_TALKBACK_MAP] = {
.offset = 0xb0, .size = 16, .activate = 10 }, .offset = 0xb0, .size = 16, .activate = 10 },
},
/* Clarett USB and Clarett+ devices: 2Pre, 4Pre, 8Pre */ /* Clarett USB and Clarett+ devices: 2Pre, 4Pre, 8Pre */
}, { }, [SCARLETT2_CONFIG_SET_CLARETT] = {
.items = {
[SCARLETT2_CONFIG_DIM_MUTE] = { [SCARLETT2_CONFIG_DIM_MUTE] = {
.offset = 0x31, .size = 8, .activate = 2 }, .offset = 0x31, .size = 8, .activate = 2 },
...@@ -1339,6 +1349,7 @@ static const struct scarlett2_config ...@@ -1339,6 +1349,7 @@ static const struct scarlett2_config
[SCARLETT2_CONFIG_STANDALONE_SWITCH] = { [SCARLETT2_CONFIG_STANDALONE_SWITCH] = {
.offset = 0x8d, .size = 8, .activate = 6 }, .offset = 0x8d, .size = 8, .activate = 6 },
}
} }; } };
/* proprietary request/response format */ /* proprietary request/response format */
...@@ -1514,7 +1525,7 @@ static int scarlett2_has_config_item( ...@@ -1514,7 +1525,7 @@ static int scarlett2_has_config_item(
{ {
const struct scarlett2_device_info *info = private->info; const struct scarlett2_device_info *info = private->info;
const struct scarlett2_config *config_item = const struct scarlett2_config *config_item =
&scarlett2_config_items[info->config_set][config_item_num]; &scarlett2_config_sets[info->config_set].items[config_item_num];
return !!config_item->offset; return !!config_item->offset;
} }
...@@ -1527,7 +1538,7 @@ static int scarlett2_usb_get_config( ...@@ -1527,7 +1538,7 @@ static int scarlett2_usb_get_config(
struct scarlett2_data *private = mixer->private_data; struct scarlett2_data *private = mixer->private_data;
const struct scarlett2_device_info *info = private->info; const struct scarlett2_device_info *info = private->info;
const struct scarlett2_config *config_item = const struct scarlett2_config *config_item =
&scarlett2_config_items[info->config_set][config_item_num]; &scarlett2_config_sets[info->config_set].items[config_item_num];
int size, err, i; int size, err, i;
u8 *buf_8; u8 *buf_8;
u8 value; u8 value;
...@@ -1589,7 +1600,7 @@ static int scarlett2_usb_set_config( ...@@ -1589,7 +1600,7 @@ static int scarlett2_usb_set_config(
struct scarlett2_data *private = mixer->private_data; struct scarlett2_data *private = mixer->private_data;
const struct scarlett2_device_info *info = private->info; const struct scarlett2_device_info *info = private->info;
const struct scarlett2_config *config_item = const struct scarlett2_config *config_item =
&scarlett2_config_items[info->config_set][config_item_num]; &scarlett2_config_sets[info->config_set].items[config_item_num];
struct { struct {
__le32 offset; __le32 offset;
__le32 bytes; __le32 bytes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment