[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1635947547-24391-5-git-send-email-spujar@nvidia.com>
Date: Wed, 3 Nov 2021 19:22:20 +0530
From: Sameer Pujar <spujar@...dia.com>
To: <broonie@...nel.org>, <lgirdwood@...il.com>, <perex@...ex.cz>,
<tiwai@...e.com>
CC: <thierry.reding@...il.com>, <jonathanh@...dia.com>,
<alsa-devel@...a-project.org>, <linux-tegra@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Sameer Pujar <spujar@...dia.com>
Subject: [PATCH v2 04/10] ASoC: tegra: Fix kcontrol put callback in DSPK
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@...ex.cz>
Suggested-by: Mark Brown <broonie@...nel.org>
Signed-off-by: Sameer Pujar <spujar@...dia.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
Powered by blists - more mailing lists