aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-07-08 07:22:39 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2009-07-21 18:28:39 -0400
commit57f4d4f1b72983f8c76e2f232e064730aeffe599 (patch)
tree5fe1344b3cac21bc73d3d8855af6a200953977ca
parent4aebac2fb9645e897864e12cdb8d1e4aadf5b2a4 (diff)
I2C: Rework i2c-pxa suspend_late()/resume_early()
This patch reworks platform driver power management code for i2c-pxa from legacy late/early callbacks to dev_pm_ops. The callbacks are converted for CONFIG_SUSPEND like this: suspend_late() -> suspend_noirq() resume_early() -> resume_noirq() Signed-off-by: Magnus Damm <damm@igel.co.jp> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r--drivers/i2c/busses/i2c-pxa.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 762e1e530882..049555777f67 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1134,35 +1134,44 @@ static int __exit i2c_pxa_remove(struct platform_device *dev)
1134} 1134}
1135 1135
1136#ifdef CONFIG_PM 1136#ifdef CONFIG_PM
1137static int i2c_pxa_suspend_late(struct platform_device *dev, pm_message_t state) 1137static int i2c_pxa_suspend_noirq(struct device *dev)
1138{ 1138{
1139 struct pxa_i2c *i2c = platform_get_drvdata(dev); 1139 struct platform_device *pdev = to_platform_device(dev);
1140 struct pxa_i2c *i2c = platform_get_drvdata(pdev);
1141
1140 clk_disable(i2c->clk); 1142 clk_disable(i2c->clk);
1143
1141 return 0; 1144 return 0;
1142} 1145}
1143 1146
1144static int i2c_pxa_resume_early(struct platform_device *dev) 1147static int i2c_pxa_resume_noirq(struct device *dev)
1145{ 1148{
1146 struct pxa_i2c *i2c = platform_get_drvdata(dev); 1149 struct platform_device *pdev = to_platform_device(dev);
1150 struct pxa_i2c *i2c = platform_get_drvdata(pdev);
1147 1151
1148 clk_enable(i2c->clk); 1152 clk_enable(i2c->clk);
1149 i2c_pxa_reset(i2c); 1153 i2c_pxa_reset(i2c);
1150 1154
1151 return 0; 1155 return 0;
1152} 1156}
1157
1158static struct dev_pm_ops i2c_pxa_dev_pm_ops = {
1159 .suspend_noirq = i2c_pxa_suspend_noirq,
1160 .resume_noirq = i2c_pxa_resume_noirq,
1161};
1162
1163#define I2C_PXA_DEV_PM_OPS (&i2c_pxa_dev_pm_ops)
1153#else 1164#else
1154#define i2c_pxa_suspend_late NULL 1165#define I2C_PXA_DEV_PM_OPS NULL
1155#define i2c_pxa_resume_early NULL
1156#endif 1166#endif
1157 1167
1158static struct platform_driver i2c_pxa_driver = { 1168static struct platform_driver i2c_pxa_driver = {
1159 .probe = i2c_pxa_probe, 1169 .probe = i2c_pxa_probe,
1160 .remove = __exit_p(i2c_pxa_remove), 1170 .remove = __exit_p(i2c_pxa_remove),
1161 .suspend_late = i2c_pxa_suspend_late,
1162 .resume_early = i2c_pxa_resume_early,
1163 .driver = { 1171 .driver = {
1164 .name = "pxa2xx-i2c", 1172 .name = "pxa2xx-i2c",
1165 .owner = THIS_MODULE, 1173 .owner = THIS_MODULE,
1174 .pm = I2C_PXA_DEV_PM_OPS,
1166 }, 1175 },
1167 .id_table = i2c_pxa_id_table, 1176 .id_table = i2c_pxa_id_table,
1168}; 1177};