diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-04-10 11:39:20 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2019-04-23 04:55:24 -0400 |
commit | 606be34440ee3e6da3799691fcab7b69e1ad06cd (patch) | |
tree | b6d49e75481ffa148237bb1c23f3f1e28ff51d8f /drivers/gpio | |
parent | 24a49543336dbaecb83862a17f6a05d53ec2592f (diff) |
gpiolib: acpi: Add acpi_gpio_update_gpiod_lookup_flags() helper
This helper consolidates all settings of GPIO descriptor lookup flags and
quirks in the future if any.
No functional change intended.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 13 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 4 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.h | 8 |
3 files changed, 19 insertions, 6 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 878c7a7dea8b..9c6ebaaa02fe 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -525,6 +525,15 @@ acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *inf | |||
525 | return ret; | 525 | return ret; |
526 | } | 526 | } |
527 | 527 | ||
528 | int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, | ||
529 | struct acpi_gpio_info *info) | ||
530 | { | ||
531 | if (info->polarity == GPIO_ACTIVE_LOW) | ||
532 | *lookupflags |= GPIO_ACTIVE_LOW; | ||
533 | |||
534 | return 0; | ||
535 | } | ||
536 | |||
528 | struct acpi_gpio_lookup { | 537 | struct acpi_gpio_lookup { |
529 | struct acpi_gpio_info info; | 538 | struct acpi_gpio_info info; |
530 | int index; | 539 | int index; |
@@ -745,10 +754,8 @@ struct gpio_desc *acpi_find_gpio(struct device *dev, | |||
745 | return ERR_PTR(-ENOENT); | 754 | return ERR_PTR(-ENOENT); |
746 | } | 755 | } |
747 | 756 | ||
748 | if (info.polarity == GPIO_ACTIVE_LOW) | ||
749 | *lookupflags |= GPIO_ACTIVE_LOW; | ||
750 | |||
751 | acpi_gpio_update_gpiod_flags(dflags, &info); | 757 | acpi_gpio_update_gpiod_flags(dflags, &info); |
758 | acpi_gpio_update_gpiod_lookup_flags(lookupflags, &info); | ||
752 | return desc; | 759 | return desc; |
753 | } | 760 | } |
754 | 761 | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index b8e4c9cd7b9e..bfbe5d7af372 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -4350,9 +4350,7 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, | |||
4350 | return desc; | 4350 | return desc; |
4351 | 4351 | ||
4352 | acpi_gpio_update_gpiod_flags(&dflags, &info); | 4352 | acpi_gpio_update_gpiod_flags(&dflags, &info); |
4353 | 4353 | acpi_gpio_update_gpiod_lookup_flags(&lflags, &info); | |
4354 | if (info.polarity == GPIO_ACTIVE_LOW) | ||
4355 | lflags |= GPIO_ACTIVE_LOW; | ||
4356 | } | 4354 | } |
4357 | 4355 | ||
4358 | /* Currently only ACPI takes this path */ | 4356 | /* Currently only ACPI takes this path */ |
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 5dbfce616ae1..e1636e152a6c 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h | |||
@@ -125,6 +125,8 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); | |||
125 | 125 | ||
126 | int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, | 126 | int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, |
127 | struct acpi_gpio_info *info); | 127 | struct acpi_gpio_info *info); |
128 | int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, | ||
129 | struct acpi_gpio_info *info); | ||
128 | 130 | ||
129 | struct gpio_desc *acpi_find_gpio(struct device *dev, | 131 | struct gpio_desc *acpi_find_gpio(struct device *dev, |
130 | const char *con_id, | 132 | const char *con_id, |
@@ -153,6 +155,12 @@ acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *inf | |||
153 | { | 155 | { |
154 | return 0; | 156 | return 0; |
155 | } | 157 | } |
158 | static inline int | ||
159 | acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, | ||
160 | struct acpi_gpio_info *info) | ||
161 | { | ||
162 | return 0; | ||
163 | } | ||
156 | 164 | ||
157 | static inline struct gpio_desc * | 165 | static inline struct gpio_desc * |
158 | acpi_find_gpio(struct device *dev, const char *con_id, | 166 | acpi_find_gpio(struct device *dev, const char *con_id, |