From: Vincent Pelletier <plr.vincent@gmail.com>
To: linux-leds@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: leds-gpio on x86
Date: Wed, 5 Aug 2015 22:09:48 +0200 [thread overview]
Message-ID: <20150805220948.3984f19c@x2> (raw)
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
next reply other threads:[~2015-08-05 20:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-05 20:09 Vincent Pelletier [this message]
2015-08-06 16:59 ` leds-gpio on x86 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
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=20150805220948.3984f19c@x2 \
--to=plr.vincent@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-leds@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).