diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-29 06:44:03 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-20 08:58:19 -0500 |
commit | 008f8d4f9955b5f20be06ed99434cc2f8b025e06 (patch) | |
tree | 4276f90fc6840ae5d0a88fcd9f39edef75a3e12f /sound/soc/codecs/wm8978.c | |
parent | ee60d0155d653888de75b642182b0300c21ce07a (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.c | 22 |
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) | |||
1000 | for (i = 0; i < ARRAY_SIZE(update_reg); i++) | 1000 | for (i = 0; i < ARRAY_SIZE(update_reg); i++) |
1001 | snd_soc_update_bits(codec, update_reg[i], 0x100, 0x100); | 1001 | snd_soc_update_bits(codec, update_reg[i], 0x100, 0x100); |
1002 | 1002 | ||
1003 | /* Reset the codec */ | ||
1004 | ret = snd_soc_write(codec, WM8978_RESET, 0); | ||
1005 | if (ret < 0) { | ||
1006 | dev_err(codec->dev, "Failed to issue reset\n"); | ||
1007 | return ret; | ||
1008 | } | ||
1009 | |||
1010 | wm8978_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1003 | wm8978_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1011 | 1004 | ||
1012 | return 0; | 1005 | return 0; |
@@ -1066,9 +1059,24 @@ static __devinit int wm8978_i2c_probe(struct i2c_client *i2c, | |||
1066 | 1059 | ||
1067 | i2c_set_clientdata(i2c, wm8978); | 1060 | i2c_set_clientdata(i2c, wm8978); |
1068 | 1061 | ||
1062 | /* Reset the codec */ | ||
1063 | ret = regmap_write(wm8978->regmap, WM8978_RESET, 0); | ||
1064 | if (ret != 0) { | ||
1065 | dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret); | ||
1066 | goto err; | ||
1067 | } | ||
1068 | |||
1069 | ret = snd_soc_register_codec(&i2c->dev, | 1069 | ret = snd_soc_register_codec(&i2c->dev, |
1070 | &soc_codec_dev_wm8978, &wm8978_dai, 1); | 1070 | &soc_codec_dev_wm8978, &wm8978_dai, 1); |
1071 | if (ret != 0) { | ||
1072 | dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); | ||
1073 | goto err; | ||
1074 | } | ||
1071 | 1075 | ||
1076 | return 0; | ||
1077 | |||
1078 | err: | ||
1079 | regmap_exit(wm8978->regmap); | ||
1072 | return ret; | 1080 | return ret; |
1073 | } | 1081 | } |
1074 | 1082 | ||