2023-10-23 09:54:43

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 00/17] ASoC: fix widget name comparisons (consider DAI name prefix)

Hi,

Some codec drivers compare widget names with strcmp, ignoring
the component name prefix. If prefix is used, the comparisons start failing.

Except Qualcomm lpass-rx-macro, none of the patches were tested
on hardware.

Best regards,
Krzysztof

Krzysztof Kozlowski (17):
ASoC: codecs: 88pm860x: Handle component name prefix
ASoC: codecs: adau1373: Handle component name prefix
ASoC: codecs: adav80x: Handle component name prefix
ASoC: codecs: lpass-rx-macro: Handle component name prefix
ASoC: codecs: max9867: Handle component name prefix
ASoC: codecs: rt5682s: Handle component name prefix
ASoC: codecs: rtq9128: Handle component name prefix
ASoC: codecs: wcd9335: Handle component name prefix
ASoC: codecs: wm8962: Handle component name prefix
ASoC: codecs: wm8994: Handle component name prefix
ASoC: codecs: wm8995: Handle component name prefix
ASoC: mediatek: mt8183: Handle component name prefix
ASoC: mediatek: mt8186: Handle component name prefix
ASoC: mediatek: mt8188: Handle component name prefix
ASoC: mediatek: mt8192: Handle component name prefix
ASoC: samsung: speyside: Handle component name prefix
ASoC: tegra: machine: Handle component name prefix

sound/soc/codecs/88pm860x-codec.c | 4 ++--
sound/soc/codecs/adau1373.c | 2 +-
sound/soc/codecs/adav80x.c | 2 +-
sound/soc/codecs/lpass-rx-macro.c | 6 +++---
sound/soc/codecs/max9867.c | 8 ++++----
sound/soc/codecs/rt5682s.c | 4 ++--
sound/soc/codecs/rtq9128.c | 6 +++---
sound/soc/codecs/wcd9335.c | 18 +++++++++---------
sound/soc/codecs/wm8962.c | 4 ++--
sound/soc/codecs/wm8994.c | 2 +-
sound/soc/codecs/wm8995.c | 2 +-
sound/soc/mediatek/mt8183/mt8183-dai-i2s.c | 4 ++--
sound/soc/mediatek/mt8186/mt8186-dai-adda.c | 2 +-
sound/soc/mediatek/mt8186/mt8186-dai-hw-gain.c | 2 +-
sound/soc/mediatek/mt8186/mt8186-dai-i2s.c | 4 ++--
sound/soc/mediatek/mt8186/mt8186-dai-src.c | 4 ++--
sound/soc/mediatek/mt8188/mt8188-dai-etdm.c | 4 ++--
sound/soc/mediatek/mt8192/mt8192-dai-adda.c | 4 ++--
sound/soc/mediatek/mt8192/mt8192-dai-i2s.c | 4 ++--
sound/soc/samsung/speyside.c | 4 ++--
sound/soc/tegra/tegra_asoc_machine.c | 12 ++++++++----
21 files changed, 53 insertions(+), 49 deletions(-)

--
2.34.1


2023-10-23 09:54:56

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 03/17] ASoC: codecs: adav80x: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/adav80x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index bb08969c5917..c8c0fc928211 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -229,7 +229,7 @@ static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget *source,
return 0;
}

- return strcmp(source->name, clk) == 0;
+ return snd_soc_dapm_widget_name_cmp(source, clk) == 0;
}

static int adav80x_dapm_pll_check(struct snd_soc_dapm_widget *source,
--
2.34.1

2023-10-23 09:54:57

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 02/17] ASoC: codecs: adau1373: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/adau1373.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c
index b0ab0a69b207..3582c4b968a0 100644
--- a/sound/soc/codecs/adau1373.c
+++ b/sound/soc/codecs/adau1373.c
@@ -834,7 +834,7 @@ static int adau1373_check_aif_clk(struct snd_soc_dapm_widget *source,
else
clk = "SYSCLK2";

- return strcmp(source->name, clk) == 0;
+ return snd_soc_dapm_widget_name_cmp(source, clk) == 0;
}

static int adau1373_check_src(struct snd_soc_dapm_widget *source,
--
2.34.1

2023-10-23 09:55:03

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 01/17] ASoC: codecs: 88pm860x: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/88pm860x-codec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
index d99b674d574b..be01f0928393 100644
--- a/sound/soc/codecs/88pm860x-codec.c
+++ b/sound/soc/codecs/88pm860x-codec.c
@@ -400,9 +400,9 @@ static int pm860x_dac_event(struct snd_soc_dapm_widget *w,
unsigned int dac = 0;
int data;

- if (!strcmp(w->name, "Left DAC"))
+ if (!snd_soc_dapm_widget_name_cmp(w, "Left DAC"))
dac = DAC_LEFT;
- if (!strcmp(w->name, "Right DAC"))
+ if (!snd_soc_dapm_widget_name_cmp(w, "Right DAC"))
dac = DAC_RIGHT;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
--
2.34.1

2023-10-23 09:55:07

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 05/17] ASoC: codecs: max9867: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/max9867.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c
index b616ad39858c..3b9dd158c34b 100644
--- a/sound/soc/codecs/max9867.c
+++ b/sound/soc/codecs/max9867.c
@@ -56,13 +56,13 @@ static int max9867_adc_dac_event(struct snd_soc_dapm_widget *w,
struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
enum max9867_adc_dac adc_dac;

- if (!strcmp(w->name, "ADCL"))
+ if (!snd_soc_dapm_widget_name_cmp(w, "ADCL"))
adc_dac = MAX9867_ADC_LEFT;
- else if (!strcmp(w->name, "ADCR"))
+ else if (!snd_soc_dapm_widget_name_cmp(w, "ADCR"))
adc_dac = MAX9867_ADC_RIGHT;
- else if (!strcmp(w->name, "DACL"))
+ else if (!snd_soc_dapm_widget_name_cmp(w, "DACL"))
adc_dac = MAX9867_DAC_LEFT;
- else if (!strcmp(w->name, "DACR"))
+ else if (!snd_soc_dapm_widget_name_cmp(w, "DACR"))
adc_dac = MAX9867_DAC_RIGHT;
else
return 0;
--
2.34.1

2023-10-23 09:55:09

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 04/17] ASoC: codecs: lpass-rx-macro: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/lpass-rx-macro.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index 29197d34ec09..f35187d69cac 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -2906,14 +2906,14 @@ static int rx_macro_enable_echo(struct snd_soc_dapm_widget *w,

val = snd_soc_component_read(component,
CDC_RX_INP_MUX_RX_MIX_CFG4);
- if (!(strcmp(w->name, "RX MIX TX0 MUX")))
+ if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX0 MUX")))
ec_tx = ((val & 0xf0) >> 0x4) - 1;
- else if (!(strcmp(w->name, "RX MIX TX1 MUX")))
+ else if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX1 MUX")))
ec_tx = (val & 0x0f) - 1;

val = snd_soc_component_read(component,
CDC_RX_INP_MUX_RX_MIX_CFG5);
- if (!(strcmp(w->name, "RX MIX TX2 MUX")))
+ if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX2 MUX")))
ec_tx = (val & 0x0f) - 1;

if (ec_tx < 0 || (ec_tx >= RX_MACRO_EC_MUX_MAX)) {
--
2.34.1

2023-10-23 09:55:13

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 06/17] ASoC: codecs: rt5682s: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/rt5682s.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/rt5682s.c b/sound/soc/codecs/rt5682s.c
index 68ac5ea50396..c261c33c4be7 100644
--- a/sound/soc/codecs/rt5682s.c
+++ b/sound/soc/codecs/rt5682s.c
@@ -1323,9 +1323,9 @@ static int set_i2s_event(struct snd_soc_dapm_widget *w,
if (SND_SOC_DAPM_EVENT_ON(event))
on = 1;

- if (!strcmp(w->name, "I2S1") && !rt5682s->wclk_enabled)
+ if (!snd_soc_dapm_widget_name_cmp(w, "I2S1") && !rt5682s->wclk_enabled)
rt5682s_set_i2s(rt5682s, RT5682S_AIF1, on);
- else if (!strcmp(w->name, "I2S2"))
+ else if (!snd_soc_dapm_widget_name_cmp(w, "I2S2"))
rt5682s_set_i2s(rt5682s, RT5682S_AIF2, on);

return 0;
--
2.34.1

2023-10-23 09:55:45

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 08/17] ASoC: codecs: wcd9335: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/wcd9335.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c
index a05b553e6472..43c648efd0d9 100644
--- a/sound/soc/codecs/wcd9335.c
+++ b/sound/soc/codecs/wcd9335.c
@@ -3296,31 +3296,31 @@ static int wcd9335_codec_enable_interpolator(struct snd_soc_dapm_widget *w,
int val;
int offset_val = 0;

- if (!(strcmp(w->name, "RX INT0 INTERP"))) {
+ if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT0 INTERP"))) {
reg = WCD9335_CDC_RX0_RX_PATH_CTL;
gain_reg = WCD9335_CDC_RX0_RX_VOL_CTL;
- } else if (!(strcmp(w->name, "RX INT1 INTERP"))) {
+ } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT1 INTERP"))) {
reg = WCD9335_CDC_RX1_RX_PATH_CTL;
gain_reg = WCD9335_CDC_RX1_RX_VOL_CTL;
- } else if (!(strcmp(w->name, "RX INT2 INTERP"))) {
+ } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT2 INTERP"))) {
reg = WCD9335_CDC_RX2_RX_PATH_CTL;
gain_reg = WCD9335_CDC_RX2_RX_VOL_CTL;
- } else if (!(strcmp(w->name, "RX INT3 INTERP"))) {
+ } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT3 INTERP"))) {
reg = WCD9335_CDC_RX3_RX_PATH_CTL;
gain_reg = WCD9335_CDC_RX3_RX_VOL_CTL;
- } else if (!(strcmp(w->name, "RX INT4 INTERP"))) {
+ } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT4 INTERP"))) {
reg = WCD9335_CDC_RX4_RX_PATH_CTL;
gain_reg = WCD9335_CDC_RX4_RX_VOL_CTL;
- } else if (!(strcmp(w->name, "RX INT5 INTERP"))) {
+ } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT5 INTERP"))) {
reg = WCD9335_CDC_RX5_RX_PATH_CTL;
gain_reg = WCD9335_CDC_RX5_RX_VOL_CTL;
- } else if (!(strcmp(w->name, "RX INT6 INTERP"))) {
+ } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT6 INTERP"))) {
reg = WCD9335_CDC_RX6_RX_PATH_CTL;
gain_reg = WCD9335_CDC_RX6_RX_VOL_CTL;
- } else if (!(strcmp(w->name, "RX INT7 INTERP"))) {
+ } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT7 INTERP"))) {
reg = WCD9335_CDC_RX7_RX_PATH_CTL;
gain_reg = WCD9335_CDC_RX7_RX_VOL_CTL;
- } else if (!(strcmp(w->name, "RX INT8 INTERP"))) {
+ } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT8 INTERP"))) {
reg = WCD9335_CDC_RX8_RX_PATH_CTL;
gain_reg = WCD9335_CDC_RX8_RX_VOL_CTL;
} else {
--
2.34.1

2023-10-23 09:55:58

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 07/17] ASoC: codecs: rtq9128: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/rtq9128.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/rtq9128.c b/sound/soc/codecs/rtq9128.c
index 371d622c6214..c22b047115cc 100644
--- a/sound/soc/codecs/rtq9128.c
+++ b/sound/soc/codecs/rtq9128.c
@@ -291,11 +291,11 @@ static int rtq9128_dac_power_event(struct snd_soc_dapm_widget *w, struct snd_kco

dev_dbg(comp->dev, "%s: %s event %d\n", __func__, w->name, event);

- if (strcmp(w->name, "DAC1") == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, "DAC1") == 0)
shift = 6;
- else if (strcmp(w->name, "DAC2") == 0)
+ else if (snd_soc_dapm_widget_name_cmp(w, "DAC2") == 0)
shift = 4;
- else if (strcmp(w->name, "DAC3") == 0)
+ else if (snd_soc_dapm_widget_name_cmp(w, "DAC3") == 0)
shift = 2;
else
shift = 0;
--
2.34.1

2023-10-23 09:56:17

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 13/17] ASoC: mediatek: mt8186: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/mediatek/mt8186/mt8186-dai-adda.c | 2 +-
sound/soc/mediatek/mt8186/mt8186-dai-hw-gain.c | 2 +-
sound/soc/mediatek/mt8186/mt8186-dai-i2s.c | 4 ++--
sound/soc/mediatek/mt8186/mt8186-dai-src.c | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-adda.c b/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
index 247ab8df941f..85ae3f76d951 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
@@ -321,7 +321,7 @@ static int mtk_adda_mtkaif_cfg_event(struct snd_soc_dapm_widget *w,
MTKAIF_RXIF_CLKINV_ADC_MASK_SFT,
BIT(MTKAIF_RXIF_CLKINV_ADC_SFT));

- if (strcmp(w->name, "ADDA_MTKAIF_CFG") == 0) {
+ if (snd_soc_dapm_widget_name_cmp(w, "ADDA_MTKAIF_CFG") == 0) {
if (afe_priv->mtkaif_chosen_phase[0] < 0 &&
afe_priv->mtkaif_chosen_phase[1] < 0) {
dev_err(afe->dev,
diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-hw-gain.c b/sound/soc/mediatek/mt8186/mt8186-dai-hw-gain.c
index 33edd6cbde12..75cb30790b1b 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-hw-gain.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-hw-gain.c
@@ -47,7 +47,7 @@ static int mtk_hw_gain_event(struct snd_soc_dapm_widget *w,

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- if (strcmp(w->name, HW_GAIN_1_EN_W_NAME) == 0) {
+ if (snd_soc_dapm_widget_name_cmp(w, HW_GAIN_1_EN_W_NAME) == 0) {
gain_cur = AFE_GAIN1_CUR;
gain_con1 = AFE_GAIN1_CON1;
} else {
diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c b/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
index f07181be4370..7c4021221950 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
@@ -393,13 +393,13 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- if (strcmp(w->name, APLL1_W_NAME) == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
mt8186_apll1_enable(afe);
else
mt8186_apll2_enable(afe);
break;
case SND_SOC_DAPM_POST_PMD:
- if (strcmp(w->name, APLL1_W_NAME) == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
mt8186_apll1_disable(afe);
else
mt8186_apll2_disable(afe);
diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-src.c b/sound/soc/mediatek/mt8186/mt8186-dai-src.c
index 67989ffd67ca..e475f4591aef 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-src.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-src.c
@@ -322,7 +322,7 @@ static int mtk_hw_src_event(struct snd_soc_dapm_widget *w,
struct mtk_afe_src_priv *src_priv;
unsigned int reg;

- if (strcmp(w->name, HW_SRC_1_EN_W_NAME) == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, HW_SRC_1_EN_W_NAME) == 0)
id = MT8186_DAI_SRC_1;
else
id = MT8186_DAI_SRC_2;
@@ -487,7 +487,7 @@ static int mtk_afe_src_en_connect(struct snd_soc_dapm_widget *source,
struct mt8186_afe_private *afe_priv = afe->platform_priv;
struct mtk_afe_src_priv *src_priv;

- if (strcmp(w->name, HW_SRC_1_EN_W_NAME) == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, HW_SRC_1_EN_W_NAME) == 0)
src_priv = afe_priv->dai_priv[MT8186_DAI_SRC_1];
else
src_priv = afe_priv->dai_priv[MT8186_DAI_SRC_2];
--
2.34.1

2023-10-23 09:56:24

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 15/17] ASoC: mediatek: mt8192: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/mediatek/mt8192/mt8192-dai-adda.c | 4 ++--
sound/soc/mediatek/mt8192/mt8192-dai-i2s.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-adda.c b/sound/soc/mediatek/mt8192/mt8192-dai-adda.c
index 4919535e2759..36d33032a37a 100644
--- a/sound/soc/mediatek/mt8192/mt8192-dai-adda.c
+++ b/sound/soc/mediatek/mt8192/mt8192-dai-adda.c
@@ -435,7 +435,7 @@ static int mtk_adda_mtkaif_cfg_event(struct snd_soc_dapm_widget *w,
regmap_write(afe->regmap, AFE_ADDA6_MTKAIF_CFG0,
0x00010000);

- if (strcmp(w->name, "ADDA_MTKAIF_CFG") == 0 &&
+ if (snd_soc_dapm_widget_name_cmp(w, "ADDA_MTKAIF_CFG") == 0 &&
(afe_priv->mtkaif_chosen_phase[0] < 0 ||
afe_priv->mtkaif_chosen_phase[1] < 0)) {
dev_warn(afe->dev,
@@ -444,7 +444,7 @@ static int mtk_adda_mtkaif_cfg_event(struct snd_soc_dapm_widget *w,
afe_priv->mtkaif_chosen_phase[0],
afe_priv->mtkaif_chosen_phase[1]);
break;
- } else if (strcmp(w->name, "ADDA6_MTKAIF_CFG") == 0 &&
+ } else if (snd_soc_dapm_widget_name_cmp(w, "ADDA6_MTKAIF_CFG") == 0 &&
afe_priv->mtkaif_chosen_phase[2] < 0) {
dev_warn(afe->dev,
"%s(), mtkaif_chosen_phase[2]:%d\n",
diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c b/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c
index ea516d63d94d..47dc7ec4cae7 100644
--- a/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c
+++ b/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c
@@ -623,13 +623,13 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- if (strcmp(w->name, APLL1_W_NAME) == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
mt8192_apll1_enable(afe);
else
mt8192_apll2_enable(afe);
break;
case SND_SOC_DAPM_POST_PMD:
- if (strcmp(w->name, APLL1_W_NAME) == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
mt8192_apll1_disable(afe);
else
mt8192_apll2_disable(afe);
--
2.34.1

2023-10-23 09:56:27

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 09/17] ASoC: codecs: wm8962: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/wm8962.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 83ce5dbecc45..fb90ae6a8a34 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -1854,10 +1854,10 @@ static int tp_event(struct snd_soc_dapm_widget *w,

reg = WM8962_ADDITIONAL_CONTROL_4;

- if (!strcmp(w->name, "TEMP_HP")) {
+ if (!snd_soc_dapm_widget_name_cmp(w, "TEMP_HP")) {
mask = WM8962_TEMP_ENA_HP_MASK;
val = WM8962_TEMP_ENA_HP;
- } else if (!strcmp(w->name, "TEMP_SPK")) {
+ } else if (!snd_soc_dapm_widget_name_cmp(w, "TEMP_SPK")) {
mask = WM8962_TEMP_ENA_SPK_MASK;
val = WM8962_TEMP_ENA_SPK;
} else {
--
2.34.1

2023-10-23 09:56:29

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 10/17] ASoC: codecs: wm8994: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/wm8994.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index a48e904a9740..fc9894975a1d 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -262,7 +262,7 @@ static int check_clk_sys(struct snd_soc_dapm_widget *source,
else
clk = "AIF1CLK";

- return strcmp(source->name, clk) == 0;
+ return snd_soc_dapm_widget_name_cmp(source, clk) == 0;
}

static const char *sidetone_hpf_text[] = {
--
2.34.1

2023-10-23 09:56:30

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 14/17] ASoC: mediatek: mt8188: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/mediatek/mt8188/mt8188-dai-etdm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c b/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c
index 16440dd0a89c..2a48f5fd6826 100644
--- a/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c
+++ b/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c
@@ -576,13 +576,13 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- if (strcmp(w->name, APLL1_W_NAME) == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
mt8188_apll1_enable(afe);
else
mt8188_apll2_enable(afe);
break;
case SND_SOC_DAPM_POST_PMD:
- if (strcmp(w->name, APLL1_W_NAME) == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
mt8188_apll1_disable(afe);
else
mt8188_apll2_disable(afe);
--
2.34.1

2023-10-23 09:56:38

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 11/17] ASoC: codecs: wm8995: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/wm8995.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index 4ffa1896faab..59ef2ef8ce00 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -541,7 +541,7 @@ static int check_clk_sys(struct snd_soc_dapm_widget *source,
clk = "AIF2CLK";
else
clk = "AIF1CLK";
- return !strcmp(source->name, clk);
+ return !snd_soc_dapm_widget_name_cmp(source, clk);
}

static int wm8995_put_class_w(struct snd_kcontrol *kcontrol,
--
2.34.1

2023-10-23 09:56:39

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 12/17] ASoC: mediatek: mt8183: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/mediatek/mt8183/mt8183-dai-i2s.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c b/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c
index 8645ab686970..65e46ebe7be6 100644
--- a/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c
+++ b/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c
@@ -276,13 +276,13 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- if (strcmp(w->name, APLL1_W_NAME) == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
mt8183_apll1_enable(afe);
else
mt8183_apll2_enable(afe);
break;
case SND_SOC_DAPM_POST_PMD:
- if (strcmp(w->name, APLL1_W_NAME) == 0)
+ if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
mt8183_apll1_disable(afe);
else
mt8183_apll2_disable(afe);
--
2.34.1

2023-10-23 09:56:42

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 16/17] ASoC: samsung: speyside: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/samsung/speyside.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index 43519572dc69..79476e8eb680 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -111,9 +111,9 @@ static int speyside_jack_polarity;
static int speyside_get_micbias(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{
- if (speyside_jack_polarity && (strcmp(source->name, "MICB1") == 0))
+ if (speyside_jack_polarity && (snd_soc_dapm_widget_name_cmp(source, "MICB1") == 0))
return 1;
- if (!speyside_jack_polarity && (strcmp(source->name, "MICB2") == 0))
+ if (!speyside_jack_polarity && (snd_soc_dapm_widget_name_cmp(source, "MICB2") == 0))
return 1;

return 0;
--
2.34.1

2023-10-23 09:57:16

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [RFT PATCH 17/17] ASoC: tegra: machine: Handle component name prefix

Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
to include also the component's name prefix.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/tegra/tegra_asoc_machine.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c
index 3caadee9584f..192e9692bdf2 100644
--- a/sound/soc/tegra/tegra_asoc_machine.c
+++ b/sound/soc/tegra/tegra_asoc_machine.c
@@ -81,19 +81,23 @@ static int tegra_machine_event(struct snd_soc_dapm_widget *w,
struct snd_soc_dapm_context *dapm = w->dapm;
struct tegra_machine *machine = snd_soc_card_get_drvdata(dapm->card);

- if (!strcmp(w->name, "Int Spk") || !strcmp(w->name, "Speakers"))
+ if (!snd_soc_dapm_widget_name_cmp(w, "Int Spk") ||
+ !snd_soc_dapm_widget_name_cmp(w, "Speakers"))
gpiod_set_value_cansleep(machine->gpiod_spkr_en,
SND_SOC_DAPM_EVENT_ON(event));

- if (!strcmp(w->name, "Mic Jack") || !strcmp(w->name, "Headset Mic"))
+ if (!snd_soc_dapm_widget_name_cmp(w, "Mic Jack") ||
+ !snd_soc_dapm_widget_name_cmp(w, "Headset Mic"))
gpiod_set_value_cansleep(machine->gpiod_ext_mic_en,
SND_SOC_DAPM_EVENT_ON(event));

- if (!strcmp(w->name, "Int Mic") || !strcmp(w->name, "Internal Mic 2"))
+ if (!snd_soc_dapm_widget_name_cmp(w, "Int Mic") ||
+ !snd_soc_dapm_widget_name_cmp(w, "Internal Mic 2"))
gpiod_set_value_cansleep(machine->gpiod_int_mic_en,
SND_SOC_DAPM_EVENT_ON(event));

- if (!strcmp(w->name, "Headphone") || !strcmp(w->name, "Headphone Jack"))
+ if (!snd_soc_dapm_widget_name_cmp(w, "Headphone") ||
+ !snd_soc_dapm_widget_name_cmp(w, "Headphone Jack"))
gpiod_set_value_cansleep(machine->gpiod_hp_mute,
!SND_SOC_DAPM_EVENT_ON(event));

--
2.34.1

Subject: Re: [RFT PATCH 14/17] ASoC: mediatek: mt8188: Handle component name prefix

Il 23/10/23 11:54, Krzysztof Kozlowski ha scritto:
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>


Subject: Re: [RFT PATCH 15/17] ASoC: mediatek: mt8192: Handle component name prefix

Il 23/10/23 11:54, Krzysztof Kozlowski ha scritto:
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Tested-by: AngeloGioacchino Del Regno <[email protected]>

Subject: Re: [RFT PATCH 12/17] ASoC: mediatek: mt8183: Handle component name prefix

Il 23/10/23 11:54, Krzysztof Kozlowski ha scritto:
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>


Subject: Re: [RFT PATCH 13/17] ASoC: mediatek: mt8186: Handle component name prefix

Il 23/10/23 11:54, Krzysztof Kozlowski ha scritto:
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Tested-by: AngeloGioacchino Del Regno <[email protected]>

2023-10-26 05:42:40

by Nuno Sá

[permalink] [raw]
Subject: Re: [RFT PATCH 02/17] ASoC: codecs: adau1373: Handle component name prefix

On Mon, 2023-10-23 at 11:54 +0200, Krzysztof Kozlowski wrote:
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---

Reviewed-by: Nuno Sa <[email protected]>

>  sound/soc/codecs/adau1373.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c
> index b0ab0a69b207..3582c4b968a0 100644
> --- a/sound/soc/codecs/adau1373.c
> +++ b/sound/soc/codecs/adau1373.c
> @@ -834,7 +834,7 @@ static int adau1373_check_aif_clk(struct snd_soc_dapm_widget
> *source,
>         else
>                 clk = "SYSCLK2";
>  
> -       return strcmp(source->name, clk) == 0;
> +       return snd_soc_dapm_widget_name_cmp(source, clk) == 0;
>  }
>  
>  static int adau1373_check_src(struct snd_soc_dapm_widget *source,

2023-10-26 05:42:44

by Nuno Sá

[permalink] [raw]
Subject: Re: [RFT PATCH 05/17] ASoC: codecs: max9867: Handle component name prefix

On Mon, 2023-10-23 at 11:54 +0200, Krzysztof Kozlowski wrote:
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---

Reviewed-by: Nuno Sa <[email protected]>

>  sound/soc/codecs/max9867.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c
> index b616ad39858c..3b9dd158c34b 100644
> --- a/sound/soc/codecs/max9867.c
> +++ b/sound/soc/codecs/max9867.c
> @@ -56,13 +56,13 @@ static int max9867_adc_dac_event(struct snd_soc_dapm_widget *w,
>         struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
>         enum max9867_adc_dac adc_dac;
>  
> -       if (!strcmp(w->name, "ADCL"))
> +       if (!snd_soc_dapm_widget_name_cmp(w, "ADCL"))
>                 adc_dac = MAX9867_ADC_LEFT;
> -       else if (!strcmp(w->name, "ADCR"))
> +       else if (!snd_soc_dapm_widget_name_cmp(w, "ADCR"))
>                 adc_dac = MAX9867_ADC_RIGHT;
> -       else if (!strcmp(w->name, "DACL"))
> +       else if (!snd_soc_dapm_widget_name_cmp(w, "DACL"))
>                 adc_dac = MAX9867_DAC_LEFT;
> -       else if (!strcmp(w->name, "DACR"))
> +       else if (!snd_soc_dapm_widget_name_cmp(w, "DACR"))
>                 adc_dac = MAX9867_DAC_RIGHT;
>         else
>                 return 0;

2023-10-26 05:43:43

by Nuno Sá

[permalink] [raw]
Subject: Re: [RFT PATCH 03/17] ASoC: codecs: adav80x: Handle component name prefix

On Mon, 2023-10-23 at 11:54 +0200, Krzysztof Kozlowski wrote:
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---

Reviewed-by: Nuno Sa <[email protected]>

>  sound/soc/codecs/adav80x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
> index bb08969c5917..c8c0fc928211 100644
> --- a/sound/soc/codecs/adav80x.c
> +++ b/sound/soc/codecs/adav80x.c
> @@ -229,7 +229,7 @@ static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget
> *source,
>                 return 0;
>         }
>  
> -       return strcmp(source->name, clk) == 0;
> +       return snd_soc_dapm_widget_name_cmp(source, clk) == 0;
>  }
>  
>  static int adav80x_dapm_pll_check(struct snd_soc_dapm_widget *source,

2023-10-26 08:53:32

by Charles Keepax

[permalink] [raw]
Subject: Re: [RFT PATCH 09/17] ASoC: codecs: wm8962: Handle component name prefix

On Mon, Oct 23, 2023 at 11:54:20AM +0200, Krzysztof Kozlowski wrote:
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---

Alas I don't have hardware of these CODECs to test, but looks
fine to me:

Acked-by: Charles Keepax <[email protected]>

Thanks,
Charles

2023-10-26 08:53:37

by Charles Keepax

[permalink] [raw]
Subject: Re: [RFT PATCH 10/17] ASoC: codecs: wm8994: Handle component name prefix

On Mon, Oct 23, 2023 at 11:54:21AM +0200, Krzysztof Kozlowski wrote:
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---

Acked-by: Charles Keepax <[email protected]>

Thanks,
Charles

2023-10-26 08:53:49

by Charles Keepax

[permalink] [raw]
Subject: Re: [RFT PATCH 11/17] ASoC: codecs: wm8995: Handle component name prefix

On Mon, Oct 23, 2023 at 11:54:22AM +0200, Krzysztof Kozlowski wrote:
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---

Acked-by: Charles Keepax <[email protected]>

Thanks,
Charles

2023-10-26 09:10:21

by Trevor Wu (吳文良)

[permalink] [raw]
Subject: Re: [RFT PATCH 14/17] ASoC: mediatek: mt8188: Handle component name prefix

On Mon, 2023-10-23 at 11:54 +0200, Krzysztof Kozlowski wrote:
>
> Use snd_soc_dapm_widget_name_cmp() helper when comparing widget
> names,
> to include also the component's name prefix.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>

Reviewed-by: Trevor Wu <[email protected]>

2023-10-26 17:10:38

by Mark Brown

[permalink] [raw]
Subject: Re: [RFT PATCH 00/17] ASoC: fix widget name comparisons (consider DAI name prefix)

On Mon, 23 Oct 2023 11:54:11 +0200, Krzysztof Kozlowski wrote:
> Some codec drivers compare widget names with strcmp, ignoring
> the component name prefix. If prefix is used, the comparisons start failing.
>
> Except Qualcomm lpass-rx-macro, none of the patches were tested
> on hardware.
>
> Best regards,
> Krzysztof
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[01/17] ASoC: codecs: 88pm860x: Handle component name prefix
commit: ccd0c6c7097b52b01a2c5951cfe96714d4421cd2
[02/17] ASoC: codecs: adau1373: Handle component name prefix
commit: 7a0762587a814387e631c07ae81169a7c646f012
[03/17] ASoC: codecs: adav80x: Handle component name prefix
commit: ecea1812b911fed5e675b2d37b29ad4265c067ce
[04/17] ASoC: codecs: lpass-rx-macro: Handle component name prefix
commit: 5efc1c903e2b43a267ad13696698fcc152ed873a
[05/17] ASoC: codecs: max9867: Handle component name prefix
commit: a1fa72a780f428ddc956cf5ed4b97e2be76ceba3
[06/17] ASoC: codecs: rt5682s: Handle component name prefix
commit: b2056ce3cf61a39796041dc5c94d7255de7f9f0c
[07/17] ASoC: codecs: rtq9128: Handle component name prefix
commit: e2d38e1196f61735716f9c2dd89dff32c0655529
[08/17] ASoC: codecs: wcd9335: Handle component name prefix
commit: 7df1e6a3c608ab0c345b8898f9ee5d5ac19f2eb4
[09/17] ASoC: codecs: wm8962: Handle component name prefix
commit: e54db8826f48c9ca52f2abd108d6e030ff20cae5
[10/17] ASoC: codecs: wm8994: Handle component name prefix
commit: e13b63c47578a27dbf8907974f0dcba0bb2efe58
[11/17] ASoC: codecs: wm8995: Handle component name prefix
commit: 343b62590d5b950c8bf7f78fef7c81103c5f982c
[12/17] ASoC: mediatek: mt8183: Handle component name prefix
commit: e84c7f5db97474cb4becd863a93d4ea541dc4110
[13/17] ASoC: mediatek: mt8186: Handle component name prefix
commit: 0fe153a99fcc2edeae4e863b03c5a8f71376629e
[14/17] ASoC: mediatek: mt8188: Handle component name prefix
commit: d1ecaabe9f1a669354de7420261bd8737da4bf48
[15/17] ASoC: mediatek: mt8192: Handle component name prefix
commit: 86cfaf99e4d3c7b4707fb8cc9eb06d8db10c1414
[16/17] ASoC: samsung: speyside: Handle component name prefix
commit: 317dd0dbadd8bd4de2d69fa6a0611456f3e15b1a
[17/17] ASoC: tegra: machine: Handle component name prefix
commit: f82eb06a40c86c9a82537e956de401d497203d3a

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