aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Murphy <dmurphy@ti.com>2011-09-15 08:17:16 -0500
committerZiyann <jaraidaniel@gmail.com>2014-10-03 01:17:58 +0200
commita15f46380a8f77c5ec0aad559b24596f429504c4 (patch)
tree6253659e98c2b61b86174fe2420b4410ecc98429
parent6fa93ba90d85cebafd75e1774d93bcaaa73f9031 (diff)
downloadkernel_samsung_tuna-a15f46380a8f77c5ec0aad559b24596f429504c4.zip
kernel_samsung_tuna-a15f46380a8f77c5ec0aad559b24596f429504c4.tar.gz
kernel_samsung_tuna-a15f46380a8f77c5ec0aad559b24596f429504c4.tar.bz2
tsl2771 prox/als: Update suspend/resume to dev_pm_ops
Update the power management suspend/resume to use the dev_pm_ops instead of legacy suspend/resume callbacks Change-Id: Id6d89fdd72049ae1bf21053cab544253ae23437b Signed-off-by: Dan Murphy <dmurphy@ti.com>
-rw-r--r--drivers/input/misc/tsl2771.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/input/misc/tsl2771.c b/drivers/input/misc/tsl2771.c
index 3dc5013..e41814a 100644
--- a/drivers/input/misc/tsl2771.c
+++ b/drivers/input/misc/tsl2771.c
@@ -24,6 +24,8 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/input.h>
+#include <linux/pm.h>
+#include <linux/platform_device.h>
#include <linux/workqueue.h>
#include <linux/i2c.h>
#include <linux/i2c/tsl2771.h>
@@ -847,10 +849,11 @@ static int __devexit tsl2771_driver_remove(struct i2c_client *client)
/* TO DO: Need to run through the power management APIs to make sure we
* do not break power management and the sensor */
#ifdef CONFIG_PM
-static int tsl2771_driver_suspend(struct i2c_client *client,
- pm_message_t mesg)
+static int tsl2771_driver_suspend(struct device *dev)
{
- struct tsl2771_data *data = i2c_get_clientdata(client);
+ struct platform_device *pdev = to_platform_device(dev);
+ struct tsl2771_data *data = platform_get_drvdata(pdev);
+
/* TO DO: May need to retain the interrupt thresholds but won't know
* until the thresholds are implemented */
data->power_context = data->power_state;
@@ -871,9 +874,10 @@ static int tsl2771_driver_suspend(struct i2c_client *client,
return 0;
}
-static int tsl2771_driver_resume(struct i2c_client *client)
+static int tsl2771_driver_resume(struct device *dev)
{
- struct tsl2771_data *data = i2c_get_clientdata(client);
+ struct platform_device *pdev = to_platform_device(dev);
+ struct tsl2771_data *data = platform_get_drvdata(pdev);
if (data->pdata->tsl2771_pwr_control) {
data->pdata->tsl2771_pwr_control(1);
@@ -894,6 +898,11 @@ static int tsl2771_driver_resume(struct i2c_client *client)
return 0;
}
+
+static const struct dev_pm_ops tsl2771_pm_ops = {
+ .suspend = tsl2771_driver_suspend,
+ .resume = tsl2771_driver_resume,
+};
#endif
static const struct i2c_device_id tsl2771_idtable[] = {
@@ -907,12 +916,11 @@ static struct i2c_driver tsl2771_driver = {
.probe = tsl2771_driver_probe,
.remove = tsl2771_driver_remove,
.id_table = tsl2771_idtable,
+ .driver = {
+ .name = TSL2771_NAME,
#ifdef CONFIG_PM
- .suspend = tsl2771_driver_suspend,
- .resume = tsl2771_driver_resume,
+ .pm = &tsl2771_pm_ops,
#endif
- .driver = {
- .name = TSL2771_NAME
},
};