linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* leds-gpio on x86
@ 2015-08-05 20:09 Vincent Pelletier
  2015-08-06 16:59 ` Mika Westerberg
  0 siblings, 1 reply; 16+ messages in thread
From: Vincent Pelletier @ 2015-08-05 20:09 UTC (permalink / raw)
  To: linux-leds, linux-acpi

Hello,

I have recently acquired a NAS[1] which is basically an x86_64 with UEFI
bios and adequate enclosure (drive trays and associated activity & error
leds).

Not being too happy with stock firmware features, I am in the process
of replacing it with a general distribution. The distribution works
great with stock kernel, but I do not get the error leds (nor, but I'm
less interested, the global power/error/usb leds).

Poking in the original firmware, I found a file declaring which SuperIO
GPIO pins are used, and confirmed they do work by loading the
appropriate gpio driver.

Now, I wonder how far I should go: I would like to use the leds
subsystem for easy triggering, but leds-acpi finds nothing.
A quick read shows this driver finds relevant devices using
openfirmware enumeration functions. If I understand correctly, this
would be devicetree on ARM/MIPS/... but ACPI tables on x86. After an
uneducated look at disassembled DSDT, I think I found the
SuperIO declaration:
  Name (IO3B, 0x0290)
  [...]
  Device (SIO1)
  {
    Name (_HID, EisaId ("PNP0C02") /* PNP Motherboard Resources */)  // _HID: Hardware ID
    [...]
    Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
    {
      [...]
      If (IO3B)
      {
        CreateWordField (CRS, \_SB.PCI0.SBRG.SIO1._Y0A._MIN, GP30)  // _MIN: Minimum Base Address
        CreateWordField (CRS, \_SB.PCI0.SBRG.SIO1._Y0A._MAX, GP31)  // _MAX: Maximum Base Address
        CreateByteField (CRS, \_SB.PCI0.SBRG.SIO1._Y0A._LEN, GPL3)  // _LEN: Length
        GP30 = IO3B /* \IO3B */
        GP31 = IO3B /* \IO3B */
        GPL3 = IO3L /* \IO3L */
      }
(dmesg showing the SuperIO being based at 0x290 and this value not
appearing elsewhere) which does not define any GPIO (no GpioIo() in
the Device {} block), even less leds.

One option seems to patch this to declare leds, but it seems dangerous
(from the examples[2] I found, the change needed is less than 100 lines
for the 6 leds, but that's an awful lot of error possibilities for the
ACPI illiterate I am).

Another option seems to develop a dumb module just declaring what the
leds. This means I'll have to maintain an off-tree module (I do not
see how it would detect that it's actually on this NAS model, so
upstream inclusion seems unlikely).

Yet another option would be to extend an existing driver, to make it
configurable (ex: via sysfs). This would be my favourite (it is
clearer to see how it would get merged), but registration need several
values (name, pin number, active high/low, maybe color ?) and I have no
idea how clean the syntax would be.

Everything seems possible but I cannot tell which has better chances of
success.

Is my analysis correct so far ?
Which next step would you recommend ?

[1] QNAP TS-651
[2] https://lwn.net/Articles/612062/
-- 
Vincent Pelletier

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-08-18 22:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-05 20:09 leds-gpio on x86 Vincent Pelletier
2015-08-06 16:59 ` Mika Westerberg
2015-08-06 17:17   ` Vincent Pelletier
2015-08-06 17:35     ` Mika Westerberg
2015-08-06 18:18       ` Vincent Pelletier
2015-08-07 10:57         ` Mika Westerberg
2015-08-08 12:06           ` Vincent Pelletier
2015-08-11 12:00             ` Mika Westerberg
2015-08-11 17:42               ` Vincent Pelletier
2015-08-12 12:53                 ` Mika Westerberg
2015-08-15 10:36                   ` Vincent Pelletier
2015-08-17 21:08                     ` Vincent Pelletier
2015-08-18  7:32                       ` Vincent Pelletier
2015-08-18  9:02                         ` Mika Westerberg
2015-08-18 11:38                           ` Vincent Pelletier
2015-08-18 22:56                             ` Vincent Pelletier

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).