diff options
Diffstat (limited to 'drivers/mfd/tc3589x.c')
-rw-r--r-- | drivers/mfd/tc3589x.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index f000d2ed23e0..32291fe4151c 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c | |||
@@ -14,6 +14,9 @@ | |||
14 | #include <linux/mfd/core.h> | 14 | #include <linux/mfd/core.h> |
15 | #include <linux/mfd/tc3589x.h> | 15 | #include <linux/mfd/tc3589x.h> |
16 | 16 | ||
17 | #define TC3589x_CLKMODE_MODCTL_SLEEP 0x0 | ||
18 | #define TC3589x_CLKMODE_MODCTL_OPERATION (1 << 0) | ||
19 | |||
17 | /** | 20 | /** |
18 | * tc3589x_reg_read() - read a single TC3589x register | 21 | * tc3589x_reg_read() - read a single TC3589x register |
19 | * @tc3589x: Device to read from | 22 | * @tc3589x: Device to read from |
@@ -339,6 +342,37 @@ static int __devexit tc3589x_remove(struct i2c_client *client) | |||
339 | return 0; | 342 | return 0; |
340 | } | 343 | } |
341 | 344 | ||
345 | static int tc3589x_suspend(struct device *dev) | ||
346 | { | ||
347 | struct tc3589x *tc3589x = dev_get_drvdata(dev); | ||
348 | struct i2c_client *client = tc3589x->i2c; | ||
349 | int ret = 0; | ||
350 | |||
351 | /* put the system to sleep mode */ | ||
352 | if (!device_may_wakeup(&client->dev)) | ||
353 | ret = tc3589x_reg_write(tc3589x, TC3589x_CLKMODE, | ||
354 | TC3589x_CLKMODE_MODCTL_SLEEP); | ||
355 | |||
356 | return ret; | ||
357 | } | ||
358 | |||
359 | static int tc3589x_resume(struct device *dev) | ||
360 | { | ||
361 | struct tc3589x *tc3589x = dev_get_drvdata(dev); | ||
362 | struct i2c_client *client = tc3589x->i2c; | ||
363 | int ret = 0; | ||
364 | |||
365 | /* enable the system into operation */ | ||
366 | if (!device_may_wakeup(&client->dev)) | ||
367 | ret = tc3589x_reg_write(tc3589x, TC3589x_CLKMODE, | ||
368 | TC3589x_CLKMODE_MODCTL_OPERATION); | ||
369 | |||
370 | return ret; | ||
371 | } | ||
372 | |||
373 | static const SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, | ||
374 | tc3589x_resume); | ||
375 | |||
342 | static const struct i2c_device_id tc3589x_id[] = { | 376 | static const struct i2c_device_id tc3589x_id[] = { |
343 | { "tc3589x", 24 }, | 377 | { "tc3589x", 24 }, |
344 | { } | 378 | { } |
@@ -348,6 +382,9 @@ MODULE_DEVICE_TABLE(i2c, tc3589x_id); | |||
348 | static struct i2c_driver tc3589x_driver = { | 382 | static struct i2c_driver tc3589x_driver = { |
349 | .driver.name = "tc3589x", | 383 | .driver.name = "tc3589x", |
350 | .driver.owner = THIS_MODULE, | 384 | .driver.owner = THIS_MODULE, |
385 | #ifdef CONFIG_PM | ||
386 | .driver.pm = &tc3589x_dev_pm_ops, | ||
387 | #endif | ||
351 | .probe = tc3589x_probe, | 388 | .probe = tc3589x_probe, |
352 | .remove = __devexit_p(tc3589x_remove), | 389 | .remove = __devexit_p(tc3589x_remove), |
353 | .id_table = tc3589x_id, | 390 | .id_table = tc3589x_id, |