diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2012-05-14 16:54:20 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-05-20 11:27:06 -0400 |
commit | 6592ebb3979c1ec0e37eb06553ef5ce9d6f5f025 (patch) | |
tree | e472e8a80ebc8328666a78239f69331c3b9c207a /drivers/mfd/max77693.c | |
parent | 83871c00bb43f41d85dd15aba56a83bbb191eabc (diff) |
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.c | 32 |
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, | |||
154 | max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); | 154 | max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); |
155 | i2c_set_clientdata(max77693->haptic, max77693); | 155 | i2c_set_clientdata(max77693->haptic, max77693); |
156 | 156 | ||
157 | ret = max77693_irq_init(max77693); | ||
158 | if (ret < 0) | ||
159 | goto err_mfd; | ||
160 | |||
157 | pm_runtime_set_active(max77693->dev); | 161 | pm_runtime_set_active(max77693->dev); |
158 | 162 | ||
159 | ret = mfd_add_devices(max77693->dev, -1, max77693_devs, | 163 | ret = mfd_add_devices(max77693->dev, -1, max77693_devs, |
@@ -161,6 +165,8 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
161 | if (ret < 0) | 165 | if (ret < 0) |
162 | goto err_mfd; | 166 | goto err_mfd; |
163 | 167 | ||
168 | device_init_wakeup(max77693->dev, pdata->wakeup); | ||
169 | |||
164 | return ret; | 170 | return ret; |
165 | 171 | ||
166 | err_mfd: | 172 | err_mfd: |
@@ -189,10 +195,36 @@ static const struct i2c_device_id max77693_i2c_id[] = { | |||
189 | }; | 195 | }; |
190 | MODULE_DEVICE_TABLE(i2c, max77693_i2c_id); | 196 | MODULE_DEVICE_TABLE(i2c, max77693_i2c_id); |
191 | 197 | ||
198 | static int max77693_suspend(struct device *dev) | ||
199 | { | ||
200 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | ||
201 | struct max77693_dev *max77693 = i2c_get_clientdata(i2c); | ||
202 | |||
203 | if (device_may_wakeup(dev)) | ||
204 | irq_set_irq_wake(max77693->irq, 1); | ||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | static int max77693_resume(struct device *dev) | ||
209 | { | ||
210 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | ||
211 | struct max77693_dev *max77693 = i2c_get_clientdata(i2c); | ||
212 | |||
213 | if (device_may_wakeup(dev)) | ||
214 | irq_set_irq_wake(max77693->irq, 0); | ||
215 | return max77693_irq_resume(max77693); | ||
216 | } | ||
217 | |||
218 | const struct dev_pm_ops max77693_pm = { | ||
219 | .suspend = max77693_suspend, | ||
220 | .resume = max77693_resume, | ||
221 | }; | ||
222 | |||
192 | static struct i2c_driver max77693_i2c_driver = { | 223 | static struct i2c_driver max77693_i2c_driver = { |
193 | .driver = { | 224 | .driver = { |
194 | .name = "max77693", | 225 | .name = "max77693", |
195 | .owner = THIS_MODULE, | 226 | .owner = THIS_MODULE, |
227 | .pm = &max77693_pm, | ||
196 | }, | 228 | }, |
197 | .probe = max77693_i2c_probe, | 229 | .probe = max77693_i2c_probe, |
198 | .remove = max77693_i2c_remove, | 230 | .remove = max77693_i2c_remove, |