mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
ASoC: SDCA: fix the register to ctl value conversion for Q7.8 format
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: 501efdcb3b ("ASoC: SDCA: Pull the Q7.8 volume helpers out of soc-ops")
Signed-off-by: Shuming Fan <shumingf@realtek.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260327082331.2277498-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
7caae0aed0
commit
ae00200acb
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user