From c6194b26b875cdd8fd6deae7919e3250e0096b2b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 15 Jul 2011 17:33:26 +0900 Subject: [PATCH] --- yaml --- r: 257601 b: refs/heads/master c: 1479c3fb5f0ca8410428006cb04ca27263beea25 h: refs/heads/master i: 257599: 72a2f78b6737463dac011156f297582afe1d4e25 v: v3 --- [refs] | 2 +- trunk/sound/soc/codecs/wm_hubs.c | 30 ++++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index 16cae53250d4..a4f4d84d5772 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6b3860b0a20a790fb26ca67aadcba0714e879667 +refs/heads/master: 1479c3fb5f0ca8410428006cb04ca27263beea25 diff --git a/trunk/sound/soc/codecs/wm_hubs.c b/trunk/sound/soc/codecs/wm_hubs.c index 5c2d5657b472..4cc2d567f22f 100644 --- a/trunk/sound/soc/codecs/wm_hubs.c +++ b/trunk/sound/soc/codecs/wm_hubs.c @@ -66,8 +66,8 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); unsigned int reg; int count = 0; + int timeout; unsigned int val; - unsigned long timeout; val = op | WM8993_DCS_ENA_CHAN_0 | WM8993_DCS_ENA_CHAN_1; @@ -76,21 +76,23 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) dev_dbg(codec->dev, "Waiting for DC servo...\n"); - if (hubs->dcs_done_irq) { - timeout = wait_for_completion_timeout(&hubs->dcs_done, - msecs_to_jiffies(500)); - if (timeout == 0) - dev_warn(codec->dev, "No DC servo interrupt\n"); + if (hubs->dcs_done_irq) + timeout = 4; + else + timeout = 400; - reg = snd_soc_read(codec, WM8993_DC_SERVO_0); - } else { - do { - count++; + do { + count++; + + if (hubs->dcs_done_irq) + wait_for_completion_timeout(&hubs->dcs_done, + msecs_to_jiffies(250)); + else msleep(1); - reg = snd_soc_read(codec, WM8993_DC_SERVO_0); - dev_dbg(codec->dev, "DC servo: %x\n", reg); - } while (reg & op && count < 400); - } + + reg = snd_soc_read(codec, WM8993_DC_SERVO_0); + dev_dbg(codec->dev, "DC servo: %x\n", reg); + } while (reg & op && count < timeout); if (reg & op) dev_err(codec->dev, "Timed out waiting for DC Servo %x\n",