diff mbox series

ASoC: msm8916-wcd-digital: Remove broken MIX2 DAPM routes

Message ID 20191007181952.34786-1-stephan@gerhold.net (mailing list archive)
State New, archived
Headers show
Series ASoC: msm8916-wcd-digital: Remove broken MIX2 DAPM routes | expand

Commit Message

Stephan Gerhold Oct. 7, 2019, 6:19 p.m. UTC
Since 5.3-rc1, the kernel (correctly) complains about missing
widgets when loading msm8916-wcd-digital:

	ASoC: no sink widget found for RX1 MIX2 INP1
	ASoC: Failed to add route IIR1 -> IIR1 -> RX1 MIX2 INP1
	ASoC: no sink widget found for RX2 MIX2 INP1
	ASoC: Failed to add route IIR1 -> IIR1 -> RX2 MIX2 INP1
	ASoC: no sink widget found for RX1 MIX2 INP1
	ASoC: Failed to add route IIR2 -> IIR2 -> RX1 MIX2 INP1
	ASoC: no sink widget found for RX2 MIX2 INP1
	ASoC: Failed to add route IIR2 -> IIR2 -> RX2 MIX2 INP1

This happens because RX1/2 MIX2 INP1 is not actually supported by
msm8916-wcd-digital for some reason. There were some traces of it
in the initial patch, but the last remnants were removed in
commit fecd5c09ddf8 ("ASoC: msm8916-wcd-digital: remove few unused variables").

On 5.3 everything seemingly worked even with that error, but on 5.4-rc1
the sound card is no longer successfully registered:

	qcom-apq8016-sbc 7702000.sound: ASoC: failed to instantiate card -19

This happens because a check for the return code of
snd_soc_dapm_add_routes() was added in
commit daa480bde6b3 ("ASoC: soc-core: tidyup for snd_soc_dapm_add_routes()").

Avoid the error by removing the routes that reference the missing widgets.

Fixes: ef8a4757a6db ("ASoC: msm8916-wcd-digital: Add sidetone support")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 sound/soc/codecs/msm8916-wcd-digital.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Srinivas Kandagatla Oct. 9, 2019, 9:15 a.m. UTC | #1
Hi Stephan,
Thanks for testing and reporting this!

On 07/10/2019 19:19, Stephan Gerhold wrote:
> Since 5.3-rc1, the kernel (correctly) complains about missing
> widgets when loading msm8916-wcd-digital:
> 
> 	ASoC: no sink widget found for RX1 MIX2 INP1
> 	ASoC: Failed to add route IIR1 -> IIR1 -> RX1 MIX2 INP1
> 	ASoC: no sink widget found for RX2 MIX2 INP1
> 	ASoC: Failed to add route IIR1 -> IIR1 -> RX2 MIX2 INP1
> 	ASoC: no sink widget found for RX1 MIX2 INP1
> 	ASoC: Failed to add route IIR2 -> IIR2 -> RX1 MIX2 INP1
> 	ASoC: no sink widget found for RX2 MIX2 INP1
> 	ASoC: Failed to add route IIR2 -> IIR2 -> RX2 MIX2 INP1
> 
> This happens because RX1/2 MIX2 INP1 is not actually supported by
> msm8916-wcd-digital for some reason. There were some traces of it

RX1/2 MIX2 path is supported by the codec with IIR1 and IIR2 inputs on INP1.

MIX2 path was not added when we added first codec support as there was 
no IIR support. I think I totally missed adding this while adding IIR 
support.
Better fix here would be to add that missing path.

Can you try this patch?

------------------------------------->cut<-----------------------------

 From c54cc63897794efdf3c9fa8886d8377f80c272f8 Mon Sep 17 00:00:00 2001
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date: Wed, 9 Oct 2019 10:10:09 +0100
Subject: [PATCH] ASoC: msm8916-wcd-digital: add missing MIX2 path for RX1/2

This patch adds missing MIX2 path on RX1/2 which take IIR1 and
IIR2 as inputs.

Without this patch sound card fails to intialize with below warning:

  ASoC: no sink widget found for RX1 MIX2 INP1
  ASoC: Failed to add route IIR1 -> IIR1 -> RX1 MIX2 INP1
  ASoC: no sink widget found for RX2 MIX2 INP1
  ASoC: Failed to add route IIR1 -> IIR1 -> RX2 MIX2 INP1
  ASoC: no sink widget found for RX1 MIX2 INP1
  ASoC: Failed to add route IIR2 -> IIR2 -> RX1 MIX2 INP1
  ASoC: no sink widget found for RX2 MIX2 INP1
  ASoC: Failed to add route IIR2 -> IIR2 -> RX2 MIX2 INP1

Reported-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
  sound/soc/codecs/msm8916-wcd-digital.c | 22 ++++++++++++++++++++++
  1 file changed, 22 insertions(+)

diff --git a/sound/soc/codecs/msm8916-wcd-digital.c 
b/sound/soc/codecs/msm8916-wcd-digital.c
index 9fa5d44fdc79..58b2468fb2a7 100644
--- a/sound/soc/codecs/msm8916-wcd-digital.c
+++ b/sound/soc/codecs/msm8916-wcd-digital.c
@@ -243,6 +243,10 @@ static const char *const rx_mix1_text[] = {
  	"ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3"
  };

+static const char * const rx_mix2_text[] = {
+	"ZERO", "IIR1", "IIR2"
+};
+
  static const char *const dec_mux_text[] = {
  	"ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2"
  };
@@ -270,6 +274,16 @@ static const struct soc_enum rx3_mix1_inp_enum[] = {
  	SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B2_CTL, 0, 6, rx_mix1_text),
  };

+/* RX1 MIX2 */
+static const struct soc_enum rx_mix2_inp1_chain_enum =
+	SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX1_B3_CTL,
+		0, 3, rx_mix2_text);
+
+/* RX2 MIX2 */
+static const struct soc_enum rx2_mix2_inp1_chain_enum =
+	SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX2_B3_CTL,
+		0, 3, rx_mix2_text);
+
  /* DEC */
  static const struct soc_enum dec1_mux_enum = SOC_ENUM_SINGLE(
  				LPASS_CDC_CONN_TX_B1_CTL, 0, 6, dec_mux_text);
@@ -309,6 +323,10 @@ static const struct snd_kcontrol_new 
rx3_mix1_inp2_mux = SOC_DAPM_ENUM(
  				"RX3 MIX1 INP2 Mux", rx3_mix1_inp_enum[1]);
  static const struct snd_kcontrol_new rx3_mix1_inp3_mux = SOC_DAPM_ENUM(
  				"RX3 MIX1 INP3 Mux", rx3_mix1_inp_enum[2]);
+static const struct snd_kcontrol_new rx1_mix2_inp1_mux = SOC_DAPM_ENUM(
+				"RX1 MIX2 INP1 Mux", rx_mix2_inp1_chain_enum);
+static const struct snd_kcontrol_new rx2_mix2_inp1_mux = SOC_DAPM_ENUM(
+				"RX2 MIX2 INP1 Mux", rx2_mix2_inp1_chain_enum);

  /* Digital Gain control -38.4 dB to +38.4 dB in 0.3 dB steps */
  static const DECLARE_TLV_DB_SCALE(digital_gain, -3840, 30, 0);
@@ -740,6 +758,10 @@ static const struct snd_soc_dapm_widget 
msm8916_wcd_digital_dapm_widgets[] = {
  			 &rx3_mix1_inp2_mux),
  	SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0,
  			 &rx3_mix1_inp3_mux),
+	SND_SOC_DAPM_MUX("RX1 MIX2 INP1", SND_SOC_NOPM, 0, 0,
+			 &rx1_mix2_inp1_mux),
+	SND_SOC_DAPM_MUX("RX2 MIX2 INP1", SND_SOC_NOPM, 0, 0,
+			 &rx2_mix2_inp1_mux),

  	SND_SOC_DAPM_MUX("CIC1 MUX", SND_SOC_NOPM, 0, 0, &cic1_mux),
  	SND_SOC_DAPM_MUX("CIC2 MUX", SND_SOC_NOPM, 0, 0, &cic2_mux),
Stephan Gerhold Oct. 9, 2019, 11:15 a.m. UTC | #2
On Wed, Oct 09, 2019 at 10:15:57AM +0100, Srinivas Kandagatla wrote:
> Hi Stephan,
> Thanks for testing and reporting this!
> 
> On 07/10/2019 19:19, Stephan Gerhold wrote:
> > Since 5.3-rc1, the kernel (correctly) complains about missing
> > widgets when loading msm8916-wcd-digital:
> > 
> > 	ASoC: no sink widget found for RX1 MIX2 INP1
> > 	ASoC: Failed to add route IIR1 -> IIR1 -> RX1 MIX2 INP1
> > 	ASoC: no sink widget found for RX2 MIX2 INP1
> > 	ASoC: Failed to add route IIR1 -> IIR1 -> RX2 MIX2 INP1
> > 	ASoC: no sink widget found for RX1 MIX2 INP1
> > 	ASoC: Failed to add route IIR2 -> IIR2 -> RX1 MIX2 INP1
> > 	ASoC: no sink widget found for RX2 MIX2 INP1
> > 	ASoC: Failed to add route IIR2 -> IIR2 -> RX2 MIX2 INP1
> > 
> > This happens because RX1/2 MIX2 INP1 is not actually supported by
> > msm8916-wcd-digital for some reason. There were some traces of it
> 
> RX1/2 MIX2 path is supported by the codec with IIR1 and IIR2 inputs on INP1.
> 
> MIX2 path was not added when we added first codec support as there was no
> IIR support. I think I totally missed adding this while adding IIR support.
> Better fix here would be to add that missing path.
> 

Either way is fine for me, as long as it gets fixed for 5.4 :)

> Can you try this patch?
> 
> ------------------------------------->cut<-----------------------------
> 
> From c54cc63897794efdf3c9fa8886d8377f80c272f8 Mon Sep 17 00:00:00 2001
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Date: Wed, 9 Oct 2019 10:10:09 +0100
> Subject: [PATCH] ASoC: msm8916-wcd-digital: add missing MIX2 path for RX1/2
> 
> This patch adds missing MIX2 path on RX1/2 which take IIR1 and
> IIR2 as inputs.
> 
> Without this patch sound card fails to intialize with below warning:
> 
>  ASoC: no sink widget found for RX1 MIX2 INP1
>  ASoC: Failed to add route IIR1 -> IIR1 -> RX1 MIX2 INP1
>  ASoC: no sink widget found for RX2 MIX2 INP1
>  ASoC: Failed to add route IIR1 -> IIR1 -> RX2 MIX2 INP1
>  ASoC: no sink widget found for RX1 MIX2 INP1
>  ASoC: Failed to add route IIR2 -> IIR2 -> RX1 MIX2 INP1
>  ASoC: no sink widget found for RX2 MIX2 INP1
>  ASoC: Failed to add route IIR2 -> IIR2 -> RX2 MIX2 INP1
> 
> Reported-by: Stephan Gerhold <stephan@gerhold.net>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/codecs/msm8916-wcd-digital.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/sound/soc/codecs/msm8916-wcd-digital.c
> b/sound/soc/codecs/msm8916-wcd-digital.c
> index 9fa5d44fdc79..58b2468fb2a7 100644
> --- a/sound/soc/codecs/msm8916-wcd-digital.c
> +++ b/sound/soc/codecs/msm8916-wcd-digital.c
> @@ -243,6 +243,10 @@ static const char *const rx_mix1_text[] = {
>  	"ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3"
>  };
> 
> +static const char * const rx_mix2_text[] = {
> +	"ZERO", "IIR1", "IIR2"
> +};
> +
>  static const char *const dec_mux_text[] = {
>  	"ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2"
>  };
> @@ -270,6 +274,16 @@ static const struct soc_enum rx3_mix1_inp_enum[] = {
>  	SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B2_CTL, 0, 6, rx_mix1_text),
>  };
> 
> +/* RX1 MIX2 */
> +static const struct soc_enum rx_mix2_inp1_chain_enum =
> +	SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX1_B3_CTL,
> +		0, 3, rx_mix2_text);
> +
> +/* RX2 MIX2 */
> +static const struct soc_enum rx2_mix2_inp1_chain_enum =
> +	SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX2_B3_CTL,
> +		0, 3, rx_mix2_text);
> +
>  /* DEC */
>  static const struct soc_enum dec1_mux_enum = SOC_ENUM_SINGLE(
>  				LPASS_CDC_CONN_TX_B1_CTL, 0, 6, dec_mux_text);
> @@ -309,6 +323,10 @@ static const struct snd_kcontrol_new rx3_mix1_inp2_mux
> = SOC_DAPM_ENUM(
>  				"RX3 MIX1 INP2 Mux", rx3_mix1_inp_enum[1]);
>  static const struct snd_kcontrol_new rx3_mix1_inp3_mux = SOC_DAPM_ENUM(
>  				"RX3 MIX1 INP3 Mux", rx3_mix1_inp_enum[2]);
> +static const struct snd_kcontrol_new rx1_mix2_inp1_mux = SOC_DAPM_ENUM(
> +				"RX1 MIX2 INP1 Mux", rx_mix2_inp1_chain_enum);
> +static const struct snd_kcontrol_new rx2_mix2_inp1_mux = SOC_DAPM_ENUM(
> +				"RX2 MIX2 INP1 Mux", rx2_mix2_inp1_chain_enum);
> 
>  /* Digital Gain control -38.4 dB to +38.4 dB in 0.3 dB steps */
>  static const DECLARE_TLV_DB_SCALE(digital_gain, -3840, 30, 0);
> @@ -740,6 +758,10 @@ static const struct snd_soc_dapm_widget
> msm8916_wcd_digital_dapm_widgets[] = {
>  			 &rx3_mix1_inp2_mux),
>  	SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0,
>  			 &rx3_mix1_inp3_mux),
> +	SND_SOC_DAPM_MUX("RX1 MIX2 INP1", SND_SOC_NOPM, 0, 0,
> +			 &rx1_mix2_inp1_mux),
> +	SND_SOC_DAPM_MUX("RX2 MIX2 INP1", SND_SOC_NOPM, 0, 0,
> +			 &rx2_mix2_inp1_mux),
> 
>  	SND_SOC_DAPM_MUX("CIC1 MUX", SND_SOC_NOPM, 0, 0, &cic1_mux),
>  	SND_SOC_DAPM_MUX("CIC2 MUX", SND_SOC_NOPM, 0, 0, &cic2_mux),
> -- 
> 2.21.0
> 
> ------------------------------------->cut<-----------------------------
> 

Thanks for the patch!

I think your mail client messed it up, but I managed to apply it with
some manual fixes. It seems to work fine too:

Tested-by: Stephan Gerhold <stephan@gerhold.net>

Thanks,
Stephan
Srinivas Kandagatla Oct. 9, 2019, 11:18 a.m. UTC | #3
On 09/10/2019 12:15, Stephan Gerhold wrote:
> Thanks for the patch!
> 
> I think your mail client messed it up, but I managed to apply it with
> some manual fixes. It seems to work fine too:
> 
> Tested-by: Stephan Gerhold<stephan@gerhold.net>
Thanks for testing!

--srini
diff mbox series

Patch

diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c
index 9fa5d44fdc79..36d8f619e298 100644
--- a/sound/soc/codecs/msm8916-wcd-digital.c
+++ b/sound/soc/codecs/msm8916-wcd-digital.c
@@ -1022,11 +1022,6 @@  static const struct snd_soc_dapm_route msm8916_wcd_digital_audio_map[] = {
 	{"RX3 MIX1 INP2", "IIR1", "IIR1"},
 	{"RX3 MIX1 INP2", "IIR2", "IIR2"},
 
-	{"RX1 MIX2 INP1", "IIR1", "IIR1"},
-	{"RX2 MIX2 INP1", "IIR1", "IIR1"},
-	{"RX1 MIX2 INP1", "IIR2", "IIR2"},
-	{"RX2 MIX2 INP1", "IIR2", "IIR2"},
-
 	{"IIR1", NULL, "IIR1 INP1 MUX"},
 	{"IIR1 INP1 MUX", "DEC1", "DEC1 MUX"},
 	{"IIR1 INP1 MUX", "DEC2", "DEC2 MUX"},