Skip to contentSkip to conversation

ASoC: SDCA: fix the register to ctl value conversion for Q7.8 format

PATCH In review [email protected] 3 participants 3 messages Mar 27

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: SDCA: fix the register to ctl value conversion for Q7.8 format

From: Shuming Fan <[email protected]>

The division calculation should be implemented using signed integer format. This patch changes mc->shift from an unsigned type to a signed integer during the calculation.

Fixes 501efdcb3b3a ("ASoC: SDCA: Pull the Q7.8 volume helpers out of soc-ops")
---
 sound/soc/sdca/sdca_asoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sdca/sdca_asoc.c +1 -1
index 733c9808891a..7709a4ce26e0 100644
@@ -850,7 +850,7 @@ static int q78_read(struct snd_soc_component *component,
 
 	reg_val = snd_soc_component_read(component, reg);
 
-	val = (sign_extend32(reg_val, mc->sign_bit) / mc->shift) - mc->min;
+	val = (sign_extend32(reg_val, mc->sign_bit) / (int)mc->shift) - mc->min;
 
 	return val & GENMASK(mc->sign_bit, 0);
 }
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · On Fri, Mar 27, 2026 at 04:23:31PM +0800, [email protected] wrote:

From: Shuming Fan <[email protected]>

The division calculation should be implemented using signed integer format. This patch changes mc->shift from an unsigned type to a signed integer during the calculation.

Fixes 501efdcb3b3a ("ASoC: SDCA: Pull the Q7.8 volume helpers out of soc-ops")
---
 sound/soc/sdca/sdca_asoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sdca/sdca_asoc.c +0 -0
index 733c9808891a..7709a4ce26e0 100644

sound/soc/sdca/sdca_asoc.c static int q78_read(struct snd_soc_component *component, · line 853

Quoted 5 lines
sound/soc/sdca/sdca_asoc.c +1 -1
@@ -850,7 +850,7 @@ static int q78_read(struct snd_soc_component *component,
 
 	reg_val = snd_soc_component_read(component, reg);
 
-	val = (sign_extend32(reg_val, mc->sign_bit) / mc->shift) - mc->min;
+	val = (sign_extend32(reg_val, mc->sign_bit) / (int)mc->shift) - mc->min;

oops... yeah thanks for catching that.

Thanks,
Charles

maintainer
#2 lore raw
In reply to [email protected]
Quoted 1 line · On Fri, 27 Mar 2026 16:23:31 +0800, [email protected] wrote:

ASoC: SDCA: fix the register to ctl value conversion for Q7.8 format

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1

Thanks!

[1/1] ASoC: SDCA: fix the register to ctl value conversion for Q7.8 format

      https://git.kernel.org/broonie/sound/c/ae00200acb87

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