From: Ben Gardner <gardner.ben@gmail.com>
To: David Brownell <david-b@pacbell.net>
Cc: linux-kernel@vger.kernel.org,
Andres Salomon <dilinger@collabora.co.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Jani Nikula <ext-jani.1.nikula@nokia.com>
Subject: Re: [PATCH 1/3] gpiolib: add gpio_set_direction()
Date: Sat, 27 Feb 2010 12:36:24 -0600 [thread overview]
Message-ID: <808c8e9d1002271036s387b4638u9c754da1e88b6e1b@mail.gmail.com> (raw)
In-Reply-To: <201002262302.18890.david-b@pacbell.net>
> NAK.
>
> When we discussed the programming interface originally, having the
> direction be part of the function name was explicitly requested as
> a way to reduce programming errors.
>
> I recall that a gpio_set_direction() was in the original proposal...
> removing that was one of the handful of fixes that went into the final
> set of calls in this programming interface.
>
> And in fact ... it *was* very easy to make errors with a few GPIO
> interfaces which worked like that. With even fewer parameters to
> create confusion than in your proposal.
>
> Let's have no retrograde motion...
>
>
>> Add 'none' and 'inout' directions to the sysfs interface.
>
> Both of those seem nonsensical:
>
> "none" ... since it's not even a GPIO, why would it show
> up through the GPIO subsystem???
>
> "inout" ... is not a direction. But if you want to do this,
> you really ought to bite the bullet and come up with a
> way the implementation can pass up its capabilities.
>
> Did you read the definition of gpio_get_value()? It says
> "When reading the value of an output pin, the value returned
> should be what's seen on the pin ... that won't always match
> the specified output value, because of issues including
> open-drain signaling and output latencies." Also: "note that
> not all platforms can read the value of output pins; those that
> can't should always return zero."
>
> Another way to say that is that "output" means 'inout" except
> when the platform can't do that. So you'd need to address the
> case of hardware that's truly output-only ... instead of
> ignoring that, as done here. (That is: you'd need to have a
> way to reject "inout" mode ... or for that matter, "output-only".)
>
>
> Doing that well might be a Good Thing ... if for example it
> lets the initial mode of a GPIO show up properly ... there's
> currently an assumption in sysfs that they start up as "input",
> which of course makes sense for any power-sensitive system
> (you don't enable output drivers unless that power consumption
> is for some reason required).
>
> I've never, for example, seen GPIO hardware that would support
> the equivalent of that "open in <bitmask> mode". It's either
> unidirectional (rarely), or (normally) the only real option is
> whether the output drivers are disabled. So you always get the
> "inout" semantics described above, or input-only ones. Asking
> for output-only would need to fail. (Or in the less typical
> cases, it's asking for "inout" that would need to fail.)
OK. Lets dump this patch series and I'll send off a patch that fixes
the cs5535-gpio driver to behave as indicated.
Ben
next prev parent reply other threads:[~2010-02-27 18:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-26 23:26 [PATCH 0/3] gpio: add gpio_set_direction Ben Gardner
2010-02-26 23:26 ` [PATCH 1/3] gpiolib: add gpio_set_direction() Ben Gardner
2010-02-26 23:39 ` Andres Salomon
2010-02-27 5:11 ` Ben Gardner
2010-02-27 7:02 ` David Brownell
2010-02-27 10:26 ` Mark Brown
2010-02-27 16:24 ` David Brownell
2010-02-27 17:20 ` Mark Brown
2010-02-27 17:51 ` David Brownell
2010-03-01 10:35 ` Mark Brown
2010-02-27 18:36 ` Ben Gardner [this message]
2010-02-27 19:23 ` David Brownell
2010-02-27 18:36 ` [PATCH] cs5535-gpio: change input/output enable to match gpiolib expectations Ben Gardner
2010-02-27 18:40 ` Ben Gardner
2010-02-27 18:56 ` [PATCH v2] " Ben Gardner
2010-02-27 19:18 ` David Brownell
2010-02-26 23:26 ` [PATCH 2/3] cs5535-gpio: Use set_direction Ben Gardner
2010-02-27 7:04 ` David Brownell
2010-02-27 18:18 ` Ben Gardner
2010-02-26 23:26 ` [PATCH 3/3] OLPC: ALSA: fix cs5535audio's MIC GPIO to enable input Ben Gardner
2010-02-27 7:14 ` David Brownell
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=808c8e9d1002271036s387b4638u9c754da1e88b6e1b@mail.gmail.com \
--to=gardner.ben@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david-b@pacbell.net \
--cc=dilinger@collabora.co.uk \
--cc=ext-jani.1.nikula@nokia.com \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®