diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-11 06:42:06 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-25 04:55:00 -0400 |
commit | 625c4888fff33c300779ed38963e1ee7ad878a12 (patch) | |
tree | 9395dbd4f62135effe57f712053f1b7f1858ce5a | |
parent | 725e7a7b58fb27d8f97a1c4eae47cb5d37564725 (diff) |
ASoC: wm8996: Move regulator notifier callbacks into I2C level
Now that we're using regmap the cache is available here.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/wm8996.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 49e0e8d6663e..e0cf5b0b5203 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c | |||
@@ -2644,21 +2644,6 @@ static int wm8996_probe(struct snd_soc_codec *codec) | |||
2644 | goto err; | 2644 | goto err; |
2645 | } | 2645 | } |
2646 | 2646 | ||
2647 | wm8996->disable_nb[0].notifier_call = wm8996_regulator_event_0; | ||
2648 | wm8996->disable_nb[1].notifier_call = wm8996_regulator_event_1; | ||
2649 | wm8996->disable_nb[2].notifier_call = wm8996_regulator_event_2; | ||
2650 | |||
2651 | /* This should really be moved into the regulator core */ | ||
2652 | for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) { | ||
2653 | ret = regulator_register_notifier(wm8996->supplies[i].consumer, | ||
2654 | &wm8996->disable_nb[i]); | ||
2655 | if (ret != 0) { | ||
2656 | dev_err(codec->dev, | ||
2657 | "Failed to register regulator notifier: %d\n", | ||
2658 | ret); | ||
2659 | } | ||
2660 | } | ||
2661 | |||
2662 | /* Apply platform data settings */ | 2647 | /* Apply platform data settings */ |
2663 | snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL, | 2648 | snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL, |
2664 | WM8996_INL_MODE_MASK | WM8996_INR_MODE_MASK, | 2649 | WM8996_INL_MODE_MASK | WM8996_INR_MODE_MASK, |
@@ -2858,9 +2843,7 @@ err: | |||
2858 | 2843 | ||
2859 | static int wm8996_remove(struct snd_soc_codec *codec) | 2844 | static int wm8996_remove(struct snd_soc_codec *codec) |
2860 | { | 2845 | { |
2861 | struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); | ||
2862 | struct i2c_client *i2c = to_i2c_client(codec->dev); | 2846 | struct i2c_client *i2c = to_i2c_client(codec->dev); |
2863 | int i; | ||
2864 | 2847 | ||
2865 | snd_soc_update_bits(codec, WM8996_INTERRUPT_CONTROL, | 2848 | snd_soc_update_bits(codec, WM8996_INTERRUPT_CONTROL, |
2866 | WM8996_IM_IRQ, WM8996_IM_IRQ); | 2849 | WM8996_IM_IRQ, WM8996_IM_IRQ); |
@@ -2868,10 +2851,6 @@ static int wm8996_remove(struct snd_soc_codec *codec) | |||
2868 | if (i2c->irq) | 2851 | if (i2c->irq) |
2869 | free_irq(i2c->irq, codec); | 2852 | free_irq(i2c->irq, codec); |
2870 | 2853 | ||
2871 | for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) | ||
2872 | regulator_unregister_notifier(wm8996->supplies[i].consumer, | ||
2873 | &wm8996->disable_nb[i]); | ||
2874 | |||
2875 | return 0; | 2854 | return 0; |
2876 | } | 2855 | } |
2877 | 2856 | ||
@@ -2985,6 +2964,21 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c, | |||
2985 | goto err_gpio; | 2964 | goto err_gpio; |
2986 | } | 2965 | } |
2987 | 2966 | ||
2967 | wm8996->disable_nb[0].notifier_call = wm8996_regulator_event_0; | ||
2968 | wm8996->disable_nb[1].notifier_call = wm8996_regulator_event_1; | ||
2969 | wm8996->disable_nb[2].notifier_call = wm8996_regulator_event_2; | ||
2970 | |||
2971 | /* This should really be moved into the regulator core */ | ||
2972 | for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) { | ||
2973 | ret = regulator_register_notifier(wm8996->supplies[i].consumer, | ||
2974 | &wm8996->disable_nb[i]); | ||
2975 | if (ret != 0) { | ||
2976 | dev_err(&i2c->dev, | ||
2977 | "Failed to register regulator notifier: %d\n", | ||
2978 | ret); | ||
2979 | } | ||
2980 | } | ||
2981 | |||
2988 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8996->supplies), | 2982 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8996->supplies), |
2989 | wm8996->supplies); | 2983 | wm8996->supplies); |
2990 | if (ret != 0) { | 2984 | if (ret != 0) { |
@@ -3062,6 +3056,7 @@ err: | |||
3062 | static __devexit int wm8996_i2c_remove(struct i2c_client *client) | 3056 | static __devexit int wm8996_i2c_remove(struct i2c_client *client) |
3063 | { | 3057 | { |
3064 | struct wm8996_priv *wm8996 = i2c_get_clientdata(client); | 3058 | struct wm8996_priv *wm8996 = i2c_get_clientdata(client); |
3059 | int i; | ||
3065 | 3060 | ||
3066 | snd_soc_unregister_codec(&client->dev); | 3061 | snd_soc_unregister_codec(&client->dev); |
3067 | wm8996_free_gpio(wm8996); | 3062 | wm8996_free_gpio(wm8996); |
@@ -3069,6 +3064,10 @@ static __devexit int wm8996_i2c_remove(struct i2c_client *client) | |||
3069 | gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); | 3064 | gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); |
3070 | gpio_free(wm8996->pdata.ldo_ena); | 3065 | gpio_free(wm8996->pdata.ldo_ena); |
3071 | } | 3066 | } |
3067 | for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) | ||
3068 | regulator_unregister_notifier(wm8996->supplies[i].consumer, | ||
3069 | &wm8996->disable_nb[i]); | ||
3070 | |||
3072 | return 0; | 3071 | return 0; |
3073 | } | 3072 | } |
3074 | 3073 | ||