aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/si470x/radio-si470x-i2c.c
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2009-12-10 14:52:50 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-15 21:18:36 -0500
commitd1471f02dfb5b3424ee3afb6459d8cb97730af76 (patch)
treebfdab65aa18d3c09bd39c15070adbb18b0b5a751 /drivers/media/radio/si470x/radio-si470x-i2c.c
parentfe2137dd4e6e4b2f5e758765d5305e8dbb0d931c (diff)
V4L/DVB (13601): radio-si470x: support PM functions
This patch is to support PM of the si470x i2c driver. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Acked-by: Tobias Lorenz <tobias.lorenz@gmx.net> Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio/si470x/radio-si470x-i2c.c')
-rw-r--r--drivers/media/radio/si470x/radio-si470x-i2c.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
index b8c0d5cda2f6..5466015346a1 100644
--- a/drivers/media/radio/si470x/radio-si470x-i2c.c
+++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
@@ -487,6 +487,44 @@ static __devexit int si470x_i2c_remove(struct i2c_client *client)
487} 487}
488 488
489 489
490#ifdef CONFIG_PM
491/*
492 * si470x_i2c_suspend - suspend the device
493 */
494static int si470x_i2c_suspend(struct i2c_client *client, pm_message_t mesg)
495{
496 struct si470x_device *radio = i2c_get_clientdata(client);
497
498 /* power down */
499 radio->registers[POWERCFG] |= POWERCFG_DISABLE;
500 if (si470x_set_register(radio, POWERCFG) < 0)
501 return -EIO;
502
503 return 0;
504}
505
506
507/*
508 * si470x_i2c_resume - resume the device
509 */
510static int si470x_i2c_resume(struct i2c_client *client)
511{
512 struct si470x_device *radio = i2c_get_clientdata(client);
513
514 /* power up : need 110ms */
515 radio->registers[POWERCFG] |= POWERCFG_ENABLE;
516 if (si470x_set_register(radio, POWERCFG) < 0)
517 return -EIO;
518 msleep(110);
519
520 return 0;
521}
522#else
523#define si470x_i2c_suspend NULL
524#define si470x_i2c_resume NULL
525#endif
526
527
490/* 528/*
491 * si470x_i2c_driver - i2c driver interface 529 * si470x_i2c_driver - i2c driver interface
492 */ 530 */
@@ -497,6 +535,8 @@ static struct i2c_driver si470x_i2c_driver = {
497 }, 535 },
498 .probe = si470x_i2c_probe, 536 .probe = si470x_i2c_probe,
499 .remove = __devexit_p(si470x_i2c_remove), 537 .remove = __devexit_p(si470x_i2c_remove),
538 .suspend = si470x_i2c_suspend,
539 .resume = si470x_i2c_resume,
500 .id_table = si470x_i2c_id, 540 .id_table = si470x_i2c_id,
501}; 541};
502 542