Commit f998f257 authored by Mark Brown's avatar Mark Brown

ASoC: Fix WM8996 DC servo operation without IRQ

We need to count the timeout down.
Reported-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarLiam Girdwood <lrg@ti.com>
parent 7803e329
...@@ -719,7 +719,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, u16 mask) ...@@ -719,7 +719,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, u16 mask)
{ {
struct i2c_client *i2c = to_i2c_client(codec->dev); struct i2c_client *i2c = to_i2c_client(codec->dev);
struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
int i, ret; int ret;
unsigned long timeout = 200; unsigned long timeout = 200;
snd_soc_write(codec, WM8996_DC_SERVO_2, mask); snd_soc_write(codec, WM8996_DC_SERVO_2, mask);
...@@ -734,15 +734,12 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, u16 mask) ...@@ -734,15 +734,12 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, u16 mask)
} else { } else {
msleep(1); msleep(1);
if (--i) { timeout--;
timeout = 0;
break;
}
} }
ret = snd_soc_read(codec, WM8996_DC_SERVO_2); ret = snd_soc_read(codec, WM8996_DC_SERVO_2);
dev_dbg(codec->dev, "DC servo state: %x\n", ret); dev_dbg(codec->dev, "DC servo state: %x\n", ret);
} while (ret & mask); } while (timeout && ret & mask);
if (timeout == 0) if (timeout == 0)
dev_err(codec->dev, "DC servo timed out for %x\n", mask); dev_err(codec->dev, "DC servo timed out for %x\n", mask);
......
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