ASoC: wcd9335: move regulator optimum calls to codec driver
There are few use cases where apps goes down to suspend but codec should be in active state. Core driver will not have knowledge of these usescases and hence move suspend and resume hooks to codec driver. Change-Id: If5614dd13f24a80d18f53f194c7be1c5b967a003 Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
This commit is contained in:
parent
cd86617027
commit
df029f9d8a
|
@ -2948,12 +2948,22 @@ int wcd9xxx_disable_static_supplies_to_optimum(struct wcd9xxx *wcd9xxx,
|
|||
}
|
||||
EXPORT_SYMBOL(wcd9xxx_disable_static_supplies_to_optimum);
|
||||
|
||||
static int wcd9xxx_enable_static_supplies_to_optimum(
|
||||
struct wcd9xxx *wcd9xxx,
|
||||
struct wcd9xxx_pdata *pdata)
|
||||
/*
|
||||
* wcd9xxx_enable_static_supplies_to_optimum(): to set supplies to optimum mode
|
||||
* @wcd9xxx: Handle to the wcd9xxx core
|
||||
* @pdata: Handle for pdata
|
||||
*
|
||||
* To set all the static supplied to optimum mode so as to save power
|
||||
*
|
||||
* Return: returns 0 if success or error information to the caller in case
|
||||
* of failure.
|
||||
*/
|
||||
int wcd9xxx_enable_static_supplies_to_optimum(
|
||||
struct wcd9xxx *wcd9xxx, void *data)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
struct wcd9xxx_pdata *pdata = (struct wcd9xxx_pdata *)data;
|
||||
|
||||
for (i = 0; i < wcd9xxx->num_of_supplies; i++) {
|
||||
if (pdata->regulator[i].ondemand)
|
||||
|
@ -2978,13 +2988,12 @@ static int wcd9xxx_enable_static_supplies_to_optimum(
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(wcd9xxx_enable_static_supplies_to_optimum);
|
||||
|
||||
static int wcd9xxx_slim_resume(struct slim_device *sldev)
|
||||
{
|
||||
struct wcd9xxx *wcd9xxx = slim_get_devicedata(sldev);
|
||||
struct wcd9xxx_pdata *pdata = sldev->dev.platform_data;
|
||||
|
||||
wcd9xxx_enable_static_supplies_to_optimum(wcd9xxx, pdata);
|
||||
return wcd9xxx_core_res_resume(&wcd9xxx->core_res);
|
||||
}
|
||||
|
||||
|
@ -3000,9 +3009,7 @@ static int wcd9xxx_i2c_resume(struct i2c_client *i2cdev)
|
|||
static int wcd9xxx_slim_suspend(struct slim_device *sldev, pm_message_t pmesg)
|
||||
{
|
||||
struct wcd9xxx *wcd9xxx = slim_get_devicedata(sldev);
|
||||
struct wcd9xxx_pdata *pdata = sldev->dev.platform_data;
|
||||
|
||||
wcd9xxx_disable_static_supplies_to_optimum(wcd9xxx, pdata);
|
||||
return wcd9xxx_core_res_suspend(&wcd9xxx->core_res, pmesg);
|
||||
}
|
||||
|
||||
|
|
|
@ -321,7 +321,9 @@ int wcd9xxx_slim_bulk_write(struct wcd9xxx *wcd9xxx,
|
|||
void wcd9xxx_disable_supplies(struct wcd9xxx *wcd9xxx,
|
||||
void *pdata);
|
||||
|
||||
int wcd9xxx_disable_static_supplies_to_optimum(
|
||||
int wcd9xxx_disable_static_supplies_to_optimum(struct wcd9xxx *wcd9xxx,
|
||||
void *data);
|
||||
int wcd9xxx_enable_static_supplies_to_optimum(
|
||||
struct wcd9xxx *wcd9xxx,
|
||||
void *pdata);
|
||||
|
||||
|
|
|
@ -9930,9 +9930,33 @@ static int tasha_codec_remove(struct snd_soc_codec *codec)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int tasha_codec_suspend(struct snd_soc_codec *codec)
|
||||
{
|
||||
|
||||
struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
|
||||
struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
|
||||
|
||||
pr_debug("%s:suspend of tasha codec\n", __func__);
|
||||
wcd9xxx_disable_static_supplies_to_optimum(tasha->wcd9xxx, pdata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tasha_codec_resume(struct snd_soc_codec *codec)
|
||||
{
|
||||
|
||||
struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
|
||||
struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
|
||||
|
||||
pr_debug("%s:resume of tasha codec\n", __func__);
|
||||
wcd9xxx_enable_static_supplies_to_optimum(tasha->wcd9xxx, pdata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_tasha = {
|
||||
.probe = tasha_codec_probe,
|
||||
.remove = tasha_codec_remove,
|
||||
.suspend = tasha_codec_suspend,
|
||||
.resume = tasha_codec_resume,
|
||||
.controls = tasha_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(tasha_snd_controls),
|
||||
.dapm_widgets = tasha_dapm_widgets,
|
||||
|
|
Loading…
Reference in New Issue