diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-09 10:22:32 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-09 10:22:32 -0500 |
commit | 86a942773d5997b32574ed4e19b25530a19ab4c5 (patch) | |
tree | 82dbd89351fcdea171ec81497c98a68bb8aec4cf /sound | |
parent | e7d28c8ca476beed80a299d3587afa5448edb356 (diff) | |
parent | b439c6d0d1c1f9272d3445b5496be687d7411cf5 (diff) |
Merge remote-tracking branch 'asoc/topic/wm8962' into asoc-next
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/wm8962.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index ce6720073798..8fd38cb4ba48 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
@@ -3610,7 +3610,7 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c, | |||
3610 | for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++) | 3610 | for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++) |
3611 | wm8962->supplies[i].supply = wm8962_supply_names[i]; | 3611 | wm8962->supplies[i].supply = wm8962_supply_names[i]; |
3612 | 3612 | ||
3613 | ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8962->supplies), | 3613 | ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8962->supplies), |
3614 | wm8962->supplies); | 3614 | wm8962->supplies); |
3615 | if (ret != 0) { | 3615 | if (ret != 0) { |
3616 | dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); | 3616 | dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); |
@@ -3621,10 +3621,10 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c, | |||
3621 | wm8962->supplies); | 3621 | wm8962->supplies); |
3622 | if (ret != 0) { | 3622 | if (ret != 0) { |
3623 | dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); | 3623 | dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); |
3624 | goto err_get; | 3624 | return ret; |
3625 | } | 3625 | } |
3626 | 3626 | ||
3627 | wm8962->regmap = regmap_init_i2c(i2c, &wm8962_regmap); | 3627 | wm8962->regmap = devm_regmap_init_i2c(i2c, &wm8962_regmap); |
3628 | if (IS_ERR(wm8962->regmap)) { | 3628 | if (IS_ERR(wm8962->regmap)) { |
3629 | ret = PTR_ERR(wm8962->regmap); | 3629 | ret = PTR_ERR(wm8962->regmap); |
3630 | dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); | 3630 | dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); |
@@ -3641,20 +3641,20 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c, | |||
3641 | ret = regmap_read(wm8962->regmap, WM8962_SOFTWARE_RESET, ®); | 3641 | ret = regmap_read(wm8962->regmap, WM8962_SOFTWARE_RESET, ®); |
3642 | if (ret < 0) { | 3642 | if (ret < 0) { |
3643 | dev_err(&i2c->dev, "Failed to read ID register\n"); | 3643 | dev_err(&i2c->dev, "Failed to read ID register\n"); |
3644 | goto err_regmap; | 3644 | goto err_enable; |
3645 | } | 3645 | } |
3646 | if (reg != 0x6243) { | 3646 | if (reg != 0x6243) { |
3647 | dev_err(&i2c->dev, | 3647 | dev_err(&i2c->dev, |
3648 | "Device is not a WM8962, ID %x != 0x6243\n", reg); | 3648 | "Device is not a WM8962, ID %x != 0x6243\n", reg); |
3649 | ret = -EINVAL; | 3649 | ret = -EINVAL; |
3650 | goto err_regmap; | 3650 | goto err_enable; |
3651 | } | 3651 | } |
3652 | 3652 | ||
3653 | ret = regmap_read(wm8962->regmap, WM8962_RIGHT_INPUT_VOLUME, ®); | 3653 | ret = regmap_read(wm8962->regmap, WM8962_RIGHT_INPUT_VOLUME, ®); |
3654 | if (ret < 0) { | 3654 | if (ret < 0) { |
3655 | dev_err(&i2c->dev, "Failed to read device revision: %d\n", | 3655 | dev_err(&i2c->dev, "Failed to read device revision: %d\n", |
3656 | ret); | 3656 | ret); |
3657 | goto err_regmap; | 3657 | goto err_enable; |
3658 | } | 3658 | } |
3659 | 3659 | ||
3660 | dev_info(&i2c->dev, "customer id %x revision %c\n", | 3660 | dev_info(&i2c->dev, "customer id %x revision %c\n", |
@@ -3667,7 +3667,7 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c, | |||
3667 | ret = wm8962_reset(wm8962); | 3667 | ret = wm8962_reset(wm8962); |
3668 | if (ret < 0) { | 3668 | if (ret < 0) { |
3669 | dev_err(&i2c->dev, "Failed to issue reset\n"); | 3669 | dev_err(&i2c->dev, "Failed to issue reset\n"); |
3670 | goto err_regmap; | 3670 | goto err_enable; |
3671 | } | 3671 | } |
3672 | 3672 | ||
3673 | if (pdata && pdata->in4_dc_measure) { | 3673 | if (pdata && pdata->in4_dc_measure) { |
@@ -3686,30 +3686,22 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c, | |||
3686 | ret = snd_soc_register_codec(&i2c->dev, | 3686 | ret = snd_soc_register_codec(&i2c->dev, |
3687 | &soc_codec_dev_wm8962, &wm8962_dai, 1); | 3687 | &soc_codec_dev_wm8962, &wm8962_dai, 1); |
3688 | if (ret < 0) | 3688 | if (ret < 0) |
3689 | goto err_regmap; | 3689 | goto err_enable; |
3690 | 3690 | ||
3691 | /* The drivers should power up as needed */ | 3691 | /* The drivers should power up as needed */ |
3692 | regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); | 3692 | regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); |
3693 | 3693 | ||
3694 | return 0; | 3694 | return 0; |
3695 | 3695 | ||
3696 | err_regmap: | ||
3697 | regmap_exit(wm8962->regmap); | ||
3698 | err_enable: | 3696 | err_enable: |
3699 | regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); | 3697 | regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); |
3700 | err_get: | ||
3701 | regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); | ||
3702 | err: | 3698 | err: |
3703 | return ret; | 3699 | return ret; |
3704 | } | 3700 | } |
3705 | 3701 | ||
3706 | static __devexit int wm8962_i2c_remove(struct i2c_client *client) | 3702 | static __devexit int wm8962_i2c_remove(struct i2c_client *client) |
3707 | { | 3703 | { |
3708 | struct wm8962_priv *wm8962 = dev_get_drvdata(&client->dev); | ||
3709 | |||
3710 | snd_soc_unregister_codec(&client->dev); | 3704 | snd_soc_unregister_codec(&client->dev); |
3711 | regmap_exit(wm8962->regmap); | ||
3712 | regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); | ||
3713 | return 0; | 3705 | return 0; |
3714 | } | 3706 | } |
3715 | 3707 | ||