linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Fix kcontrol put callback in Tegra drivers
@ 2021-11-03  5:04 Sameer Pujar
  2021-11-03  5:04 ` [PATCH 1/4] ASoC: tegra: Fix kcontrol put callback in ADMAIF Sameer Pujar
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Sameer Pujar @ 2021-11-03  5:04 UTC (permalink / raw)
  To: broonie, lgirdwood, perex, tiwai
  Cc: thierry.reding, jonathanh, alsa-devel, linux-tegra, linux-kernel,
	Sameer Pujar

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(-)

-- 
2.7.4


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

* [PATCH 1/4] ASoC: tegra: Fix kcontrol put callback in ADMAIF
  2021-11-03  5:04 [PATCH 0/4] Fix kcontrol put callback in Tegra drivers Sameer Pujar
@ 2021-11-03  5:04 ` Sameer Pujar
  2021-11-03  5:04 ` [PATCH 2/4] ASoC: tegra: Fix kcontrol put callback in I2S Sameer Pujar
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Sameer Pujar @ 2021-11-03  5:04 UTC (permalink / raw)
  To: broonie, lgirdwood, perex, tiwai
  Cc: thierry.reding, jonathanh, alsa-devel, linux-tegra, linux-kernel,
	Sameer Pujar

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)
-- 
2.7.4


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

* [PATCH 2/4] ASoC: tegra: Fix kcontrol put callback in I2S
  2021-11-03  5:04 [PATCH 0/4] Fix kcontrol put callback in Tegra drivers Sameer Pujar
  2021-11-03  5:04 ` [PATCH 1/4] ASoC: tegra: Fix kcontrol put callback in ADMAIF Sameer Pujar
@ 2021-11-03  5:04 ` Sameer Pujar
  2021-11-03  5:04 ` [PATCH 3/4] ASoC: tegra: Fix kcontrol put callback in DMIC Sameer Pujar
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Sameer Pujar @ 2021-11-03  5:04 UTC (permalink / raw)
  To: broonie, lgirdwood, perex, tiwai
  Cc: thierry.reding, jonathanh, alsa-devel, linux-tegra, linux-kernel,
	Sameer Pujar

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,
-- 
2.7.4


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

* [PATCH 3/4] ASoC: tegra: Fix kcontrol put callback in DMIC
  2021-11-03  5:04 [PATCH 0/4] Fix kcontrol put callback in Tegra drivers Sameer Pujar
  2021-11-03  5:04 ` [PATCH 1/4] ASoC: tegra: Fix kcontrol put callback in ADMAIF Sameer Pujar
  2021-11-03  5:04 ` [PATCH 2/4] ASoC: tegra: Fix kcontrol put callback in I2S Sameer Pujar
@ 2021-11-03  5:04 ` Sameer Pujar
  2021-11-03  5:04 ` [PATCH 4/4] ASoC: tegra: Fix kcontrol put callback in DSPK Sameer Pujar
  2021-11-03  8:50 ` [PATCH 0/4] Fix kcontrol put callback in Tegra drivers Jaroslav Kysela
  4 siblings, 0 replies; 7+ messages in thread
From: Sameer Pujar @ 2021-11-03  5:04 UTC (permalink / raw)
  To: broonie, lgirdwood, perex, tiwai
  Cc: thierry.reding, jonathanh, alsa-devel, linux-tegra, linux-kernel,
	Sameer Pujar

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 = {
-- 
2.7.4


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

* [PATCH 4/4] ASoC: tegra: Fix kcontrol put callback in DSPK
  2021-11-03  5:04 [PATCH 0/4] Fix kcontrol put callback in Tegra drivers Sameer Pujar
                   ` (2 preceding siblings ...)
  2021-11-03  5:04 ` [PATCH 3/4] ASoC: tegra: Fix kcontrol put callback in DMIC Sameer Pujar
@ 2021-11-03  5:04 ` Sameer Pujar
  2021-11-03  8:50 ` [PATCH 0/4] Fix kcontrol put callback in Tegra drivers Jaroslav Kysela
  4 siblings, 0 replies; 7+ messages in thread
From: Sameer Pujar @ 2021-11-03  5:04 UTC (permalink / raw)
  To: broonie, lgirdwood, perex, tiwai
  Cc: thierry.reding, jonathanh, alsa-devel, linux-tegra, linux-kernel,
	Sameer Pujar

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)
-- 
2.7.4


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

* Re: [PATCH 0/4] Fix kcontrol put callback in Tegra drivers
  2021-11-03  5:04 [PATCH 0/4] Fix kcontrol put callback in Tegra drivers Sameer Pujar
                   ` (3 preceding siblings ...)
  2021-11-03  5:04 ` [PATCH 4/4] ASoC: tegra: Fix kcontrol put callback in DSPK Sameer Pujar
@ 2021-11-03  8:50 ` Jaroslav Kysela
  2021-11-03 11:29   ` Sameer Pujar
  4 siblings, 1 reply; 7+ messages in thread
From: Jaroslav Kysela @ 2021-11-03  8:50 UTC (permalink / raw)
  To: Sameer Pujar, broonie, lgirdwood, tiwai
  Cc: thierry.reding, jonathanh, alsa-devel, linux-tegra, linux-kernel

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

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

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

* Re: [PATCH 0/4] Fix kcontrol put callback in Tegra drivers
  2021-11-03  8:50 ` [PATCH 0/4] Fix kcontrol put callback in Tegra drivers Jaroslav Kysela
@ 2021-11-03 11:29   ` Sameer Pujar
  0 siblings, 0 replies; 7+ messages in thread
From: Sameer Pujar @ 2021-11-03 11:29 UTC (permalink / raw)
  To: Jaroslav Kysela, broonie, lgirdwood, tiwai
  Cc: thierry.reding, jonathanh, alsa-devel, linux-tegra, linux-kernel



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.

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

end of thread, other threads:[~2021-11-03 11:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03  5:04 [PATCH 0/4] Fix kcontrol put callback in Tegra drivers Sameer Pujar
2021-11-03  5:04 ` [PATCH 1/4] ASoC: tegra: Fix kcontrol put callback in ADMAIF Sameer Pujar
2021-11-03  5:04 ` [PATCH 2/4] ASoC: tegra: Fix kcontrol put callback in I2S Sameer Pujar
2021-11-03  5:04 ` [PATCH 3/4] ASoC: tegra: Fix kcontrol put callback in DMIC Sameer Pujar
2021-11-03  5:04 ` [PATCH 4/4] ASoC: tegra: Fix kcontrol put callback in DSPK Sameer Pujar
2021-11-03  8:50 ` [PATCH 0/4] Fix kcontrol put callback in Tegra drivers Jaroslav Kysela
2021-11-03 11:29   ` Sameer Pujar

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).