lkml.org 
[lkml]   [2008]   [Dec]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 2.6.27 1/1] gpiolib: add support for batch set of pins
On Tue, Dec 30, 2008 at 11:58 PM, Jaya Kumar <jayakumar.lkml@gmail.com> wrote:
> On Tue, Dec 30, 2008 at 11:55 PM, Robin Getz <rgetz@blackfin.uclinux.org> wrote:
>> Yeah, I hadn't thought about spanning more than one gpio_chip. That's a good
>> point.
>
> The currently posted code already supports spanning more than one gpio_chip.

and btw, that was because the use case needed to span 2, since it
started at 58 and was 16 bits long on a platform where ngpio == 32.
this was explained at the start of the thread.

>
> + do {
> + chip = gpio_to_chip(gpio + i);
> + WARN_ON(extra_checks && chip->can_sleep);
> +
> + if (!chip->set_bus) {
> + while (((gpio + i) < (chip->base + chip->ngpio))
> + && bitwidth) {
> + value = values & (1 << i);
> + chip->set(chip, gpio + i - chip->base, value);
> + i++;
> + bitwidth--;
> + }
> + } else {
> + value = values >> i; /* shift off the used stuff */
> + remwidth = ((chip->base + (int) chip->ngpio) -
> + ((int) gpio + i));
> + width = min(bitwidth, remwidth);
> +
> + chip->set_bus(chip, gpio + i - chip->base, value,
> + width);
> + i += width;
> + bitwidth -= width;
> + }
> + } while (bitwidth);
>


\
 
 \ /
  Last update: 2008-12-31 06:05    [W:0.200 / U:0.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site