diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-05-29 05:59:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-17 07:46:34 -0400 |
commit | 7486af1ae3ee34b12fcff1b1ce3a9cc6a2eca03a (patch) | |
tree | b530832a93119bb6852431769843a9364fe5ad70 | |
parent | 08fe9f7ddf31b8c42dd1a689b0a2c1501f10b58c (diff) |
[media] marvell-ccic: remove g_chip_ident
Remove g_chip_ident. This driver used some of the V4L2_IDENT defines, replace
those with a driver-specific enum. This makes it possible to drop the
v4l2-chip-ident.h define as well.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/platform/marvell-ccic/cafe-driver.c | 3 | ||||
-rw-r--r-- | drivers/media/platform/marvell-ccic/mcam-core.c | 55 | ||||
-rw-r--r-- | drivers/media/platform/marvell-ccic/mcam-core.h | 8 | ||||
-rw-r--r-- | drivers/media/platform/marvell-ccic/mmp-driver.c | 3 |
4 files changed, 16 insertions, 53 deletions
diff --git a/drivers/media/platform/marvell-ccic/cafe-driver.c b/drivers/media/platform/marvell-ccic/cafe-driver.c index d030f9beae88..7b07fc55cd3c 100644 --- a/drivers/media/platform/marvell-ccic/cafe-driver.c +++ b/drivers/media/platform/marvell-ccic/cafe-driver.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/videodev2.h> | 28 | #include <linux/videodev2.h> |
29 | #include <media/v4l2-device.h> | 29 | #include <media/v4l2-device.h> |
30 | #include <media/v4l2-chip-ident.h> | ||
31 | #include <linux/device.h> | 30 | #include <linux/device.h> |
32 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
33 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
@@ -469,7 +468,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
469 | goto out; | 468 | goto out; |
470 | cam->pdev = pdev; | 469 | cam->pdev = pdev; |
471 | mcam = &cam->mcam; | 470 | mcam = &cam->mcam; |
472 | mcam->chip_id = V4L2_IDENT_CAFE; | 471 | mcam->chip_id = MCAM_CAFE; |
473 | spin_lock_init(&mcam->dev_lock); | 472 | spin_lock_init(&mcam->dev_lock); |
474 | init_waitqueue_head(&cam->smbus_wait); | 473 | init_waitqueue_head(&cam->smbus_wait); |
475 | mcam->plat_power_up = cafe_ctlr_power_up; | 474 | mcam->plat_power_up = cafe_ctlr_power_up; |
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c index 64ab91edfb81..a187161e980e 100644 --- a/drivers/media/platform/marvell-ccic/mcam-core.c +++ b/drivers/media/platform/marvell-ccic/mcam-core.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <media/v4l2-device.h> | 23 | #include <media/v4l2-device.h> |
24 | #include <media/v4l2-ioctl.h> | 24 | #include <media/v4l2-ioctl.h> |
25 | #include <media/v4l2-ctrls.h> | 25 | #include <media/v4l2-ctrls.h> |
26 | #include <media/v4l2-chip-ident.h> | ||
27 | #include <media/ov7670.h> | 26 | #include <media/ov7670.h> |
28 | #include <media/videobuf2-vmalloc.h> | 27 | #include <media/videobuf2-vmalloc.h> |
29 | #include <media/videobuf2-dma-contig.h> | 28 | #include <media/videobuf2-dma-contig.h> |
@@ -336,7 +335,7 @@ static void mcam_ctlr_dma_vmalloc(struct mcam_camera *cam) | |||
336 | mcam_reg_clear_bit(cam, REG_CTRL1, C1_TWOBUFS); | 335 | mcam_reg_clear_bit(cam, REG_CTRL1, C1_TWOBUFS); |
337 | } else | 336 | } else |
338 | mcam_reg_set_bit(cam, REG_CTRL1, C1_TWOBUFS); | 337 | mcam_reg_set_bit(cam, REG_CTRL1, C1_TWOBUFS); |
339 | if (cam->chip_id == V4L2_IDENT_CAFE) | 338 | if (cam->chip_id == MCAM_CAFE) |
340 | mcam_reg_write(cam, REG_UBAR, 0); /* 32 bits only */ | 339 | mcam_reg_write(cam, REG_UBAR, 0); /* 32 bits only */ |
341 | } | 340 | } |
342 | 341 | ||
@@ -796,7 +795,6 @@ static int __mcam_cam_reset(struct mcam_camera *cam) | |||
796 | */ | 795 | */ |
797 | static int mcam_cam_init(struct mcam_camera *cam) | 796 | static int mcam_cam_init(struct mcam_camera *cam) |
798 | { | 797 | { |
799 | struct v4l2_dbg_chip_ident chip; | ||
800 | int ret; | 798 | int ret; |
801 | 799 | ||
802 | mutex_lock(&cam->s_mutex); | 800 | mutex_lock(&cam->s_mutex); |
@@ -804,24 +802,8 @@ static int mcam_cam_init(struct mcam_camera *cam) | |||
804 | cam_warn(cam, "Cam init with device in funky state %d", | 802 | cam_warn(cam, "Cam init with device in funky state %d", |
805 | cam->state); | 803 | cam->state); |
806 | ret = __mcam_cam_reset(cam); | 804 | ret = __mcam_cam_reset(cam); |
807 | if (ret) | 805 | /* Get/set parameters? */ |
808 | goto out; | ||
809 | chip.ident = V4L2_IDENT_NONE; | ||
810 | chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR; | ||
811 | chip.match.addr = cam->sensor_addr; | ||
812 | ret = sensor_call(cam, core, g_chip_ident, &chip); | ||
813 | if (ret) | ||
814 | goto out; | ||
815 | cam->sensor_type = chip.ident; | ||
816 | if (cam->sensor_type != V4L2_IDENT_OV7670) { | ||
817 | cam_err(cam, "Unsupported sensor type 0x%x", cam->sensor_type); | ||
818 | ret = -EINVAL; | ||
819 | goto out; | ||
820 | } | ||
821 | /* Get/set parameters? */ | ||
822 | ret = 0; | ||
823 | cam->state = S_IDLE; | 806 | cam->state = S_IDLE; |
824 | out: | ||
825 | mcam_ctlr_power_down(cam); | 807 | mcam_ctlr_power_down(cam); |
826 | mutex_unlock(&cam->s_mutex); | 808 | mutex_unlock(&cam->s_mutex); |
827 | return ret; | 809 | return ret; |
@@ -1392,20 +1374,6 @@ static int mcam_vidioc_s_parm(struct file *filp, void *priv, | |||
1392 | return ret; | 1374 | return ret; |
1393 | } | 1375 | } |
1394 | 1376 | ||
1395 | static int mcam_vidioc_g_chip_ident(struct file *file, void *priv, | ||
1396 | struct v4l2_dbg_chip_ident *chip) | ||
1397 | { | ||
1398 | struct mcam_camera *cam = priv; | ||
1399 | |||
1400 | chip->ident = V4L2_IDENT_NONE; | ||
1401 | chip->revision = 0; | ||
1402 | if (v4l2_chip_match_host(&chip->match)) { | ||
1403 | chip->ident = cam->chip_id; | ||
1404 | return 0; | ||
1405 | } | ||
1406 | return sensor_call(cam, core, g_chip_ident, chip); | ||
1407 | } | ||
1408 | |||
1409 | static int mcam_vidioc_enum_framesizes(struct file *filp, void *priv, | 1377 | static int mcam_vidioc_enum_framesizes(struct file *filp, void *priv, |
1410 | struct v4l2_frmsizeenum *sizes) | 1378 | struct v4l2_frmsizeenum *sizes) |
1411 | { | 1379 | { |
@@ -1436,12 +1404,9 @@ static int mcam_vidioc_g_register(struct file *file, void *priv, | |||
1436 | { | 1404 | { |
1437 | struct mcam_camera *cam = priv; | 1405 | struct mcam_camera *cam = priv; |
1438 | 1406 | ||
1439 | if (v4l2_chip_match_host(®->match)) { | 1407 | reg->val = mcam_reg_read(cam, reg->reg); |
1440 | reg->val = mcam_reg_read(cam, reg->reg); | 1408 | reg->size = 4; |
1441 | reg->size = 4; | 1409 | return 0; |
1442 | return 0; | ||
1443 | } | ||
1444 | return sensor_call(cam, core, g_register, reg); | ||
1445 | } | 1410 | } |
1446 | 1411 | ||
1447 | static int mcam_vidioc_s_register(struct file *file, void *priv, | 1412 | static int mcam_vidioc_s_register(struct file *file, void *priv, |
@@ -1449,11 +1414,8 @@ static int mcam_vidioc_s_register(struct file *file, void *priv, | |||
1449 | { | 1414 | { |
1450 | struct mcam_camera *cam = priv; | 1415 | struct mcam_camera *cam = priv; |
1451 | 1416 | ||
1452 | if (v4l2_chip_match_host(®->match)) { | 1417 | mcam_reg_write(cam, reg->reg, reg->val); |
1453 | mcam_reg_write(cam, reg->reg, reg->val); | 1418 | return 0; |
1454 | return 0; | ||
1455 | } | ||
1456 | return sensor_call(cam, core, s_register, reg); | ||
1457 | } | 1419 | } |
1458 | #endif | 1420 | #endif |
1459 | 1421 | ||
@@ -1477,7 +1439,6 @@ static const struct v4l2_ioctl_ops mcam_v4l_ioctl_ops = { | |||
1477 | .vidioc_s_parm = mcam_vidioc_s_parm, | 1439 | .vidioc_s_parm = mcam_vidioc_s_parm, |
1478 | .vidioc_enum_framesizes = mcam_vidioc_enum_framesizes, | 1440 | .vidioc_enum_framesizes = mcam_vidioc_enum_framesizes, |
1479 | .vidioc_enum_frameintervals = mcam_vidioc_enum_frameintervals, | 1441 | .vidioc_enum_frameintervals = mcam_vidioc_enum_frameintervals, |
1480 | .vidioc_g_chip_ident = mcam_vidioc_g_chip_ident, | ||
1481 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1442 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1482 | .vidioc_g_register = mcam_vidioc_g_register, | 1443 | .vidioc_g_register = mcam_vidioc_g_register, |
1483 | .vidioc_s_register = mcam_vidioc_s_register, | 1444 | .vidioc_s_register = mcam_vidioc_s_register, |
@@ -1695,7 +1656,7 @@ int mccic_register(struct mcam_camera *cam) | |||
1695 | if (buffer_mode >= 0) | 1656 | if (buffer_mode >= 0) |
1696 | cam->buffer_mode = buffer_mode; | 1657 | cam->buffer_mode = buffer_mode; |
1697 | if (cam->buffer_mode == B_DMA_sg && | 1658 | if (cam->buffer_mode == B_DMA_sg && |
1698 | cam->chip_id == V4L2_IDENT_CAFE) { | 1659 | cam->chip_id == MCAM_CAFE) { |
1699 | printk(KERN_ERR "marvell-cam: Cafe can't do S/G I/O, " | 1660 | printk(KERN_ERR "marvell-cam: Cafe can't do S/G I/O, " |
1700 | "attempting vmalloc mode instead\n"); | 1661 | "attempting vmalloc mode instead\n"); |
1701 | cam->buffer_mode = B_vmalloc; | 1662 | cam->buffer_mode = B_vmalloc; |
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.h b/drivers/media/platform/marvell-ccic/mcam-core.h index 01dec9e5fc2b..46b6ea31e66b 100644 --- a/drivers/media/platform/marvell-ccic/mcam-core.h +++ b/drivers/media/platform/marvell-ccic/mcam-core.h | |||
@@ -53,6 +53,11 @@ enum mcam_buffer_mode { | |||
53 | B_DMA_sg = 2 | 53 | B_DMA_sg = 2 |
54 | }; | 54 | }; |
55 | 55 | ||
56 | enum mcam_chip_id { | ||
57 | MCAM_CAFE, | ||
58 | MCAM_ARMADA610, | ||
59 | }; | ||
60 | |||
56 | /* | 61 | /* |
57 | * Is a given buffer mode supported by the current kernel configuration? | 62 | * Is a given buffer mode supported by the current kernel configuration? |
58 | */ | 63 | */ |
@@ -98,7 +103,7 @@ struct mcam_camera { | |||
98 | unsigned char __iomem *regs; | 103 | unsigned char __iomem *regs; |
99 | spinlock_t dev_lock; | 104 | spinlock_t dev_lock; |
100 | struct device *dev; /* For messages, dma alloc */ | 105 | struct device *dev; /* For messages, dma alloc */ |
101 | unsigned int chip_id; | 106 | enum mcam_chip_id chip_id; |
102 | short int clock_speed; /* Sensor clock speed, default 30 */ | 107 | short int clock_speed; /* Sensor clock speed, default 30 */ |
103 | short int use_smbus; /* SMBUS or straight I2c? */ | 108 | short int use_smbus; /* SMBUS or straight I2c? */ |
104 | enum mcam_buffer_mode buffer_mode; | 109 | enum mcam_buffer_mode buffer_mode; |
@@ -152,7 +157,6 @@ struct mcam_camera { | |||
152 | void (*frame_complete)(struct mcam_camera *cam, int frame); | 157 | void (*frame_complete)(struct mcam_camera *cam, int frame); |
153 | 158 | ||
154 | /* Current operating parameters */ | 159 | /* Current operating parameters */ |
155 | u32 sensor_type; /* Currently ov7670 only */ | ||
156 | struct v4l2_pix_format pix_format; | 160 | struct v4l2_pix_format pix_format; |
157 | enum v4l2_mbus_pixelcode mbus_code; | 161 | enum v4l2_mbus_pixelcode mbus_code; |
158 | 162 | ||
diff --git a/drivers/media/platform/marvell-ccic/mmp-driver.c b/drivers/media/platform/marvell-ccic/mmp-driver.c index c4c17fe76c0d..cadad647ce0e 100644 --- a/drivers/media/platform/marvell-ccic/mmp-driver.c +++ b/drivers/media/platform/marvell-ccic/mmp-driver.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/videodev2.h> | 19 | #include <linux/videodev2.h> |
20 | #include <media/v4l2-device.h> | 20 | #include <media/v4l2-device.h> |
21 | #include <media/v4l2-chip-ident.h> | ||
22 | #include <media/mmp-camera.h> | 21 | #include <media/mmp-camera.h> |
23 | #include <linux/device.h> | 22 | #include <linux/device.h> |
24 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
@@ -185,7 +184,7 @@ static int mmpcam_probe(struct platform_device *pdev) | |||
185 | mcam->plat_power_down = mmpcam_power_down; | 184 | mcam->plat_power_down = mmpcam_power_down; |
186 | mcam->dev = &pdev->dev; | 185 | mcam->dev = &pdev->dev; |
187 | mcam->use_smbus = 0; | 186 | mcam->use_smbus = 0; |
188 | mcam->chip_id = V4L2_IDENT_ARMADA610; | 187 | mcam->chip_id = MCAM_ARMADA610; |
189 | mcam->buffer_mode = B_DMA_sg; | 188 | mcam->buffer_mode = B_DMA_sg; |
190 | spin_lock_init(&mcam->dev_lock); | 189 | spin_lock_init(&mcam->dev_lock); |
191 | /* | 190 | /* |