lkml.org 
[lkml]   [2021]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 04/10] ASoC: tegra: Fix kcontrol put callback in DSPK
Date
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 | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/sound/soc/tegra/tegra186_dspk.c b/sound/soc/tegra/tegra186_dspk.c
index 8ee9a77..4cc06e9 100644
--- a/sound/soc/tegra/tegra186_dspk.c
+++ b/sound/soc/tegra/tegra186_dspk.c
@@ -55,20 +55,39 @@ static int tegra186_dspk_put_control(struct snd_kcontrol *kcontrol,
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
int val = ucontrol->value.integer.value[0];

- if (strstr(kcontrol->id.name, "FIFO Threshold"))
+ if (strstr(kcontrol->id.name, "FIFO Threshold")) {
+ if (dspk->rx_fifo_th == val)
+ return 0;
+
dspk->rx_fifo_th = val;
- else if (strstr(kcontrol->id.name, "OSR Value"))
+ } else if (strstr(kcontrol->id.name, "OSR Value")) {
+ if (dspk->osr_val == val)
+ return 0;
+
dspk->osr_val = val;
- else if (strstr(kcontrol->id.name, "LR Polarity Select"))
+ } else if (strstr(kcontrol->id.name, "LR Polarity Select")) {
+ if (dspk->lrsel == val)
+ return 0;
+
dspk->lrsel = val;
- else if (strstr(kcontrol->id.name, "Channel Select"))
+ } else if (strstr(kcontrol->id.name, "Channel Select")) {
+ if (dspk->ch_sel == val)
+ return 0;
+
dspk->ch_sel = val;
- else if (strstr(kcontrol->id.name, "Mono To Stereo"))
+ } else if (strstr(kcontrol->id.name, "Mono To Stereo")) {
+ if (dspk->mono_to_stereo == val)
+ return 0;
+
dspk->mono_to_stereo = val;
- else if (strstr(kcontrol->id.name, "Stereo To Mono"))
+ } else if (strstr(kcontrol->id.name, "Stereo To Mono")) {
+ if (dspk->stereo_to_mono == val)
+ return 0;
+
dspk->stereo_to_mono = val;
+ }

- return 0;
+ return 1;
}

static int __maybe_unused tegra186_dspk_runtime_suspend(struct device *dev)
--
2.7.4
\
 
 \ /
  Last update: 2021-11-03 14:54    [W:0.097 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site