aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/gpio-i2cmux.h
diff options
context:
space:
mode:
authorPeter Korsgaard <peter.korsgaard@barco.com>2011-01-10 16:11:23 -0500
committerJean Delvare <khali@endymion.delvare>2011-01-10 16:11:23 -0500
commit92ed1a76ca31774eb27de14b2215841367c68056 (patch)
treef9becefa5dbcdaa8cfd65100e1735044cd3910d6 /include/linux/gpio-i2cmux.h
parentb18a5c80eb2e7e9c72d23f1960b09d78ddf7e5b0 (diff)
i2c: Add generic I2C multiplexer using GPIO API
Add an i2c mux driver providing access to i2c bus segments using a hardware MUX sitting on a master bus and controlled through gpio pins. E.G. something like: ---------- ---------- Bus segment 1 - - - - - | | SCL/SDA | |-------------- | | | |------------| | | | | | Bus segment 2 | | | Linux | GPIO 1..N | MUX |--------------- Devices | |------------| | | | | | | | Bus segment M | | | |---------------| | ---------- ---------- - - - - - SCL/SDA of the master I2C bus is multiplexed to bus segment 1..M according to the settings of the GPIO pins 1..N. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'include/linux/gpio-i2cmux.h')
-rw-r--r--include/linux/gpio-i2cmux.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/gpio-i2cmux.h b/include/linux/gpio-i2cmux.h
new file mode 100644
index 000000000000..4a333bb0bd0d
--- /dev/null
+++ b/include/linux/gpio-i2cmux.h
@@ -0,0 +1,38 @@
1/*
2 * gpio-i2cmux interface to platform code
3 *
4 * Peter Korsgaard <peter.korsgaard@barco.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef _LINUX_GPIO_I2CMUX_H
12#define _LINUX_GPIO_I2CMUX_H
13
14/* MUX has no specific idle mode */
15#define GPIO_I2CMUX_NO_IDLE ((unsigned)-1)
16
17/**
18 * struct gpio_i2cmux_platform_data - Platform-dependent data for gpio-i2cmux
19 * @parent: Parent I2C bus adapter number
20 * @base_nr: Base I2C bus number to number adapters from or zero for dynamic
21 * @values: Array of bitmasks of GPIO settings (low/high) for each
22 * position
23 * @n_values: Number of multiplexer positions (busses to instantiate)
24 * @gpios: Array of GPIO numbers used to control MUX
25 * @n_gpios: Number of GPIOs used to control MUX
26 * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used
27 */
28struct gpio_i2cmux_platform_data {
29 int parent;
30 int base_nr;
31 const unsigned *values;
32 int n_values;
33 const unsigned *gpios;
34 int n_gpios;
35 unsigned idle;
36};
37
38#endif /* _LINUX_GPIO_I2CMUX_H */