[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1635947547-24391-8-git-send-email-spujar@nvidia.com>
Date: Wed, 3 Nov 2021 19:22:23 +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 07/10] ASoC: tegra: Fix kcontrol put callback in SFC
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. Filter
out duplicate updates in SFC driver.
Fixes: b2f74ec53a6c ("ASoC: tegra: Add Tegra210 based SFC driver")
Signed-off-by: Sameer Pujar <spujar@...dia.com>
Suggested-by: Jaroslav Kysela <perex@...ex.cz>
Suggested-by: Mark Brown <broonie@...nel.org>
---
sound/soc/tegra/tegra210_sfc.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/sound/soc/tegra/tegra210_sfc.c b/sound/soc/tegra/tegra210_sfc.c
index dc477ee..ac24980 100644
--- a/sound/soc/tegra/tegra210_sfc.c
+++ b/sound/soc/tegra/tegra210_sfc.c
@@ -3273,16 +3273,27 @@ static int tegra210_sfc_put_control(struct snd_kcontrol *kcontrol,
struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt);
int value = ucontrol->value.integer.value[0];
- if (strstr(kcontrol->id.name, "Input Stereo To Mono"))
+ if (strstr(kcontrol->id.name, "Input Stereo To Mono")) {
+ if (sfc->stereo_to_mono[SFC_RX_PATH] == value)
+ return 0;
+
sfc->stereo_to_mono[SFC_RX_PATH] = value;
- else if (strstr(kcontrol->id.name, "Input Mono To Stereo"))
+ } else if (strstr(kcontrol->id.name, "Input Mono To Stereo")) {
+ if (sfc->mono_to_stereo[SFC_RX_PATH] == value)
+ return 0;
+
sfc->mono_to_stereo[SFC_RX_PATH] = value;
- else if (strstr(kcontrol->id.name, "Output Stereo To Mono"))
+ } else if (strstr(kcontrol->id.name, "Output Stereo To Mono")) {
+ if (sfc->stereo_to_mono[SFC_TX_PATH] == value)
+ return 0;
+
sfc->stereo_to_mono[SFC_TX_PATH] = value;
- else if (strstr(kcontrol->id.name, "Output Mono To Stereo"))
+ } else if (strstr(kcontrol->id.name, "Output Mono To Stereo")) {
+ if (sfc->mono_to_stereo[SFC_TX_PATH] == value)
+ return 0;
+
sfc->mono_to_stereo[SFC_TX_PATH] = value;
- else
- return 0;
+ }
return 1;
}
--
2.7.4
Powered by blists - more mailing lists