diff options
Diffstat (limited to 'drivers/mfd/tps6586x.c')
-rw-r--r-- | drivers/mfd/tps6586x.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index f54fe4d4f77b..ee61fd7c198d 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/regmap.h> | 28 | #include <linux/regmap.h> |
29 | #include <linux/of.h> | ||
29 | 30 | ||
30 | #include <linux/mfd/core.h> | 31 | #include <linux/mfd/core.h> |
31 | #include <linux/mfd/tps6586x.h> | 32 | #include <linux/mfd/tps6586x.h> |
@@ -124,6 +125,7 @@ struct tps6586x { | |||
124 | struct i2c_client *client; | 125 | struct i2c_client *client; |
125 | struct regmap *regmap; | 126 | struct regmap *regmap; |
126 | 127 | ||
128 | int irq; | ||
127 | struct irq_chip irq_chip; | 129 | struct irq_chip irq_chip; |
128 | struct mutex irq_lock; | 130 | struct mutex irq_lock; |
129 | int irq_base; | 131 | int irq_base; |
@@ -261,12 +263,23 @@ static void tps6586x_irq_sync_unlock(struct irq_data *data) | |||
261 | mutex_unlock(&tps6586x->irq_lock); | 263 | mutex_unlock(&tps6586x->irq_lock); |
262 | } | 264 | } |
263 | 265 | ||
266 | #ifdef CONFIG_PM_SLEEP | ||
267 | static int tps6586x_irq_set_wake(struct irq_data *irq_data, unsigned int on) | ||
268 | { | ||
269 | struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data); | ||
270 | return irq_set_irq_wake(tps6586x->irq, on); | ||
271 | } | ||
272 | #else | ||
273 | #define tps6586x_irq_set_wake NULL | ||
274 | #endif | ||
275 | |||
264 | static struct irq_chip tps6586x_irq_chip = { | 276 | static struct irq_chip tps6586x_irq_chip = { |
265 | .name = "tps6586x", | 277 | .name = "tps6586x", |
266 | .irq_bus_lock = tps6586x_irq_lock, | 278 | .irq_bus_lock = tps6586x_irq_lock, |
267 | .irq_bus_sync_unlock = tps6586x_irq_sync_unlock, | 279 | .irq_bus_sync_unlock = tps6586x_irq_sync_unlock, |
268 | .irq_disable = tps6586x_irq_disable, | 280 | .irq_disable = tps6586x_irq_disable, |
269 | .irq_enable = tps6586x_irq_enable, | 281 | .irq_enable = tps6586x_irq_enable, |
282 | .irq_set_wake = tps6586x_irq_set_wake, | ||
270 | }; | 283 | }; |
271 | 284 | ||
272 | static int tps6586x_irq_map(struct irq_domain *h, unsigned int virq, | 285 | static int tps6586x_irq_map(struct irq_domain *h, unsigned int virq, |
@@ -331,6 +344,8 @@ static int tps6586x_irq_init(struct tps6586x *tps6586x, int irq, | |||
331 | int new_irq_base; | 344 | int new_irq_base; |
332 | int irq_num = ARRAY_SIZE(tps6586x_irqs); | 345 | int irq_num = ARRAY_SIZE(tps6586x_irqs); |
333 | 346 | ||
347 | tps6586x->irq = irq; | ||
348 | |||
334 | mutex_init(&tps6586x->irq_lock); | 349 | mutex_init(&tps6586x->irq_lock); |
335 | for (i = 0; i < 5; i++) { | 350 | for (i = 0; i < 5; i++) { |
336 | tps6586x->mask_reg[i] = 0xff; | 351 | tps6586x->mask_reg[i] = 0xff; |
@@ -360,10 +375,8 @@ static int tps6586x_irq_init(struct tps6586x *tps6586x, int irq, | |||
360 | ret = request_threaded_irq(irq, NULL, tps6586x_irq, IRQF_ONESHOT, | 375 | ret = request_threaded_irq(irq, NULL, tps6586x_irq, IRQF_ONESHOT, |
361 | "tps6586x", tps6586x); | 376 | "tps6586x", tps6586x); |
362 | 377 | ||
363 | if (!ret) { | 378 | if (!ret) |
364 | device_init_wakeup(tps6586x->dev, 1); | 379 | device_init_wakeup(tps6586x->dev, 1); |
365 | enable_irq_wake(irq); | ||
366 | } | ||
367 | 380 | ||
368 | return ret; | 381 | return ret; |
369 | } | 382 | } |