* [PATCH] pinctrl: oxnas: Add GPIO get_direction
@ 2016-05-24 10:03 Neil Armstrong
2016-05-24 12:51 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Neil Armstrong @ 2016-05-24 10:03 UTC (permalink / raw)
To: linus.walleij, linux-kernel, linux-arm-kernel, linux-gpio; +Cc: Neil Armstrong
Implement a get_direction callback for the OXNAS GPIO driver in order
to have pin output polarity in debugfs and new userspace ABI.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/pinctrl/pinctrl-oxnas.c | 11 +++++++++++
1 file changed, 11 insertions(+)
Linus,
Sorry, I should have implemented it earlier but I was focused to
have a clean driver for upstream !
Thanks,
Neil
diff --git a/drivers/pinctrl/pinctrl-oxnas.c b/drivers/pinctrl/pinctrl-oxnas.c
index 5fd113c..2c6abef 100644
--- a/drivers/pinctrl/pinctrl-oxnas.c
+++ b/drivers/pinctrl/pinctrl-oxnas.c
@@ -49,6 +49,7 @@
/* GPIO Registers */
#define INPUT_VALUE 0x00
+#define OUTPUT_EN 0x04
#define IRQ_PENDING 0x0c
#define OUTPUT_SET 0x14
#define OUTPUT_CLEAR 0x18
@@ -431,6 +432,15 @@ static int oxnas_gpio_request_enable(struct pinctrl_dev *pctldev,
return 0;
}
+static int oxnas_gpio_get_direction(struct gpio_chip *chip,
+ unsigned int offset)
+{
+ struct oxnas_gpio_bank *bank = gpiochip_get_data(chip);
+ u32 mask = BIT(offset);
+
+ return !(readl_relaxed(bank->reg_base + OUTPUT_EN) & mask);
+}
+
static int oxnas_gpio_direction_input(struct gpio_chip *chip,
unsigned int offset)
{
@@ -664,6 +674,7 @@ static void oxnas_gpio_irq_handler(struct irq_desc *desc)
.label = "GPIO" #_bank, \
.request = gpiochip_generic_request, \
.free = gpiochip_generic_free, \
+ .get_direction = oxnas_gpio_get_direction, \
.direction_input = oxnas_gpio_direction_input, \
.direction_output = oxnas_gpio_direction_output, \
.get = oxnas_gpio_get, \
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] pinctrl: oxnas: Add GPIO get_direction
2016-05-24 10:03 [PATCH] pinctrl: oxnas: Add GPIO get_direction Neil Armstrong
@ 2016-05-24 12:51 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2016-05-24 12:51 UTC (permalink / raw)
To: Neil Armstrong; +Cc: linux-kernel, linux-arm-kernel, linux-gpio
On Tue, May 24, 2016 at 12:03 PM, Neil Armstrong
<narmstrong@baylibre.com> wrote:
> Implement a get_direction callback for the OXNAS GPIO driver in order
> to have pin output polarity in debugfs and new userspace ABI.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-24 12:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-24 10:03 [PATCH] pinctrl: oxnas: Add GPIO get_direction Neil Armstrong
2016-05-24 12:51 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®