aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-common.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/v4l2-common.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/v4l2-common.c')
-rw-r--r--drivers/media/video/v4l2-common.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 4a3635cd6f9e..49f1df74aa21 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -60,6 +60,7 @@
60#include <linux/video_decoder.h> 60#include <linux/video_decoder.h>
61#define __OLD_VIDIOC_ /* To allow fixing old calls*/ 61#define __OLD_VIDIOC_ /* To allow fixing old calls*/
62#include <media/v4l2-common.h> 62#include <media/v4l2-common.h>
63#include <media/v4l2-chip-ident.h>
63 64
64#ifdef CONFIG_KMOD 65#ifdef CONFIG_KMOD
65#include <linux/kmod.h> 66#include <linux/kmod.h>
@@ -383,6 +384,8 @@ static const char *v4l2_ioctls[] = {
383 384
384 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", 385 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
385 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", 386 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
387
388 [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT",
386#endif 389#endif
387}; 390};
388#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) 391#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
@@ -413,7 +416,6 @@ static const char *v4l2_int_ioctls[] = {
413 [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE", 416 [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE",
414 [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA", 417 [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA",
415 [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA", 418 [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA",
416 [_IOC_NR(VIDIOC_INT_G_CHIP_IDENT)] = "VIDIOC_INT_G_CHIP_IDENT",
417 [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ", 419 [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ",
418 [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY", 420 [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY",
419 [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING", 421 [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING",
@@ -981,6 +983,22 @@ int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_c
981 } 983 }
982} 984}
983 985
986int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip,
987 u32 ident, u32 revision)
988{
989 if (!v4l2_chip_match_i2c_client(c, chip->match_type, chip->match_chip))
990 return 0;
991 if (chip->ident == V4L2_IDENT_NONE) {
992 chip->ident = ident;
993 chip->revision = revision;
994 }
995 else {
996 chip->ident = V4L2_IDENT_AMBIGUOUS;
997 chip->revision = 0;
998 }
999 return 0;
1000}
1001
984int v4l2_chip_match_host(u32 match_type, u32 match_chip) 1002int v4l2_chip_match_host(u32 match_type, u32 match_chip)
985{ 1003{
986 switch (match_type) { 1004 switch (match_type) {
@@ -1015,6 +1033,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_fill);
1015EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); 1033EXPORT_SYMBOL(v4l2_ctrl_query_fill_std);
1016 1034
1017EXPORT_SYMBOL(v4l2_chip_match_i2c_client); 1035EXPORT_SYMBOL(v4l2_chip_match_i2c_client);
1036EXPORT_SYMBOL(v4l2_chip_ident_i2c_client);
1018EXPORT_SYMBOL(v4l2_chip_match_host); 1037EXPORT_SYMBOL(v4l2_chip_match_host);
1019 1038
1020/* 1039/*