[Gta04-owner] Linux 3.2-rc2 on GTA04
neilb at suse.de
Mon Nov 21 22:56:39 CET 2011
On Mon, 21 Nov 2011 17:00:11 +0100 "Dr. H. Nikolaus Schaller"
<hns at goldelico.com> wrote:
> Am 21.11.2011 um 16:50 schrieb Christoph Mair:
> > On Mon, Nov 21, 2011 at 3:50 PM, Dr. H. Nikolaus Schaller
> > <hns at goldelico.com> wrote:
> >> Am 21.11.2011 um 12:32 schrieb NeilBrown:
> >>> The next big thing I want to work on is proper integration of the LED
> >>> controller - with the 'wlan reset' line looking like a GPIO output rather
> >>> than an LED :-)
> >> Does this matter?
> > In my opinion: yes.
> >> IMHO it is
> >> echo "const1" >somepath and
> >> echo "const2" >somepath
> >> So user space daemons should be able to be configured so that it matches
> >> whatever the hardware/kernel needs.
> >> My idea of the TCA6507 driver was to provide a general I2C LED driver similar
> >> to others. This makes it much more useful to others and raises chance of being
> >> accepted upstream.
> >> That we mis-use one of the outputs as a WLAN reset, should IMHO not be
> >> hard-coded in the kernel or drivers. It could change for future hardware revisions.
> >> E.g. if we use a WLAN module without reset. Or assign a real GPIO.
> > Nevertheless, if the TCA6507 driver would for example look for a
> > platform_data structure which defines which output is used as GPIO or
> > as LED, it sould be acceptable anyways.
> AFAIK, none of the existing LED drivers does this.
> So I would say: don't make it more complicated as it is :)
Don't think "simple" vs "complicated". Think "right" vs "wrong". :-)
> > In my opinion, the main difference between a LED and a GPIO output is
> > the following: a GPIO does not have a brightness or (probably) should
> > not fade in or out. And this should be handled in software.
> Well, there are GPIOs that can also be programmed as PWM outputs.
> So we need some universal output driver that can be configured to behave
> as GPIO, PWM or LED (with different brightness and blinking patterns).
> If we want to harmonize that I think it will reach far beyond the GTA04 project...
> The main question is: what is a driver? A driver for a specific I2C chip (e.g. TCA6507)
> or for a function (GPIO, PWM, LED).
I like taxonomies....
A "chip" is a little piece of silicon and plastic with legs or balls.
It provides functionality.
A "platform" combines a number of "chips" and specifies the purpose or use for
A "device" is a feature of the kernel and provides functionality to
user-space, or to other parts of the kernel. "devices" are grouped
into "classes". Each "class" describes a set of functionality that
those devices can provide.
A "driver" is a piece of code that communicates with a "chip" on a "platform"
and provides one or more "devices" in one or more "classes".
A "driver" can also communicate with a "device" to provide a different
"device" (A 'filesystem' is a driver that uses a "block device" to provide
a "mounted filesystem").
So the TCA6507 can be programmed to drive 7 different outputs in various ways
and is intended to be used either to drive LEDs or as a GPO (GPIO output).
The GTA04a3 identifies 4 of these outputs as specific LEDs and one as a reset
line for wifi/BT.
The classes currently in Linux that best fit this seem to be "led" and "gpio".
So the tca6507 driver should be able to provide a number of "led" devices
and a number of "gpio" devices as determined by the platform-data from the
gta04a3 platform (or differently by any other platform that uses it).
The "led" devices can the be programmed with any of various 'triggers'. One
of the triggers is "timer" which can blink the LED in a set duty cycle. The
driver should tell the "led" class that it can do that in hardware and the
"led" class will let it and not set up software timers itself. The tca6507
can do a double-blink in hardware too. The "led" class doesn't currently
have a "double-blink" trigger so we cannot currently export that
functionality. But enhancing "ledtrig-timer" to support double-blink and
allowing it to be then handled by hardware shouldn't be too hard.
I'm less familiar with "gpio" devices but I know they can be "exported" to
user-space so they can be controlled directly through /sys. That might be
best for controlling the reset line. However if there was some way for
the "platform" to tell Linux that this particular "gpio" was a reset line for
the "wlan0" network card (or whatever it is called), that would be ideal. It
might not be worth the effort though.
The "led" class provides a "led-gpio" driver so that any gpio can be
controlled by an "led" device.
I don't know about "PWM" functions - is that like a regulator? Maybe a chip
which had outputs that could be PWM or GPIO would need a driver that exported
both "regulator" and "gpio". It wouldn't need to also export "led" unless it
provided special led functionality like brightness, fading, or blinking.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 828 bytes
Desc: not available
More information about the Gta04-owner