summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorWilliam Breathitt Gray <vilhelm.gray@gmail.com>2017-01-30 12:16:04 -0500
committerJonathan Cameron <jic23@kernel.org>2017-01-31 18:54:04 +0000
commit7d816e54b847b1e9e7357bf890a03a00f2025381 (patch)
treedd17e98fea9ab056911b3d5a2ae3f23d06093827 /drivers/iio
parent87ac0c24bd8ee970be14173d15bf2872e5f39d71 (diff)
iio: stx104: 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 Apex Embedded Systems STX104. 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> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/stx104.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/iio/adc/stx104.c b/drivers/iio/adc/stx104.c
index fcfad51cc4fb..40c05df218f8 100644
--- a/drivers/iio/adc/stx104.c
+++ b/drivers/iio/adc/stx104.c
@@ -256,6 +256,11 @@ static void stx104_gpio_set(struct gpio_chip *chip, unsigned int offset,
spin_unlock_irqrestore(&stx104gpio->lock, flags);
}
+#define STX104_NGPIO 8
+static const char *stx104_names[STX104_NGPIO] = {
+ "DIN0", "DIN1", "DIN2", "DIN3", "DOUT0", "DOUT1", "DOUT2", "DOUT3"
+};
+
static int stx104_probe(struct device *dev, unsigned int id)
{
struct iio_dev *indio_dev;
@@ -309,7 +314,8 @@ static int stx104_probe(struct device *dev, unsigned int id)
stx104gpio->chip.parent = dev;
stx104gpio->chip.owner = THIS_MODULE;
stx104gpio->chip.base = -1;
- stx104gpio->chip.ngpio = 8;
+ stx104gpio->chip.ngpio = STX104_NGPIO;
+ stx104gpio->chip.names = stx104_names;
stx104gpio->chip.get_direction = stx104_gpio_get_direction;
stx104gpio->chip.direction_input = stx104_gpio_direction_input;
stx104gpio->chip.direction_output = stx104_gpio_direction_output;