aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/muxes
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2012-04-28 09:32:06 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-05-12 08:28:18 -0400
commite7065e20d9a6a8ee4a8b31ebe71d6c00a0f45354 (patch)
tree2f219f7db3371d477733bbcf6d8f56e5bac1cf69 /drivers/i2c/muxes
parent353f56b5f3093b6d75e81f523a8b10748a40f278 (diff)
i2c: Rename last mux driver to standard pattern
Update the MAINTAINERS entry and all other references accordingly. Based on an original patch by Wolfram Sang. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Peter Korsgaard <peter.korsgaard@barco.com> [wsa: fixed merge conflict due to rework in i2c_add_mux_adapter()] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c/muxes')
-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
3 files changed, 23 insertions, 24 deletions
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");