diff options
author | Mark Brown <broonie@linaro.org> | 2013-11-22 13:32:36 +0000 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-11-24 13:53:27 +0000 |
commit | e4634804cacce6fe1ec34d92786f764fcb75cb97 (patch) | |
tree | 44c11745fe0a6d7c23e6b88bf70623b72217cbed /sound/soc/codecs/wm8991.c | |
parent | a86652e51a8776bc0fe811e32ec3118f03c7e3bb (diff) | |
download | op-kernel-dev-e4634804cacce6fe1ec34d92786f764fcb75cb97.zip op-kernel-dev-e4634804cacce6fe1ec34d92786f764fcb75cb97.tar.gz |
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>
Diffstat (limited to 'sound/soc/codecs/wm8991.c')
-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 7006f97..5fdcf78 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) } } -#define wm8991_reset(c) snd_soc_write(c, WM8991_RESET, 0) - static const unsigned int rec_mix_tlv[] = { TLV_DB_RANGE_HEAD(1), 0, 7, TLV_DB_LINEAR_ITEM(-1500, 600), @@ -1264,31 +1262,8 @@ static int wm8991_probe(struct snd_soc_codec *codec) return ret; } - ret = wm8991_reset(codec); - if (ret < 0) { - dev_err(codec->dev, "Failed to issue reset\n"); - return ret; - } - wm8991_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - snd_soc_update_bits(codec, WM8991_AUDIO_INTERFACE_4, - WM8991_ALRCGPIO1, WM8991_ALRCGPIO1); - - snd_soc_update_bits(codec, WM8991_GPIO1_GPIO2, - WM8991_GPIO1_SEL_MASK, 1); - - snd_soc_update_bits(codec, WM8991_POWER_MANAGEMENT_1, - WM8991_VREF_ENA | WM8991_VMID_MODE_MASK, - WM8991_VREF_ENA | WM8991_VMID_MODE_MASK); - - snd_soc_update_bits(codec, WM8991_POWER_MANAGEMENT_2, - WM8991_OPCLK_ENA, WM8991_OPCLK_ENA); - - snd_soc_write(codec, WM8991_DAC_CTRL, 0); - snd_soc_write(codec, WM8991_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); - snd_soc_write(codec, WM8991_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); - return 0; } @@ -1372,6 +1347,31 @@ static int wm8991_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm8991); + ret = regmap_write(wm8991->regmap, WM8991_RESET, 0); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret); + return ret; + } + + regmap_update_bits(wm8991->regmap, WM8991_AUDIO_INTERFACE_4, + WM8991_ALRCGPIO1, WM8991_ALRCGPIO1); + + regmap_update_bits(wm8991->regmap, WM8991_GPIO1_GPIO2, + WM8991_GPIO1_SEL_MASK, 1); + + regmap_update_bits(wm8991->regmap, WM8991_POWER_MANAGEMENT_1, + WM8991_VREF_ENA | WM8991_VMID_MODE_MASK, + WM8991_VREF_ENA | WM8991_VMID_MODE_MASK); + + regmap_update_bits(wm8991->regmap, WM8991_POWER_MANAGEMENT_2, + WM8991_OPCLK_ENA, WM8991_OPCLK_ENA); + + regmap_write(wm8991->regmap, WM8991_DAC_CTRL, 0); + regmap_write(wm8991->regmap, WM8991_LEFT_OUTPUT_VOLUME, + 0x50 | (1<<8)); + regmap_write(wm8991->regmap, WM8991_RIGHT_OUTPUT_VOLUME, + 0x50 | (1<<8)); + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8991, &wm8991_dai, 1); |