[lkml]   [2009]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2] GPIO: Add gpio_lookup
On Mon, 2009-10-12 at 09:23 -0600, Jonathan Corbet wrote:
> On Mon, 12 Oct 2009 17:11:44 +1100
> Ben Nizette <> wrote:
> > Back to this patch though, the gpio names have to come from the platform
> > code via some platform_data for the gpio chip [1], the driver then looks
> > up that pre-defined name to find the gpio number. Why not just pass the
> > gpio number straight to the end device driver through platform_data and
> > bypass the middle-man?
> That's true in a situation where you've one One Platform to Bind Them
> All, yes. But if you have (say) GPIOs provided by a PCI-connected
> peripheral which are needed in (say) a camera driver, there is no one
> platform which can manage all those GPIO numbers. In particular, I've
> done a driver for viafb-based GPIOs; these devices can show up in any
> of a number of x86-based systems. I honestly don't know why it would
> make sense to try to hardware numbers to these GPIOs when using names
> and dynamic numbering is so much more flexible - and we are already
> tracking the names.
> Perhaps it would make sense to implement a proper namespace layer for
> GPIOs rather than continuing to grow something which evidently sneaked
> in through the back door. Until that's done, though, I think this
> patch is useful. But it it's really unwanted I'll find some other way.

Fair enough; I hadn't seen gpio controllers on such buses before but
that makes sense. If the naming information isn't coming from platform
code but from some driver itself this seems fairly sane.

If gpios are going to be named, and it seems they are, then personally
I'd like to see the names field of struct gpio_chip go and a proper
namespace layer inserted. Something which allows gpio_name() and
gpio_lookup() and decentralises that responsibility would be nice (the
chip could call gpio_name itself if it has reason). That code could be
common to all gpio framework implementations.

But a) I don't have the hours to do this myself and b) it's really
David's call, I'm just an interested bystander :-)


 \ /
  Last update: 2009-10-13 10:35    [W:0.071 / U:2.316 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site