From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
"linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Guenter Roeck
<guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>,
Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
Ben Dooks <ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>,
u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
Grant Grundler <grundler-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
Alexandre Courbot
<acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
"Ben Dooks (embedded platforms)"
<ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
Girish Shivananjappa
<girish.shivananjappa-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
"bhushan.r" <bhushan.r-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Naveen Krishna Chatradhi
<ch.naveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
"sreekumar.c"
<sreekumar.c-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Mark Brown
<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY@public.gmane.org>
Subject: Re: [PATCH v1 1/4] i2c: mux: Add i2c-arbitrator 'mux' driver
Date: Thu, 14 Feb 2013 10:37:01 -0700 [thread overview]
Message-ID: <511D20BD.5090305@wwwdotorg.org> (raw)
In-Reply-To: <CACRpkdaUtOe9g7+T=cWPepeGae6RcJ1nTeGc9opTijcYzfMedQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On 02/14/2013 03:01 AM, Linus Walleij wrote:
> On Thu, Feb 14, 2013 at 1:41 AM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
>> On 02/13/2013 05:34 PM, Doug Anderson wrote:
>
>>> A little torn here. It adds a bunch of complexity to the code to
>>> handle this case and there are no known or anticipated users. I only
>>> wish that the GPIO polarity could be more hidden from drivers (add
>>> functions like gpio_assert, gpio_deassert, etc)...
>>
>> Yes, that would be nice. Alex, LinusW?
>
> OK so good point since Alex is rewriting the way the external
> API to GPIOs is done.
>
> So this is one of the evolutionary artifacts of the GPIO subsystem:
> that it has this concept of clients having to know if they want to
> drive the line low or high.
>
> Either way somewhere in the system the knowledge of whether
> the low or high state counts as asserted must be stored.
>
> The same goes for inputs really: for example we have a
> platform data flag for drivers/mmc/host/mmci.c that tells
> whether a card is inserted when the line goes low or high. And
> this varies between platforms.
>
> So that would lead to gpio_get_value() being rewritten
> as gpio_is_asserted() as well.
>
> We all agree that the meaning of a certain GPIO pins
> high vs low state as asserter or deasserted is a machine-
> specific thing, so it need to come from device tree or platform
> data.
>
> So what this is really all about is whether that knowledge
> should be part of the consumer DT node/platform data
> or the producer DT node/platform data.
>
> I.e. in the MMCI case whether we encode that into the
> DT node/pdata for the GPIO controller or the MMCI
> controller.
>
> A bit like whether to eat eggs from the big or little end
> you could say :-)
>
> But changing it would have very drastic effects.
> Consider this snippet from
> arch/arm/boot/dts/snowball.dts:
>
> // External Micro SD slot
> sdi0_per1@80126000 {
> arm,primecell-periphid = <0x10480180>;
> max-frequency = <50000000>;
> bus-width = <4>;
> mmc-cap-mmc-highspeed;
> vmmc-supply = <&ab8500_ldo_aux3_reg>;
>
> cd-gpios = <&gpio6 26 0x4>; // 218
> cd-inverted;
>
> status = "okay";
> };
>
> Note property "cd-inverted".
>
> It states whether the GPIO value is active high (default) or
> active low (this flag set). Ironically the binding document is
> incomplete but we have to support device trees like this
> going forward.
>
> How do I make sure that this device tree continue to work
> as expected if we change the semantic of the GPIO subsystem
> to only provide gpio_is_asserted()?
>
> You would have to include a function call to the GPIO core
> and tell it what is asserted and what is not, like
> gpiod_set_assertion_polarity() so the driver can also
> tell the GPIO subsystem what is asserted and what is not,
> rather than encoding that at the GPIO end of things.
>
> So all of a sudden *both* the consumers and the providers
> can define assertion sematics for the pins. What happens
> if they are in disagreement?
I think it's actually binding-specific.
Either a binding assumed that the GPIO specifier might not include an
inversion flag, and hence included its own alternative (cd-inverted), or
it assumed that the GPIO specifier would always include this flag, and
hence relied purely on the GPIO flags.
Drivers are written to support specific bindings, and hence they know
which case they fall into.
Hence, I think we want something like:
Case 1: Just use GPIO specifier flags:
gpio = of_get_named_gpio_flags(np, name, index, &flags);
gpio_request_with_flags(gpio, flags);
Case 2: Just use binding-specific property:
gpio = of_get_named_gpio(np, name, index);
flags = 0;
if (of_property_read_bool(np, name))
flags |= FLAG_INVERTED;
gpio_request_with_flags(gpio, flags);
Or something like that.
That seems simple enough?
prev parent reply other threads:[~2013-02-14 17:37 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 18:02 [PATCH v1 1/4] i2c: mux: Add i2c-arbitrator 'mux' driver Doug Anderson
2013-02-13 18:02 ` Doug Anderson
2013-02-13 18:02 ` [PATCH v1 2/4] ARM: dts: Add i2c-arbitrator bus for exynos5250-snow Doug Anderson
2013-02-13 18:02 ` Doug Anderson
2013-02-13 21:04 ` Stephen Warren
2013-02-13 21:04 ` Stephen Warren
2013-02-14 0:38 ` Doug Anderson
2013-02-14 0:38 ` Doug Anderson
2013-02-14 4:42 ` Stephen Warren
2013-02-14 4:42 ` Stephen Warren
2013-02-13 18:02 ` [PATCH v1 3/4] ARM: dts: Add sbs-battery " Doug Anderson
2013-02-13 18:02 ` Doug Anderson
2013-02-13 18:02 ` [PATCH v1 4/4] i2c-mux: i2c_add_mux_adapter() should use -1 for auto bus num Doug Anderson
2013-02-13 18:02 ` Doug Anderson
[not found] ` <1360778532-7480-4-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2013-02-13 20:34 ` Guenter Roeck
2013-02-13 20:34 ` Guenter Roeck
2013-02-13 21:09 ` Stephen Warren
2013-02-13 21:09 ` Stephen Warren
[not found] ` <511C00F4.4080708-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-14 7:15 ` Jean Delvare
2013-02-14 7:15 ` Jean Delvare
[not found] ` <1360778532-7480-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2013-02-13 18:45 ` [PATCH v1 1/4] i2c: mux: Add i2c-arbitrator 'mux' driver Olof Johansson
2013-02-13 18:45 ` Olof Johansson
2013-02-13 18:49 ` Olof Johansson
2013-02-13 18:49 ` Olof Johansson
2013-02-13 21:02 ` Stephen Warren
2013-02-13 21:02 ` Stephen Warren
[not found] ` <511BFF77.2090202-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-14 0:34 ` Doug Anderson
[not found] ` <CAD=FV=XUEcUx3NGCm+KijRGujECVTSJ9X5fY=arq-4U_RUdxCQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14 0:41 ` Stephen Warren
[not found] ` <511C32B5.20600-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-14 0:54 ` Doug Anderson
[not found] ` <CAD=FV=X=BPQo245kAtPvNUgKjypOYnheYJWcBkq6AA19z99V0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14 21:40 ` Doug Anderson
[not found] ` <CAD=FV=UYEqreNbUAxHydmWH+66pOORMB_uFokivLitsavzTcsQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14 23:35 ` Stephen Warren
[not found] ` <511D74DD.9070600-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-14 23:59 ` Doug Anderson
[not found] ` <CAD=FV=Uri9O=iuuUKB9nPKW+6C+A_WsqW0sXB2nS5i7+=NtFKA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-15 0:16 ` Stephen Warren
[not found] ` <511D7E5D.1030003-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-15 1:14 ` Doug Anderson
[not found] ` <CAD=FV=USf_YSzW1ZN2NWZKnLk_LPpnFpxRy=AGVyn_YHjRpKyw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-15 10:26 ` Mark Brown
2013-02-15 10:24 ` Mark Brown
[not found] ` <20130215102420.GA22283-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-02-15 19:56 ` Linus Walleij
[not found] ` <CACRpkdav8WO5yOSLPLtpUCeM41nttrbspRb7YrsqGXJ01ebMhw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-17 16:03 ` Mark Brown
2013-02-15 21:05 ` Doug Anderson
2013-02-14 10:01 ` Linus Walleij
[not found] ` <CACRpkdaUtOe9g7+T=cWPepeGae6RcJ1nTeGc9opTijcYzfMedQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14 17:37 ` Stephen Warren [this message]
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=511D20BD.5090305@wwwdotorg.org \
--to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
--cc=acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org \
--cc=bhushan.r-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
--cc=ch.naveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=girish.shivananjappa-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=grundler-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
--cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
--cc=sreekumar.c-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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.