]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/mt9m001.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg...
[linux-2.6-omap-h63xx.git] / drivers / media / video / mt9m001.c
index b58f0f85e30fb21508426e56e7fee6a8317afa75..c1bf75ef2741389576f167c65ccbda8254fa4c40 100644 (file)
@@ -327,28 +327,30 @@ static int mt9m001_set_fmt(struct soc_camera_device *icd,
 static int mt9m001_try_fmt(struct soc_camera_device *icd,
                           struct v4l2_format *f)
 {
-       if (f->fmt.pix.height < 32 + icd->y_skip_top)
-               f->fmt.pix.height = 32 + icd->y_skip_top;
-       if (f->fmt.pix.height > 1024 + icd->y_skip_top)
-               f->fmt.pix.height = 1024 + icd->y_skip_top;
-       if (f->fmt.pix.width < 48)
-               f->fmt.pix.width = 48;
-       if (f->fmt.pix.width > 1280)
-               f->fmt.pix.width = 1280;
-       f->fmt.pix.width &= ~0x01; /* has to be even, unsure why was ~3 */
+       struct v4l2_pix_format *pix = &f->fmt.pix;
+
+       if (pix->height < 32 + icd->y_skip_top)
+               pix->height = 32 + icd->y_skip_top;
+       if (pix->height > 1024 + icd->y_skip_top)
+               pix->height = 1024 + icd->y_skip_top;
+       if (pix->width < 48)
+               pix->width = 48;
+       if (pix->width > 1280)
+               pix->width = 1280;
+       pix->width &= ~0x01; /* has to be even, unsure why was ~3 */
 
        return 0;
 }
 
 static int mt9m001_get_chip_id(struct soc_camera_device *icd,
-                              struct v4l2_chip_ident *id)
+                              struct v4l2_dbg_chip_ident *id)
 {
        struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
 
-       if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR)
+       if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
                return -EINVAL;
 
-       if (id->match_chip != mt9m001->client->addr)
+       if (id->match.addr != mt9m001->client->addr)
                return -ENODEV;
 
        id->ident       = mt9m001->model;
@@ -359,16 +361,17 @@ static int mt9m001_get_chip_id(struct soc_camera_device *icd,
 
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 static int mt9m001_get_register(struct soc_camera_device *icd,
-                               struct v4l2_register *reg)
+                               struct v4l2_dbg_register *reg)
 {
        struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
 
-       if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
+       if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
                return -EINVAL;
 
-       if (reg->match_chip != mt9m001->client->addr)
+       if (reg->match.addr != mt9m001->client->addr)
                return -ENODEV;
 
+       reg->size = 2;
        reg->val = reg_read(icd, reg->reg);
 
        if (reg->val > 0xffff)
@@ -378,14 +381,14 @@ static int mt9m001_get_register(struct soc_camera_device *icd,
 }
 
 static int mt9m001_set_register(struct soc_camera_device *icd,
-                               struct v4l2_register *reg)
+                               struct v4l2_dbg_register *reg)
 {
        struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
 
-       if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
+       if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
                return -EINVAL;
 
-       if (reg->match_chip != mt9m001->client->addr)
+       if (reg->match.addr != mt9m001->client->addr)
                return -ENODEV;
 
        if (reg_write(icd, reg->reg, reg->val) < 0)
@@ -588,7 +591,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd)
                return -ENODEV;
 
        /* Enable the chip */
-       data = reg_write(&mt9m001->icd, MT9M001_CHIP_ENABLE, 1);
+       data = reg_write(icd, MT9M001_CHIP_ENABLE, 1);
        dev_dbg(&icd->dev, "write: %d\n", data);
 
        /* Read out the chip version register */
@@ -640,8 +643,8 @@ static void mt9m001_video_remove(struct soc_camera_device *icd)
        struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
 
        dev_dbg(&icd->dev, "Video %x removed: %p, %p\n", mt9m001->client->addr,
-               mt9m001->icd.dev.parent, mt9m001->icd.vdev);
-       soc_camera_video_stop(&mt9m001->icd);
+               icd->dev.parent, icd->vdev);
+       soc_camera_video_stop(icd);
 }
 
 static int mt9m001_probe(struct i2c_client *client,