Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
led: Add Altra LED driver
Browse files Browse the repository at this point in the history
Add Altra LED driver to control NVME LED.

This driver support control LED via SPCI interface on Altra system.
Currently, it is 2-LEDs system(Activity LED, Status LED). Activity
LED is completely controlled by hardware. Status LED is controlled
by this driver.
There are 4 stages of Status LED:
    - ON
    - OFF
    - Locate(blink at 1Hz)
    - Rebuild(blink at 4Hz)

Example:
To On, Off the LED on slot 9:
    1. Write the seg:bus_number corresponding to LED on slot 9 to
       altra:led
         echo 000b:03 > /sys/class/leds/altra:led/address
    2. Write 1 to brightness attr to ON, 0 to brightness attr to OFF
         echo 1 > /sys/class/leds/altra:led/brightness
         echo 0 > /sys/class/leds/altra:led/brightness
To blink the LED on slot 9:
    1. Write the seg:bus_number corresponding to LED on slot 9 to
       altra:led
         echo 000b:03 > /sys/class/leds/altra:led/address
    2. Write 1 to blink attr to select Locate(blink 1Hz), or 4 to
       blink attr to select Rebuild(blink 4Hz)
         echo 1 > /sys/class/leds/altra:led/blink
         echo 4 > /sys/class/leds/altra:led/blink
    3. Write 1 to shot attr to execute blink
         echo 1 > /sys/class/leds/altra:led/shot

cherry-pick from: AmpereComputing/ampere-centos-kernel---DEPRECATED@28c026a

Signed-off-by: Dung Cao <[email protected]>
  • Loading branch information
dcao-ampere authored and Yi Li committed Mar 3, 2021
1 parent beaf40d commit 5a19482
Show file tree
Hide file tree
Showing 4 changed files with 449 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm64/configs/altra_5.4_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,7 @@ CONFIG_LEDS_PCA955X=m
CONFIG_LEDS_PCA963X=m
CONFIG_LEDS_LT3593=m
CONFIG_LEDS_BLINKM=m
CONFIG_LEDS_ALTRA_SPCI=y
CONFIG_LEDS_TRIGGER_TIMER=m
CONFIG_LEDS_TRIGGER_ONESHOT=m
CONFIG_LEDS_TRIGGER_DISK=y
Expand Down
7 changes: 7 additions & 0 deletions drivers/leds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,13 @@ config LEDS_LM36274
Say Y to enable the LM36274 LED driver for TI LMU devices.
This supports the LED device LM36274.

config LEDS_ALTRA_SPCI
bool "Altra LED support via SPCI"
depends on ARM64 && ACPI
help
If you say yes here, you get support for Altra SPCI LED
When in doubt, say N.

comment "LED Triggers"
source "drivers/leds/trigger/Kconfig"

Expand Down
1 change: 1 addition & 0 deletions drivers/leds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o
obj-$(CONFIG_LEDS_TI_LMU_COMMON) += leds-ti-lmu-common.o
obj-$(CONFIG_LEDS_LM3697) += leds-lm3697.o
obj-$(CONFIG_LEDS_LM36274) += leds-lm36274.o
obj-$(CONFIG_LEDS_ALTRA_SPCI) += leds-altra-spci.o

# LED SPI Drivers
obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o
Expand Down
Loading

0 comments on commit 5a19482

Please sign in to comment.