Skip to content

Commit

Permalink
V4L/DVB (9783): Change power on/off sequence on ov772x
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kuninori Morimoto authored and Mauro Carvalho Chehab committed Dec 30, 2008
1 parent daa1c16 commit b90c032
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions drivers/media/video/ov772x.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,30 @@ static int ov772x_reset(struct i2c_client *client)

static int ov772x_init(struct soc_camera_device *icd)
{
return 0;
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
int ret = 0;

if (priv->info->link.power) {
ret = priv->info->link.power(&priv->client->dev, 1);
if (ret < 0)
return ret;
}

if (priv->info->link.reset)
ret = priv->info->link.reset(&priv->client->dev);

return ret;
}

static int ov772x_release(struct soc_camera_device *icd)
{
return 0;
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
int ret = 0;

if (priv->info->link.power)
ret = priv->info->link.power(&priv->client->dev, 0);

return ret;
}

static int ov772x_start_capture(struct soc_camera_device *icd)
Expand Down Expand Up @@ -814,18 +832,15 @@ static int ov772x_video_probe(struct soc_camera_device *icd)
icd->formats = ov772x_fmt_lists;
icd->num_formats = ARRAY_SIZE(ov772x_fmt_lists);

if (priv->info->link.power)
priv->info->link.power(&priv->client->dev, 1);

/*
* check and show product ID and manufacturer ID
*/
pid = i2c_smbus_read_byte_data(priv->client, PID);
ver = i2c_smbus_read_byte_data(priv->client, VER);
if (pid != 0x77 ||
ver != 0x21) {
if (priv->info->link.power)
priv->info->link.power(&priv->client->dev, 0);
dev_err(&icd->dev,
"Product ID error %x:%x\n", pid, ver);
return -ENODEV;
}

Expand All @@ -842,13 +857,7 @@ static int ov772x_video_probe(struct soc_camera_device *icd)

static void ov772x_video_remove(struct soc_camera_device *icd)
{
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);

soc_camera_video_stop(icd);

if (priv->info->link.power)
priv->info->link.power(&priv->client->dev, 0);

}

static struct soc_camera_ops ov772x_ops = {
Expand Down

0 comments on commit b90c032

Please sign in to comment.