Commit ff43728c authored by Tony Lindgren's avatar Tony Lindgren

bus: ti-sysc: Move legacy platform data idling into separate functions

Let's move the legacy idle and enable into separate functions to simplify
PM runtime functions a bit.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent b7182b42
...@@ -622,9 +622,50 @@ static void sysc_show_registers(struct sysc *ddata) ...@@ -622,9 +622,50 @@ static void sysc_show_registers(struct sysc *ddata)
buf); buf);
} }
static int __maybe_unused sysc_runtime_suspend(struct device *dev) static int __maybe_unused sysc_runtime_suspend_legacy(struct device *dev,
struct sysc *ddata)
{
struct ti_sysc_platform_data *pdata;
int error;
pdata = dev_get_platdata(ddata->dev);
if (!pdata)
return 0;
if (!pdata->idle_module)
return -ENODEV;
error = pdata->idle_module(dev, &ddata->cookie);
if (error)
dev_err(dev, "%s: could not idle: %i\n",
__func__, error);
return 0;
}
static int __maybe_unused sysc_runtime_resume_legacy(struct device *dev,
struct sysc *ddata)
{ {
struct ti_sysc_platform_data *pdata; struct ti_sysc_platform_data *pdata;
int error;
pdata = dev_get_platdata(ddata->dev);
if (!pdata)
return 0;
if (!pdata->enable_module)
return -ENODEV;
error = pdata->enable_module(dev, &ddata->cookie);
if (error)
dev_err(dev, "%s: could not enable: %i\n",
__func__, error);
return 0;
}
static int __maybe_unused sysc_runtime_suspend(struct device *dev)
{
struct sysc *ddata; struct sysc *ddata;
int error = 0, i; int error = 0, i;
...@@ -634,19 +675,11 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev) ...@@ -634,19 +675,11 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
return 0; return 0;
if (ddata->legacy_mode) { if (ddata->legacy_mode) {
pdata = dev_get_platdata(ddata->dev); error = sysc_runtime_suspend_legacy(dev, ddata);
if (!pdata) if (!error)
return 0; ddata->enabled = false;
if (!pdata->idle_module)
return -ENODEV;
error = pdata->idle_module(dev, &ddata->cookie);
if (error)
dev_err(dev, "%s: could not idle: %i\n",
__func__, error);
goto idled; return error;
} }
for (i = 0; i < ddata->nr_clocks; i++) { for (i = 0; i < ddata->nr_clocks; i++) {
...@@ -659,7 +692,6 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev) ...@@ -659,7 +692,6 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
clk_disable(ddata->clocks[i]); clk_disable(ddata->clocks[i]);
} }
idled:
ddata->enabled = false; ddata->enabled = false;
return error; return error;
...@@ -667,7 +699,6 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev) ...@@ -667,7 +699,6 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
static int __maybe_unused sysc_runtime_resume(struct device *dev) static int __maybe_unused sysc_runtime_resume(struct device *dev)
{ {
struct ti_sysc_platform_data *pdata;
struct sysc *ddata; struct sysc *ddata;
int error = 0, i; int error = 0, i;
...@@ -677,19 +708,11 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev) ...@@ -677,19 +708,11 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
return 0; return 0;
if (ddata->legacy_mode) { if (ddata->legacy_mode) {
pdata = dev_get_platdata(ddata->dev); error = sysc_runtime_resume_legacy(dev, ddata);
if (!pdata) if (!error)
return 0; ddata->enabled = true;
if (!pdata->enable_module) return error;
return -ENODEV;
error = pdata->enable_module(dev, &ddata->cookie);
if (error)
dev_err(dev, "%s: could not enable: %i\n",
__func__, error);
goto awake;
} }
for (i = 0; i < ddata->nr_clocks; i++) { for (i = 0; i < ddata->nr_clocks; i++) {
...@@ -704,7 +727,6 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev) ...@@ -704,7 +727,6 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
return error; return error;
} }
awake:
ddata->enabled = true; ddata->enabled = true;
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment