From: David Brownell <david-b@pacbell.net>
To: Jaya Kumar <jayakumar.lkml@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>,
Sam Ravnborg <sam@ravnborg.org>,
Eric Miao <eric.miao@marvell.com>,
Haavard Skinnemoen <hskinnemoen@atmel.com>,
Philipp Zabel <philipp.zabel@gmail.com>,
Russell King <rmk@arm.linux.org.uk>,
Ben Gardner <bgardner@wabtec.com>, Greg KH <greg@kroah.com>,
linux-arm-kernel@lists.arm.linux.org.uk,
linux-fbdev-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, linux-embedded@vger.kernel.org
Subject: Re: [RFC 2.6.27 1/1] gpiolib: add support for batch set of pins
Date: Mon, 29 Dec 2008 11:06:41 -0800 [thread overview]
Message-ID: <200812291106.42238.david-b@pacbell.net> (raw)
In-Reply-To: <45a44e480811301710v78875425p75dedd850728cbec@mail.gmail.com>
On Sunday 30 November 2008, Jaya Kumar wrote:
> > The gpio_*() interfaces are how system glue code and drivers
> > access GPIOs, unless they roll their own chip-specific calls.
> >
> > Whereas gpiolib (and gpio_chip) are an *optional* framework
> > for implementing those calls. Platforms can (and do!) use
> > other frameworks ... maybe they don't want to pay its costs,
> > and don't need the various GPIO expander drivers.
> >
> > So to repeat: don't assume the interface is implemented in
> > one particular way (using gpiolib). It has to make sense
> > with other implementation strategies too. Standard split
> > between interface and implementation, that's all. (Some folk
> > have been heard to talk about "gpiolib" as the interface to
> > drivers ... it's not, it's a provider-only interface library.)
> >
>
> Okay, I read above several times and I read Documentation/gpio.txt.
> But... I'm not confident I've understood your meanings above in terms
> of how it should change the code. What I know so far is:
>
> a)
> arch/arm/mach-pxa/include/mach/gpio.h is where the pxa GPIO api
> interface is defined.
It's actually where the *implementation* is *declared*. The
API is defined primarily in Documentation/gpio.txt ... though
in this case the implementation mostly punts to gpiolib. And
as you note below, the implementation is *defined* elsewhere.
> So that's where I will put the
> gpio_get/set_values_batch functions. This will match the existing
> gpio_set/get_value code there.
Those functions just punt to gpiolib, unlesss they happen
to fit in the "constant parameters" case where they can
expend to two or three instructions inline, rather than a
more expensive function call.
In this case, I don't see any benefit to supporting that
"inline constant parameters" case.
> b)
> arch/arm/mach-pxa/gpio.c is where the implementation is.
> So I'll put the pxa_gpio_direction_input/output_batch and
> pxa_gpio_set/get_batch there.
This is where the PXA implementation is *defined*, yes.
> c)
> drivers/gpio/gpiolib_batch.c
>
> This is where I'd put the generic platform independent implementations
> of __gpio_set/get_values_batch
>
> Does this sound consistent with your recommendation? If not, I need
> more help to understand what changes you are recommending.
More or less, yes. I'd have to see actual code. :)
> > Doesn't necessarily need to be *you* doing that, but if it only
> > works on older gumstix boards it'd not be general enough. Which
> > is part of why I say to get the lowest level proposal out there
> > first. If done right, it'll be easy to support on other chips.
>
> Yes, I completely agree that it must work on a wide range of
> architectures. But I don't understand what you mean when you say get
> the lowest level proposal out there first.
Provide a patch/RFD with
(0) methods you want to add to "struct gpio_chip".
Nothing else. That should be the easiest part of this change.
Other patches should probably include:
(1) one with the proposed driver level interface ... needs
discussion, so beginning with a patch may not be best;
(2) one *implementing* that interface using current calls;
(3) another *optimizing* that interface to use the new low
level methods (0), on chips where they're available;
(4) gpio_chip implementations for those low level ops.
Plus at least one example of how to use the interfaces in (1),
by the time everything starts to become solid, and implementation
patches are worth while.
(I'm not keen on starting with code to implement interfaces, except
when the interfaces are trivial or obvious. Interfaces are hard to
change. It's best to spend some time up-front improving them, while
they're easy to change/fix.)
> I see the RFC code that I
> posted as being the lowest level proposal (albeit needing better name
> and bitmask support) and one that is sufficiently general that it can
> be implemented on other architectures.
To repeat: what you've sent so far is mixing layers. It doesn't split
out the programming interface from its implementation at all.
Yet the whole *point* of having gpiolib is to make that split easy.
Which is why I want to see patches that reflect that architectural
split, instead of a hard-to-review megapatch that crosses all the
existing boundaries and doesn't show how non-PXA hardware could
implement these patches (or benefit from them).
- Dave
next prev parent reply other threads:[~2008-12-29 19:06 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-25 22:52 [RFC 2.6.27 1/1] gpiolib: add support for batch set of pins Jaya Kumar
2008-11-26 1:20 ` Eric Miao
2008-11-26 3:27 ` Jaya Kumar
2008-11-26 4:15 ` David Brownell
2008-11-26 5:51 ` Jaya Kumar
2008-11-27 20:01 ` Sam Ravnborg
2008-11-27 23:43 ` Jaya Kumar
2008-11-28 5:47 ` Sam Ravnborg
2008-11-29 22:48 ` David Brownell
2008-11-29 23:33 ` Jaya Kumar
2008-11-29 22:54 ` David Brownell
2008-11-29 23:52 ` Jaya Kumar
2008-11-30 17:55 ` David Brownell
2008-12-01 1:10 ` Jaya Kumar
2008-12-27 14:55 ` Jaya Kumar
2008-12-28 18:46 ` Robin Getz
2008-12-28 22:00 ` Ben Nizette
2008-12-29 0:28 ` Jaya Kumar
2008-12-29 20:32 ` David Brownell
2008-12-29 19:59 ` David Brownell
2009-01-06 23:02 ` Robin Getz
2009-01-07 1:52 ` Ben Nizette
2008-12-29 19:56 ` David Brownell
2008-12-30 0:20 ` Jamie Lokier
2008-12-30 0:43 ` David Brownell
2008-12-31 4:55 ` Robin Getz
2008-12-31 4:58 ` Jaya Kumar
2008-12-31 5:02 ` Jaya Kumar
2008-12-31 17:38 ` Robin Getz
2008-12-31 18:05 ` Jaya Kumar
2009-01-06 22:41 ` Robin Getz
2009-01-10 7:37 ` Jaya Kumar
2008-12-29 19:32 ` David Brownell
2008-12-30 15:45 ` Jaya Kumar
2008-12-29 19:06 ` David Brownell [this message]
2008-11-26 9:09 ` Paulius Zaleckas
2008-11-26 9:18 ` Jaya Kumar
2008-11-26 10:08 ` [Linux-fbdev-devel] " Geert Uytterhoeven
2008-11-26 10:25 ` Jaya Kumar
2008-11-26 12:08 ` Geert Uytterhoeven
2008-11-29 22:47 ` David Brownell
2008-11-29 23:04 ` Jaya Kumar
2008-11-30 3:27 ` 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=200812291106.42238.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=bgardner@wabtec.com \
--cc=eric.miao@marvell.com \
--cc=eric.y.miao@gmail.com \
--cc=greg@kroah.com \
--cc=hskinnemoen@atmel.com \
--cc=jayakumar.lkml@gmail.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=philipp.zabel@gmail.com \
--cc=rmk@arm.linux.org.uk \
--cc=sam@ravnborg.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).