Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fa49e3a authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: Avoid wraparound in wm_hubs DC servo correction



If the correction wraps around then a substantial offset would be
introduced.

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent b5442a75
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -113,12 +113,14 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec)
		/* HPOUT1L */
		reg = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_1) &
			WM8993_DCS_INTEG_CHAN_0_MASK;;
		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;

		/* HPOUT1R */
		reg = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_2) &
			WM8993_DCS_INTEG_CHAN_1_MASK;
		if (reg + hubs->dcs_codes > 0 && reg + hubs->dcs_codes < 0xff)
			reg += hubs->dcs_codes;
		dcs_cfg |= reg;