aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2011-11-16 04:24:39 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-01-03 03:10:04 -0500
commitb4e3ac74d5cd4152f2ec6b3280b1ff3428952f7f (patch)
treeb1dc770b28ac3dcdf2fd2b770827e4112804155e /drivers/pinctrl
parentf812f0f53e5643c06b929ce3299cbaffb307c488 (diff)
pinctrl/coh901: driver to request its pins
This makes the COH 901 driver request muxing of its GPIO pins from the pinmux-u300 driver using the standard API calls. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/Kconfig2
-rw-r--r--drivers/pinctrl/pinctrl-coh901.c21
2 files changed, 22 insertions, 1 deletions
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index e087f0219f48..e963da41e948 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -32,7 +32,7 @@ config PINMUX_U300
32 32
33config PINCTRL_COH901 33config PINCTRL_COH901
34 bool "ST-Ericsson U300 COH 901 335/571 GPIO" 34 bool "ST-Ericsson U300 COH 901 335/571 GPIO"
35 depends on GPIOLIB && ARCH_U300 35 depends on GPIOLIB && ARCH_U300 && PINMUX_U300
36 help 36 help
37 Say yes here to support GPIO interface on ST-Ericsson U300. 37 Say yes here to support GPIO interface on ST-Ericsson U300.
38 The names of the two IP block variants supported are 38 The names of the two IP block variants supported are
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c
index 4035778852b0..69fb7072a23e 100644
--- a/drivers/pinctrl/pinctrl-coh901.c
+++ b/drivers/pinctrl/pinctrl-coh901.c
@@ -22,6 +22,7 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/pinctrl/pinmux.h>
25#include <mach/gpio-u300.h> 26#include <mach/gpio-u300.h>
26 27
27/* 28/*
@@ -351,6 +352,24 @@ static inline struct u300_gpio *to_u300_gpio(struct gpio_chip *chip)
351 return container_of(chip, struct u300_gpio, chip); 352 return container_of(chip, struct u300_gpio, chip);
352} 353}
353 354
355static int u300_gpio_request(struct gpio_chip *chip, unsigned offset)
356{
357 /*
358 * Map back to global GPIO space and request muxing, the direction
359 * parameter does not matter for this controller.
360 */
361 int gpio = chip->base + offset;
362
363 return pinmux_request_gpio(gpio);
364}
365
366static void u300_gpio_free(struct gpio_chip *chip, unsigned offset)
367{
368 int gpio = chip->base + offset;
369
370 pinmux_free_gpio(gpio);
371}
372
354static int u300_gpio_get(struct gpio_chip *chip, unsigned offset) 373static int u300_gpio_get(struct gpio_chip *chip, unsigned offset)
355{ 374{
356 struct u300_gpio *gpio = to_u300_gpio(chip); 375 struct u300_gpio *gpio = to_u300_gpio(chip);
@@ -483,6 +502,8 @@ static int u300_gpio_config(struct gpio_chip *chip, unsigned offset,
483static struct gpio_chip u300_gpio_chip = { 502static struct gpio_chip u300_gpio_chip = {
484 .label = "u300-gpio-chip", 503 .label = "u300-gpio-chip",
485 .owner = THIS_MODULE, 504 .owner = THIS_MODULE,
505 .request = u300_gpio_request,
506 .free = u300_gpio_free,
486 .get = u300_gpio_get, 507 .get = u300_gpio_get,
487 .set = u300_gpio_set, 508 .set = u300_gpio_set,
488 .direction_input = u300_gpio_direction_input, 509 .direction_input = u300_gpio_direction_input,