aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cafe_ccic.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-04-27 11:31:08 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:43:27 -0400
commit3434eb7e14d9587ee56f3462bcfa5726b62dadb9 (patch)
tree49afb0915dac8e7864f89582ddbb7a6453982e2c /drivers/media/video/cafe_ccic.c
parentced80c67cd1ed503c6fb72f02ac7342ab4ebf67a (diff)
V4L/DVB (5306): Add support for VIDIOC_G_CHIP_IDENT
VIDIOC_G_CHIP_IDENT improves debugging of card problems: it can be used to detect which chips are on the board and based on that information selected register dumps can be made, making it easy to debug complicated media chips containing tens or hundreds of registers. This ioctl replaces the internal VIDIOC_INT_G_CHIP_IDENT ioctl. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cafe_ccic.c')
-rw-r--r--drivers/media/video/cafe_ccic.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 710c11a68296..4d4db7b2b611 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -22,6 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/videodev2.h> 23#include <linux/videodev2.h>
24#include <media/v4l2-common.h> 24#include <media/v4l2-common.h>
25#include <media/v4l2-chip-ident.h>
25#include <linux/device.h> 26#include <linux/device.h>
26#include <linux/wait.h> 27#include <linux/wait.h>
27#include <linux/list.h> 28#include <linux/list.h>
@@ -164,7 +165,7 @@ struct cafe_camera
164 struct tasklet_struct s_tasklet; 165 struct tasklet_struct s_tasklet;
165 166
166 /* Current operating parameters */ 167 /* Current operating parameters */
167 enum v4l2_chip_ident sensor_type; /* Currently ov7670 only */ 168 u32 sensor_type; /* Currently ov7670 only */
168 struct v4l2_pix_format pix_format; 169 struct v4l2_pix_format pix_format;
169 170
170 /* Locks */ 171 /* Locks */
@@ -818,6 +819,7 @@ static int __cafe_cam_reset(struct cafe_camera *cam)
818 */ 819 */
819static int cafe_cam_init(struct cafe_camera *cam) 820static int cafe_cam_init(struct cafe_camera *cam)
820{ 821{
822 struct v4l2_chip_ident chip = { V4L2_CHIP_MATCH_I2C_ADDR, 0, 0, 0 };
821 int ret; 823 int ret;
822 824
823 mutex_lock(&cam->s_mutex); 825 mutex_lock(&cam->s_mutex);
@@ -827,9 +829,11 @@ static int cafe_cam_init(struct cafe_camera *cam)
827 ret = __cafe_cam_reset(cam); 829 ret = __cafe_cam_reset(cam);
828 if (ret) 830 if (ret)
829 goto out; 831 goto out;
830 ret = __cafe_cam_cmd(cam, VIDIOC_INT_G_CHIP_IDENT, &cam->sensor_type); 832 chip.match_chip = cam->sensor->addr;
833 ret = __cafe_cam_cmd(cam, VIDIOC_G_CHIP_IDENT, &chip);
831 if (ret) 834 if (ret)
832 goto out; 835 goto out;
836 cam->sensor_type = chip.ident;
833// if (cam->sensor->addr != OV7xx0_SID) { 837// if (cam->sensor->addr != OV7xx0_SID) {
834 if (cam->sensor_type != V4L2_IDENT_OV7670) { 838 if (cam->sensor_type != V4L2_IDENT_OV7670) {
835 cam_err(cam, "Unsupported sensor type %d", cam->sensor->addr); 839 cam_err(cam, "Unsupported sensor type %d", cam->sensor->addr);