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: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/bfdb04cd6239af9a8c26a52da0537980f77c0437.1703444932.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
c13d43a858
commit
c0a7e1d859
@ -1226,12 +1226,16 @@ struct scarlett2_config {
|
||||
u8 activate;
|
||||
};
|
||||
|
||||
static const struct scarlett2_config
|
||||
scarlett2_config_items[SCARLETT2_CONFIG_SET_COUNT]
|
||||
[SCARLETT2_CONFIG_COUNT] =
|
||||
struct scarlett2_config_set {
|
||||
const struct scarlett2_config items[SCARLETT2_CONFIG_COUNT];
|
||||
};
|
||||
|
||||
static const struct scarlett2_config_set
|
||||
scarlett2_config_sets[SCARLETT2_CONFIG_SET_COUNT] =
|
||||
|
||||
/* Gen 2 devices: 6i6, 18i8, 18i20 */
|
||||
{ {
|
||||
{ [SCARLETT2_CONFIG_SET_GEN_2] = {
|
||||
.items = {
|
||||
[SCARLETT2_CONFIG_DIM_MUTE] = {
|
||||
.offset = 0x31, .size = 8, .activate = 2 },
|
||||
|
||||
@ -1252,9 +1256,11 @@ static const struct scarlett2_config
|
||||
|
||||
[SCARLETT2_CONFIG_STANDALONE_SWITCH] = {
|
||||
.offset = 0x8d, .size = 8, .activate = 6 },
|
||||
},
|
||||
|
||||
/* Gen 3 devices without a mixer (Solo and 2i2) */
|
||||
}, {
|
||||
}, [SCARLETT2_CONFIG_SET_GEN_3A] = {
|
||||
.items = {
|
||||
[SCARLETT2_CONFIG_MSD_SWITCH] = {
|
||||
.offset = 0x04, .size = 8, .activate = 6 },
|
||||
|
||||
@ -1272,9 +1278,11 @@ static const struct scarlett2_config
|
||||
|
||||
[SCARLETT2_CONFIG_AIR_SWITCH] = {
|
||||
.offset = 0x09, .size = 1, .activate = 8 },
|
||||
},
|
||||
|
||||
/* Gen 3 devices: 4i4, 8i6, 18i8, 18i20 */
|
||||
}, {
|
||||
}, [SCARLETT2_CONFIG_SET_GEN_3B] = {
|
||||
.items = {
|
||||
[SCARLETT2_CONFIG_DIM_MUTE] = {
|
||||
.offset = 0x31, .size = 8, .activate = 2 },
|
||||
|
||||
@ -1316,9 +1324,11 @@ static const struct scarlett2_config
|
||||
|
||||
[SCARLETT2_CONFIG_TALKBACK_MAP] = {
|
||||
.offset = 0xb0, .size = 16, .activate = 10 },
|
||||
},
|
||||
|
||||
/* Clarett USB and Clarett+ devices: 2Pre, 4Pre, 8Pre */
|
||||
}, {
|
||||
}, [SCARLETT2_CONFIG_SET_CLARETT] = {
|
||||
.items = {
|
||||
[SCARLETT2_CONFIG_DIM_MUTE] = {
|
||||
.offset = 0x31, .size = 8, .activate = 2 },
|
||||
|
||||
@ -1339,6 +1349,7 @@ static const struct scarlett2_config
|
||||
|
||||
[SCARLETT2_CONFIG_STANDALONE_SWITCH] = {
|
||||
.offset = 0x8d, .size = 8, .activate = 6 },
|
||||
}
|
||||
} };
|
||||
|
||||
/* proprietary request/response format */
|
||||
@ -1514,7 +1525,7 @@ static int scarlett2_has_config_item(
|
||||
{
|
||||
const struct scarlett2_device_info *info = private->info;
|
||||
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;
|
||||
}
|
||||
@ -1527,7 +1538,7 @@ static int scarlett2_usb_get_config(
|
||||
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->config_set][config_item_num];
|
||||
&scarlett2_config_sets[info->config_set].items[config_item_num];
|
||||
int size, err, i;
|
||||
u8 *buf_8;
|
||||
u8 value;
|
||||
@ -1589,7 +1600,7 @@ static int scarlett2_usb_set_config(
|
||||
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->config_set][config_item_num];
|
||||
&scarlett2_config_sets[info->config_set].items[config_item_num];
|
||||
struct {
|
||||
__le32 offset;
|
||||
__le32 bytes;
|
||||
|
Loading…
x
Reference in New Issue
Block a user