summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/ov772x.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/ov772x.c')
-rw-r--r--linux/drivers/media/video/ov772x.c97
1 files changed, 53 insertions, 44 deletions
diff --git a/linux/drivers/media/video/ov772x.c b/linux/drivers/media/video/ov772x.c
index 2ddc2ab70..c023bbc84 100644
--- a/linux/drivers/media/video/ov772x.c
+++ b/linux/drivers/media/video/ov772x.c
@@ -112,34 +112,34 @@
#define AREF7 0x55 /* Analog reference control */
#define UFIX 0x60 /* U channel fixed value output */
#define VFIX 0x61 /* V channel fixed value output */
-#define AW_BB_BLK 0x62 /* AWB option for advanced AWB */
-#define AW_B_CTRL0 0x63 /* AWB control byte 0 */
+#define AWBB_BLK 0x62 /* AWB option for advanced AWB */
+#define AWB_CTRL0 0x63 /* AWB control byte 0 */
#define DSP_CTRL1 0x64 /* DSP control byte 1 */
#define DSP_CTRL2 0x65 /* DSP control byte 2 */
#define DSP_CTRL3 0x66 /* DSP control byte 3 */
#define DSP_CTRL4 0x67 /* DSP control byte 4 */
-#define AW_B_BIAS 0x68 /* AWB BLC level clip */
-#define AW_BCTRL1 0x69 /* AWB control 1 */
-#define AW_BCTRL2 0x6A /* AWB control 2 */
-#define AW_BCTRL3 0x6B /* AWB control 3 */
-#define AW_BCTRL4 0x6C /* AWB control 4 */
-#define AW_BCTRL5 0x6D /* AWB control 5 */
-#define AW_BCTRL6 0x6E /* AWB control 6 */
-#define AW_BCTRL7 0x6F /* AWB control 7 */
-#define AW_BCTRL8 0x70 /* AWB control 8 */
-#define AW_BCTRL9 0x71 /* AWB control 9 */
-#define AW_BCTRL10 0x72 /* AWB control 10 */
-#define AW_BCTRL11 0x73 /* AWB control 11 */
-#define AW_BCTRL12 0x74 /* AWB control 12 */
-#define AW_BCTRL13 0x75 /* AWB control 13 */
-#define AW_BCTRL14 0x76 /* AWB control 14 */
-#define AW_BCTRL15 0x77 /* AWB control 15 */
-#define AW_BCTRL16 0x78 /* AWB control 16 */
-#define AW_BCTRL17 0x79 /* AWB control 17 */
-#define AW_BCTRL18 0x7A /* AWB control 18 */
-#define AW_BCTRL19 0x7B /* AWB control 19 */
-#define AW_BCTRL20 0x7C /* AWB control 20 */
-#define AW_BCTRL21 0x7D /* AWB control 21 */
+#define AWB_BIAS 0x68 /* AWB BLC level clip */
+#define AWB_CTRL1 0x69 /* AWB control 1 */
+#define AWB_CTRL2 0x6A /* AWB control 2 */
+#define AWB_CTRL3 0x6B /* AWB control 3 */
+#define AWB_CTRL4 0x6C /* AWB control 4 */
+#define AWB_CTRL5 0x6D /* AWB control 5 */
+#define AWB_CTRL6 0x6E /* AWB control 6 */
+#define AWB_CTRL7 0x6F /* AWB control 7 */
+#define AWB_CTRL8 0x70 /* AWB control 8 */
+#define AWB_CTRL9 0x71 /* AWB control 9 */
+#define AWB_CTRL10 0x72 /* AWB control 10 */
+#define AWB_CTRL11 0x73 /* AWB control 11 */
+#define AWB_CTRL12 0x74 /* AWB control 12 */
+#define AWB_CTRL13 0x75 /* AWB control 13 */
+#define AWB_CTRL14 0x76 /* AWB control 14 */
+#define AWB_CTRL15 0x77 /* AWB control 15 */
+#define AWB_CTRL16 0x78 /* AWB control 16 */
+#define AWB_CTRL17 0x79 /* AWB control 17 */
+#define AWB_CTRL18 0x7A /* AWB control 18 */
+#define AWB_CTRL19 0x7B /* AWB control 19 */
+#define AWB_CTRL20 0x7C /* AWB control 20 */
+#define AWB_CTRL21 0x7D /* AWB control 21 */
#define GAM1 0x7E /* Gamma Curve 1st segment input end point */
#define GAM2 0x7F /* Gamma Curve 2nd segment input end point */
#define GAM3 0x80 /* Gamma Curve 3rd segment input end point */
@@ -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)
@@ -737,9 +755,9 @@ static int ov772x_set_register(struct soc_camera_device *icd,
}
#endif
-static int ov772x_set_fmt_cap(struct soc_camera_device *icd,
- __u32 pixfmt,
- struct v4l2_rect *rect)
+static int ov772x_set_fmt(struct soc_camera_device *icd,
+ __u32 pixfmt,
+ struct v4l2_rect *rect)
{
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
int ret = -EINVAL;
@@ -760,8 +778,8 @@ static int ov772x_set_fmt_cap(struct soc_camera_device *icd,
return ret;
}
-static int ov772x_try_fmt_cap(struct soc_camera_device *icd,
- struct v4l2_format *f)
+static int ov772x_try_fmt(struct soc_camera_device *icd,
+ struct v4l2_format *f)
{
struct v4l2_pix_format *pix = &f->fmt.pix;
struct ov772x_priv *priv;
@@ -814,9 +832,6 @@ 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
*/
@@ -824,8 +839,8 @@ static int ov772x_video_probe(struct soc_camera_device *icd)
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;
}
@@ -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 = {
@@ -859,8 +868,8 @@ static struct soc_camera_ops ov772x_ops = {
.release = ov772x_release,
.start_capture = ov772x_start_capture,
.stop_capture = ov772x_stop_capture,
- .set_fmt_cap = ov772x_set_fmt_cap,
- .try_fmt_cap = ov772x_try_fmt_cap,
+ .set_fmt = ov772x_set_fmt,
+ .try_fmt = ov772x_try_fmt,
.set_bus_param = ov772x_set_bus_param,
.query_bus_param = ov772x_query_bus_param,
.get_chip_id = ov772x_get_chip_id,