aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/i2c/muxes/i2c-mux-gpio (renamed from Documentation/i2c/muxes/gpio-i2cmux)12
-rw-r--r--MAINTAINERS6
-rw-r--r--drivers/i2c/muxes/Kconfig2
-rw-r--r--drivers/i2c/muxes/Makefile2
-rw-r--r--drivers/i2c/muxes/i2c-mux-gpio.c (renamed from drivers/i2c/muxes/gpio-i2cmux.c)43
-rw-r--r--include/linux/i2c-mux-gpio.h (renamed from include/linux/gpio-i2cmux.h)14
6 files changed, 39 insertions, 40 deletions
diff --git a/Documentation/i2c/muxes/gpio-i2cmux b/Documentation/i2c/muxes/i2c-mux-gpio
index 811cd78d4cdc..bd9b2299b739 100644
--- a/Documentation/i2c/muxes/gpio-i2cmux
+++ b/Documentation/i2c/muxes/i2c-mux-gpio
@@ -1,11 +1,11 @@
1Kernel driver gpio-i2cmux 1Kernel driver i2c-gpio-mux
2 2
3Author: Peter Korsgaard <peter.korsgaard@barco.com> 3Author: Peter Korsgaard <peter.korsgaard@barco.com>
4 4
5Description 5Description
6----------- 6-----------
7 7
8gpio-i2cmux is an i2c mux driver providing access to I2C bus segments 8i2c-gpio-mux is an i2c mux driver providing access to I2C bus segments
9from a master I2C bus and a hardware MUX controlled through GPIO pins. 9from a master I2C bus and a hardware MUX controlled through GPIO pins.
10 10
11E.G.: 11E.G.:
@@ -26,16 +26,16 @@ according to the settings of the GPIO pins 1..N.
26Usage 26Usage
27----- 27-----
28 28
29gpio-i2cmux uses the platform bus, so you need to provide a struct 29i2c-gpio-mux uses the platform bus, so you need to provide a struct
30platform_device with the platform_data pointing to a struct 30platform_device with the platform_data pointing to a struct
31gpio_i2cmux_platform_data with the I2C adapter number of the master 31gpio_i2cmux_platform_data with the I2C adapter number of the master
32bus, the number of bus segments to create and the GPIO pins used 32bus, the number of bus segments to create and the GPIO pins used
33to control it. See include/linux/gpio-i2cmux.h for details. 33to control it. See include/linux/i2c-gpio-mux.h for details.
34 34
35E.G. something like this for a MUX providing 4 bus segments 35E.G. something like this for a MUX providing 4 bus segments
36controlled through 3 GPIO pins: 36controlled through 3 GPIO pins:
37 37
38#include <linux/gpio-i2cmux.h> 38#include <linux/i2c-gpio-mux.h>
39#include <linux/platform_device.h> 39#include <linux/platform_device.h>
40 40
41static const unsigned myboard_gpiomux_gpios[] = { 41static const unsigned myboard_gpiomux_gpios[] = {
@@ -57,7 +57,7 @@ static struct gpio_i2cmux_platform_data myboard_i2cmux_data = {
57}; 57};
58 58
59static struct platform_device myboard_i2cmux = { 59static struct platform_device myboard_i2cmux = {
60 .name = "gpio-i2cmux", 60 .name = "i2c-gpio-mux",
61 .id = 0, 61 .id = 0,
62 .dev = { 62 .dev = {
63 .platform_data = &myboard_i2cmux_data, 63 .platform_data = &myboard_i2cmux_data,
diff --git a/MAINTAINERS b/MAINTAINERS
index f0c3b4558381..4241699adea3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2937,9 +2937,9 @@ GENERIC GPIO I2C MULTIPLEXER DRIVER
2937M: Peter Korsgaard <peter.korsgaard@barco.com> 2937M: Peter Korsgaard <peter.korsgaard@barco.com>
2938L: linux-i2c@vger.kernel.org 2938L: linux-i2c@vger.kernel.org
2939S: Supported 2939S: Supported
2940F: drivers/i2c/muxes/gpio-i2cmux.c 2940F: drivers/i2c/muxes/i2c-mux-gpio.c
2941F: include/linux/gpio-i2cmux.h 2941F: include/linux/i2c-mux-gpio.h
2942F: Documentation/i2c/muxes/gpio-i2cmux 2942F: Documentation/i2c/muxes/i2c-mux-gpio
2943 2943
2944GENERIC HDLC (WAN) DRIVERS 2944GENERIC HDLC (WAN) DRIVERS
2945M: Krzysztof Halasa <khc@pm.waw.pl> 2945M: Krzysztof Halasa <khc@pm.waw.pl>
diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig
index e14a4205e5c6..beb2491db274 100644
--- a/drivers/i2c/muxes/Kconfig
+++ b/drivers/i2c/muxes/Kconfig
@@ -15,7 +15,7 @@ config I2C_MUX_GPIO
15 through GPIO pins. 15 through GPIO pins.
16 16
17 This driver can also be built as a module. If so, the module 17 This driver can also be built as a module. If so, the module
18 will be called gpio-i2cmux. 18 will be called i2c-mux-gpio.
19 19
20config I2C_MUX_PCA9541 20config I2C_MUX_PCA9541
21 tristate "NXP PCA9541 I2C Master Selector" 21 tristate "NXP PCA9541 I2C Master Selector"
diff --git a/drivers/i2c/muxes/Makefile b/drivers/i2c/muxes/Makefile
index 0868335cff11..5826249b29ca 100644
--- a/drivers/i2c/muxes/Makefile
+++ b/drivers/i2c/muxes/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for multiplexer I2C chip drivers. 2# Makefile for multiplexer I2C chip drivers.
3 3
4obj-$(CONFIG_I2C_MUX_GPIO) += gpio-i2cmux.o 4obj-$(CONFIG_I2C_MUX_GPIO) += i2c-mux-gpio.o
5obj-$(CONFIG_I2C_MUX_PCA9541) += i2c-mux-pca9541.o 5obj-$(CONFIG_I2C_MUX_PCA9541) += i2c-mux-pca9541.o
6obj-$(CONFIG_I2C_MUX_PCA954x) += i2c-mux-pca954x.o 6obj-$(CONFIG_I2C_MUX_PCA954x) += i2c-mux-pca954x.o
7 7
diff --git a/drivers/i2c/muxes/gpio-i2cmux.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index fc5c1ef9b6ec..68b1f8ec3436 100644
--- a/drivers/i2c/muxes/gpio-i2cmux.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -10,7 +10,7 @@
10 10
11#include <linux/i2c.h> 11#include <linux/i2c.h>
12#include <linux/i2c-mux.h> 12#include <linux/i2c-mux.h>
13#include <linux/gpio-i2cmux.h> 13#include <linux/i2c-mux-gpio.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/module.h> 16#include <linux/module.h>
@@ -20,10 +20,10 @@
20struct gpiomux { 20struct gpiomux {
21 struct i2c_adapter *parent; 21 struct i2c_adapter *parent;
22 struct i2c_adapter **adap; /* child busses */ 22 struct i2c_adapter **adap; /* child busses */
23 struct gpio_i2cmux_platform_data data; 23 struct i2c_mux_gpio_platform_data data;
24}; 24};
25 25
26static void gpiomux_set(const struct gpiomux *mux, unsigned val) 26static void i2c_mux_gpio_set(const struct gpiomux *mux, unsigned val)
27{ 27{
28 int i; 28 int i;
29 29
@@ -31,28 +31,28 @@ static void gpiomux_set(const struct gpiomux *mux, unsigned val)
31 gpio_set_value(mux->data.gpios[i], val & (1 << i)); 31 gpio_set_value(mux->data.gpios[i], val & (1 << i));
32} 32}
33 33
34static int gpiomux_select(struct i2c_adapter *adap, void *data, u32 chan) 34static int i2c_mux_gpio_select(struct i2c_adapter *adap, void *data, u32 chan)
35{ 35{
36 struct gpiomux *mux = data; 36 struct gpiomux *mux = data;
37 37
38 gpiomux_set(mux, mux->data.values[chan]); 38 i2c_mux_gpio_set(mux, mux->data.values[chan]);
39 39
40 return 0; 40 return 0;
41} 41}
42 42
43static int gpiomux_deselect(struct i2c_adapter *adap, void *data, u32 chan) 43static int i2c_mux_gpio_deselect(struct i2c_adapter *adap, void *data, u32 chan)
44{ 44{
45 struct gpiomux *mux = data; 45 struct gpiomux *mux = data;
46 46
47 gpiomux_set(mux, mux->data.idle); 47 i2c_mux_gpio_set(mux, mux->data.idle);
48 48
49 return 0; 49 return 0;
50} 50}
51 51
52static int __devinit gpiomux_probe(struct platform_device *pdev) 52static int __devinit i2c_mux_gpio_probe(struct platform_device *pdev)
53{ 53{
54 struct gpiomux *mux; 54 struct gpiomux *mux;
55 struct gpio_i2cmux_platform_data *pdata; 55 struct i2c_mux_gpio_platform_data *pdata;
56 struct i2c_adapter *parent; 56 struct i2c_adapter *parent;
57 int (*deselect) (struct i2c_adapter *, void *, u32); 57 int (*deselect) (struct i2c_adapter *, void *, u32);
58 unsigned initial_state; 58 unsigned initial_state;
@@ -86,16 +86,16 @@ static int __devinit gpiomux_probe(struct platform_device *pdev)
86 goto alloc_failed2; 86 goto alloc_failed2;
87 } 87 }
88 88
89 if (pdata->idle != GPIO_I2CMUX_NO_IDLE) { 89 if (pdata->idle != I2C_MUX_GPIO_NO_IDLE) {
90 initial_state = pdata->idle; 90 initial_state = pdata->idle;
91 deselect = gpiomux_deselect; 91 deselect = i2c_mux_gpio_deselect;
92 } else { 92 } else {
93 initial_state = pdata->values[0]; 93 initial_state = pdata->values[0];
94 deselect = NULL; 94 deselect = NULL;
95 } 95 }
96 96
97 for (i = 0; i < pdata->n_gpios; i++) { 97 for (i = 0; i < pdata->n_gpios; i++) {
98 ret = gpio_request(pdata->gpios[i], "gpio-i2cmux"); 98 ret = gpio_request(pdata->gpios[i], "i2c-mux-gpio");
99 if (ret) 99 if (ret)
100 goto err_request_gpio; 100 goto err_request_gpio;
101 gpio_direction_output(pdata->gpios[i], 101 gpio_direction_output(pdata->gpios[i],
@@ -105,9 +105,8 @@ static int __devinit gpiomux_probe(struct platform_device *pdev)
105 for (i = 0; i < pdata->n_values; i++) { 105 for (i = 0; i < pdata->n_values; i++) {
106 u32 nr = pdata->base_nr ? (pdata->base_nr + i) : 0; 106 u32 nr = pdata->base_nr ? (pdata->base_nr + i) : 0;
107 107
108 mux->adap[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, 108 mux->adap[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, nr, i,
109 nr, i, 109 i2c_mux_gpio_select, deselect);
110 gpiomux_select, deselect);
111 if (!mux->adap[i]) { 110 if (!mux->adap[i]) {
112 ret = -ENODEV; 111 ret = -ENODEV;
113 dev_err(&pdev->dev, "Failed to add adapter %d\n", i); 112 dev_err(&pdev->dev, "Failed to add adapter %d\n", i);
@@ -138,7 +137,7 @@ alloc_failed:
138 return ret; 137 return ret;
139} 138}
140 139
141static int __devexit gpiomux_remove(struct platform_device *pdev) 140static int __devexit i2c_mux_gpio_remove(struct platform_device *pdev)
142{ 141{
143 struct gpiomux *mux = platform_get_drvdata(pdev); 142 struct gpiomux *mux = platform_get_drvdata(pdev);
144 int i; 143 int i;
@@ -157,18 +156,18 @@ static int __devexit gpiomux_remove(struct platform_device *pdev)
157 return 0; 156 return 0;
158} 157}
159 158
160static struct platform_driver gpiomux_driver = { 159static struct platform_driver i2c_mux_gpio_driver = {
161 .probe = gpiomux_probe, 160 .probe = i2c_mux_gpio_probe,
162 .remove = __devexit_p(gpiomux_remove), 161 .remove = __devexit_p(i2c_mux_gpio_remove),
163 .driver = { 162 .driver = {
164 .owner = THIS_MODULE, 163 .owner = THIS_MODULE,
165 .name = "gpio-i2cmux", 164 .name = "i2c-mux-gpio",
166 }, 165 },
167}; 166};
168 167
169module_platform_driver(gpiomux_driver); 168module_platform_driver(i2c_mux_gpio_driver);
170 169
171MODULE_DESCRIPTION("GPIO-based I2C multiplexer driver"); 170MODULE_DESCRIPTION("GPIO-based I2C multiplexer driver");
172MODULE_AUTHOR("Peter Korsgaard <peter.korsgaard@barco.com>"); 171MODULE_AUTHOR("Peter Korsgaard <peter.korsgaard@barco.com>");
173MODULE_LICENSE("GPL"); 172MODULE_LICENSE("GPL");
174MODULE_ALIAS("platform:gpio-i2cmux"); 173MODULE_ALIAS("platform:i2c-mux-gpio");
diff --git a/include/linux/gpio-i2cmux.h b/include/linux/i2c-mux-gpio.h
index 4a333bb0bd0d..a36343a37ebc 100644
--- a/include/linux/gpio-i2cmux.h
+++ b/include/linux/i2c-mux-gpio.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * gpio-i2cmux interface to platform code 2 * i2c-mux-gpio interface to platform code
3 * 3 *
4 * Peter Korsgaard <peter.korsgaard@barco.com> 4 * Peter Korsgaard <peter.korsgaard@barco.com>
5 * 5 *
@@ -8,14 +8,14 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#ifndef _LINUX_GPIO_I2CMUX_H 11#ifndef _LINUX_I2C_MUX_GPIO_H
12#define _LINUX_GPIO_I2CMUX_H 12#define _LINUX_I2C_MUX_GPIO_H
13 13
14/* MUX has no specific idle mode */ 14/* MUX has no specific idle mode */
15#define GPIO_I2CMUX_NO_IDLE ((unsigned)-1) 15#define I2C_MUX_GPIO_NO_IDLE ((unsigned)-1)
16 16
17/** 17/**
18 * struct gpio_i2cmux_platform_data - Platform-dependent data for gpio-i2cmux 18 * struct i2c_mux_gpio_platform_data - Platform-dependent data for i2c-mux-gpio
19 * @parent: Parent I2C bus adapter number 19 * @parent: Parent I2C bus adapter number
20 * @base_nr: Base I2C bus number to number adapters from or zero for dynamic 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 21 * @values: Array of bitmasks of GPIO settings (low/high) for each
@@ -25,7 +25,7 @@
25 * @n_gpios: Number of GPIOs 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 26 * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used
27 */ 27 */
28struct gpio_i2cmux_platform_data { 28struct i2c_mux_gpio_platform_data {
29 int parent; 29 int parent;
30 int base_nr; 30 int base_nr;
31 const unsigned *values; 31 const unsigned *values;
@@ -35,4 +35,4 @@ struct gpio_i2cmux_platform_data {
35 unsigned idle; 35 unsigned idle;
36}; 36};
37 37
38#endif /* _LINUX_GPIO_I2CMUX_H */ 38#endif /* _LINUX_I2C_MUX_GPIO_H */