aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ov772x.c
diff options
context:
space:
mode:
authorKuninori Morimoto <morimoto.kuninori@renesas.com>2008-12-01 07:44:48 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:38:20 -0500
commitb90c032b0da3b8d5293676f6aabcd032a6c02bcb (patch)
tree677492300ba98898d2ee9dec9607b86ac5faf0bd /drivers/media/video/ov772x.c
parentdaa1c164db63540fe7a52c658ce14ae6a8d1ae53 (diff)
V4L/DVB (9783): Change power on/off sequence on ov772x
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ov772x.c')
-rw-r--r--drivers/media/video/ov772x.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 0af2ca6a98f7..d3b54a41758a 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -593,12 +593,30 @@ static int ov772x_reset(struct i2c_client *client)
593 593
594static int ov772x_init(struct soc_camera_device *icd) 594static int ov772x_init(struct soc_camera_device *icd)
595{ 595{
596 return 0; 596 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
597 int ret = 0;
598
599 if (priv->info->link.power) {
600 ret = priv->info->link.power(&priv->client->dev, 1);
601 if (ret < 0)
602 return ret;
603 }
604
605 if (priv->info->link.reset)
606 ret = priv->info->link.reset(&priv->client->dev);
607
608 return ret;
597} 609}
598 610
599static int ov772x_release(struct soc_camera_device *icd) 611static int ov772x_release(struct soc_camera_device *icd)
600{ 612{
601 return 0; 613 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
614 int ret = 0;
615
616 if (priv->info->link.power)
617 ret = priv->info->link.power(&priv->client->dev, 0);
618
619 return ret;
602} 620}
603 621
604static int ov772x_start_capture(struct soc_camera_device *icd) 622static int ov772x_start_capture(struct soc_camera_device *icd)
@@ -814,9 +832,6 @@ static int ov772x_video_probe(struct soc_camera_device *icd)
814 icd->formats = ov772x_fmt_lists; 832 icd->formats = ov772x_fmt_lists;
815 icd->num_formats = ARRAY_SIZE(ov772x_fmt_lists); 833 icd->num_formats = ARRAY_SIZE(ov772x_fmt_lists);
816 834
817 if (priv->info->link.power)
818 priv->info->link.power(&priv->client->dev, 1);
819
820 /* 835 /*
821 * check and show product ID and manufacturer ID 836 * check and show product ID and manufacturer ID
822 */ 837 */
@@ -824,8 +839,8 @@ static int ov772x_video_probe(struct soc_camera_device *icd)
824 ver = i2c_smbus_read_byte_data(priv->client, VER); 839 ver = i2c_smbus_read_byte_data(priv->client, VER);
825 if (pid != 0x77 || 840 if (pid != 0x77 ||
826 ver != 0x21) { 841 ver != 0x21) {
827 if (priv->info->link.power) 842 dev_err(&icd->dev,
828 priv->info->link.power(&priv->client->dev, 0); 843 "Product ID error %x:%x\n", pid, ver);
829 return -ENODEV; 844 return -ENODEV;
830 } 845 }
831 846
@@ -842,13 +857,7 @@ static int ov772x_video_probe(struct soc_camera_device *icd)
842 857
843static void ov772x_video_remove(struct soc_camera_device *icd) 858static void ov772x_video_remove(struct soc_camera_device *icd)
844{ 859{
845 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
846
847 soc_camera_video_stop(icd); 860 soc_camera_video_stop(icd);
848
849 if (priv->info->link.power)
850 priv->info->link.power(&priv->client->dev, 0);
851
852} 861}
853 862
854static struct soc_camera_ops ov772x_ops = { 863static struct soc_camera_ops ov772x_ops = {