All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-gpio@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Stephen Warren <swarren@wwwdotorg.org>
Subject: Correct meaning of the GPIO active low flag
Date: Mon, 10 Feb 2014 15:33:11 +0100	[thread overview]
Message-ID: <4298328.sSSAEV5F8t@avalon> (raw)

Hello everybody,

While working on Dt support for a driver that uses GPIO I came to ponder about 
the correct meaning of the GPIO active low flag. I'm bringing the question to 
the mailing list to get feedback.

When a device has an active low input, the fact that the input is active low 
is a property of the device, and thus known to the driver. On the other hand, 
if an inverter is present on the board, that information isn't known to device 
drivers and need to be expressed in DT.

Does the active low flag express the latter only, or both of them ? To ask the 
question differently, should the low flag model the inverter inside the 
device, known to the device driver, effectively moving handling of that 
inverter out of the device driver to the core code, or should it stop at the 
device boundary and only model the board ?

As an example, if my device datasheet states that the reset input is active 
low, an no inverter is present on the GPIO line, should I set the GPIO active 
low flag in DT and set the GPIO value to 1 in software (assuming I use the 
gpiod_* API) to make the reset signal active, or should I set the GPIO active 
high flag in DT and the the GPIO value to 0 in software ?

Let's also keep in mind that devices can have programmable polarities for 
inputs connected to GPIO-driven signals, in which case the internal polarity 
inversion is dynamic and can't be expressed in the GPIO propery in DT.

-- 
Regards,

Laurent Pinchart


             reply	other threads:[~2014-02-10 14:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10 14:33 Laurent Pinchart [this message]
2014-02-10 14:50 ` Correct meaning of the GPIO active low flag Alexandre Courbot
2014-02-10 15:13   ` Laurent Pinchart
2014-02-10 16:56     ` Stephen Warren
2014-02-10 16:57       ` Stephen Warren
2014-02-10 17:52         ` Laurent Pinchart
2014-02-10 23:04           ` Stephen Warren
2014-02-10 23:21             ` Laurent Pinchart
2014-02-12 16:50               ` Stephen Warren
2014-02-13 14:43                 ` Laurent Pinchart
2014-02-13 16:49                   ` Stephen Warren
2014-02-14 23:48                     ` Laurent Pinchart
2014-02-15  0:07                       ` Stephen Warren
2014-02-15  0:20                         ` Laurent Pinchart
2014-02-18 17:58                           ` Stephen Warren
2014-02-19  0:19                             ` Laurent Pinchart

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=4298328.sSSAEV5F8t@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=swarren@wwwdotorg.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.