]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
soc-camera: ov772x: Modify buswidth control
authorKuninori Morimoto <morimoto.kuninori@renesas.com>
Wed, 6 Jan 2010 09:42:16 +0000 (18:42 +0900)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:11:00 +0000 (15:11 -0300)
This patch removes "buswidth" struct member, and sets the default buswidth
to the natively supported 10 bit. You can select 8 bit buswidth by new flag.
This patch also modify ap325rxa/migor setup.c

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>
arch/sh/boards/mach-ap325rxa/setup.c
arch/sh/boards/mach-migor/setup.c
drivers/media/video/ov772x.c
include/media/ov772x.h

index 1f5fa5c44f6df77d42f0166893abf815ed54c981..71f556fe3f38efbb50bab7c64d0e39fc539009ad 100644 (file)
@@ -471,8 +471,8 @@ static struct i2c_board_info ap325rxa_i2c_camera[] = {
 };
 
 static struct ov772x_camera_info ov7725_info = {
-       .buswidth       = SOCAM_DATAWIDTH_8,
-       .flags          = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
+       .flags          = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP | \
+                         OV772X_FLAG_8BIT,
        .edgectrl       = OV772X_AUTO_EDGECTRL(0xf, 0),
 };
 
index 507c77be476d649c454f6b0b0653df1ca8ce907f..9b4676fa6fbb40cd7fe8e5f6ce2b789abf719144 100644 (file)
@@ -431,7 +431,7 @@ static struct i2c_board_info migor_i2c_camera[] = {
 };
 
 static struct ov772x_camera_info ov7725_info = {
-       .buswidth       = SOCAM_DATAWIDTH_8,
+       .flags          = OV772X_FLAG_8BIT,
 };
 
 static struct soc_camera_link ov7725_link = {
index 3a45e945a528c6fdf63b3c4c72626493f6ab5a4b..7f8ece30c77ba790cb38c314783544a0de0e162d 100644 (file)
@@ -547,7 +547,6 @@ static const struct v4l2_queryctrl ov772x_controls[] = {
        },
 };
 
-
 /*
  * general function
  */
@@ -634,7 +633,12 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
        struct soc_camera_link *icl = to_soc_camera_link(icd);
        unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER |
                SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH |
-               SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth;
+               SOCAM_DATA_ACTIVE_HIGH;
+
+       if (priv->info->flags & OV772X_FLAG_8BIT)
+               flags |= SOCAM_DATAWIDTH_8;
+       else
+               flags |= SOCAM_DATAWIDTH_10;
 
        return soc_camera_apply_sensor_flags(icl, flags);
 }
@@ -1039,15 +1043,6 @@ static int ov772x_video_probe(struct soc_camera_device *icd,
            to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
                return -ENODEV;
 
-       /*
-        * ov772x only use 8 or 10 bit bus width
-        */
-       if (SOCAM_DATAWIDTH_10 != priv->info->buswidth &&
-           SOCAM_DATAWIDTH_8  != priv->info->buswidth) {
-               dev_err(&client->dev, "bus width error\n");
-               return -ENODEV;
-       }
-
        /*
         * check and show product ID and manufacturer ID
         */
@@ -1130,7 +1125,6 @@ static int ov772x_probe(struct i2c_client *client,
                        const struct i2c_device_id *did)
 {
        struct ov772x_priv        *priv;
-       struct ov772x_camera_info *info;
        struct soc_camera_device  *icd = client->dev.platform_data;
        struct i2c_adapter        *adapter = to_i2c_adapter(client->dev.parent);
        struct soc_camera_link    *icl;
@@ -1145,8 +1139,6 @@ static int ov772x_probe(struct i2c_client *client,
        if (!icl || !icl->priv)
                return -EINVAL;
 
-       info = icl->priv;
-
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
                dev_err(&adapter->dev,
                        "I2C-Adapter doesn't support "
@@ -1158,7 +1150,7 @@ static int ov772x_probe(struct i2c_client *client,
        if (!priv)
                return -ENOMEM;
 
-       priv->info = info;
+       priv->info = icl->priv;
 
        v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops);
 
index 14c77efd6a85297e2599da5cc08ad30a8f9ce83e..548bf1155c83209f4444d6fc5546eccfb3a2a3df 100644 (file)
@@ -15,8 +15,9 @@
 #include <media/soc_camera.h>
 
 /* for flags */
-#define OV772X_FLAG_VFLIP     0x00000001 /* Vertical flip image */
-#define OV772X_FLAG_HFLIP     0x00000002 /* Horizontal flip image */
+#define OV772X_FLAG_VFLIP      (1 << 0) /* Vertical flip image */
+#define OV772X_FLAG_HFLIP      (1 << 1) /* Horizontal flip image */
+#define OV772X_FLAG_8BIT       (1 << 2) /* default 10 bit */
 
 /*
  * for Edge ctrl
@@ -53,9 +54,8 @@ struct ov772x_edge_ctrl {
  * ov772x camera info
  */
 struct ov772x_camera_info {
-       unsigned long          buswidth;
-       unsigned long          flags;
-       struct ov772x_edge_ctrl edgectrl;
+       unsigned long           flags;
+       struct ov772x_edge_ctrl edgectrl;
 };
 
 #endif /* __OV772X_H__ */