[PATCH 0/7] ASoC: codecs: wsa88xx and wcd93xx: Soundwire port non-functional cleanup
![](https://secure.gravatar.com/avatar/ed75bd1c5039f5d61a1c57e65cd58c9e.jpg?s=120&d=mm&r=g)
Hi,
Few cleanups to make the code more robust or readable. No functional impact (compiled objects stay the same).
Best regards, Krzysztof
--- Krzysztof Kozlowski (7): ASoC: codecs: wsa881x: Use designator array initializers for Soundwire ports ASoC: codecs: wsa883x: Use designator array initializers for Soundwire ports ASoC: codecs: wsa884x: Use designator array initializers for Soundwire ports ASoC: codecs: wcd938x: Drop unused defines and enums ASoC: codecs: wcd937x: Move max port number defines to enum ASoC: codecs: wcd938x: Move max port number defines to enum ASoC: codecs: wcd939x: Move max port number defines to enum
sound/soc/codecs/wcd937x.h | 34 +++++++++++++++++----------------- sound/soc/codecs/wcd938x.c | 18 ------------------ sound/soc/codecs/wcd938x.h | 4 ++-- sound/soc/codecs/wcd939x.h | 6 +++--- sound/soc/codecs/wsa881x.c | 42 ++++++++++++++++++++++-------------------- sound/soc/codecs/wsa883x.c | 42 ++++++++++++++++++++++-------------------- sound/soc/codecs/wsa884x.c | 34 ++++++++++++++++++++++------------ 7 files changed, 88 insertions(+), 92 deletions(-) --- base-commit: 66df68b9536e7465aec703733ea91ca39b787ed8 change-id: 20240725-asoc-wsa88xx-port-arrays-c58c96cd888e
Best regards,
![](https://secure.gravatar.com/avatar/ed75bd1c5039f5d61a1c57e65cd58c9e.jpg?s=120&d=mm&r=g)
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 wsa_port_ids, e.g. WSA881X_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 --- sound/soc/codecs/wsa881x.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-)
diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c index 0478599d0f35..a5e05c05fd3d 100644 --- a/sound/soc/codecs/wsa881x.c +++ b/sound/soc/codecs/wsa881x.c @@ -386,33 +386,32 @@ enum wsa_port_ids {
/* 4 ports */ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = { - { - /* DAC */ - .num = 1, + [WSA881X_PORT_DAC] = { + .num = WSA881X_PORT_DAC + 1, .type = SDW_DPN_SIMPLE, .min_ch = 1, .max_ch = 1, .simple_ch_prep_sm = true, .read_only_wordlength = true, - }, { - /* COMP */ - .num = 2, + }, + [WSA881X_PORT_COMP] = { + .num = WSA881X_PORT_COMP + 1, .type = SDW_DPN_SIMPLE, .min_ch = 1, .max_ch = 1, .simple_ch_prep_sm = true, .read_only_wordlength = true, - }, { - /* BOOST */ - .num = 3, + }, + [WSA881X_PORT_BOOST] = { + .num = WSA881X_PORT_BOOST + 1, .type = SDW_DPN_SIMPLE, .min_ch = 1, .max_ch = 1, .simple_ch_prep_sm = true, .read_only_wordlength = true, - }, { - /* VISENSE */ - .num = 4, + }, + [WSA881X_PORT_VISENSE] = { + .num = WSA881X_PORT_VISENSE + 1, .type = SDW_DPN_SIMPLE, .min_ch = 1, .max_ch = 1, @@ -422,17 +421,20 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = { };
static const struct sdw_port_config wsa881x_pconfig[WSA881X_MAX_SWR_PORTS] = { - { - .num = 1, + [WSA881X_PORT_DAC] = { + .num = WSA881X_PORT_DAC + 1, .ch_mask = 0x1, - }, { - .num = 2, + }, + [WSA881X_PORT_COMP] = { + .num = WSA881X_PORT_COMP + 1, .ch_mask = 0xf, - }, { - .num = 3, + }, + [WSA881X_PORT_BOOST] = { + .num = WSA881X_PORT_BOOST + 1, .ch_mask = 0x3, - }, { /* IV feedback */ - .num = 4, + }, + [WSA881X_PORT_VISENSE] = { + .num = WSA881X_PORT_VISENSE + 1, .ch_mask = 0x3, }, };
![](https://secure.gravatar.com/avatar/de6791ca2d7e9b55758163fc44293d33.jpg?s=120&d=mm&r=g)
On Thu, Jul 25, 2024 at 01:23:43PM GMT, Krzysztof Kozlowski wrote:
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 wsa_port_ids, e.g. WSA881X_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
sound/soc/codecs/wsa881x.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-)
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org
![](https://secure.gravatar.com/avatar/ed75bd1c5039f5d61a1c57e65cd58c9e.jpg?s=120&d=mm&r=g)
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 wsa_port_ids, e.g. WSA883X_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 --- sound/soc/codecs/wsa883x.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-)
diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c index d0ab4e2290b6..9dc2e4d96b10 100644 --- a/sound/soc/codecs/wsa883x.c +++ b/sound/soc/codecs/wsa883x.c @@ -482,33 +482,32 @@ static const struct soc_enum wsa_dev_mode_enum =
/* 4 ports */ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA883X_MAX_SWR_PORTS] = { - { - /* DAC */ - .num = 1, + [WSA883X_PORT_DAC] = { + .num = WSA883X_PORT_DAC + 1, .type = SDW_DPN_SIMPLE, .min_ch = 1, .max_ch = 1, .simple_ch_prep_sm = true, .read_only_wordlength = true, - }, { - /* COMP */ - .num = 2, + }, + [WSA883X_PORT_COMP] = { + .num = WSA883X_PORT_COMP + 1, .type = SDW_DPN_SIMPLE, .min_ch = 1, .max_ch = 1, .simple_ch_prep_sm = true, .read_only_wordlength = true, - }, { - /* BOOST */ - .num = 3, + }, + [WSA883X_PORT_BOOST] = { + .num = WSA883X_PORT_BOOST + 1, .type = SDW_DPN_SIMPLE, .min_ch = 1, .max_ch = 1, .simple_ch_prep_sm = true, .read_only_wordlength = true, - }, { - /* VISENSE */ - .num = 4, + }, + [WSA883X_PORT_VISENSE] = { + .num = WSA883X_PORT_VISENSE + 1, .type = SDW_DPN_SIMPLE, .min_ch = 1, .max_ch = 1, @@ -518,17 +517,20 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA883X_MAX_SWR_PORTS] = { };
static const struct sdw_port_config wsa883x_pconfig[WSA883X_MAX_SWR_PORTS] = { - { - .num = 1, + [WSA883X_PORT_DAC] = { + .num = WSA883X_PORT_DAC + 1, .ch_mask = 0x1, - }, { - .num = 2, + }, + [WSA883X_PORT_COMP] = { + .num = WSA883X_PORT_COMP + 1, .ch_mask = 0xf, - }, { - .num = 3, + }, + [WSA883X_PORT_BOOST] = { + .num = WSA883X_PORT_BOOST + 1, .ch_mask = 0x3, - }, { /* IV feedback */ - .num = 4, + }, + [WSA883X_PORT_VISENSE] = { + .num = WSA883X_PORT_VISENSE + 1, .ch_mask = 0x3, }, };
![](https://secure.gravatar.com/avatar/de6791ca2d7e9b55758163fc44293d33.jpg?s=120&d=mm&r=g)
On Thu, Jul 25, 2024 at 01:23:44PM GMT, Krzysztof Kozlowski wrote:
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 wsa_port_ids, e.g. WSA883X_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
sound/soc/codecs/wsa883x.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-)
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org
![](https://secure.gravatar.com/avatar/ed75bd1c5039f5d61a1c57e65cd58c9e.jpg?s=120&d=mm&r=g)
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 --- sound/soc/codecs/wsa884x.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c index d17ae17b2938..d3d09c3bab2d 100644 --- a/sound/soc/codecs/wsa884x.c +++ b/sound/soc/codecs/wsa884x.c @@ -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, },
![](https://secure.gravatar.com/avatar/de6791ca2d7e9b55758163fc44293d33.jpg?s=120&d=mm&r=g)
On Thu, Jul 25, 2024 at 01:23:45PM GMT, Krzysztof Kozlowski wrote:
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
sound/soc/codecs/wsa884x.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org
![](https://secure.gravatar.com/avatar/ed75bd1c5039f5d61a1c57e65cd58c9e.jpg?s=120&d=mm&r=g)
Drop defines and enums not used in the driver.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org --- sound/soc/codecs/wcd938x.c | 18 ------------------ 1 file changed, 18 deletions(-)
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 12b32d5dc580..aa92f1bfc921 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -29,7 +29,6 @@ #define WCD938X_MAX_SUPPLY (4) #define WCD938X_MBHC_MAX_BUTTONS (8) #define TX_ADC_MAX (4) -#define WCD938X_TX_MAX_SWR_PORTS (5)
#define WCD938X_RATES_MASK (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\ @@ -39,8 +38,6 @@ SNDRV_PCM_RATE_176400) #define WCD938X_FORMATS_S16_S24_LE (SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S24_LE) -/* Convert from vout ctl to micbias voltage in mV */ -#define WCD_VOUT_CTL_TO_MICB(v) (1000 + v * 50) #define SWR_CLK_RATE_0P6MHZ (600000) #define SWR_CLK_RATE_1P2MHZ (1200000) #define SWR_CLK_RATE_2P4MHZ (2400000) @@ -48,8 +45,6 @@ #define SWR_CLK_RATE_9P6MHZ (9600000) #define SWR_CLK_RATE_11P2896MHZ (1128960)
-#define WCD938X_DRV_NAME "wcd938x_codec" -#define WCD938X_VERSION_1_0 (1) #define EAR_RX_PATH_AUX (1)
#define ADC_MODE_VAL_HIFI 0x01 @@ -72,7 +67,6 @@ /* Z value compared in milliOhm */ #define WCD938X_MBHC_IS_SECOND_RAMP_REQUIRED(z) ((z > 400000) || (z < 32000)) #define WCD938X_MBHC_ZDET_CONST (86 * 16384) -#define WCD938X_MBHC_MOISTURE_RREF R_24_KOHM #define WCD_MBHC_HS_V_MAX 1600
#define WCD938X_EAR_PA_GAIN_TLV(xname, reg, shift, max, invert, tlv_array) \ @@ -89,18 +83,6 @@ enum { WCD9385 = 5, };
-enum { - TX_HDR12 = 0, - TX_HDR34, - TX_HDR_MAX, -}; - -enum { - WCD_RX1, - WCD_RX2, - WCD_RX3 -}; - enum { /* INTR_CTRL_INT_MASK_0 */ WCD938X_IRQ_MBHC_BUTTON_PRESS_DET = 0,
![](https://secure.gravatar.com/avatar/de6791ca2d7e9b55758163fc44293d33.jpg?s=120&d=mm&r=g)
On Thu, Jul 25, 2024 at 01:23:46PM GMT, Krzysztof Kozlowski wrote:
Drop defines and enums not used in the driver.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org
sound/soc/codecs/wcd938x.c | 18 ------------------ 1 file changed, 18 deletions(-)
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org
![](https://secure.gravatar.com/avatar/ed75bd1c5039f5d61a1c57e65cd58c9e.jpg?s=120&d=mm&r=g)
Instead of having separate define to indicate number of TX and RX Soundwire ports, move it to the enums defining actual port indices/values. This makes it more obvious why such value was chosen as number of TX/RX ports. Note: the enums start from 1, thus number of ports equals to the last vaue in the enum.
WCD937X_MAX_SWR_PORTS is used in one of structures in the header, so entire enum must be moved to the top of the header file.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org --- sound/soc/codecs/wcd937x.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/sound/soc/codecs/wcd937x.h b/sound/soc/codecs/wcd937x.h index 37bff16e88dd..35f3d48bd7dd 100644 --- a/sound/soc/codecs/wcd937x.h +++ b/sound/soc/codecs/wcd937x.h @@ -484,10 +484,25 @@
#define WCD937X_MAX_MICBIAS 3 #define WCD937X_MAX_BULK_SUPPLY 4 -#define WCD937X_MAX_TX_SWR_PORTS 4 -#define WCD937X_MAX_SWR_PORTS 5 #define WCD937X_MAX_SWR_CH_IDS 15
+enum wcd937x_tx_sdw_ports { + WCD937X_ADC_1_PORT = 1, + WCD937X_ADC_2_3_PORT, + WCD937X_DMIC_0_3_MBHC_PORT, + WCD937X_DMIC_4_6_PORT, + WCD937X_MAX_TX_SWR_PORTS = WCD937X_DMIC_4_6_PORT, +}; + +enum wcd937x_rx_sdw_ports { + WCD937X_HPH_PORT = 1, + WCD937X_CLSH_PORT, + WCD937X_COMP_PORT, + WCD937X_LO_PORT, + WCD937X_DSD_PORT, + WCD937X_MAX_SWR_PORTS = WCD937X_DSD_PORT, +}; + struct wcd937x_sdw_ch_info { int port_num; unsigned int ch_mask; @@ -581,13 +596,6 @@ enum { WCD937X_NUM_IRQS, };
-enum wcd937x_tx_sdw_ports { - WCD937X_ADC_1_PORT = 1, - WCD937X_ADC_2_3_PORT, - WCD937X_DMIC_0_3_MBHC_PORT, - WCD937X_DMIC_4_6_PORT, -}; - enum wcd937x_tx_sdw_channels { WCD937X_ADC1, WCD937X_ADC2, @@ -602,14 +610,6 @@ enum wcd937x_tx_sdw_channels { WCD937X_DMIC6, };
-enum wcd937x_rx_sdw_ports { - WCD937X_HPH_PORT = 1, - WCD937X_CLSH_PORT, - WCD937X_COMP_PORT, - WCD937X_LO_PORT, - WCD937X_DSD_PORT, -}; - enum wcd937x_rx_sdw_channels { WCD937X_HPH_L, WCD937X_HPH_R,
![](https://secure.gravatar.com/avatar/de6791ca2d7e9b55758163fc44293d33.jpg?s=120&d=mm&r=g)
On Thu, Jul 25, 2024 at 01:23:47PM GMT, Krzysztof Kozlowski wrote:
Instead of having separate define to indicate number of TX and RX Soundwire ports, move it to the enums defining actual port indices/values. This makes it more obvious why such value was chosen as number of TX/RX ports. Note: the enums start from 1, thus number of ports equals to the last vaue in the enum.
WCD937X_MAX_SWR_PORTS is used in one of structures in the header, so entire enum must be moved to the top of the header file.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org
sound/soc/codecs/wcd937x.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org
![](https://secure.gravatar.com/avatar/ed75bd1c5039f5d61a1c57e65cd58c9e.jpg?s=120&d=mm&r=g)
Instead of having separate define to indicate number of TX and RX Soundwire ports, move it to the enums defining actual port indices/values. This makes it more obvious why such value was chosen as number of TX/RX ports. Note: the enums start from 1, thus number of ports equals to the last vaue in the enum.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org --- sound/soc/codecs/wcd938x.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wcd938x.h b/sound/soc/codecs/wcd938x.h index b2ad98026ae2..fb6a0e4ef337 100644 --- a/sound/soc/codecs/wcd938x.h +++ b/sound/soc/codecs/wcd938x.h @@ -585,8 +585,6 @@ #define WCD938X_DIGITAL_DEM_BYPASS_DATA3 (0x34D8) #define WCD938X_MAX_REGISTER (WCD938X_DIGITAL_DEM_BYPASS_DATA3)
-#define WCD938X_MAX_SWR_PORTS 5 -#define WCD938X_MAX_TX_SWR_PORTS 4 #define WCD938X_MAX_SWR_CH_IDS 15
struct wcd938x_sdw_ch_info { @@ -606,6 +604,7 @@ enum wcd938x_tx_sdw_ports { /* DMIC0_0, DMIC0_1, DMIC1_0, DMIC1_1 */ WCD938X_DMIC_0_3_MBHC_PORT, WCD938X_DMIC_4_7_PORT, + WCD938X_MAX_TX_SWR_PORTS = WCD938X_DMIC_4_7_PORT, };
enum wcd938x_tx_sdw_channels { @@ -630,6 +629,7 @@ enum wcd938x_rx_sdw_ports { WCD938X_COMP_PORT, WCD938X_LO_PORT, WCD938X_DSD_PORT, + WCD938X_MAX_SWR_PORTS = WCD938X_DSD_PORT, };
enum wcd938x_rx_sdw_channels {
![](https://secure.gravatar.com/avatar/de6791ca2d7e9b55758163fc44293d33.jpg?s=120&d=mm&r=g)
On Thu, Jul 25, 2024 at 01:23:48PM GMT, Krzysztof Kozlowski wrote:
Instead of having separate define to indicate number of TX and RX Soundwire ports, move it to the enums defining actual port indices/values. This makes it more obvious why such value was chosen as number of TX/RX ports. Note: the enums start from 1, thus number of ports equals to the last vaue in the enum.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org
sound/soc/codecs/wcd938x.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org
![](https://secure.gravatar.com/avatar/ed75bd1c5039f5d61a1c57e65cd58c9e.jpg?s=120&d=mm&r=g)
Instead of having separate define to indicate number of TX and RX Soundwire ports, move it to the enums defining actual port indices/values. This makes it more obvious why such value was chosen as number of TX/RX ports. Note: the enums start from 1, thus number of ports equals to the last vaue in the enum.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org --- sound/soc/codecs/wcd939x.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/wcd939x.h b/sound/soc/codecs/wcd939x.h index 1571c2120cfc..3204fb10b58d 100644 --- a/sound/soc/codecs/wcd939x.h +++ b/sound/soc/codecs/wcd939x.h @@ -842,9 +842,6 @@ #define WCD939X_DSD_HPHR_CFG5 (0x35a6) #define WCD939X_MAX_REGISTER (WCD939X_DSD_HPHR_CFG5)
-#define WCD939X_MAX_SWR_PORTS (6) -#define WCD939X_MAX_RX_SWR_PORTS (6) -#define WCD939X_MAX_TX_SWR_PORTS (4) #define WCD939X_MAX_SWR_CH_IDS (15)
struct wcd939x_sdw_ch_info { @@ -863,6 +860,7 @@ enum wcd939x_tx_sdw_ports { WCD939X_ADC_DMIC_1_2_PORT, WCD939X_DMIC_0_3_MBHC_PORT, WCD939X_DMIC_3_7_PORT, + WCD939X_MAX_TX_SWR_PORTS = WCD939X_DMIC_3_7_PORT, };
enum wcd939x_tx_sdw_channels { @@ -888,6 +886,8 @@ enum wcd939x_rx_sdw_ports { WCD939X_LO_PORT, WCD939X_DSD_PORT, WCD939X_HIFI_PCM_PORT, + WCD939X_MAX_RX_SWR_PORTS = WCD939X_HIFI_PCM_PORT, + WCD939X_MAX_SWR_PORTS = WCD939X_MAX_RX_SWR_PORTS, };
enum wcd939x_rx_sdw_channels {
![](https://secure.gravatar.com/avatar/de6791ca2d7e9b55758163fc44293d33.jpg?s=120&d=mm&r=g)
On Thu, Jul 25, 2024 at 01:23:49PM GMT, Krzysztof Kozlowski wrote:
Instead of having separate define to indicate number of TX and RX Soundwire ports, move it to the enums defining actual port indices/values. This makes it more obvious why such value was chosen as number of TX/RX ports. Note: the enums start from 1, thus number of ports equals to the last vaue in the enum.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org
sound/soc/codecs/wcd939x.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org
![](https://secure.gravatar.com/avatar/d930951cb00393ecf9c3db3a56d78fa9.jpg?s=120&d=mm&r=g)
On Thu, 25 Jul 2024 13:23:42 +0200, Krzysztof Kozlowski wrote:
Few cleanups to make the code more robust or readable. No functional impact (compiled objects stay the same).
Best regards, Krzysztof
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/7] ASoC: codecs: wsa881x: Use designator array initializers for Soundwire ports commit: 874d04fe15d12cafa09dd36e8555cea4eb0653f6 [2/7] ASoC: codecs: wsa883x: Use designator array initializers for Soundwire ports commit: add41ea55060d5e41d62268aa0bda2a27e0f5053 [3/7] ASoC: codecs: wsa884x: Use designator array initializers for Soundwire ports commit: 125ed86b0d669334dbc567f441d10163ff0c44bc [4/7] ASoC: codecs: wcd938x: Drop unused defines and enums commit: 06fa8271273d8181cb8727e63aeec3f87a48d8c7 [5/7] ASoC: codecs: wcd937x: Move max port number defines to enum commit: 42f3a2caf80910d0c251b2a407d4d220c0d3a79f [6/7] ASoC: codecs: wcd938x: Move max port number defines to enum commit: 5e388488f0a1dd6d340f3925e7b371e212ee3cc2 [7/7] ASoC: codecs: wcd939x: Move max port number defines to enum commit: a9d843e6b231e550f8141f27e930f90ded4edae2
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (3)
-
Dmitry Baryshkov
-
Krzysztof Kozlowski
-
Mark Brown