diff options
author | Mark Brown <broonie@linaro.org> | 2013-11-22 08:32:36 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-11-24 08:53:27 -0500 |
commit | e4634804cacce6fe1ec34d92786f764fcb75cb97 (patch) | |
tree | 44c11745fe0a6d7c23e6b88bf70623b72217cbed | |
parent | a86652e51a8776bc0fe811e32ec3118f03c7e3bb (diff) |
ASoC: wm8991: Move basic initialisation to I2C level probe
This is better practice, though some of this stuff ought not to be here at
all.
Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/wm8991.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index 7006f9732af6..5fdcf788e990 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c | |||
@@ -111,8 +111,6 @@ static bool wm8991_volatile(struct device *dev, unsigned int reg) | |||
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | #define wm8991_reset(c) snd_soc_write(c, WM8991_RESET, 0) | ||
115 | |||
116 | static const unsigned int rec_mix_tlv[] = { | 114 | static const unsigned int rec_mix_tlv[] = { |
117 | TLV_DB_RANGE_HEAD(1), | 115 | TLV_DB_RANGE_HEAD(1), |
118 | 0, 7, TLV_DB_LINEAR_ITEM(-1500, 600), | 116 | 0, 7, TLV_DB_LINEAR_ITEM(-1500, 600), |
@@ -1264,31 +1262,8 @@ static int wm8991_probe(struct snd_soc_codec *codec) | |||
1264 | return ret; | 1262 | return ret; |
1265 | } | 1263 | } |
1266 | 1264 | ||
1267 | ret = wm8991_reset(codec); | ||
1268 | if (ret < 0) { | ||
1269 | dev_err(codec->dev, "Failed to issue reset\n"); | ||
1270 | return ret; | ||
1271 | } | ||
1272 | |||
1273 | wm8991_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1265 | wm8991_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1274 | 1266 | ||
1275 | snd_soc_update_bits(codec, WM8991_AUDIO_INTERFACE_4, | ||
1276 | WM8991_ALRCGPIO1, WM8991_ALRCGPIO1); | ||
1277 | |||
1278 | snd_soc_update_bits(codec, WM8991_GPIO1_GPIO2, | ||
1279 | WM8991_GPIO1_SEL_MASK, 1); | ||
1280 | |||
1281 | snd_soc_update_bits(codec, WM8991_POWER_MANAGEMENT_1, | ||
1282 | WM8991_VREF_ENA | WM8991_VMID_MODE_MASK, | ||
1283 | WM8991_VREF_ENA | WM8991_VMID_MODE_MASK); | ||
1284 | |||
1285 | snd_soc_update_bits(codec, WM8991_POWER_MANAGEMENT_2, | ||
1286 | WM8991_OPCLK_ENA, WM8991_OPCLK_ENA); | ||
1287 | |||
1288 | snd_soc_write(codec, WM8991_DAC_CTRL, 0); | ||
1289 | snd_soc_write(codec, WM8991_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); | ||
1290 | snd_soc_write(codec, WM8991_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); | ||
1291 | |||
1292 | return 0; | 1267 | return 0; |
1293 | } | 1268 | } |
1294 | 1269 | ||
@@ -1372,6 +1347,31 @@ static int wm8991_i2c_probe(struct i2c_client *i2c, | |||
1372 | 1347 | ||
1373 | i2c_set_clientdata(i2c, wm8991); | 1348 | i2c_set_clientdata(i2c, wm8991); |
1374 | 1349 | ||
1350 | ret = regmap_write(wm8991->regmap, WM8991_RESET, 0); | ||
1351 | if (ret < 0) { | ||
1352 | dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret); | ||
1353 | return ret; | ||
1354 | } | ||
1355 | |||
1356 | regmap_update_bits(wm8991->regmap, WM8991_AUDIO_INTERFACE_4, | ||
1357 | WM8991_ALRCGPIO1, WM8991_ALRCGPIO1); | ||
1358 | |||
1359 | regmap_update_bits(wm8991->regmap, WM8991_GPIO1_GPIO2, | ||
1360 | WM8991_GPIO1_SEL_MASK, 1); | ||
1361 | |||
1362 | regmap_update_bits(wm8991->regmap, WM8991_POWER_MANAGEMENT_1, | ||
1363 | WM8991_VREF_ENA | WM8991_VMID_MODE_MASK, | ||
1364 | WM8991_VREF_ENA | WM8991_VMID_MODE_MASK); | ||
1365 | |||
1366 | regmap_update_bits(wm8991->regmap, WM8991_POWER_MANAGEMENT_2, | ||
1367 | WM8991_OPCLK_ENA, WM8991_OPCLK_ENA); | ||
1368 | |||
1369 | regmap_write(wm8991->regmap, WM8991_DAC_CTRL, 0); | ||
1370 | regmap_write(wm8991->regmap, WM8991_LEFT_OUTPUT_VOLUME, | ||
1371 | 0x50 | (1<<8)); | ||
1372 | regmap_write(wm8991->regmap, WM8991_RIGHT_OUTPUT_VOLUME, | ||
1373 | 0x50 | (1<<8)); | ||
1374 | |||
1375 | ret = snd_soc_register_codec(&i2c->dev, | 1375 | ret = snd_soc_register_codec(&i2c->dev, |
1376 | &soc_codec_dev_wm8991, &wm8991_dai, 1); | 1376 | &soc_codec_dev_wm8991, &wm8991_dai, 1); |
1377 | 1377 | ||