diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-01-21 07:47:33 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-01-21 13:20:16 -0500 |
commit | 20a4e7fc7e213365ea3771d7bf1e10a6bab853be (patch) | |
tree | 51d72efa1c5e306a4dfd2feb791675c27a634206 /sound | |
parent | dc5a460a1bfa44273653700e33d4e7051194cbfd (diff) |
ASoC: Handle low measured DC offsets for wm_hubs devices
The DC servo codes are actually signed numbers so need to be treated as
such.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: stable@kernel.org
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/wm_hubs.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index c466982eed23..613df5db0b32 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -91,6 +91,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) | |||
91 | static void calibrate_dc_servo(struct snd_soc_codec *codec) | 91 | static void calibrate_dc_servo(struct snd_soc_codec *codec) |
92 | { | 92 | { |
93 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); | 93 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); |
94 | s8 offset; | ||
94 | u16 reg, reg_l, reg_r, dcs_cfg; | 95 | u16 reg, reg_l, reg_r, dcs_cfg; |
95 | 96 | ||
96 | /* If we're using a digital only path and have a previously | 97 | /* If we're using a digital only path and have a previously |
@@ -149,16 +150,14 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec) | |||
149 | hubs->dcs_codes); | 150 | hubs->dcs_codes); |
150 | 151 | ||
151 | /* HPOUT1L */ | 152 | /* HPOUT1L */ |
152 | if (reg_l + hubs->dcs_codes > 0 && | 153 | offset = reg_l; |
153 | reg_l + hubs->dcs_codes < 0xff) | 154 | offset += hubs->dcs_codes; |
154 | reg_l += hubs->dcs_codes; | 155 | dcs_cfg = (u8)offset << WM8993_DCS_DAC_WR_VAL_1_SHIFT; |
155 | dcs_cfg = reg_l << WM8993_DCS_DAC_WR_VAL_1_SHIFT; | ||
156 | 156 | ||
157 | /* HPOUT1R */ | 157 | /* HPOUT1R */ |
158 | if (reg_r + hubs->dcs_codes > 0 && | 158 | offset = reg_r; |
159 | reg_r + hubs->dcs_codes < 0xff) | 159 | offset += hubs->dcs_codes; |
160 | reg_r += hubs->dcs_codes; | 160 | dcs_cfg |= (u8)offset; |
161 | dcs_cfg |= reg_r; | ||
162 | 161 | ||
163 | dev_dbg(codec->dev, "DCS result: %x\n", dcs_cfg); | 162 | dev_dbg(codec->dev, "DCS result: %x\n", dcs_cfg); |
164 | 163 | ||