[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1392069908-22017-1-git-send-email-ddaney.cavm@gmail.com>
Date: Mon, 10 Feb 2014 14:05:08 -0800
From: David Daney <ddaney.cavm@...il.com>
To: Grant Likely <grant.likely@...aro.org>,
Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org,
Linus Walleij <linus.walleij@...aro.org>,
Alexandre Courbot <gnurou@...il.com>,
linux-gpio@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, David Daney <david.daney@...ium.com>
Subject: [PATCH] of/gpio: Define OF_GPIO_OPEN_DRAIN flag for Open Drain outputs.
From: David Daney <david.daney@...ium.com>
When we have a GPIO pin connected to an open-drain network, we want a
standard way of specifying this in the device tree. So we choose bit
1 of the flag field to indicate open drain.
A typical use case would be something like:
enum of_gpio_flags f;
.
.
.
reset_gpio = of_get_named_gpio_flags(node, "reset", 0, &f);
.
.
.
ret = gpio_request_one(reset_gpio,
(f & OF_GPIO_OPEN_DRAIN) ? GPIOF_OPEN_DRAIN : 0,
"reset");
.
.
.
gpio_direction_output(reset_gpio, 1);
gpio_set_value(reset_gpio, 0);
msleep(20);
gpio_set_value(reset_gpio, 1);
.
.
.
Signed-off-by: David Daney <david.daney@...ium.com>
---
include/linux/of_gpio.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index f14123a..0e374774 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -30,6 +30,7 @@ struct device_node;
*/
enum of_gpio_flags {
OF_GPIO_ACTIVE_LOW = 0x1,
+ OF_GPIO_OPEN_DRAIN = 0x2,
};
#ifdef CONFIG_OF_GPIO
--
1.7.11.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists