aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2009-12-10 16:52:50 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-16 00:18:36 -0200
commitd1471f02dfb5b3424ee3afb6459d8cb97730af76 (patch)
treebfdab65aa18d3c09bd39c15070adbb18b0b5a751 /drivers/media/radio
parentfe2137dd4e6e4b2f5e758765d5305e8dbb0d931c (diff)
downloadkernel_samsung_tuna-d1471f02dfb5b3424ee3afb6459d8cb97730af76.zip
kernel_samsung_tuna-d1471f02dfb5b3424ee3afb6459d8cb97730af76.tar.gz
kernel_samsung_tuna-d1471f02dfb5b3424ee3afb6459d8cb97730af76.tar.bz2
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')
-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 b8c0d5c..5466015 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)
}
+#ifdef CONFIG_PM
+/*
+ * si470x_i2c_suspend - suspend the device
+ */
+static int si470x_i2c_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+ struct si470x_device *radio = i2c_get_clientdata(client);
+
+ /* power down */
+ radio->registers[POWERCFG] |= POWERCFG_DISABLE;
+ if (si470x_set_register(radio, POWERCFG) < 0)
+ return -EIO;
+
+ return 0;
+}
+
+
+/*
+ * si470x_i2c_resume - resume the device
+ */
+static int si470x_i2c_resume(struct i2c_client *client)
+{
+ struct si470x_device *radio = i2c_get_clientdata(client);
+
+ /* power up : need 110ms */
+ radio->registers[POWERCFG] |= POWERCFG_ENABLE;
+ if (si470x_set_register(radio, POWERCFG) < 0)
+ return -EIO;
+ msleep(110);
+
+ return 0;
+}
+#else
+#define si470x_i2c_suspend NULL
+#define si470x_i2c_resume NULL
+#endif
+
+
/*
* si470x_i2c_driver - i2c driver interface
*/
@@ -497,6 +535,8 @@ static struct i2c_driver si470x_i2c_driver = {
},
.probe = si470x_i2c_probe,
.remove = __devexit_p(si470x_i2c_remove),
+ .suspend = si470x_i2c_suspend,
+ .resume = si470x_i2c_resume,
.id_table = si470x_i2c_id,
};