summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Breathitt Gray <vilhelm.gray@gmail.com>2017-01-30 13:33:37 -0500
committerLinus Walleij <linus.walleij@linaro.org>2017-02-01 10:05:28 -0500
commit210b4bde5fc9974e60a912f9a17c014c7cbf5b75 (patch)
tree8e8544da99279cefb785c5c52894d355481ac3dc
parente0af4b5e248bcfbdb056691c9b12ee697b07c213 (diff)
gpio: gpio-mm: Add support for GPIO names
This patch sets the gpio_chip names option with an array of GPIO line names that match the manual documentation for the Diamond Systems GPIO-MM. This should make it easier for users to identify which GPIO line corresponds to a respective GPIO pin on the device. Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-gpio-mm.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-gpio-mm.c b/drivers/gpio/gpio-gpio-mm.c
index 60017425b49f..fa4baa2543db 100644
--- a/drivers/gpio/gpio-gpio-mm.c
+++ b/drivers/gpio/gpio-gpio-mm.c
@@ -230,6 +230,18 @@ static void gpiomm_gpio_set_multiple(struct gpio_chip *chip,
230 } 230 }
231} 231}
232 232
233#define GPIOMM_NGPIO 48
234static const char *gpiomm_names[GPIOMM_NGPIO] = {
235 "Port 1A0", "Port 1A1", "Port 1A2", "Port 1A3", "Port 1A4", "Port 1A5",
236 "Port 1A6", "Port 1A7", "Port 1B0", "Port 1B1", "Port 1B2", "Port 1B3",
237 "Port 1B4", "Port 1B5", "Port 1B6", "Port 1B7", "Port 1C0", "Port 1C1",
238 "Port 1C2", "Port 1C3", "Port 1C4", "Port 1C5", "Port 1C6", "Port 1C7",
239 "Port 2A0", "Port 2A1", "Port 2A2", "Port 2A3", "Port 2A4", "Port 2A5",
240 "Port 2A6", "Port 2A7", "Port 2B0", "Port 2B1", "Port 2B2", "Port 2B3",
241 "Port 2B4", "Port 2B5", "Port 2B6", "Port 2B7", "Port 2C0", "Port 2C1",
242 "Port 2C2", "Port 2C3", "Port 2C4", "Port 2C5", "Port 2C6", "Port 2C7",
243};
244
233static int gpiomm_probe(struct device *dev, unsigned int id) 245static int gpiomm_probe(struct device *dev, unsigned int id)
234{ 246{
235 struct gpiomm_gpio *gpiommgpio; 247 struct gpiomm_gpio *gpiommgpio;
@@ -250,7 +262,8 @@ static int gpiomm_probe(struct device *dev, unsigned int id)
250 gpiommgpio->chip.parent = dev; 262 gpiommgpio->chip.parent = dev;
251 gpiommgpio->chip.owner = THIS_MODULE; 263 gpiommgpio->chip.owner = THIS_MODULE;
252 gpiommgpio->chip.base = -1; 264 gpiommgpio->chip.base = -1;
253 gpiommgpio->chip.ngpio = 48; 265 gpiommgpio->chip.ngpio = GPIOMM_NGPIO;
266 gpiommgpio->chip.names = gpiomm_names;
254 gpiommgpio->chip.get_direction = gpiomm_gpio_get_direction; 267 gpiommgpio->chip.get_direction = gpiomm_gpio_get_direction;
255 gpiommgpio->chip.direction_input = gpiomm_gpio_direction_input; 268 gpiommgpio->chip.direction_input = gpiomm_gpio_direction_input;
256 gpiommgpio->chip.direction_output = gpiomm_gpio_direction_output; 269 gpiommgpio->chip.direction_output = gpiomm_gpio_direction_output;