Commit 79063a02 authored by Mark Brown's avatar Mark Brown Committed by Greg Kroah-Hartman

ASoC: Handle low measured DC offsets for wm_hubs devices

commit 20a4e7fc upstream.

The DC servo codes are actually signed numbers so need to be treated as
such.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3ef0ec4b
...@@ -92,6 +92,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) ...@@ -92,6 +92,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op)
static void calibrate_dc_servo(struct snd_soc_codec *codec) static void calibrate_dc_servo(struct snd_soc_codec *codec)
{ {
struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
s8 offset;
u16 reg, reg_l, reg_r, dcs_cfg; u16 reg, reg_l, reg_r, dcs_cfg;
/* Set for 32 series updates */ /* Set for 32 series updates */
...@@ -130,16 +131,14 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec) ...@@ -130,16 +131,14 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec)
dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r); dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r);
/* HPOUT1L */ /* HPOUT1L */
if (reg_l + hubs->dcs_codes > 0 && offset = reg_l;
reg_l + hubs->dcs_codes < 0xff) offset += hubs->dcs_codes;
reg_l += hubs->dcs_codes; dcs_cfg = (u8)offset << WM8993_DCS_DAC_WR_VAL_1_SHIFT;
dcs_cfg = reg_l << WM8993_DCS_DAC_WR_VAL_1_SHIFT;
/* HPOUT1R */ /* HPOUT1R */
if (reg_r + hubs->dcs_codes > 0 && offset = reg_r;
reg_r + hubs->dcs_codes < 0xff) offset += hubs->dcs_codes;
reg_r += hubs->dcs_codes; dcs_cfg |= (u8)offset;
dcs_cfg |= reg_r;
dev_dbg(codec->dev, "DCS result: %x\n", dcs_cfg); dev_dbg(codec->dev, "DCS result: %x\n", dcs_cfg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment