summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/wm8978.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-29 11:44:03 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-20 13:58:19 +0000
commit008f8d4f9955b5f20be06ed99434cc2f8b025e06 (patch)
tree4276f90fc6840ae5d0a88fcd9f39edef75a3e12f /sound/soc/codecs/wm8978.c
parentee60d0155d653888de75b642182b0300c21ce07a (diff)
ASoC: Push wm8978 reset down into the I2C probe
Ensures that we get control of the CODEC earlier and don't try to probe the card at all if register I/O isn't working. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8978.c')
-rw-r--r--sound/soc/codecs/wm8978.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index 5ff8734d5d2e..72d5fdcd3cc2 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -1000,13 +1000,6 @@ static int wm8978_probe(struct snd_soc_codec *codec)
for (i = 0; i < ARRAY_SIZE(update_reg); i++)
snd_soc_update_bits(codec, update_reg[i], 0x100, 0x100);
- /* Reset the codec */
- ret = snd_soc_write(codec, WM8978_RESET, 0);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to issue reset\n");
- return ret;
- }
-
wm8978_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0;
@@ -1066,9 +1059,24 @@ static __devinit int wm8978_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, wm8978);
+ /* Reset the codec */
+ ret = regmap_write(wm8978->regmap, WM8978_RESET, 0);
+ if (ret != 0) {
+ dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret);
+ goto err;
+ }
+
ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_wm8978, &wm8978_dai, 1);
+ if (ret != 0) {
+ dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
+ goto err;
+ }
+ return 0;
+
+err:
+ regmap_exit(wm8978->regmap);
return ret;
}