linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: q6afe-dai: add dummy register read function
@ 2020-08-11 10:25 Srinivas Kandagatla
  2020-08-11 10:25 ` [PATCH 2/2] ASoC: q6routing: " Srinivas Kandagatla
  2020-08-11 11:04 ` [PATCH 1/2] ASoC: q6afe-dai: " Stephan Gerhold
  0 siblings, 2 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2020-08-11 10:25 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, alsa-devel, linux-kernel, lgirdwood, john.stultz,
	Srinivas Kandagatla

Most of the DAPM widgets for DSP ASoC components reuse reg field
of the widgets for its internal calculations, however these are not
real registers. So read/writes to these numbers are not really
valid. However ASoC core will read these registers to get default
state during startup.

With recent changes to ASoC core, every register read/write
failures are reported very verbosely. Prior to this fails to reads
are totally ignored, so we never saw any error messages.

To fix this add dummy read function to return default value.

Reported-by: John Stultz <john.stultz@linaro.org>
Fixes: 24c4cbcfac09 ("ASoC: qdsp6: q6afe: Add q6afe dai driver")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/qdsp6/q6afe-dai.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c
index 2a5302f1db98..492bdbaf13c4 100644
--- a/sound/soc/qcom/qdsp6/q6afe-dai.c
+++ b/sound/soc/qcom/qdsp6/q6afe-dai.c
@@ -1352,6 +1352,13 @@ static const struct snd_soc_dapm_widget q6afe_dai_widgets[] = {
 	SND_SOC_DAPM_AIF_OUT("DISPLAY_PORT_RX", "NULL", 0, 0, 0, 0),
 };
 
+static unsigned int q6afe_reg_read(struct snd_soc_component *component,
+				   unsigned int reg)
+{
+	/* default value */
+	return 0;
+}
+
 static const struct snd_soc_component_driver q6afe_dai_component = {
 	.name		= "q6afe-dai-component",
 	.dapm_widgets = q6afe_dai_widgets,
@@ -1359,7 +1366,7 @@ static const struct snd_soc_component_driver q6afe_dai_component = {
 	.dapm_routes = q6afe_dapm_routes,
 	.num_dapm_routes = ARRAY_SIZE(q6afe_dapm_routes),
 	.of_xlate_dai_name = q6afe_of_xlate_dai_name,
-
+	.read = q6afe_reg_read,
 };
 
 static void of_q6afe_parse_dai_data(struct device *dev,
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ASoC: q6routing: add dummy register read function
  2020-08-11 10:25 [PATCH 1/2] ASoC: q6afe-dai: add dummy register read function Srinivas Kandagatla
@ 2020-08-11 10:25 ` Srinivas Kandagatla
  2020-08-11 11:04 ` [PATCH 1/2] ASoC: q6afe-dai: " Stephan Gerhold
  1 sibling, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2020-08-11 10:25 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, alsa-devel, linux-kernel, lgirdwood, john.stultz,
	Srinivas Kandagatla

Most of the DAPM widgets for DSP ASoC components reuse reg field
of the widgets for its internal calculations, however these are not
real registers. So read/writes to these numbers are not really
valid. However ASoC core will read these registers to get default
state during startup.

With recent changes to ASoC core, every register read/write
failures are reported very verbosely. Prior to this fails to reads
are totally ignored, so we never saw any error messages.

To fix this add dummy read function to return default value.

Reported-by: John Stultz <john.stultz@linaro.org>
Fixes: e3a33673e845 ("ASoC: qdsp6: q6routing: Add q6routing driver")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/qdsp6/q6routing.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
index eaa95b5a7b66..fb7c4b266d19 100644
--- a/sound/soc/qcom/qdsp6/q6routing.c
+++ b/sound/soc/qcom/qdsp6/q6routing.c
@@ -973,6 +973,13 @@ static int msm_routing_probe(struct snd_soc_component *c)
 	return 0;
 }
 
+static unsigned int q6routing_reg_read(struct snd_soc_component *component,
+				       unsigned int reg)
+{
+	/* default value */
+	return 0;
+}
+
 static const struct snd_soc_component_driver msm_soc_routing_component = {
 	.probe = msm_routing_probe,
 	.name = DRV_NAME,
@@ -981,6 +988,7 @@ static const struct snd_soc_component_driver msm_soc_routing_component = {
 	.num_dapm_widgets = ARRAY_SIZE(msm_qdsp6_widgets),
 	.dapm_routes = intercon,
 	.num_dapm_routes = ARRAY_SIZE(intercon),
+	.read = q6routing_reg_read,
 };
 
 static int q6pcm_routing_probe(struct platform_device *pdev)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] ASoC: q6afe-dai: add dummy register read function
  2020-08-11 10:25 [PATCH 1/2] ASoC: q6afe-dai: add dummy register read function Srinivas Kandagatla
  2020-08-11 10:25 ` [PATCH 2/2] ASoC: q6routing: " Srinivas Kandagatla
@ 2020-08-11 11:04 ` Stephan Gerhold
  2020-08-11 11:16   ` Srinivas Kandagatla
  2020-08-11 11:36   ` Mark Brown
  1 sibling, 2 replies; 5+ messages in thread
From: Stephan Gerhold @ 2020-08-11 11:04 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: broonie, alsa-devel, linux-kernel, lgirdwood, tiwai, john.stultz

On Tue, Aug 11, 2020 at 11:25:51AM +0100, Srinivas Kandagatla wrote:
> Most of the DAPM widgets for DSP ASoC components reuse reg field
> of the widgets for its internal calculations, however these are not
> real registers. So read/writes to these numbers are not really
> valid. However ASoC core will read these registers to get default
> state during startup.
> 

Actually q6afe-dai does not seem to make use of the register number.
The DAPM widgets all look like

  SND_SOC_DAPM_AIF_IN("HDMI_RX",  NULL,   0,    0,     0,      0),
                  /* (wname,    stname, wchan, wreg, wshift, winvert)

Wouldn't it be better to replace wreg = 0 with SND_SOC_NOPM in this case
so the read/write won't happen at all?

q6routing on the other hand does make use of wreg, so this would not
work there...

Also: If I remember correctly the ASoC core will also attempt to write
to these "registers" when starting to play some audio, so you might also
need to implement component->write().

Stephan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] ASoC: q6afe-dai: add dummy register read function
  2020-08-11 11:04 ` [PATCH 1/2] ASoC: q6afe-dai: " Stephan Gerhold
@ 2020-08-11 11:16   ` Srinivas Kandagatla
  2020-08-11 11:36   ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2020-08-11 11:16 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: broonie, alsa-devel, linux-kernel, lgirdwood, tiwai, john.stultz



On 11/08/2020 12:04, Stephan Gerhold wrote:
> On Tue, Aug 11, 2020 at 11:25:51AM +0100, Srinivas Kandagatla wrote:
>> Most of the DAPM widgets for DSP ASoC components reuse reg field
>> of the widgets for its internal calculations, however these are not
>> real registers. So read/writes to these numbers are not really
>> valid. However ASoC core will read these registers to get default
>> state during startup.
>>
> 
> Actually q6afe-dai does not seem to make use of the register number.
> The DAPM widgets all look like
> 
>    SND_SOC_DAPM_AIF_IN("HDMI_RX",  NULL,   0,    0,     0,      0),
>                    /* (wname,    stname, wchan, wreg, wshift, winvert)
> 
> Wouldn't it be better to replace wreg = 0 with SND_SOC_NOPM in this case
> so the read/write won't happen at all?
That should work, let me try that!

--srini
> 
> q6routing on the other hand does make use of wreg, so this would not
> work there...
> 
> Also: If I remember correctly the ASoC core will also attempt to write
> to these "registers" when starting to play some audio, so you might also
> need to implement component->write().

> 
> Stephan
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] ASoC: q6afe-dai: add dummy register read function
  2020-08-11 11:04 ` [PATCH 1/2] ASoC: q6afe-dai: " Stephan Gerhold
  2020-08-11 11:16   ` Srinivas Kandagatla
@ 2020-08-11 11:36   ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2020-08-11 11:36 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Srinivas Kandagatla, alsa-devel, linux-kernel, lgirdwood, tiwai,
	john.stultz

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

On Tue, Aug 11, 2020 at 01:04:09PM +0200, Stephan Gerhold wrote:

> Actually q6afe-dai does not seem to make use of the register number.
> The DAPM widgets all look like

>   SND_SOC_DAPM_AIF_IN("HDMI_RX",  NULL,   0,    0,     0,      0),
>                   /* (wname,    stname, wchan, wreg, wshift, winvert)

> Wouldn't it be better to replace wreg = 0 with SND_SOC_NOPM in this case
> so the read/write won't happen at all?

Yes, if they are not used at all then that's what _NOPM is for.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-11 11:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 10:25 [PATCH 1/2] ASoC: q6afe-dai: add dummy register read function Srinivas Kandagatla
2020-08-11 10:25 ` [PATCH 2/2] ASoC: q6routing: " Srinivas Kandagatla
2020-08-11 11:04 ` [PATCH 1/2] ASoC: q6afe-dai: " Stephan Gerhold
2020-08-11 11:16   ` Srinivas Kandagatla
2020-08-11 11:36   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).