* [PATCH v2] ASoC: qdsp6: q6routing: Fix return value from msm_routing_put_audio_mixer
@ 2021-11-30 16:31 ` Srinivas Kandagatla
0 siblings, 0 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2021-11-30 16:31 UTC (permalink / raw)
To: broonie
Cc: lgirdwood, perex, tiwai, pierre-louis.bossart, alsa-devel,
linux-kernel, Srinivas Kandagatla
msm_routing_put_audio_mixer() can return incorrect value in various scenarios.
scenario 1:
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
return value is 0 instead of 1 eventhough value was changed
scenario 2:
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
return value is 1 instead of 0 eventhough the value was not changed
scenario 3:
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
return value is 1 instead of 0 eventhough the value was not changed
Fix this by adding checks, so that change notifications are sent correctly.
Fixes: e3a33673e845 ("ASoC: qdsp6: q6routing: Add q6routing driver")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
sound/soc/qcom/qdsp6/q6routing.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
index cd74681e811e..928fd23e2c27 100644
--- a/sound/soc/qcom/qdsp6/q6routing.c
+++ b/sound/soc/qcom/qdsp6/q6routing.c
@@ -498,14 +498,16 @@ static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol,
struct session_data *session = &data->sessions[session_id];
if (ucontrol->value.integer.value[0]) {
+ if (session->port_id == be_id)
+ return 0;
+
session->port_id = be_id;
snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, update);
} else {
- if (session->port_id == be_id) {
- session->port_id = -1;
+ if (session->port_id == -1 || session->port_id != be_id)
return 0;
- }
+ session->port_id = -1;
snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, update);
}
--
2.21.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] ASoC: qdsp6: q6routing: Fix return value from msm_routing_put_audio_mixer
@ 2021-11-30 16:31 ` Srinivas Kandagatla
0 siblings, 0 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2021-11-30 16:31 UTC (permalink / raw)
To: broonie; +Cc: alsa-devel, lgirdwood, linux-kernel, pierre-louis.bossart, tiwai
msm_routing_put_audio_mixer() can return incorrect value in various scenarios.
scenario 1:
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
return value is 0 instead of 1 eventhough value was changed
scenario 2:
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
return value is 1 instead of 0 eventhough the value was not changed
scenario 3:
amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
return value is 1 instead of 0 eventhough the value was not changed
Fix this by adding checks, so that change notifications are sent correctly.
Fixes: e3a33673e845 ("ASoC: qdsp6: q6routing: Add q6routing driver")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
sound/soc/qcom/qdsp6/q6routing.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
index cd74681e811e..928fd23e2c27 100644
--- a/sound/soc/qcom/qdsp6/q6routing.c
+++ b/sound/soc/qcom/qdsp6/q6routing.c
@@ -498,14 +498,16 @@ static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol,
struct session_data *session = &data->sessions[session_id];
if (ucontrol->value.integer.value[0]) {
+ if (session->port_id == be_id)
+ return 0;
+
session->port_id = be_id;
snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, update);
} else {
- if (session->port_id == be_id) {
- session->port_id = -1;
+ if (session->port_id == -1 || session->port_id != be_id)
return 0;
- }
+ session->port_id = -1;
snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, update);
}
--
2.21.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ASoC: qdsp6: q6routing: Fix return value from msm_routing_put_audio_mixer
2021-11-30 16:31 ` Srinivas Kandagatla
@ 2021-12-01 18:32 ` Mark Brown
-1 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-12-01 18:32 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: linux-kernel, perex, alsa-devel, lgirdwood, pierre-louis.bossart, tiwai
On Tue, 30 Nov 2021 16:31:10 +0000, Srinivas Kandagatla wrote:
> msm_routing_put_audio_mixer() can return incorrect value in various scenarios.
>
> scenario 1:
> amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
> amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
>
> return value is 0 instead of 1 eventhough value was changed
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-linus
Thanks!
[1/1] ASoC: qdsp6: q6routing: Fix return value from msm_routing_put_audio_mixer
commit: 4739d88ad8e1900f809f8a5c98f3c1b65bf76220
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ASoC: qdsp6: q6routing: Fix return value from msm_routing_put_audio_mixer
@ 2021-12-01 18:32 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-12-01 18:32 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: pierre-louis.bossart, alsa-devel, linux-kernel, lgirdwood, tiwai
On Tue, 30 Nov 2021 16:31:10 +0000, Srinivas Kandagatla wrote:
> msm_routing_put_audio_mixer() can return incorrect value in various scenarios.
>
> scenario 1:
> amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1
> amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 0
>
> return value is 0 instead of 1 eventhough value was changed
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-linus
Thanks!
[1/1] ASoC: qdsp6: q6routing: Fix return value from msm_routing_put_audio_mixer
commit: 4739d88ad8e1900f809f8a5c98f3c1b65bf76220
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-01 18:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 16:31 [PATCH v2] ASoC: qdsp6: q6routing: Fix return value from msm_routing_put_audio_mixer Srinivas Kandagatla
2021-11-30 16:31 ` Srinivas Kandagatla
2021-12-01 18:32 ` Mark Brown
2021-12-01 18:32 ` Mark Brown
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.