Skip to contentSkip to conversation

Fix kcontrol put callback in Tegra drivers

PATCH Superseded Sameer Pujar 2 participants 7 messages Nov 3, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover 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/[email protected]/

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(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 ASoC: tegra: Fix kcontrol put callback in ADMAIF

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")
---
 sound/soc/tegra/tegra210_admaif.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/tegra/tegra210_admaif.c +3 -1
index bcccdf3..36ba980 100644
@@ -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)
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 ASoC: tegra: Fix kcontrol put callback in I2S

In reply to 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")
---
 sound/soc/tegra/tegra210_i2s.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/tegra/tegra210_i2s.c +3 -1
index 45f31cc..b738b21 100644
@@ -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,
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/4 ASoC: tegra: Fix kcontrol put callback in DMIC

In reply to 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")
---
 sound/soc/tegra/tegra210_dmic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/tegra/tegra210_dmic.c +3 -1
index b096478..133509f 100644
@@ -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 = {
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/4 ASoC: tegra: Fix kcontrol put callback in DSPK

In reply to 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")
---
 sound/soc/tegra/tegra186_dspk.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/tegra/tegra186_dspk.c +3 -1
index 8ee9a77..3b1bdb7 100644
@@ -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)
Signature · 1 line
2.7.4
maintainer
#5 lore raw
In reply to Sameer Pujar
Quoted 3 lines · 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.

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

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#6 lore raw
Quoted 11 lines · Jaroslav Kysela

External email: Use caution opening links or attachments

Quoted 3 lines · 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.

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.