mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 01:51:34 +00:00
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>
This commit is contained in:
parent
725e7a7b58
commit
625c4888ff
@ -2644,21 +2644,6 @@ static int wm8996_probe(struct snd_soc_codec *codec)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
wm8996->disable_nb[0].notifier_call = wm8996_regulator_event_0;
|
|
||||||
wm8996->disable_nb[1].notifier_call = wm8996_regulator_event_1;
|
|
||||||
wm8996->disable_nb[2].notifier_call = wm8996_regulator_event_2;
|
|
||||||
|
|
||||||
/* This should really be moved into the regulator core */
|
|
||||||
for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) {
|
|
||||||
ret = regulator_register_notifier(wm8996->supplies[i].consumer,
|
|
||||||
&wm8996->disable_nb[i]);
|
|
||||||
if (ret != 0) {
|
|
||||||
dev_err(codec->dev,
|
|
||||||
"Failed to register regulator notifier: %d\n",
|
|
||||||
ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Apply platform data settings */
|
/* Apply platform data settings */
|
||||||
snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL,
|
snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL,
|
||||||
WM8996_INL_MODE_MASK | WM8996_INR_MODE_MASK,
|
WM8996_INL_MODE_MASK | WM8996_INR_MODE_MASK,
|
||||||
@ -2858,9 +2843,7 @@ err:
|
|||||||
|
|
||||||
static int wm8996_remove(struct snd_soc_codec *codec)
|
static int wm8996_remove(struct snd_soc_codec *codec)
|
||||||
{
|
{
|
||||||
struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
|
|
||||||
struct i2c_client *i2c = to_i2c_client(codec->dev);
|
struct i2c_client *i2c = to_i2c_client(codec->dev);
|
||||||
int i;
|
|
||||||
|
|
||||||
snd_soc_update_bits(codec, WM8996_INTERRUPT_CONTROL,
|
snd_soc_update_bits(codec, WM8996_INTERRUPT_CONTROL,
|
||||||
WM8996_IM_IRQ, WM8996_IM_IRQ);
|
WM8996_IM_IRQ, WM8996_IM_IRQ);
|
||||||
@ -2868,10 +2851,6 @@ static int wm8996_remove(struct snd_soc_codec *codec)
|
|||||||
if (i2c->irq)
|
if (i2c->irq)
|
||||||
free_irq(i2c->irq, codec);
|
free_irq(i2c->irq, codec);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++)
|
|
||||||
regulator_unregister_notifier(wm8996->supplies[i].consumer,
|
|
||||||
&wm8996->disable_nb[i]);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2985,6 +2964,21 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c,
|
|||||||
goto err_gpio;
|
goto err_gpio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wm8996->disable_nb[0].notifier_call = wm8996_regulator_event_0;
|
||||||
|
wm8996->disable_nb[1].notifier_call = wm8996_regulator_event_1;
|
||||||
|
wm8996->disable_nb[2].notifier_call = wm8996_regulator_event_2;
|
||||||
|
|
||||||
|
/* This should really be moved into the regulator core */
|
||||||
|
for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) {
|
||||||
|
ret = regulator_register_notifier(wm8996->supplies[i].consumer,
|
||||||
|
&wm8996->disable_nb[i]);
|
||||||
|
if (ret != 0) {
|
||||||
|
dev_err(&i2c->dev,
|
||||||
|
"Failed to register regulator notifier: %d\n",
|
||||||
|
ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = regulator_bulk_enable(ARRAY_SIZE(wm8996->supplies),
|
ret = regulator_bulk_enable(ARRAY_SIZE(wm8996->supplies),
|
||||||
wm8996->supplies);
|
wm8996->supplies);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@ -3062,6 +3056,7 @@ err:
|
|||||||
static __devexit int wm8996_i2c_remove(struct i2c_client *client)
|
static __devexit int wm8996_i2c_remove(struct i2c_client *client)
|
||||||
{
|
{
|
||||||
struct wm8996_priv *wm8996 = i2c_get_clientdata(client);
|
struct wm8996_priv *wm8996 = i2c_get_clientdata(client);
|
||||||
|
int i;
|
||||||
|
|
||||||
snd_soc_unregister_codec(&client->dev);
|
snd_soc_unregister_codec(&client->dev);
|
||||||
wm8996_free_gpio(wm8996);
|
wm8996_free_gpio(wm8996);
|
||||||
@ -3069,6 +3064,10 @@ static __devexit int wm8996_i2c_remove(struct i2c_client *client)
|
|||||||
gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0);
|
gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0);
|
||||||
gpio_free(wm8996->pdata.ldo_ena);
|
gpio_free(wm8996->pdata.ldo_ena);
|
||||||
}
|
}
|
||||||
|
for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++)
|
||||||
|
regulator_unregister_notifier(wm8996->supplies[i].consumer,
|
||||||
|
&wm8996->disable_nb[i]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user