ASoC: wcd: modify codec power down sequence
Modify the codec power down sequence as below 1. Disable regulators. 2. Pull down codec reset GPIO. 3. Wait for 60 msec for codec to stabilise. Change-Id: I410482561d99365395eea6ec94347e91507fe03a Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
This commit is contained in:
parent
97267485e0
commit
8f7738bdb5
|
@ -131,8 +131,6 @@ static int wcd9xxx_slim_device_up(struct slim_device *sldev);
|
|||
static int wcd9xxx_slim_device_down(struct slim_device *sldev);
|
||||
static int wcd9xxx_enable_static_supplies(struct wcd9xxx *wcd9xxx,
|
||||
struct wcd9xxx_pdata *pdata);
|
||||
static void wcd9xxx_disable_supplies(struct wcd9xxx *wcd9xxx,
|
||||
struct wcd9xxx_pdata *pdata);
|
||||
|
||||
struct wcd9xxx_i2c wcd9xxx_modules[MAX_WCD9XXX_DEVICE];
|
||||
|
||||
|
@ -1796,11 +1794,17 @@ static int wcd9xxx_enable_static_supplies(struct wcd9xxx *wcd9xxx,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void wcd9xxx_disable_supplies(struct wcd9xxx *wcd9xxx,
|
||||
struct wcd9xxx_pdata *pdata)
|
||||
/*
|
||||
* wcd9xxx_disable_supplies: to disable static regulators
|
||||
* @wcd9xxx: Handle to the wcd9xxx core
|
||||
* @pdata: Handle for pdata
|
||||
* @return: void
|
||||
*/
|
||||
void wcd9xxx_disable_supplies(struct wcd9xxx *wcd9xxx, void *data)
|
||||
{
|
||||
int i;
|
||||
int rc;
|
||||
struct wcd9xxx_pdata *pdata = (struct wcd9xxx_pdata *)data;
|
||||
|
||||
for (i = 0; i < wcd9xxx->num_of_supplies; i++) {
|
||||
if (pdata->regulator[i].ondemand)
|
||||
|
@ -1815,9 +1819,10 @@ static void wcd9xxx_disable_supplies(struct wcd9xxx *wcd9xxx,
|
|||
}
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(wcd9xxx_disable_supplies);
|
||||
|
||||
static void wcd9xxx_release_supplies(struct wcd9xxx *wcd9xxx,
|
||||
struct wcd9xxx_pdata *pdata)
|
||||
struct wcd9xxx_pdata *pdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -2913,12 +2918,19 @@ static int wcd9xxx_slim_device_down(struct slim_device *sldev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int wcd9xxx_disable_static_supplies_to_optimum(
|
||||
struct wcd9xxx *wcd9xxx,
|
||||
struct wcd9xxx_pdata *pdata)
|
||||
/*
|
||||
* wcd9xxx_disable_static_supplies_to_optimum: to set supplies to optimum mode
|
||||
* @wcd9xxx: Handle to the wcd9xxx core
|
||||
* @pdata: Handle for pdata
|
||||
* @return: returns 0 if success or error information to the caller in case
|
||||
* of failure.
|
||||
*/
|
||||
int wcd9xxx_disable_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)
|
||||
|
@ -2934,6 +2946,7 @@ static int wcd9xxx_disable_static_supplies_to_optimum(
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(wcd9xxx_disable_static_supplies_to_optimum);
|
||||
|
||||
static int wcd9xxx_enable_static_supplies_to_optimum(
|
||||
struct wcd9xxx *wcd9xxx,
|
||||
|
|
|
@ -318,6 +318,13 @@ int wcd9xxx_slim_bulk_write(struct wcd9xxx *wcd9xxx,
|
|||
struct wcd9xxx_reg_val *bulk_reg,
|
||||
unsigned int size, bool interface);
|
||||
|
||||
void wcd9xxx_disable_supplies(struct wcd9xxx *wcd9xxx,
|
||||
void *pdata);
|
||||
|
||||
int wcd9xxx_disable_static_supplies_to_optimum(
|
||||
struct wcd9xxx *wcd9xxx,
|
||||
void *pdata);
|
||||
|
||||
#if defined(CONFIG_WCD9310_CODEC) || \
|
||||
defined(CONFIG_WCD9304_CODEC) || \
|
||||
defined(CONFIG_WCD9320_CODEC) || \
|
||||
|
|
|
@ -9684,9 +9684,23 @@ static int tasha_remove(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void tasha_powershutdown(struct platform_device *pdev)
|
||||
{
|
||||
struct tasha_priv *tasha;
|
||||
struct wcd9xxx_pdata *pdata = dev_get_platdata(pdev->dev.parent);
|
||||
|
||||
tasha = platform_get_drvdata(pdev);
|
||||
wcd9xxx_disable_static_supplies_to_optimum(tasha->wcd9xxx, pdata);
|
||||
wcd9xxx_disable_supplies(tasha->wcd9xxx, pdata);
|
||||
gpio_direction_output(pdata->reset_gpio, 0);
|
||||
/* sleep for 60msec to follow codec power down sequence */
|
||||
usleep_range(60000, 60100);
|
||||
}
|
||||
|
||||
static struct platform_driver tasha_codec_driver = {
|
||||
.probe = tasha_probe,
|
||||
.remove = tasha_remove,
|
||||
.shutdown = tasha_powershutdown,
|
||||
.driver = {
|
||||
.name = "tasha_codec",
|
||||
.owner = THIS_MODULE,
|
||||
|
|
Loading…
Reference in New Issue