mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gpio: samsung: add flags specifier to device-tree binding
@ 2012-06-26  4:18 Olof Johansson
  2012-07-05 13:24 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Olof Johansson @ 2012-06-26  4:18 UTC (permalink / raw)
  To: Grant Likely, Rob Herring, Linus Walleij
  Cc: Thomas Abraham, Kukjin Kim, devicetree-discuss, linux-kernel,
	linux-arm-kernel, samsung-soc, Olof Johansson

This adds a flags field to the gpio specifier for Samsung. I didn't
want to add yet another field in the already quite long specifier, so
I decided to compress it together with the Pull Up/Down settings instead.

This is needed to, for example, have a gpio-keys input that is active low.

Signed-off-by: Olof Johansson <olof@lixom.net>
---
 Documentation/devicetree/bindings/gpio/gpio-samsung.txt | 9 +++++----
 drivers/gpio/gpio-samsung.c                             | 5 ++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-samsung.txt b/Documentation/devicetree/bindings/gpio/gpio-samsung.txt
index 8f50fe5..c873e80 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-samsung.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-samsung.txt
@@ -11,14 +11,15 @@ Required properties:
      <[phandle of the gpio controller node]
       [pin number within the gpio controller]
       [mux function]
-      [pull up/down]
+      [flags and pull up/down]
       [drive strength]>
 
   Values for gpio specifier:
   - Pin number: is a value between 0 to 7.
-  - Pull Up/Down: 0 - Pull Up/Down Disabled.
-                  1 - Pull Down Enabled.
-                  3 - Pull Up Enabled.
+  - Flags and Pull Up/Down: 0 - Pull Up/Down Disabled.
+                            1 - Pull Down Enabled.
+                            3 - Pull Up Enabled.
+          Bit 16 (0x00010000) - Input is active low.
   - Drive Strength: 0 - 1x,
                     1 - 3x,
                     2 - 2x,
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index b6453d0..92f7b2b 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -2681,11 +2681,14 @@ static int exynos_gpio_xlate(struct gpio_chip *gc,
 
 	if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(gpiospec->args[1])))
 		pr_warn("gpio_xlate: failed to set pin function\n");
-	if (s3c_gpio_setpull(pin, gpiospec->args[2]))
+	if (s3c_gpio_setpull(pin, gpiospec->args[2] & 0xffff))
 		pr_warn("gpio_xlate: failed to set pin pull up/down\n");
 	if (s5p_gpio_set_drvstr(pin, gpiospec->args[3]))
 		pr_warn("gpio_xlate: failed to set pin drive strength\n");
 
+	if (flags)
+		*flags = gpiospec->args[2] >> 16;
+
 	return gpiospec->args[0];
 }
 
-- 
1.7.10.1.488.g05fbf7a


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpio: samsung: add flags specifier to device-tree binding
  2012-06-26  4:18 [PATCH] gpio: samsung: add flags specifier to device-tree binding Olof Johansson
@ 2012-07-05 13:24 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2012-07-05 13:24 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Grant Likely, Rob Herring, Linus Walleij, Thomas Abraham,
	Kukjin Kim, devicetree-discuss, linux-kernel, linux-arm-kernel,
	samsung-soc

On Tue, Jun 26, 2012 at 6:18 AM, Olof Johansson <olof@lixom.net> wrote:

> This adds a flags field to the gpio specifier for Samsung. I didn't
> want to add yet another field in the already quite long specifier, so
> I decided to compress it together with the Pull Up/Down settings instead.
>
> This is needed to, for example, have a gpio-keys input that is active low.
>
> Signed-off-by: Olof Johansson <olof@lixom.net>

Applied.

Thanks,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-05 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-26  4:18 [PATCH] gpio: samsung: add flags specifier to device-tree binding Olof Johansson
2012-07-05 13:24 ` 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®