OMAP1 / PM: Use generic clock manipulation routines for runtime PM
Convert OMAP1 to using the new generic clock manipulation routines and a device power domain for runtime PM instead of overriding the platform bus type's runtime PM callbacks. This allows us to simplify OMAP1-specific code and to share some code with other platforms (shmobile in particular). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Kevin Hilman <khilman@ti.com>
This commit is contained in:
parent
85eb8c8d0b
commit
600b776eb3
@ -24,75 +24,50 @@
|
|||||||
#ifdef CONFIG_PM_RUNTIME
|
#ifdef CONFIG_PM_RUNTIME
|
||||||
static int omap1_pm_runtime_suspend(struct device *dev)
|
static int omap1_pm_runtime_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct clk *iclk, *fclk;
|
int ret;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
dev_dbg(dev, "%s\n", __func__);
|
dev_dbg(dev, "%s\n", __func__);
|
||||||
|
|
||||||
ret = pm_generic_runtime_suspend(dev);
|
ret = pm_generic_runtime_suspend(dev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
fclk = clk_get(dev, "fck");
|
ret = pm_runtime_clk_suspend(dev);
|
||||||
if (!IS_ERR(fclk)) {
|
if (ret) {
|
||||||
clk_disable(fclk);
|
pm_generic_runtime_resume(dev);
|
||||||
clk_put(fclk);
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
iclk = clk_get(dev, "ick");
|
|
||||||
if (!IS_ERR(iclk)) {
|
|
||||||
clk_disable(iclk);
|
|
||||||
clk_put(iclk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
static int omap1_pm_runtime_resume(struct device *dev)
|
static int omap1_pm_runtime_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct clk *iclk, *fclk;
|
|
||||||
|
|
||||||
dev_dbg(dev, "%s\n", __func__);
|
dev_dbg(dev, "%s\n", __func__);
|
||||||
|
|
||||||
iclk = clk_get(dev, "ick");
|
pm_runtime_clk_resume(dev);
|
||||||
if (!IS_ERR(iclk)) {
|
|
||||||
clk_enable(iclk);
|
|
||||||
clk_put(iclk);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclk = clk_get(dev, "fck");
|
|
||||||
if (!IS_ERR(fclk)) {
|
|
||||||
clk_enable(fclk);
|
|
||||||
clk_put(fclk);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pm_generic_runtime_resume(dev);
|
return pm_generic_runtime_resume(dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct dev_power_domain default_power_domain = {
|
||||||
|
.ops = {
|
||||||
|
.runtime_suspend = omap1_pm_runtime_suspend,
|
||||||
|
.runtime_resume = omap1_pm_runtime_resume,
|
||||||
|
USE_PLATFORM_PM_SLEEP_OPS
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct pm_clk_notifier_block platform_bus_notifier = {
|
||||||
|
.pwr_domain = &default_power_domain,
|
||||||
|
.con_ids = { "ick", "fck", NULL, },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init omap1_pm_runtime_init(void)
|
static int __init omap1_pm_runtime_init(void)
|
||||||
{
|
{
|
||||||
const struct dev_pm_ops *pm;
|
|
||||||
struct dev_pm_ops *omap_pm;
|
|
||||||
|
|
||||||
if (!cpu_class_is_omap1())
|
if (!cpu_class_is_omap1())
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
pm = platform_bus_get_pm_ops();
|
pm_runtime_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
|
||||||
if (!pm) {
|
|
||||||
pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
|
|
||||||
__func__);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
|
|
||||||
if (!omap_pm) {
|
|
||||||
pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
|
|
||||||
__func__);
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
omap_pm->runtime_suspend = omap1_pm_runtime_suspend;
|
|
||||||
omap_pm->runtime_resume = omap1_pm_runtime_resume;
|
|
||||||
|
|
||||||
platform_bus_set_pm_ops(omap_pm);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user