aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Breathitt Gray <vilhelm.gray@gmail.com>2017-01-30 13:33:47 -0500
committerLinus Walleij <linus.walleij@linaro.org>2017-02-01 10:06:17 -0500
commit5238f60feb408efbb5ad212d9b5b98a44d97af3a (patch)
treeafe4b1f7410ddd20d05257b6cf9e02ff7455d903
parent210b4bde5fc9974e60a912f9a17c014c7cbf5b75 (diff)
gpio: ws16c48: 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 WinSystems WS16C48. 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-ws16c48.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-ws16c48.c b/drivers/gpio/gpio-ws16c48.c
index 48b35589b7d6..901b5ccb032d 100644
--- a/drivers/gpio/gpio-ws16c48.c
+++ b/drivers/gpio/gpio-ws16c48.c
@@ -341,6 +341,22 @@ static irqreturn_t ws16c48_irq_handler(int irq, void *dev_id)
341 return IRQ_HANDLED; 341 return IRQ_HANDLED;
342} 342}
343 343
344#define WS16C48_NGPIO 48
345static const char *ws16c48_names[WS16C48_NGPIO] = {
346 "Port 0 Bit 0", "Port 0 Bit 1", "Port 0 Bit 2", "Port 0 Bit 3",
347 "Port 0 Bit 4", "Port 0 Bit 5", "Port 0 Bit 6", "Port 0 Bit 7",
348 "Port 1 Bit 0", "Port 1 Bit 1", "Port 1 Bit 2", "Port 1 Bit 3",
349 "Port 1 Bit 4", "Port 1 Bit 5", "Port 1 Bit 6", "Port 1 Bit 7",
350 "Port 2 Bit 0", "Port 2 Bit 1", "Port 2 Bit 2", "Port 2 Bit 3",
351 "Port 2 Bit 4", "Port 2 Bit 5", "Port 2 Bit 6", "Port 2 Bit 7",
352 "Port 3 Bit 0", "Port 3 Bit 1", "Port 3 Bit 2", "Port 3 Bit 3",
353 "Port 3 Bit 4", "Port 3 Bit 5", "Port 3 Bit 6", "Port 3 Bit 7",
354 "Port 4 Bit 0", "Port 4 Bit 1", "Port 4 Bit 2", "Port 4 Bit 3",
355 "Port 4 Bit 4", "Port 4 Bit 5", "Port 4 Bit 6", "Port 4 Bit 7",
356 "Port 5 Bit 0", "Port 5 Bit 1", "Port 5 Bit 2", "Port 5 Bit 3",
357 "Port 5 Bit 4", "Port 5 Bit 5", "Port 5 Bit 6", "Port 5 Bit 7"
358};
359
344static int ws16c48_probe(struct device *dev, unsigned int id) 360static int ws16c48_probe(struct device *dev, unsigned int id)
345{ 361{
346 struct ws16c48_gpio *ws16c48gpio; 362 struct ws16c48_gpio *ws16c48gpio;
@@ -361,7 +377,8 @@ static int ws16c48_probe(struct device *dev, unsigned int id)
361 ws16c48gpio->chip.parent = dev; 377 ws16c48gpio->chip.parent = dev;
362 ws16c48gpio->chip.owner = THIS_MODULE; 378 ws16c48gpio->chip.owner = THIS_MODULE;
363 ws16c48gpio->chip.base = -1; 379 ws16c48gpio->chip.base = -1;
364 ws16c48gpio->chip.ngpio = 48; 380 ws16c48gpio->chip.ngpio = WS16C48_NGPIO;
381 ws16c48gpio->chip.names = ws16c48_names;
365 ws16c48gpio->chip.get_direction = ws16c48_gpio_get_direction; 382 ws16c48gpio->chip.get_direction = ws16c48_gpio_get_direction;
366 ws16c48gpio->chip.direction_input = ws16c48_gpio_direction_input; 383 ws16c48gpio->chip.direction_input = ws16c48_gpio_direction_input;
367 ws16c48gpio->chip.direction_output = ws16c48_gpio_direction_output; 384 ws16c48gpio->chip.direction_output = ws16c48_gpio_direction_output;