diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-02-23 18:55:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-03-01 10:09:44 -0500 |
commit | f3d092b84a855c44914fea0648695bef7d751266 (patch) | |
tree | 3ae7a87e18e83be2a39e00a2ae29f26299d1c272 /drivers/media/video/v4l2-common.c | |
parent | d55c7aec666658495e5b57a6b194c8c2a1ac255f (diff) |
V4L/DVB (5304): Improve chip matching in v4l2_register
The chip matching in struct v4l2_register for VIDIOC_DBG_G/S_REGISTER
was rather primitive. It could not be extended to other busses besides
i2c and it lacked a way to.
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.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index ddfd80c5618b..3506cb667111 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/mm.h> | 51 | #include <linux/mm.h> |
52 | #include <linux/string.h> | 52 | #include <linux/string.h> |
53 | #include <linux/errno.h> | 53 | #include <linux/errno.h> |
54 | #include <linux/i2c.h> | ||
54 | #include <asm/uaccess.h> | 55 | #include <asm/uaccess.h> |
55 | #include <asm/system.h> | 56 | #include <asm/system.h> |
56 | #include <asm/pgtable.h> | 57 | #include <asm/pgtable.h> |
@@ -947,6 +948,32 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id) | |||
947 | return **ctrl_classes; | 948 | return **ctrl_classes; |
948 | } | 949 | } |
949 | 950 | ||
951 | int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip) | ||
952 | { | ||
953 | switch (match_type) { | ||
954 | case V4L2_CHIP_MATCH_ALWAYS: | ||
955 | return 1; | ||
956 | case V4L2_CHIP_MATCH_I2C_DRIVER: | ||
957 | return (c != NULL && c->driver != NULL && c->driver->id == match_chip); | ||
958 | case V4L2_CHIP_MATCH_I2C_ADDR: | ||
959 | return (c != NULL && c->addr == match_chip); | ||
960 | default: | ||
961 | return 0; | ||
962 | } | ||
963 | } | ||
964 | |||
965 | int v4l2_chip_match_host(u32 match_type, u32 match_chip) | ||
966 | { | ||
967 | switch (match_type) { | ||
968 | case V4L2_CHIP_MATCH_ALWAYS: | ||
969 | return 1; | ||
970 | case V4L2_CHIP_MATCH_HOST: | ||
971 | return match_chip == 0; | ||
972 | default: | ||
973 | return 0; | ||
974 | } | ||
975 | } | ||
976 | |||
950 | /* ----------------------------------------------------------------- */ | 977 | /* ----------------------------------------------------------------- */ |
951 | 978 | ||
952 | EXPORT_SYMBOL(v4l2_norm_to_name); | 979 | EXPORT_SYMBOL(v4l2_norm_to_name); |
@@ -970,6 +997,9 @@ EXPORT_SYMBOL(v4l2_ctrl_query_menu); | |||
970 | EXPORT_SYMBOL(v4l2_ctrl_query_fill); | 997 | EXPORT_SYMBOL(v4l2_ctrl_query_fill); |
971 | EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); | 998 | EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); |
972 | 999 | ||
1000 | EXPORT_SYMBOL(v4l2_chip_match_i2c_client); | ||
1001 | EXPORT_SYMBOL(v4l2_chip_match_host); | ||
1002 | |||
973 | /* | 1003 | /* |
974 | * Local variables: | 1004 | * Local variables: |
975 | * c-basic-offset: 8 | 1005 | * c-basic-offset: 8 |