Skip to contentSkip to conversation

ASoC: Fix WM8996 DC servo operation without IRQ

PATCH In review Mark Brown 2 participants 2 messages Sep 15, 2011

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: Fix WM8996 DC servo operation without IRQ

We need to count the timneout down.

---
 sound/soc/codecs/wm8996.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
sound/soc/codecs/wm8996.c +3 -6
index 0fed436..5ca9d76 100644
@@ -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 wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
-	int i, ret;
+	int ret;
 	unsigned long timeout = 200;
 
 	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)
 
 		} else {
 			msleep(1);
-			if (--i) {
-				timeout = 0;
-				break;
-			}
+			timeout--;
 		}
 
 		ret = snd_soc_read(codec, WM8996_DC_SERVO_2);
 		dev_dbg(codec->dev, "DC servo state: %x\n", ret);
-	} while (ret & mask);
+	} while (timeout && ret & mask);
 
 	if (timeout == 0)
 		dev_err(codec->dev, "DC servo timed out for %x\n", mask);
Signature · 1 line
1.7.6.3
Acked-by on v1 1/1
#1 lore raw
Quoted 29 lines · Mark Brown

We need to count the timneout down.

---
 sound/soc/codecs/wm8996.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
sound/soc/codecs/wm8996.c +1 -5
index 0fed436..5ca9d76 100644
@@ -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 wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
-	int i, ret;
+	int ret;
 	unsigned long timeout = 200;
 
 	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)
 
 		} else {
 			msleep(1);
-			if (--i) {
-				timeout = 0;
-				break;
-			}

sound/soc/codecs/wm8996.c static void wait_for_dc_servo(struct snd_soc_codec *codec, u16 mask) · line 745

Quoted 10 lines
sound/soc/codecs/wm8996.c +2 -1
+			timeout--;
 		}
 
 		ret = snd_soc_read(codec, WM8996_DC_SERVO_2);
 		dev_dbg(codec->dev, "DC servo state: %x\n", ret);
-	} while (ret & mask);
+	} while (timeout && ret & mask);
 
 	if (timeout == 0)
 		dev_err(codec->dev, "DC servo timed out for %x\n", mask);