Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 189594
b: refs/heads/master
c: 4dcc93d
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Apr 5, 2010
1 parent 75e2d80 commit 0c77497
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae9d8607fe24253efc9f14b696f51cfd683801be
refs/heads/master: 4dcc93d0ede49fae32dd0ee41c685db1be14c529
38 changes: 15 additions & 23 deletions trunk/sound/soc/codecs/wm_hubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,27 @@ static const char *speaker_mode_text[] = {
static const struct soc_enum speaker_mode =
SOC_ENUM_SINGLE(WM8993_SPKMIXR_ATTENUATION, 8, 2, speaker_mode_text);

static void wait_for_dc_servo(struct snd_soc_codec *codec)
static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op)
{
unsigned int reg;
int count = 0;
unsigned int val;

val = op | WM8993_DCS_ENA_CHAN_0 | WM8993_DCS_ENA_CHAN_1;

/* Trigger the command */
snd_soc_write(codec, WM8993_DC_SERVO_0, val);

dev_dbg(codec->dev, "Waiting for DC servo...\n");

do {
count++;
msleep(1);
reg = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_0);
reg = snd_soc_read(codec, WM8993_DC_SERVO_0);
dev_dbg(codec->dev, "DC servo: %x\n", reg);
} while (reg & WM8993_DCS_DATAPATH_BUSY && count < 400);
} while (reg & op && count < 400);

if (reg & WM8993_DCS_DATAPATH_BUSY)
if (reg & op)
dev_err(codec->dev, "Timed out waiting for DC Servo\n");
}

Expand All @@ -92,18 +98,8 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec)
snd_soc_update_bits(codec, WM8993_DC_SERVO_1,
WM8993_DCS_SERIES_NO_01_MASK,
32 << WM8993_DCS_SERIES_NO_01_SHIFT);

/* Enable the DC servo. Write all bits to avoid triggering startup
* or write calibration.
*/
snd_soc_update_bits(codec, WM8993_DC_SERVO_0,
0xFFFF,
WM8993_DCS_ENA_CHAN_0 |
WM8993_DCS_ENA_CHAN_1 |
WM8993_DCS_TRIG_SERIES_1 |
WM8993_DCS_TRIG_SERIES_0);

wait_for_dc_servo(codec);
wait_for_dc_servo(codec,
WM8993_DCS_TRIG_SERIES_0 | WM8993_DCS_TRIG_SERIES_1);

/* Apply correction to DC servo result */
if (hubs->dcs_codes) {
Expand Down Expand Up @@ -145,13 +141,9 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec)

/* Do it */
snd_soc_write(codec, WM8993_DC_SERVO_3, dcs_cfg);
snd_soc_update_bits(codec, WM8993_DC_SERVO_0,
WM8993_DCS_TRIG_DAC_WR_0 |
WM8993_DCS_TRIG_DAC_WR_1,
WM8993_DCS_TRIG_DAC_WR_0 |
WM8993_DCS_TRIG_DAC_WR_1);

wait_for_dc_servo(codec);
wait_for_dc_servo(codec,
WM8993_DCS_TRIG_DAC_WR_0 |
WM8993_DCS_TRIG_DAC_WR_1);
}
}

Expand Down

0 comments on commit 0c77497

Please sign in to comment.