1 /* linux/arch/arm/plat-samsung/pd.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * Samsung Power domain support
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/init.h>
14 #include <linux/export.h>
15 #include <linux/platform_device.h>
16 #include <linux/err.h>
17 #include <linux/pm_runtime.h>
21 static int samsung_pd_probe(struct platform_device
*pdev
)
23 struct samsung_pd_info
*pdata
= pdev
->dev
.platform_data
;
24 struct device
*dev
= &pdev
->dev
;
27 dev_err(dev
, "no device data specified\n");
31 pm_runtime_set_active(dev
);
32 pm_runtime_enable(dev
);
34 dev_info(dev
, "power domain registered\n");
38 static int __devexit
samsung_pd_remove(struct platform_device
*pdev
)
40 struct device
*dev
= &pdev
->dev
;
42 pm_runtime_disable(dev
);
46 static int samsung_pd_runtime_suspend(struct device
*dev
)
48 struct samsung_pd_info
*pdata
= dev
->platform_data
;
52 ret
= pdata
->disable(dev
);
54 dev_dbg(dev
, "suspended\n");
58 static int samsung_pd_runtime_resume(struct device
*dev
)
60 struct samsung_pd_info
*pdata
= dev
->platform_data
;
64 ret
= pdata
->enable(dev
);
66 dev_dbg(dev
, "resumed\n");
70 static const struct dev_pm_ops samsung_pd_pm_ops
= {
71 .runtime_suspend
= samsung_pd_runtime_suspend
,
72 .runtime_resume
= samsung_pd_runtime_resume
,
75 static struct platform_driver samsung_pd_driver
= {
79 .pm
= &samsung_pd_pm_ops
,
81 .probe
= samsung_pd_probe
,
82 .remove
= __devexit_p(samsung_pd_remove
),
85 static int __init
samsung_pd_init(void)
89 ret
= platform_driver_register(&samsung_pd_driver
);
91 printk(KERN_ERR
"%s: failed to add PD driver\n", __func__
);
95 arch_initcall(samsung_pd_init
);