summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/max77693.c
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2012-05-14 22:54:20 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-05-20 17:27:06 +0200
commit6592ebb3979c1ec0e37eb06553ef5ce9d6f5f025 (patch)
treee472e8a80ebc8328666a78239f69331c3b9c207a /drivers/mfd/max77693.c
parent83871c00bb43f41d85dd15aba56a83bbb191eabc (diff)
downloadlinux-6592ebb3979c1ec0e37eb06553ef5ce9d6f5f025.tar.gz
linux-6592ebb3979c1ec0e37eb06553ef5ce9d6f5f025.tar.bz2
linux-6592ebb3979c1ec0e37eb06553ef5ce9d6f5f025.zip
mfd: Add MAX77693 irq handler
This patch supports IRQ handling for MAX77693. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/max77693.c')
-rw-r--r--drivers/mfd/max77693.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index c852515e68c8..e9e4278722f3 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -154,6 +154,10 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
i2c_set_clientdata(max77693->haptic, max77693);
+ ret = max77693_irq_init(max77693);
+ if (ret < 0)
+ goto err_mfd;
+
pm_runtime_set_active(max77693->dev);
ret = mfd_add_devices(max77693->dev, -1, max77693_devs,
@@ -161,6 +165,8 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
if (ret < 0)
goto err_mfd;
+ device_init_wakeup(max77693->dev, pdata->wakeup);
+
return ret;
err_mfd:
@@ -189,10 +195,36 @@ static const struct i2c_device_id max77693_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, max77693_i2c_id);
+static int max77693_suspend(struct device *dev)
+{
+ struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
+ struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
+
+ if (device_may_wakeup(dev))
+ irq_set_irq_wake(max77693->irq, 1);
+ return 0;
+}
+
+static int max77693_resume(struct device *dev)
+{
+ struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
+ struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
+
+ if (device_may_wakeup(dev))
+ irq_set_irq_wake(max77693->irq, 0);
+ return max77693_irq_resume(max77693);
+}
+
+const struct dev_pm_ops max77693_pm = {
+ .suspend = max77693_suspend,
+ .resume = max77693_resume,
+};
+
static struct i2c_driver max77693_i2c_driver = {
.driver = {
.name = "max77693",
.owner = THIS_MODULE,
+ .pm = &max77693_pm,
},
.probe = max77693_i2c_probe,
.remove = max77693_i2c_remove,