Message ID | 20200811102552.26975-1-srinivas.kandagatla@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] ASoC: q6afe-dai: add dummy register read function | expand |
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
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 >
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.
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,
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(-)