From 30e50fe332679825e6f54936c7c5e97bf109584d Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Wed, 12 Sep 2007 13:32:50 +0200 Subject: v4l2: add support for bus-based I2C drivers From: Hans Verkuil Two new headers were added: one for I2C drivers that are only used by V4L2 drivers converted to the new bus-based I2C API, and one that can be used by both converted and unconverted drivers (at the expense of some additional overhead). To support the legacy I2C API a helper function was added to v4l2-common.c. These headers take care of all the 'boilerplate' code that all V4L2 I2C drivers have in common and will automatically support the bus-based I2C API introduced in kernel 2.6.22. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/v4l2-common.c | 37 +++++ linux/include/media/v4l2-common.h | 11 + linux/include/media/v4l2-i2c-drv-legacy.h | 207 ++++++++++++++++++++++++++++++ linux/include/media/v4l2-i2c-drv.h | 199 ++++++++++++++++++++++++++++ 4 files changed, 454 insertions(+) --- linux/include/media/v4l2-common.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'linux/include/media/v4l2-common.h') diff --git a/linux/include/media/v4l2-common.h b/linux/include/media/v4l2-common.h index ee1265433..10fc32e16 100644 --- a/linux/include/media/v4l2-common.h +++ b/linux/include/media/v4l2-common.h @@ -113,6 +113,17 @@ int v4l2_chip_match_host(u32 id_type, u32 chip_id); /* ------------------------------------------------------------------------- */ +/* Helper function for I2C legacy drivers */ + +struct i2c_driver; +struct i2c_adapter; +struct i2c_client; + +int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver, + const char *name, int (*probe)(struct i2c_client *)); + +/* ------------------------------------------------------------------------- */ + /* Internal ioctls */ /* VIDIOC_INT_DECODE_VBI_LINE */ -- cgit v1.2.3