i2c bus multiplexing (Version 1).
Subsystems (3)
This patch set adds to the I2C core the ability to handle multiplexed I2C bus topologies by presenting each multiplexed segment as a I2C adapter.
Rodolfo
--
b/drivers/i2c/Kconfig | 10 + b/drivers/i2c/Makefile | 3 b/drivers/i2c/i2c-core.c | 4 b/drivers/i2c/i2c-mux.c | 180 +++++++++++++++++++++++ b/drivers/i2c/muxes/Kconfig | 8 + b/drivers/i2c/muxes/Makefile | 6 b/drivers/i2c/muxes/pca954x.c | 325 ++++++++++++++++++++++++++++++++++++++++++ b/include/linux/i2c-id.h | 3 b/include/linux/i2c.h | 14 + b/include/linux/i2c/pca954x.h | 13 + drivers/i2c/muxes/Kconfig | 9 + drivers/i2c/muxes/Makefile | 2 12 files changed, 574 insertions(+), 3 deletions(-)
A message that is not in the archive (sent off-list or not yet received): 1233177275-21700-1-git-send-email-giometti-k2GhghHVRtY@public.gmane.org
PATCH 1/3 i2c: put driver_unregister() out of core_lock protection.
--- drivers/i2c/i2c-core.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/i2c-core.c +2 -2
@@ -799,10 +799,10 @@ void i2c_del_driver(struct i2c_driver *driver)class_for_each_device (&i2c_adapter_class,NULL , driver, __detach_adapter); +mutex_unlock (&core_lock); +driver_unregister (&driver->driver);pr_debug ("i2c-core: driver [%s] unregistered\n" , driver->driver.name); - -mutex_unlock (&core_lock); }EXPORT_SYMBOL (i2c_del_driver);
Signature · 1 line
1.5.6.3
A message that is not in the archive (sent off-list or not yet received): 1233177275-21700-2-git-send-email-giometti-k2GhghHVRtY@public.gmane.org
PATCH 2/3 i2c: Multiplexed I2C bus core support.
Add to the I2C core the ability to handle multiplexed I2C bus topologies by presenting each multiplexed segment as a I2C adapter.
--- drivers/i2c/Kconfig | 10 +++ drivers/i2c/Makefile | 3 +- drivers/i2c/i2c-mux.c | 180 ++++++++++++++++++++++++++++++++++++++++++++ drivers/i2c/muxes/Kconfig | 8 ++ drivers/i2c/muxes/Makefile | 6 ++ include/linux/i2c-id.h | 3 + include/linux/i2c.h | 14 ++++ 7 files changed, 223 insertions(+), 1 deletions(-) create mode 100644 drivers/i2c/i2c-mux.c create mode 100644 drivers/i2c/muxes/Kconfig create mode 100644 drivers/i2c/muxes/Makefile
drivers/i2c/Kconfig +10 -0
@@ -27,6 +27,16 @@ config I2C_BOARDINFO boolean default y +config I2C_MUX + tristate "I2C bus multiplexing support" + depends on I2C + help + Say Y here if you want the I2C core to support the ability to + handle multiplexed I2C bus topologies, by presenting each + multiplexed segment as a I2C adapter. + +source drivers/i2c/muxes/Kconfig + config I2C_CHARDEV tristate "I2C device interface" help
drivers/i2c/Makefile +2 -1
@@ -4,8 +4,9 @@ obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o obj-$(CONFIG_I2C) += i2c-core.o +obj-$(CONFIG_I2C_MUX) += i2c-mux.o obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o -obj-y += busses/ chips/ algos/ +obj-y += busses/ chips/ muxes/ algos/ ifeq ($(CONFIG_I2C_DEBUG_CORE),y) EXTRA_CFLAGS += -DDEBUG
drivers/i2c/i2c-mux.c new file +180 -0
180 lines not on this page · raw message
drivers/i2c/muxes/Kconfig new file +8 -0
@@ -0,0 +1,8 @@ +# +# Multiplexer I2C chip drivers configuration +# + +menu "Multiplexer I2C Chip support" + depends on I2C && I2C_MUX && EXPERIMENTAL + +endmenu
drivers/i2c/muxes/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for multiplexer I2C chip drivers. + +ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) +EXTRA_CFLAGS += -DDEBUG +endif
include/linux/i2c-id.h +3 -0
@@ -162,4 +162,7 @@#define I2C_HW_SAA7146 0x060000/* SAA7146 video decoder bus */ #define I2C_HW_SAA7134 0x090000/* SAA7134 video decoder bus */ +/* --- Virtual adapter mark */ +#define I2C_HW_VIRT 0x80000000 +#endif /* LINUX_I2C_ID_H */
include/linux/i2c.h +14 -0
@@ -588,6 +588,20 @@ union i2c_smbus_data {#define I2C_SMBUS_BLOCK_PROC_CALL 7/* SMBus 2.0 */ #define I2C_SMBUS_I2C_BLOCK_DATA 8 +/* +* Called to create a 'virtual' i2c bus which represents a multiplexed bus +* segment. The client and mux_val are passed to the select and deselect +* callback functions to perform hardware-specific mux control. +*/ +struct i2c_adapter *i2c_add_mux_adapter (struct i2c_adapter *parent, +void *client,u32 force_nr,u32 mux_val, +int (*select_cb) (struct i2c_adapter *, +void *,u32 ), +int (*deselect_cb) (struct i2c_adapter *, +void *,u32 )); + +int i2c_del_mux_adapter (struct i2c_adapter *adap); +#ifdef __KERNEL__
Signature · 1 line
1.5.6.3
A message that is not in the archive (sent off-list or not yet received): 1233177275-21700-3-git-send-email-giometti-k2GhghHVRtY@public.gmane.org
PATCH 3/3 i2c: driver for PCA954x I2C multiplexer series.
--- drivers/i2c/muxes/Kconfig | 9 ++ drivers/i2c/muxes/Makefile | 2 + drivers/i2c/muxes/pca954x.c | 325 +++++++++++++++++++++++++++++++++++++++++++ include/linux/i2c/pca954x.h | 13 ++ 4 files changed, 349 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/muxes/pca954x.c create mode 100644 include/linux/i2c/pca954x.h
drivers/i2c/muxes/Kconfig +9 -0
@@ -5,4 +5,13 @@ menu "Multiplexer I2C Chip support" depends on I2C && I2C_MUX && EXPERIMENTAL +config I2CMUX_PCA954x + tristate "Philips PCA953x I2C Mux/switches" + help + If you say yes here you get support for the Philips PCA954x + I2C mux/switch devices. + + This driver can also be built as a module. If so, the module + will be called pca954x. + endmenu
drivers/i2c/muxes/Makefile +2 -0
@@ -1,6 +1,8 @@ # # Makefile for multiplexer I2C chip drivers. +obj-$(CONFIG_I2CMUX_PCA954x) += pca954x.o + ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) EXTRA_CFLAGS += -DDEBUG endif
drivers/i2c/muxes/pca954x.c new file +325 -0
325 lines not on this page · raw message
include/linux/i2c/pca954x.h new file +13 -0
@@ -0,0 +1,13 @@ +/* Platform data for the PCA954x I2C multiplexers */ + +struct pca954x_platform_mode { +int adap_id; +unsigned int deselect_on_exit:1 ; +int (*is_chan_connected)(struct i2c_adapter *adap, +struct i2c_client *client,u32 chan); +}; + +struct pca954x_platform_data { +struct pca954x_platform_mode *modes; +int num_modes; +};
Signature · 1 line
1.5.6.3
From: Rodolfo Giometti <[email protected]>
Date: Wed, 28 Jan 2009 22:14:32 +0100
Quoted 2 lines
This patch set adds to the I2C core the ability to handle multiplexed I2C bus topologies by presenting each multiplexed segment as a I2C adapter.
Thank you for doing this work.