mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-16 01:54:00 +00:00
ASoC: Avoid wraparound in wm_hubs DC servo correction
If the correction wraps around then a substantial offset would be introduced. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
This commit is contained in:
parent
b5442a75de
commit
3fa49e3ad9
@ -113,13 +113,15 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec)
|
|||||||
/* HPOUT1L */
|
/* HPOUT1L */
|
||||||
reg = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_1) &
|
reg = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_1) &
|
||||||
WM8993_DCS_INTEG_CHAN_0_MASK;;
|
WM8993_DCS_INTEG_CHAN_0_MASK;;
|
||||||
reg += hubs->dcs_codes;
|
if (reg + hubs->dcs_codes > 0 && reg + hubs->dcs_codes < 0xff)
|
||||||
|
reg += hubs->dcs_codes;
|
||||||
dcs_cfg = reg << WM8993_DCS_DAC_WR_VAL_1_SHIFT;
|
dcs_cfg = reg << WM8993_DCS_DAC_WR_VAL_1_SHIFT;
|
||||||
|
|
||||||
/* HPOUT1R */
|
/* HPOUT1R */
|
||||||
reg = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_2) &
|
reg = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_2) &
|
||||||
WM8993_DCS_INTEG_CHAN_1_MASK;
|
WM8993_DCS_INTEG_CHAN_1_MASK;
|
||||||
reg += hubs->dcs_codes;
|
if (reg + hubs->dcs_codes > 0 && reg + hubs->dcs_codes < 0xff)
|
||||||
|
reg += hubs->dcs_codes;
|
||||||
dcs_cfg |= reg;
|
dcs_cfg |= reg;
|
||||||
|
|
||||||
/* Do it */
|
/* Do it */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user