mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
ASoC: codecs: wsa884x: Use designator array initializers for Soundwire ports
Two arrays (with 'struct sdw_dpn_prop' and 'struct sdw_port_config') store configuration of Soundwire ports, thus each of their element is indexed according to the port number (enum wsa884x_port_ids, e.g. WSA884X_PORT_DAC). Except the indexing, they also store port number offset by one in member 'num'. Entire code depends on that correlation between array index and port number, thus make it explicit by using designators. The code is functionally the same, but more obvious for reading. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://patch.msgid.link/20240725-asoc-wsa88xx-port-arrays-v1-3-80a03f440c72@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
add41ea550
commit
125ed86b0d
@ -782,42 +782,47 @@ static const struct soc_enum wsa884x_dev_mode_enum =
|
||||
SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wsa884x_dev_mode_text), wsa884x_dev_mode_text);
|
||||
|
||||
static struct sdw_dpn_prop wsa884x_sink_dpn_prop[WSA884X_MAX_SWR_PORTS] = {
|
||||
{
|
||||
[WSA884X_PORT_DAC] = {
|
||||
.num = WSA884X_PORT_DAC + 1,
|
||||
.type = SDW_DPN_SIMPLE,
|
||||
.min_ch = 1,
|
||||
.max_ch = 1,
|
||||
.simple_ch_prep_sm = true,
|
||||
.read_only_wordlength = true,
|
||||
}, {
|
||||
},
|
||||
[WSA884X_PORT_COMP] = {
|
||||
.num = WSA884X_PORT_COMP + 1,
|
||||
.type = SDW_DPN_SIMPLE,
|
||||
.min_ch = 1,
|
||||
.max_ch = 1,
|
||||
.simple_ch_prep_sm = true,
|
||||
.read_only_wordlength = true,
|
||||
}, {
|
||||
},
|
||||
[WSA884X_PORT_BOOST] = {
|
||||
.num = WSA884X_PORT_BOOST + 1,
|
||||
.type = SDW_DPN_SIMPLE,
|
||||
.min_ch = 1,
|
||||
.max_ch = 1,
|
||||
.simple_ch_prep_sm = true,
|
||||
.read_only_wordlength = true,
|
||||
}, {
|
||||
},
|
||||
[WSA884X_PORT_PBR] = {
|
||||
.num = WSA884X_PORT_PBR + 1,
|
||||
.type = SDW_DPN_SIMPLE,
|
||||
.min_ch = 1,
|
||||
.max_ch = 1,
|
||||
.simple_ch_prep_sm = true,
|
||||
.read_only_wordlength = true,
|
||||
}, {
|
||||
},
|
||||
[WSA884X_PORT_VISENSE] = {
|
||||
.num = WSA884X_PORT_VISENSE + 1,
|
||||
.type = SDW_DPN_SIMPLE,
|
||||
.min_ch = 1,
|
||||
.max_ch = 1,
|
||||
.simple_ch_prep_sm = true,
|
||||
.read_only_wordlength = true,
|
||||
}, {
|
||||
},
|
||||
[WSA884X_PORT_CPS] = {
|
||||
.num = WSA884X_PORT_CPS + 1,
|
||||
.type = SDW_DPN_SIMPLE,
|
||||
.min_ch = 1,
|
||||
@ -828,22 +833,27 @@ static struct sdw_dpn_prop wsa884x_sink_dpn_prop[WSA884X_MAX_SWR_PORTS] = {
|
||||
};
|
||||
|
||||
static const struct sdw_port_config wsa884x_pconfig[WSA884X_MAX_SWR_PORTS] = {
|
||||
{
|
||||
[WSA884X_PORT_DAC] = {
|
||||
.num = WSA884X_PORT_DAC + 1,
|
||||
.ch_mask = 0x1,
|
||||
}, {
|
||||
},
|
||||
[WSA884X_PORT_COMP] = {
|
||||
.num = WSA884X_PORT_COMP + 1,
|
||||
.ch_mask = 0xf,
|
||||
}, {
|
||||
},
|
||||
[WSA884X_PORT_BOOST] = {
|
||||
.num = WSA884X_PORT_BOOST + 1,
|
||||
.ch_mask = 0x3,
|
||||
}, {
|
||||
},
|
||||
[WSA884X_PORT_PBR] = {
|
||||
.num = WSA884X_PORT_PBR + 1,
|
||||
.ch_mask = 0x1,
|
||||
}, {
|
||||
},
|
||||
[WSA884X_PORT_VISENSE] = {
|
||||
.num = WSA884X_PORT_VISENSE + 1,
|
||||
.ch_mask = 0x3,
|
||||
}, {
|
||||
},
|
||||
[WSA884X_PORT_CPS] = {
|
||||
.num = WSA884X_PORT_CPS + 1,
|
||||
.ch_mask = 0x3,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user