diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-11 06:41:16 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-25 04:55:01 -0400 |
commit | d4b3d0fbb7617a65cb919ac86110b0790ae568c5 (patch) | |
tree | 6f23bd4a3d65d00134b272dd44ef2376b4fea0c9 /sound | |
parent | 625c4888fff33c300779ed38963e1ee7ad878a12 (diff) |
ASoC: wm8996: Inline wm8996_reset() and optimise cache-only usage
There is only one caller and this allows us to cleanly leave the CODEC
with the internal LDO powered down which is the default state we're
looking for and means that we can robustly disable the register cache
only when we either disable the LDO or power down the external
regulators.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/wm8996.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index e0cf5b0b5203..1579880ac05d 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c | |||
@@ -1528,18 +1528,6 @@ static bool wm8996_volatile_register(struct device *dev, unsigned int reg) | |||
1528 | } | 1528 | } |
1529 | } | 1529 | } |
1530 | 1530 | ||
1531 | static int wm8996_reset(struct wm8996_priv *wm8996) | ||
1532 | { | ||
1533 | if (wm8996->pdata.ldo_ena > 0) { | ||
1534 | gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); | ||
1535 | gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 1); | ||
1536 | return 0; | ||
1537 | } else { | ||
1538 | return regmap_write(wm8996->regmap, WM8996_SOFTWARE_RESET, | ||
1539 | 0x8915); | ||
1540 | } | ||
1541 | } | ||
1542 | |||
1543 | static const int bclk_divs[] = { | 1531 | static const int bclk_divs[] = { |
1544 | 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96 | 1532 | 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96 |
1545 | }; | 1533 | }; |
@@ -1631,8 +1619,10 @@ static int wm8996_set_bias_level(struct snd_soc_codec *codec, | |||
1631 | 1619 | ||
1632 | case SND_SOC_BIAS_OFF: | 1620 | case SND_SOC_BIAS_OFF: |
1633 | regcache_cache_only(codec->control_data, true); | 1621 | regcache_cache_only(codec->control_data, true); |
1634 | if (wm8996->pdata.ldo_ena >= 0) | 1622 | if (wm8996->pdata.ldo_ena >= 0) { |
1635 | gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); | 1623 | gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); |
1624 | regcache_cache_only(codec->control_data, true); | ||
1625 | } | ||
1636 | regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), | 1626 | regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), |
1637 | wm8996->supplies); | 1627 | wm8996->supplies); |
1638 | break; | 1628 | break; |
@@ -3019,13 +3009,18 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c, | |||
3019 | dev_info(&i2c->dev, "revision %c\n", | 3009 | dev_info(&i2c->dev, "revision %c\n", |
3020 | (reg & WM8996_CHIP_REV_MASK) + 'A'); | 3010 | (reg & WM8996_CHIP_REV_MASK) + 'A'); |
3021 | 3011 | ||
3022 | ret = wm8996_reset(wm8996); | 3012 | if (wm8996->pdata.ldo_ena > 0) { |
3023 | if (ret < 0) { | 3013 | gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); |
3024 | dev_err(&i2c->dev, "Failed to issue reset\n"); | 3014 | regcache_cache_only(wm8996->regmap, true); |
3025 | goto err_regmap; | 3015 | } else { |
3016 | ret = regmap_write(wm8996->regmap, WM8996_SOFTWARE_RESET, | ||
3017 | 0x8915); | ||
3018 | if (ret != 0) { | ||
3019 | dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret); | ||
3020 | goto err_regmap; | ||
3021 | } | ||
3026 | } | 3022 | } |
3027 | 3023 | ||
3028 | regcache_cache_only(wm8996->regmap, true); | ||
3029 | regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); | 3024 | regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); |
3030 | 3025 | ||
3031 | wm8996_init_gpio(wm8996); | 3026 | wm8996_init_gpio(wm8996); |