summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/v4l2-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/v4l2-common.c')
-rw-r--r--linux/drivers/media/video/v4l2-common.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c
index 61cf41995..9d0df66e9 100644
--- a/linux/drivers/media/video/v4l2-common.c
+++ b/linux/drivers/media/video/v4l2-common.c
@@ -51,6 +51,7 @@
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/errno.h>
+#include <linux/i2c.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/pgtable.h>
@@ -806,8 +807,9 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_DBG_S_REGISTER:
{
struct v4l2_register *p=arg;
- printk ("%s: i2c_id=%d, reg=%llu, val=%u\n", s,
- p->i2c_id,(unsigned long long)p->reg,p->val);
+ printk ("%s: match_type=%d, match_chip=%d, reg=%llu, val=%llu\n", s,
+ p->match_type, p->match_chip,
+ (unsigned long long)p->reg, (unsigned long long)p->val);
break;
}
@@ -1590,6 +1592,32 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
return **ctrl_classes;
}
+int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip)
+{
+ switch (match_type) {
+ case V4L2_CHIP_MATCH_ALWAYS:
+ return 1;
+ case V4L2_CHIP_MATCH_I2C_DRIVER:
+ return (c != NULL && c->driver != NULL && c->driver->id == match_chip);
+ case V4L2_CHIP_MATCH_I2C_ADDR:
+ return (c != NULL && c->addr == match_chip);
+ default:
+ return 0;
+ }
+}
+
+int v4l2_chip_match_host(u32 match_type, u32 match_chip)
+{
+ switch (match_type) {
+ case V4L2_CHIP_MATCH_ALWAYS:
+ return 1;
+ case V4L2_CHIP_MATCH_HOST:
+ return match_chip == 0;
+ default:
+ return 0;
+ }
+}
+
/* ----------------------------------------------------------------- */
EXPORT_SYMBOL(v4l2_norm_to_name);
@@ -1613,6 +1641,9 @@ EXPORT_SYMBOL(v4l2_ctrl_query_menu);
EXPORT_SYMBOL(v4l2_ctrl_query_fill);
EXPORT_SYMBOL(v4l2_ctrl_query_fill_std);
+EXPORT_SYMBOL(v4l2_chip_match_i2c_client);
+EXPORT_SYMBOL(v4l2_chip_match_host);
+
/*
* Local variables:
* c-basic-offset: 8