* [PATCH] ASoC: sophgo: return 1 on volume change in cv1800b_adc_volume_set()
@ 2026-07-27 5:38 kr494167
2026-07-27 23:12 ` Mark Brown
2026-07-29 1:33 ` Inochi Amaoto
0 siblings, 2 replies; 3+ messages in thread
From: kr494167 @ 2026-07-27 5:38 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: stavinsky, chen.wang, inochiama, linux-sound, sophgo,
linux-kernel, Surendra Singh Chouhan
From: Surendra Singh Chouhan <kr494167@gmail.com>
cv1800b_adc_volume_set() serves as the .put callback for the "Internal
I2S Capture Volume" control.
ALSA mixer control callbacks must return 1 when the register value is
modified, 0 if unchanged, or a negative error code on failure. Returning
0 unconditionally causes ALSA core to assume the value was unchanged,
suppressing SNDRV_CTL_EVENT_MASK_VALUE change notifications to userspace
sound servers (e.g. PipeWire/PulseAudio).
Fix this by comparing the new register value with the existing register
value. If unchanged, return 0; otherwise, write the updated value and
return 1.
Fixes: 4cf8752a03e6 ("ASoC: sophgo: add CV1800B internal ADC codec driver")
Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com>
---
sound/soc/sophgo/cv1800b-sound-adc.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sophgo/cv1800b-sound-adc.c b/sound/soc/sophgo/cv1800b-sound-adc.c
index b66761156b99..bd93e261bdd1 100644
--- a/sound/soc/sophgo/cv1800b-sound-adc.c
+++ b/sound/soc/sophgo/cv1800b-sound-adc.c
@@ -251,16 +251,22 @@ static int cv1800b_adc_volume_set(struct snd_kcontrol *kcontrol,
u32 v_left = clamp_t(u32, ucontrol->value.integer.value[0], 0, 24);
u32 v_right = clamp_t(u32, ucontrol->value.integer.value[1], 0, 24);
- u32 val;
+ u32 val, old_val;
val = readl(priv->regs + CV1800B_RXADC_ANA0);
+ old_val = val;
+
val = u32_replace_bits(val, cv1800b_gains[v_left],
REG_COMB_LEFT_VOLUME);
val = u32_replace_bits(val, cv1800b_gains[v_right],
REG_COMB_RIGHT_VOLUME);
+
+ if (val == old_val)
+ return 0;
+
writel(val, priv->regs + CV1800B_RXADC_ANA0);
- return 0;
+ return 1;
}
static DECLARE_TLV_DB_SCALE(cv1800b_volume_tlv, 0, 200, 0);
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: sophgo: return 1 on volume change in cv1800b_adc_volume_set()
2026-07-27 5:38 [PATCH] ASoC: sophgo: return 1 on volume change in cv1800b_adc_volume_set() kr494167
@ 2026-07-27 23:12 ` Mark Brown
2026-07-29 1:33 ` Inochi Amaoto
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-07-27 23:12 UTC (permalink / raw)
To: lgirdwood, kr494167
Cc: stavinsky, chen.wang, inochiama, linux-sound, sophgo,
linux-kernel
On Mon, 27 Jul 2026 11:08:04 +0530, kr494167@gmail.com wrote:
> ASoC: sophgo: return 1 on volume change in cv1800b_adc_volume_set()
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2
Thanks!
[1/1] ASoC: sophgo: return 1 on volume change in cv1800b_adc_volume_set()
https://git.kernel.org/broonie/sound/c/f47064c970d3
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] 3+ messages in thread* Re: [PATCH] ASoC: sophgo: return 1 on volume change in cv1800b_adc_volume_set()
2026-07-27 5:38 [PATCH] ASoC: sophgo: return 1 on volume change in cv1800b_adc_volume_set() kr494167
2026-07-27 23:12 ` Mark Brown
@ 2026-07-29 1:33 ` Inochi Amaoto
1 sibling, 0 replies; 3+ messages in thread
From: Inochi Amaoto @ 2026-07-29 1:33 UTC (permalink / raw)
To: kr494167, broonie, lgirdwood
Cc: stavinsky, chen.wang, inochiama, linux-sound, sophgo,
linux-kernel
On Mon, Jul 27, 2026 at 11:08:04AM +0530, kr494167@gmail.com wrote:
> From: Surendra Singh Chouhan <kr494167@gmail.com>
>
> cv1800b_adc_volume_set() serves as the .put callback for the "Internal
> I2S Capture Volume" control.
>
> ALSA mixer control callbacks must return 1 when the register value is
> modified, 0 if unchanged, or a negative error code on failure. Returning
> 0 unconditionally causes ALSA core to assume the value was unchanged,
> suppressing SNDRV_CTL_EVENT_MASK_VALUE change notifications to userspace
> sound servers (e.g. PipeWire/PulseAudio).
>
> Fix this by comparing the new register value with the existing register
> value. If unchanged, return 0; otherwise, write the updated value and
> return 1.
>
> Fixes: 4cf8752a03e6 ("ASoC: sophgo: add CV1800B internal ADC codec driver")
> Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com>
> ---
LGTM
Reviewed-by: Inochi Amaoto <inochiama@gmail.com>
> sound/soc/sophgo/cv1800b-sound-adc.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/sophgo/cv1800b-sound-adc.c b/sound/soc/sophgo/cv1800b-sound-adc.c
> index b66761156b99..bd93e261bdd1 100644
> --- a/sound/soc/sophgo/cv1800b-sound-adc.c
> +++ b/sound/soc/sophgo/cv1800b-sound-adc.c
> @@ -251,16 +251,22 @@ static int cv1800b_adc_volume_set(struct snd_kcontrol *kcontrol,
>
> u32 v_left = clamp_t(u32, ucontrol->value.integer.value[0], 0, 24);
> u32 v_right = clamp_t(u32, ucontrol->value.integer.value[1], 0, 24);
> - u32 val;
> + u32 val, old_val;
>
> val = readl(priv->regs + CV1800B_RXADC_ANA0);
> + old_val = val;
> +
> val = u32_replace_bits(val, cv1800b_gains[v_left],
> REG_COMB_LEFT_VOLUME);
> val = u32_replace_bits(val, cv1800b_gains[v_right],
> REG_COMB_RIGHT_VOLUME);
> +
> + if (val == old_val)
> + return 0;
> +
> writel(val, priv->regs + CV1800B_RXADC_ANA0);
>
> - return 0;
> + return 1;
> }
>
> static DECLARE_TLV_DB_SCALE(cv1800b_volume_tlv, 0, 200, 0);
> --
> 2.55.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-29 13:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-27 5:38 [PATCH] ASoC: sophgo: return 1 on volume change in cv1800b_adc_volume_set() kr494167
2026-07-27 23:12 ` Mark Brown
2026-07-29 1:33 ` Inochi Amaoto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).