mb/purism/librem_mini: Rework front status LED to show all disk activity

The front status LED on the Librem Mini is driven by the SATALED# GPIO
line configured for native function, so only shows disk activity for
SATA drives, but not NVMe. To allow it to show disk activity for NVMe
drives as well, reconfigure the GPIO as GPIO-OUT (rather than native
function), and configure it via ACPI so that the linux gpio-leds
driver will attach and use it accordingly.

This has the added benefit of allowing the user to reconfigure the
LED as they see fit via sysfs.

Test: boot Linux (PureOS) on Librem Mini v2 with NVMe drive, observe status
LED blinks during periods of disk activity (tested via 'stress').

Change-Id: I34c2a5f3fd1038266f4514544abfc1020da6f85b
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63749
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Matt DeVillier 2022-04-20 13:52:44 -05:00 committed by Felix Held
parent 5b58902749
commit f759a6257c
2 changed files with 53 additions and 2 deletions

View File

@ -539,8 +539,8 @@ static const struct pad_config gpio_table[] = {
/* GPP_E7 - NC */
PAD_NC(GPP_E7, NONE),
/* GPP_E8 - SATALED# */
PAD_CFG_NF(GPP_E8, NONE, DEEP, NF1),
/* GPP_E8 - STATUSLED# */
PAD_CFG_GPO(GPP_E8, 1, PLTRST),
/* GPP_E9 - USB2_OC0# */
PAD_CFG_NF(GPP_E9, NONE, DEEP, NF1),

View File

@ -14,3 +14,54 @@ Scope (\_SB.PCI0.LPCB)
}
}
}
Scope (\_SB)
{
Device (LEDS)
{
Name (_HID, "PRP0001")
Name (_DDN, "GPIO LEDs device")
Name (_CRS, ResourceTemplate () {
GpioIo (
Exclusive, // Not shared
PullNone, // No need for pulls
0, // Debounce timeout
0, // Drive strength
IoRestrictionOutputOnly, // Only used as output
"\\_SB.PCI0.GPIO", // GPIO controller
0) // Must be 0
{
296, // GPP_E8 - STATUSLED#
}
})
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () { "compatible", Package() { "gpio-leds" } },
},
ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package () {
Package () {"led-0", "LED0"},
}
})
/*
* For more information about these bindings see:
* Documentation/devicetree/bindings/leds/common.yaml,
* Documentation/devicetree/bindings/leds/leds-gpio.yaml and
* Documentation/firmware-guide/acpi/gpio-properties.rst.
*/
Name (LED0, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "blue:status"},
Package () {"default-state", "keep"},
Package () {"linux,default-trigger", "disk-activity"},
Package () {"gpios", Package () {^LEDS, 0, 0, 1}},
Package () {"retain-state-suspended", 1},
}
})
}
}