linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Nizette <bn@niasdigital.com>
To: Robin Getz <rgetz@blackfin.uclinux.org>
Cc: Jaya Kumar <jayakumar.lkml@gmail.com>,
	David Brownell <david-b@pacbell.net>,
	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 09:00:34 +1100	[thread overview]
Message-ID: <1230501634.16910.57.camel@linux-51e8.site> (raw)
In-Reply-To: <200812281346.56703.rgetz@blackfin.uclinux.org>

On Sun, 2008-12-28 at 13:46 -0500, Robin Getz wrote:
> > gpio_set_batch(DB0, value, 0xFFFF, 16)
> > 
> > which has the nice performance benefit of skipping all the bit
> > counting in the most common use case scenario.
> 
> but has the requirement that the driver know exactly the board level 
> impmentation details (something that doesn't sound generic).

The original use case for these batch operations was in a fastpath -
setting data lines on a framebuffer.  Sure it's arguably not as generic
as may be, but it optimises for speed and current usage patterns - I'm
OK with that.  Other usage patterns which don't have a speed requirement
can be done using the individual pin operations and a loop.

> 
> > While we are here, I was thinking about it, and its better if I give
> > gpio_request/free/direction_batch a miss for now. Nothing prevents
> > those features being added at a later point.
> 
> I don't think that request/free are optional.
> 
> For example - in most SoC implementations - gpios are implemented as banks of 
> 16 or 32. (a 16 or 32 bit register).
> 
> Are there facilities to span these registers? 
>  - can you request 64 gpios as a 'bank'?
>  - can you request gpio_8 -> gpio_40 as a 'bank' on a 32-bit system?
> 
> Are non-adjacent/non-contiguous gpios avaliable to be put into 
> a 'bank/batch/bus'? can you use gpio_8 -> 11 &  28 -> 31 as a 8-bit 'bus'? 
> 
> How do you know what is avaliable to be talked to as a bank/bus/batch without 
> the request/free operation?

I think the read/write operations should be able to fail if you give
them invalid chunks of gpio, sure.  Request/free are not really designed
for that operation - they just ensure exclusive access to a gpio if
that's what the driver wants.  In the batch case the
request/free/direction operations can once again be performed by single
pin operations and iteration.

> 
> 
> I have seen various hardware designs (both at the PCB and SoC level) require 
> all of these options, and would like to see common infrastructure which 
> handles this.
> 
> The issue is that on many SoC implementations - dedicated peripherals can also 
> be GPIOs - so it someone wants to use SPI (for example) GPIO's 3->7 might be 
> removed from the avaliable 'gpio' resources. This is determined by the 
> silicon designer - and even the PCB designer has little to no flexibility on 
> this. It gets worse as multiple SPI or I2C are used on the PCB (which can 
> have lots of small (less than 5) dedicated pins in the middle of the larger 
> gpio resources)....

Yeah the request/free operation doesn't deal with muxing or any other
platform-specific kinda gumph, that was an original design decision.
They're really just a usage counter.

An example which comes to mind is the avr32-specific userspace gpio
interface.  This takes a bitmask, loops over the set bits and fails if
any of the gpio are previously requested or have been assigned to
non-gpio peripherals.  I don't really see a need to streamline this.

> 
> I would think that a 'bank' / 'bus' (whatever) would be a collection of 
> random/multiple GPIOs (a struct of gpio_port_t) rather than a start/length 
> (as you described) - or better yet - the request function takes a list (of 
> individual GPIO's - defined in the platform data), and creates the struct 
> itself.

Hmm, this seems a little overengineered for the basic use-cases I can
think of.  If this can be cranked up to the same speed as the current
proposition then OK maybe someone will like it but otherwise, once
again, I think most people will be happy with individual operations and
iteration.


	--Ben.

  reply	other threads:[~2008-12-28 22:00 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 [this message]
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
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=1230501634.16910.57.camel@linux-51e8.site \
    --to=bn@niasdigital.com \
    --cc=bgardner@wabtec.com \
    --cc=david-b@pacbell.net \
    --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=rgetz@blackfin.uclinux.org \
    --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).