[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45a44e480812302058k365eddcfxf902095657b78534@mail.gmail.com>
Date: Tue, 30 Dec 2008 23:58:44 -0500
From: "Jaya Kumar" <jayakumar.lkml@...il.com>
To: "Robin Getz" <rgetz@...ckfin.uclinux.org>
Cc: "David Brownell" <david-b@...bell.net>,
"Eric Miao" <eric.y.miao@...il.com>,
"Sam Ravnborg" <sam@...nborg.org>,
"Eric Miao" <eric.miao@...vell.com>,
"Haavard Skinnemoen" <hskinnemoen@...el.com>,
"Philipp Zabel" <philipp.zabel@...il.com>,
"Russell King" <rmk@....linux.org.uk>,
"Ben Gardner" <bgardner@...tec.com>, "Greg KH" <greg@...ah.com>,
linux-arm-kernel@...ts.arm.linux.org.uk,
linux-fbdev-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org, linux-embedded@...r.kernel.org
Subject: Re: [RFC 2.6.27 1/1] gpiolib: add support for batch set of pins
On Tue, Dec 30, 2008 at 11:55 PM, Robin Getz <rgetz@...ckfin.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.
+ 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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists