aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-07-15 04:33:26 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-07-15 10:48:05 -0400
commit1479c3fb5f0ca8410428006cb04ca27263beea25 (patch)
tree7367a0648f4ce09c9d8827de9e511e2b662ad8e7 /sound/soc
parent6b3860b0a20a790fb26ca67aadcba0714e879667 (diff)
ASoC: Handle spurious wm_hubs DC servo done interrupts
Don't assume the first fire indicates that we're done. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wm_hubs.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 5c2d5657b472..4cc2d567f22f 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -66,8 +66,8 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op)
66 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); 66 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
67 unsigned int reg; 67 unsigned int reg;
68 int count = 0; 68 int count = 0;
69 int timeout;
69 unsigned int val; 70 unsigned int val;
70 unsigned long timeout;
71 71
72 val = op | WM8993_DCS_ENA_CHAN_0 | WM8993_DCS_ENA_CHAN_1; 72 val = op | WM8993_DCS_ENA_CHAN_0 | WM8993_DCS_ENA_CHAN_1;
73 73
@@ -76,21 +76,23 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op)
76 76
77 dev_dbg(codec->dev, "Waiting for DC servo...\n"); 77 dev_dbg(codec->dev, "Waiting for DC servo...\n");
78 78
79 if (hubs->dcs_done_irq) { 79 if (hubs->dcs_done_irq)
80 timeout = wait_for_completion_timeout(&hubs->dcs_done, 80 timeout = 4;
81 msecs_to_jiffies(500)); 81 else
82 if (timeout == 0) 82 timeout = 400;
83 dev_warn(codec->dev, "No DC servo interrupt\n");
84 83
85 reg = snd_soc_read(codec, WM8993_DC_SERVO_0); 84 do {
86 } else { 85 count++;
87 do { 86
88 count++; 87 if (hubs->dcs_done_irq)
88 wait_for_completion_timeout(&hubs->dcs_done,
89 msecs_to_jiffies(250));
90 else
89 msleep(1); 91 msleep(1);
90 reg = snd_soc_read(codec, WM8993_DC_SERVO_0); 92
91 dev_dbg(codec->dev, "DC servo: %x\n", reg); 93 reg = snd_soc_read(codec, WM8993_DC_SERVO_0);
92 } while (reg & op && count < 400); 94 dev_dbg(codec->dev, "DC servo: %x\n", reg);
93 } 95 } while (reg & op && count < timeout);
94 96
95 if (reg & op) 97 if (reg & op)
96 dev_err(codec->dev, "Timed out waiting for DC Servo %x\n", 98 dev_err(codec->dev, "Timed out waiting for DC Servo %x\n",