From f759a6257c0de47a579ec5fdfbd9d88f063669ec Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Wed, 20 Apr 2022 13:52:44 -0500 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63749 Tested-by: build bot (Jenkins) Reviewed-by: Tim Wawrzynczak --- .../purism/librem_cnl/variants/librem_mini/gpio.c | 4 +- .../librem_mini/include/variant/acpi/variant.asl | 51 ++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) (limited to 'src/mainboard/purism') diff --git a/src/mainboard/purism/librem_cnl/variants/librem_mini/gpio.c b/src/mainboard/purism/librem_cnl/variants/librem_mini/gpio.c index 08134e0c76..24ed2be0bd 100644 --- a/src/mainboard/purism/librem_cnl/variants/librem_mini/gpio.c +++ b/src/mainboard/purism/librem_cnl/variants/librem_mini/gpio.c @@ -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), diff --git a/src/mainboard/purism/librem_cnl/variants/librem_mini/include/variant/acpi/variant.asl b/src/mainboard/purism/librem_cnl/variants/librem_mini/include/variant/acpi/variant.asl index 0c9a76b168..727a9d4ff5 100644 --- a/src/mainboard/purism/librem_cnl/variants/librem_mini/include/variant/acpi/variant.asl +++ b/src/mainboard/purism/librem_cnl/variants/librem_mini/include/variant/acpi/variant.asl @@ -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}, + } + }) + } +} -- cgit v1.2.3