[PATCH 0/4] Fix kcontrol put callback in Tegra drivers
This series fixes kcontrol put callback in some of the Tegra drivers which are used on platforms based on Tegra210 and later. The callback is expected to return 1 whenever the HW update is done.
ADMAIF, I2S, DMIC and DSPK drivers are updated as part of it.
This idea is suggested by Jaroslav. Similar suggestion came from Mark during review of series [0] and drivers under those series were taken care. This series takes care of remaining drivers. I have added 'Suggested-by" tags accordingly.
[0] https://lore.kernel.org/linux-arm-kernel/20210913142307.GF4283@sirena.org.uk...
Sameer Pujar (4): ASoC: tegra: Fix kcontrol put callback in ADMAIF ASoC: tegra: Fix kcontrol put callback in I2S ASoC: tegra: Fix kcontrol put callback in DMIC ASoC: tegra: Fix kcontrol put callback in DSPK
sound/soc/tegra/tegra186_dspk.c | 4 +++- sound/soc/tegra/tegra210_admaif.c | 4 +++- sound/soc/tegra/tegra210_dmic.c | 4 +++- sound/soc/tegra/tegra210_i2s.c | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-)
The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Update the ADMAIF driver accordingly
Fixes: f74028e159bb ("ASoC: tegra: Add Tegra210 based ADMAIF driver") Suggested-by: Jaroslav Kysela perex@perex.cz Suggested-by: Mark Brown broonie@kernel.org Signed-off-by: Sameer Pujar spujar@nvidia.com --- sound/soc/tegra/tegra210_admaif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/tegra/tegra210_admaif.c b/sound/soc/tegra/tegra210_admaif.c index bcccdf3..36ba980 100644 --- a/sound/soc/tegra/tegra210_admaif.c +++ b/sound/soc/tegra/tegra210_admaif.c @@ -460,8 +460,10 @@ static int tegra_admaif_put_control(struct snd_kcontrol *kcontrol, admaif->stereo_to_mono[ADMAIF_TX_PATH][ec->reg] = value; else if (strstr(kcontrol->id.name, "Capture Stereo To Mono")) admaif->stereo_to_mono[ADMAIF_RX_PATH][ec->reg] = value; + else + return 0;
- return 0; + return 1; }
static int tegra_admaif_dai_probe(struct snd_soc_dai *dai)
The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Update the I2S driver accordingly.
Fixes: c0bfa98349d1 ("ASoC: tegra: Add Tegra210 based I2S driver") Suggested-by: Jaroslav Kysela perex@perex.cz Suggested-by: Mark Brown broonie@kernel.org Signed-off-by: Sameer Pujar spujar@nvidia.com --- sound/soc/tegra/tegra210_i2s.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/tegra/tegra210_i2s.c b/sound/soc/tegra/tegra210_i2s.c index 45f31cc..b738b21 100644 --- a/sound/soc/tegra/tegra210_i2s.c +++ b/sound/soc/tegra/tegra210_i2s.c @@ -380,9 +380,11 @@ static int tegra210_i2s_put_control(struct snd_kcontrol *kcontrol, i2s->rx_fifo_th = value; } else if (strstr(kcontrol->id.name, "BCLK Ratio")) { i2s->bclk_ratio = value; + } else { + return 0; }
- return 0; + return 1; }
static int tegra210_i2s_set_timing_params(struct device *dev,
The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Update the DMIC driver accordingly.
Fixes: 8c8ff982e9e2 ("ASoC: tegra: Add Tegra210 based DMIC driver") Suggested-by: Jaroslav Kysela perex@perex.cz Suggested-by: Mark Brown broonie@kernel.org Signed-off-by: Sameer Pujar spujar@nvidia.com --- sound/soc/tegra/tegra210_dmic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/tegra/tegra210_dmic.c b/sound/soc/tegra/tegra210_dmic.c index b096478..133509f 100644 --- a/sound/soc/tegra/tegra210_dmic.c +++ b/sound/soc/tegra/tegra210_dmic.c @@ -197,8 +197,10 @@ static int tegra210_dmic_put_control(struct snd_kcontrol *kcontrol, dmic->osr_val = value; else if (strstr(kcontrol->id.name, "LR Polarity Select")) dmic->lrsel = value; + else + return 0;
- return 0; + return 1; }
static const struct snd_soc_dai_ops tegra210_dmic_dai_ops = {
The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Update the DSPK driver accordingly.
Fixes: 327ef6470266 ("ASoC: tegra: Add Tegra186 based DSPK driver") Suggested-by: Jaroslav Kysela perex@perex.cz Suggested-by: Mark Brown broonie@kernel.org Signed-off-by: Sameer Pujar spujar@nvidia.com --- sound/soc/tegra/tegra186_dspk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/tegra/tegra186_dspk.c b/sound/soc/tegra/tegra186_dspk.c index 8ee9a77..3b1bdb7 100644 --- a/sound/soc/tegra/tegra186_dspk.c +++ b/sound/soc/tegra/tegra186_dspk.c @@ -67,8 +67,10 @@ static int tegra186_dspk_put_control(struct snd_kcontrol *kcontrol, dspk->mono_to_stereo = val; else if (strstr(kcontrol->id.name, "Stereo To Mono")) dspk->stereo_to_mono = val; + else + return 0;
- return 0; + return 1; }
static int __maybe_unused tegra186_dspk_runtime_suspend(struct device *dev)
On 03. 11. 21 6:04, Sameer Pujar wrote:
This series fixes kcontrol put callback in some of the Tegra drivers which are used on platforms based on Tegra210 and later. The callback is expected to return 1 whenever the HW update is done.
The logic is a little bit another. The 1 means change, so you should compare the register / cached value and return 1 only when a different value is set. Your implementation invokes the change events for duplicate updates.
Jaroslav
On 11/3/2021 2:20 PM, Jaroslav Kysela wrote:
External email: Use caution opening links or attachments
On 03. 11. 21 6:04, Sameer Pujar wrote:
This series fixes kcontrol put callback in some of the Tegra drivers which are used on platforms based on Tegra210 and later. The callback is expected to return 1 whenever the HW update is done.
The logic is a little bit another. The 1 means change, so you should compare the register / cached value and return 1 only when a different value is set. Your implementation invokes the change events for duplicate updates.
Sorry, I did not think the about duplicate updates. Thanks for the suggestion.
participants (2)
-
Jaroslav Kysela
-
Sameer Pujar