All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: broonie@kernel.org
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	krzysztof.kozlowski+dt@linaro.org, linux-arm-msm@vger.kernel.org,
	tiwai@suse.com, lgirdwood@gmail.com, robh+dt@kernel.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	bgoswami@quicinc.com, linux-kernel@vger.kernel.org
Subject: [PATCH v2 05/12] ASoC: codecs: tx-macro: fix kcontrol put
Date: Tue,  6 Sep 2022 18:01:05 +0100	[thread overview]
Message-ID: <20220906170112.1984-6-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20220906170112.1984-1-srinivas.kandagatla@linaro.org>

tx_macro_tx_mixer_put() and tx_macro_dec_mode_put() currently returns zero
eventhough it changes the value.
Fix this, so that change notifications are sent correctly.

Fixes: d207bdea0ca9 ("ASoC: codecs: lpass-tx-macro: add dapm widgets and route")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
index 5c03ef8d88b3..7f9370ed126f 100644
--- a/sound/soc/codecs/lpass-tx-macro.c
+++ b/sound/soc/codecs/lpass-tx-macro.c
@@ -822,17 +822,23 @@ static int tx_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
 	struct tx_macro *tx = snd_soc_component_get_drvdata(component);
 
 	if (enable) {
+		if (tx->active_decimator[dai_id] == dec_id)
+			return 0;
+
 		set_bit(dec_id, &tx->active_ch_mask[dai_id]);
 		tx->active_ch_cnt[dai_id]++;
 		tx->active_decimator[dai_id] = dec_id;
 	} else {
+		if (tx->active_decimator[dai_id] == -1)
+			return 0;
+
 		tx->active_ch_cnt[dai_id]--;
 		clear_bit(dec_id, &tx->active_ch_mask[dai_id]);
 		tx->active_decimator[dai_id] = -1;
 	}
 	snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update);
 
-	return 0;
+	return 1;
 }
 
 static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w,
@@ -1018,9 +1024,12 @@ static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol,
 	int path = e->shift_l;
 	struct tx_macro *tx = snd_soc_component_get_drvdata(component);
 
+	if (tx->dec_mode[path] == value)
+		return 0;
+
 	tx->dec_mode[path] = value;
 
-	return 0;
+	return 1;
 }
 
 static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol,
-- 
2.21.0


WARNING: multiple messages have this Message-ID (diff)
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: broonie@kernel.org
Cc: lgirdwood@gmail.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, bgoswami@quicinc.com,
	perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org,
	alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH v2 05/12] ASoC: codecs: tx-macro: fix kcontrol put
Date: Tue,  6 Sep 2022 18:01:05 +0100	[thread overview]
Message-ID: <20220906170112.1984-6-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20220906170112.1984-1-srinivas.kandagatla@linaro.org>

tx_macro_tx_mixer_put() and tx_macro_dec_mode_put() currently returns zero
eventhough it changes the value.
Fix this, so that change notifications are sent correctly.

Fixes: d207bdea0ca9 ("ASoC: codecs: lpass-tx-macro: add dapm widgets and route")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
index 5c03ef8d88b3..7f9370ed126f 100644
--- a/sound/soc/codecs/lpass-tx-macro.c
+++ b/sound/soc/codecs/lpass-tx-macro.c
@@ -822,17 +822,23 @@ static int tx_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
 	struct tx_macro *tx = snd_soc_component_get_drvdata(component);
 
 	if (enable) {
+		if (tx->active_decimator[dai_id] == dec_id)
+			return 0;
+
 		set_bit(dec_id, &tx->active_ch_mask[dai_id]);
 		tx->active_ch_cnt[dai_id]++;
 		tx->active_decimator[dai_id] = dec_id;
 	} else {
+		if (tx->active_decimator[dai_id] == -1)
+			return 0;
+
 		tx->active_ch_cnt[dai_id]--;
 		clear_bit(dec_id, &tx->active_ch_mask[dai_id]);
 		tx->active_decimator[dai_id] = -1;
 	}
 	snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update);
 
-	return 0;
+	return 1;
 }
 
 static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w,
@@ -1018,9 +1024,12 @@ static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol,
 	int path = e->shift_l;
 	struct tx_macro *tx = snd_soc_component_get_drvdata(component);
 
+	if (tx->dec_mode[path] == value)
+		return 0;
+
 	tx->dec_mode[path] = value;
 
-	return 0;
+	return 1;
 }
 
 static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol,
-- 
2.21.0


  parent reply	other threads:[~2022-09-06 17:04 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 17:01 [PATCH v2 00/12] ASoC: codecs: qcom add support for SM8450 and SC8280XP Srinivas Kandagatla
2022-09-06 17:01 ` Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 01/12] ASoC: codecs: wsa-macro: handle swr_reset correctly Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 02/12] ASoC: codecs: rx-macro: " Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 03/12] ASoC: codecs: tx-macro: " Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 04/12] ASoC: codecs: tx-macro: fix active_decimator array Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-06 17:01 ` Srinivas Kandagatla [this message]
2022-09-06 17:01   ` [PATCH v2 05/12] ASoC: codecs: tx-macro: fix kcontrol put Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 06/12] ASoC: codecs: wsa883x: add clock stop support Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 07/12] ASoC: qcom: dt-bindings: add sm8450 and sc8280xp compatibles Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 08/12] ASoC: codecs: wsa-macro: add support for sm8450 and sc8280xp Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 09/12] ASoC: codecs: tx-macro: " Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 10/12] ASoC: codecs: rx-macro: " Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 11/12] ASoC: codecs: va-macro: clear the frame sync counter before enabling Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-06 17:01 ` [PATCH v2 12/12] ASoC: codecs: va-macro: add support for sm8450 and sc8280xp Srinivas Kandagatla
2022-09-06 17:01   ` Srinivas Kandagatla
2022-09-27 10:34 ` [PATCH v2 00/12] ASoC: codecs: qcom add support for SM8450 and SC8280XP Mark Brown
2022-09-27 10:34   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220906170112.1984-6-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bgoswami@quicinc.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.