aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-04-13 07:20:07 -0400
committerAnton Vorontsov <anton@enomsg.org>2013-04-16 22:00:01 -0400
commit6b170807cd5cac8dc6353f47a88ccb14bbf76c4f (patch)
treec8c438b552aaa115cf0acdb0b5033c7cb34b1e9f /drivers/power
parentf2c6a5fb258bdfa5aa9743b912b6b782fa631959 (diff)
pm2301-charger: Fix suspend/resume
The pm2301-charger driver implements runtime pm and at the same time uses the legacy pm callbacks for suspend and resume. This does not work since the I2C core wont look at the legacy pm callbacks if a driver has the 'pm' field set. This patch fixes it by moving over to dev_pm_ops for suspend/resume as well. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/pm2301_charger.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/power/pm2301_charger.c b/drivers/power/pm2301_charger.c
index 618c46d25a3b..f123f3c219c3 100644
--- a/drivers/power/pm2301_charger.c
+++ b/drivers/power/pm2301_charger.c
@@ -26,6 +26,7 @@
26#include <linux/pm2301_charger.h> 26#include <linux/pm2301_charger.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/pm_runtime.h> 28#include <linux/pm_runtime.h>
29#include <linux/pm.h>
29 30
30#include "pm2301_charger.h" 31#include "pm2301_charger.h"
31 32
@@ -906,8 +907,13 @@ static struct pm2xxx_irq pm2xxx_charger_irq[] = {
906 {"PM2XXX_IRQ_INT", pm2xxx_irq_int}, 907 {"PM2XXX_IRQ_INT", pm2xxx_irq_int},
907}; 908};
908 909
909static int pm2xxx_wall_charger_resume(struct i2c_client *i2c_client) 910#ifdef CONFIG_PM
911
912#ifdef CONFIG_PM_SLEEP
913
914static int pm2xxx_wall_charger_resume(struct device *dev)
910{ 915{
916 struct i2c_client *i2c_client = to_i2c_client(dev);
911 struct pm2xxx_charger *pm2; 917 struct pm2xxx_charger *pm2;
912 918
913 pm2 = (struct pm2xxx_charger *)i2c_get_clientdata(i2c_client); 919 pm2 = (struct pm2xxx_charger *)i2c_get_clientdata(i2c_client);
@@ -921,9 +927,9 @@ static int pm2xxx_wall_charger_resume(struct i2c_client *i2c_client)
921 return 0; 927 return 0;
922} 928}
923 929
924static int pm2xxx_wall_charger_suspend(struct i2c_client *i2c_client, 930static int pm2xxx_wall_charger_suspend(struct device *dev)
925 pm_message_t state)
926{ 931{
932 struct i2c_client *i2c_client = to_i2c_client(dev);
927 struct pm2xxx_charger *pm2; 933 struct pm2xxx_charger *pm2;
928 934
929 pm2 = (struct pm2xxx_charger *)i2c_get_clientdata(i2c_client); 935 pm2 = (struct pm2xxx_charger *)i2c_get_clientdata(i2c_client);
@@ -939,7 +945,10 @@ static int pm2xxx_wall_charger_suspend(struct i2c_client *i2c_client,
939 return 0; 945 return 0;
940} 946}
941 947
942#ifdef CONFIG_PM 948#endif
949
950#ifdef CONFIG_PM_RUNTIME
951
943static int pm2xxx_runtime_suspend(struct device *dev) 952static int pm2xxx_runtime_suspend(struct device *dev)
944{ 953{
945 struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev); 954 struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev);
@@ -977,9 +986,12 @@ static int pm2xxx_runtime_resume(struct device *dev)
977 return ret; 986 return ret;
978} 987}
979 988
989#endif
990
980static const struct dev_pm_ops pm2xxx_pm_ops = { 991static const struct dev_pm_ops pm2xxx_pm_ops = {
981 .runtime_suspend = pm2xxx_runtime_suspend, 992 SET_SYSTEM_SLEEP_PM_OPS(pm2xxx_wall_charger_suspend,
982 .runtime_resume = pm2xxx_runtime_resume, 993 pm2xxx_wall_charger_resume)
994 SET_RUNTIME_PM_OPS(pm2xxx_runtime_suspend, pm2xxx_runtime_resume, NULL)
983}; 995};
984#define PM2XXX_PM_OPS (&pm2xxx_pm_ops) 996#define PM2XXX_PM_OPS (&pm2xxx_pm_ops)
985#else 997#else
@@ -1234,8 +1246,6 @@ MODULE_DEVICE_TABLE(i2c, pm2xxx_id);
1234static struct i2c_driver pm2xxx_charger_driver = { 1246static struct i2c_driver pm2xxx_charger_driver = {
1235 .probe = pm2xxx_wall_charger_probe, 1247 .probe = pm2xxx_wall_charger_probe,
1236 .remove = pm2xxx_wall_charger_remove, 1248 .remove = pm2xxx_wall_charger_remove,
1237 .suspend = pm2xxx_wall_charger_suspend,
1238 .resume = pm2xxx_wall_charger_resume,
1239 .driver = { 1249 .driver = {
1240 .name = "pm2xxx-wall_charger", 1250 .name = "pm2xxx-wall_charger",
1241 .owner = THIS_MODULE, 1251 .owner = THIS_MODULE,