All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: Alexandre Courbot <gnurou@gmail.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: Correct meaning of the GPIO active low flag
Date: Thu, 13 Feb 2014 15:43:27 +0100	[thread overview]
Message-ID: <7178755.iaUGSV8r4q@avalon> (raw)
In-Reply-To: <52FBA65D.8060405@wwwdotorg.org>

Hi Stephen,

On Wednesday 12 February 2014 09:50:37 Stephen Warren wrote:
> On 02/10/2014 04:21 PM, Laurent Pinchart wrote:
> > On Monday 10 February 2014 16:04:30 Stephen Warren wrote:
> >> On 02/10/2014 10:52 AM, Laurent Pinchart wrote:
> >>> On Monday 10 February 2014 09:57:43 Stephen Warren wrote:
> >>>> On 02/10/2014 09:56 AM, Stephen Warren wrote:
> >> ...
> >> 
> >>>>> I think the flag should represent the physical level of the signal on
> >>>>> the board at the device pin. I'm pretty sure that's what's most
> >>>>> consistent with existing DT properties.
> >>>> 
> >>>> (That would have to be the GPIO source device, in order to account for
> >>>> any board-induced inversion)
> >>> 
> >>> Would that be the physical level at the GPIO source device output to
> >>> achieve a high level at the target device input pin, or the physical
> >>> level at the GPIO source device output to assert the signal at the
> >>> target device input pin ? The first case wouldn't take the receiver
> >>> device internal inverter into account while the second case would. In
> >>> the second case, how should we handle receiver devices that have
> >>> configurable signal polarities (essentially enabling/disabling the
> >>> internal inverter from a software-controller configuration) ?
> >> 
> >> I would expect the flag to represent the physical level that achieves (or
> >> represents, for inputs) a logically asserted value at the device.
> > 
> > I assume you mean "the physical level at the GPIO controller output".
> 
> Yes.
> 
> >> I don't think we should make the level flag influence any kind of
> >> configurable level within the device; that's a separate orthogonal, but
> >> related, concept. It'd be best if the DT binding for the device either
> >> (a) provided a separate property to configure that, or (b) picked a
> >> single one of the configurable values, and documented that all DTs
> >> should assume that value.
> > 
> > Agreed. I've phrased my question incorrectly though.
> > 
> > My concern with devices that have configurable input polarities is that
> > the
> 
> s/input/output/ I assume?

No, I mean input. Think about video vertical/horizontal sync inputs, they 
usually have configurable polarities on the receiver side. In that case the 
physical level at the GPIO controller output that achieves a logically 
asserted value at the device depends on how the device is configured at 
runtime.

Moving the input's internal inverter out of the GPIO flag would solve this 
problem in that the flag would instead represent the physical level at the 
GPIO controller output that achieves a high level at the device (option 'a').

That might be considered counterintuitive though. The other option ('b') I can 
think of is the one I mentioned, representing "the physical level at the GPIO 
controller output that achieves (or represents, for inputs) a logically 
asserted value at the device, for the default configuration of the device" 
with the default configuration of the device defined in the DT bindings.

Option 'b' is more complex in the sense that it requires expressing more 
information in the DT bindings.

> > "physical level [at the GPIO controller output] that achieves (or
> > represents, for inputs) a logically asserted value at the device" depends
> > on runtime configuration of the device, and is thus ill-defined.
> 
> I think for DT, we can define what the runtime state must be, as I mentioned
> above.
> 
> > We could consider that the flag represents the physical level at the GPIO
> > controller output that achieves (or represents, for inputs) a logically
> > asserted value at the device, for the default configuration of the device.
> > The default configuration of the device would then need to be defined.
> > I'm unsure whether the default configuration should be constant, or could
> > depend on other DT properties.
> 
> Either would work, so long as the exact meaning of the DT content was well-
> defined, and statically defined.

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2014-02-13 14:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10 14:33 Correct meaning of the GPIO active low flag Laurent Pinchart
2014-02-10 14:50 ` 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 [this message]
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=7178755.iaUGSV8r4q@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.