Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: SDCA: fix the register to ctl value conversion for Q7.8 format
@ 2026-03-27  8:23 shumingf
  2026-03-27  9:43 ` Charles Keepax
  2026-03-27 19:12 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: shumingf @ 2026-03-27  8:23 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: linux-sound, lars, flove, oder_chiou, jack.yu, derek.fang,
	ckeepax, Shuming Fan

From: Shuming Fan <shumingf@realtek.com>

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")
Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
 sound/soc/sdca/sdca_asoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sdca/sdca_asoc.c b/sound/soc/sdca/sdca_asoc.c
index 733c9808891a..7709a4ce26e0 100644
--- a/sound/soc/sdca/sdca_asoc.c
+++ b/sound/soc/sdca/sdca_asoc.c
@@ -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);
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-27 20:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27  8:23 [PATCH] ASoC: SDCA: fix the register to ctl value conversion for Q7.8 format shumingf
2026-03-27  9:43 ` Charles Keepax
2026-03-27 19:12 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox