diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-10-01 10:41:05 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2009-12-13 13:20:43 -0500 |
commit | 6f2ecaae72910211034c4f1955da97b2ff994265 (patch) | |
tree | 68d7217dd24f72deeb40e733e0f9f29aecdfde49 | |
parent | 894362f53164f93d609559e196378b4d0710c2dd (diff) |
gpiolib: Make WM831x GPIO count dynamic
This supports future devices with fewer GPIOs.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/gpio/wm831x-gpio.c | 4 | ||||
-rw-r--r-- | drivers/mfd/wm831x-core.c | 3 | ||||
-rw-r--r-- | include/linux/mfd/wm831x/core.h | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpio/wm831x-gpio.c b/drivers/gpio/wm831x-gpio.c index f9c09a54ec7f..f5e4934f1da1 100644 --- a/drivers/gpio/wm831x-gpio.c +++ b/drivers/gpio/wm831x-gpio.c | |||
@@ -23,8 +23,6 @@ | |||
23 | #include <linux/mfd/wm831x/pdata.h> | 23 | #include <linux/mfd/wm831x/pdata.h> |
24 | #include <linux/mfd/wm831x/gpio.h> | 24 | #include <linux/mfd/wm831x/gpio.h> |
25 | 25 | ||
26 | #define WM831X_GPIO_MAX 16 | ||
27 | |||
28 | struct wm831x_gpio { | 26 | struct wm831x_gpio { |
29 | struct wm831x *wm831x; | 27 | struct wm831x *wm831x; |
30 | struct gpio_chip gpio_chip; | 28 | struct gpio_chip gpio_chip; |
@@ -192,7 +190,7 @@ static int __devinit wm831x_gpio_probe(struct platform_device *pdev) | |||
192 | 190 | ||
193 | wm831x_gpio->wm831x = wm831x; | 191 | wm831x_gpio->wm831x = wm831x; |
194 | wm831x_gpio->gpio_chip = template_chip; | 192 | wm831x_gpio->gpio_chip = template_chip; |
195 | wm831x_gpio->gpio_chip.ngpio = WM831X_GPIO_MAX; | 193 | wm831x_gpio->gpio_chip.ngpio = wm831x->num_gpio; |
196 | wm831x_gpio->gpio_chip.dev = &pdev->dev; | 194 | wm831x_gpio->gpio_chip.dev = &pdev->dev; |
197 | if (pdata && pdata->gpio_base) | 195 | if (pdata && pdata->gpio_base) |
198 | wm831x_gpio->gpio_chip.base = pdata->gpio_base; | 196 | wm831x_gpio->gpio_chip.base = pdata->gpio_base; |
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 8504c6ef4a16..8d386c0c8027 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c | |||
@@ -1293,16 +1293,19 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1293 | switch (ret) { | 1293 | switch (ret) { |
1294 | case WM8310: | 1294 | case WM8310: |
1295 | parent = WM8310; | 1295 | parent = WM8310; |
1296 | wm831x->num_gpio = 16; | ||
1296 | dev_info(wm831x->dev, "WM8310 revision %c\n", 'A' + rev); | 1297 | dev_info(wm831x->dev, "WM8310 revision %c\n", 'A' + rev); |
1297 | break; | 1298 | break; |
1298 | 1299 | ||
1299 | case WM8311: | 1300 | case WM8311: |
1300 | parent = WM8311; | 1301 | parent = WM8311; |
1302 | wm831x->num_gpio = 16; | ||
1301 | dev_info(wm831x->dev, "WM8311 revision %c\n", 'A' + rev); | 1303 | dev_info(wm831x->dev, "WM8311 revision %c\n", 'A' + rev); |
1302 | break; | 1304 | break; |
1303 | 1305 | ||
1304 | case WM8312: | 1306 | case WM8312: |
1305 | parent = WM8312; | 1307 | parent = WM8312; |
1308 | wm831x->num_gpio = 16; | ||
1306 | dev_info(wm831x->dev, "WM8312 revision %c\n", 'A' + rev); | 1309 | dev_info(wm831x->dev, "WM8312 revision %c\n", 'A' + rev); |
1307 | break; | 1310 | break; |
1308 | 1311 | ||
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h index 91eb493bf14c..c1bc59f6cbf2 100644 --- a/include/linux/mfd/wm831x/core.h +++ b/include/linux/mfd/wm831x/core.h | |||
@@ -253,6 +253,8 @@ struct wm831x { | |||
253 | unsigned int irq_base; | 253 | unsigned int irq_base; |
254 | int irq_masks[5]; | 254 | int irq_masks[5]; |
255 | 255 | ||
256 | int num_gpio; | ||
257 | |||
256 | struct mutex auxadc_lock; | 258 | struct mutex auxadc_lock; |
257 | 259 | ||
258 | /* The WM831x has a security key blocking access to certain | 260 | /* The WM831x has a security key blocking access to certain |