public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: simon.guinot@sequanux.org (Simon Guinot)
To: linux-arm-kernel@lists.infradead.org
Subject: Location for a kind of GPIO bus driver
Date: Thu, 25 Jul 2013 17:49:32 +0200	[thread overview]
Message-ID: <20130725154932.GL9916@kw.sim.vm.gnt> (raw)
In-Reply-To: <20130724181924.GI19736@titan.lakedaemon.net>

On Wed, Jul 24, 2013 at 02:19:24PM -0400, Jason Cooper wrote:
> On Tue, Jul 23, 2013 at 05:18:34PM +0200, Simon Guinot wrote:
> > Hi,
> > 
> > I am currently working on converting the LED driver leds-netxbig to DT.
> > Doing so, I am also considering to move the GPIO extension bus functions
> > (which are currently parts of leds-netxbig) into a separate driver.
> > 
> > On the LaCie "Big Network" board family (netxbig), the LEDs are
> > controlled by a CPLD. In turn, the CPLD can be configured (mostly the
> > LEDs modes) through a kind of parallel GPIO bus, called GPIO extension
> > bus. Two registers (address and data) are exposed. Each of them is made
> > up of several GPIOs. An extra GPIO is used to notify the CPLD that the
> > registers have been updated. The leds-netxbig driver uses some dedicated
> > functions (prefixed by "gpio_ext_") to handle the GPIO bus extension.
> > 
> > On the latest "Big Network" boards, this bus is also used to enable the
> > PM wakeup sources: the CPLD can be asked to keep powered some devices
> > (as the RTC or the Ethernet PHY) while the board is down. I think it
> > could be nice to expose this feature to the userland. That's why I am
> > thinking about moving the GPIO extension bus support into a separate
> > driver. The problem is that I can't find a proper location for a such
> > driver. AFAIK, it doesn't fit with anything existing supported by Linux.
> > Maybe I should consider drivers/bus ? Or even drivers/misc ?

Hi Jason,

Thanks for your answer.

> 
> iiuc, the CPLD is more of gpio multiplexer/expander.  Have you seen
> 
>   66bcb58 arm: mvebu: enable gpio expander over i2c on Mirabox platform
> 
> ?  And the corresponding driver, drivers/gpio/gpio-pca953x.c?

All the drivers under drivers/gpio are registering some GPIO chips.
It is a big difference with the LaCie "GPIO extension bus". This last
is more an extension mechanism on the top of GPIOs already existing
(eventually provided by a SoC or a Super-I/O on x86 boards). No new
GPIOs are added. I think that the name "extension" is quite confusing.

The idea behind this "bus" is to allow to configure a lot of LEDs (in
various modes) using only few GPIOs and a CPLD (which is already
available on the board for other purposes). This cheap solution allows
precisely to save the cost of a GPIO expander :)

As an example, you can see the "GPIO extension bus" configuration for
the Kirkwood "Big Network" boards in:
arch/arm/mach-kirkwood/netxbig_v2-setup.c:132.

> 
> I would try drivers/gpio.  If there are complaints, it should be trivial
> to move it in a new version of the series.

Why not, as long it is clear that the resulting driver will not provide
a GPIO chip but rather functions as a library.

> 
> Is there any reason why the new capabilities in the "Big Network" boards
> couldn't be covered by gpio-regulator?

I don't have looked at the details but I think that gpio-regulator
could be able to configure the PM modes through the GPIO extension bus.

But a problem remains. The same GPIOs would be used by two different
drivers: leds-netxbig and gpio-regulator. This would lead to some
conflicts. That's why I think that at some level a driver is needed to
handle the GPIO extension bus.

Regards,

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130725/c2ada4ec/attachment.sig>

  reply	other threads:[~2013-07-25 15:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 15:18 Location for a kind of GPIO bus driver Simon Guinot
2013-07-24 18:19 ` Jason Cooper
2013-07-25 15:49   ` Simon Guinot [this message]
2013-07-25 16:03     ` Jason Cooper
2013-07-26  8:56       ` Simon Guinot
2013-07-26 11:27         ` Jason Cooper
2013-07-26 16:18         ` Arnd Bergmann
2013-07-25 21:46 ` Linus Walleij
2013-07-25 22:16   ` Greg KH
2013-07-26 12:01     ` Jason Cooper

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=20130725154932.GL9916@kw.sim.vm.gnt \
    --to=simon.guinot@sequanux.org \
    --cc=linux-arm-kernel@lists.infradead.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