linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Daney <ddaney.cavm@gmail.com>
To: Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, David Daney <david.daney@cavium.com>
Subject: [PATCH v2 2/2] of/gpio: Automatically decode OF_GPIO_OPEN_DRAIN and OF_GPIO_OPEN_SOURCE flags in gpiolib.
Date: Tue, 11 Feb 2014 11:50:00 -0800	[thread overview]
Message-ID: <1392148200-5393-3-git-send-email-ddaney.cavm@gmail.com> (raw)
In-Reply-To: <1392148200-5393-1-git-send-email-ddaney.cavm@gmail.com>

From: David Daney <david.daney@cavium.com>

Just as gpiod_get() automatically interprets the OF_GPIO_ACTIVE_LOW
flag from the device tree, add handling for OF_GPIO_OPEN_DRAIN and
OF_GPIO_OPEN_SOURCE.

This keeps the details of handling open-drain GPIOs in the core GPIO
code, and out of the individual drivers.

Signed-off-by: David Daney <david.daney@cavium.com>
---
 drivers/gpio/gpiolib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 50c4922..7f596d0 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2307,6 +2307,12 @@ static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
 	if (of_flags & OF_GPIO_ACTIVE_LOW)
 		*flags |= GPIO_ACTIVE_LOW;
 
+	if (of_flags & OF_GPIO_OPEN_DRAIN)
+		*flags |= GPIO_OPEN_DRAIN;
+
+	if (of_flags & OF_GPIO_OPEN_SOURCE)
+		*flags |= GPIO_OPEN_SOURCE;
+
 	return desc;
 }
 #else
-- 
1.7.11.7

  parent reply	other threads:[~2014-02-11 19:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 19:49 [PATCH v2 0/2] of/gpio: Automatic handling of devicetree open-drain GPIO specifications David Daney
2014-02-11 19:49 ` [PATCH v2 1/2] of/gpio: Define OF_GPIO_OPEN_DRAIN and OF_GPIO_OPEN_SOURCE flags David Daney
2014-02-12  2:20   ` Alexandre Courbot
2014-02-24 12:09   ` Linus Walleij
2014-02-24 12:11   ` Linus Walleij
2014-02-11 19:50 ` David Daney [this message]
     [not found]   ` <1392148200-5393-3-git-send-email-ddaney.cavm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-02-12  2:21     ` [PATCH v2 2/2] of/gpio: Automatically decode OF_GPIO_OPEN_DRAIN and OF_GPIO_OPEN_SOURCE flags in gpiolib Alexandre Courbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392148200-5393-3-git-send-email-ddaney.cavm@gmail.com \
    --to=ddaney.cavm@gmail.com \
    --cc=david.daney@cavium.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gnurou@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).