Setup system-LED of SP7021 demo board V3 to heartbeat-trigger mode

Please follow the following steps to setup system-LED of SP7021 demo board (V3) to heartbeat-trigger mode:

1. Enable Linux LED driver

Run make kconfig in project top directory. After Kernel Configuration menu pops up, use arrow keys to move cursor and enter "Device Drivers". Move cursor to “LED Support”, and press 'Y' to enable it. Refer to screenshot below:

Press ‘Enter’ to enter menu “LED Support”. Move cursor and press 'Y' to enable "LED Class Support", "LED Support for GPIO connected LEDs" and "LED Trigger support". Refer to screenshot below:

Enter "LED Trigger support" menu and enable "LED Heartbeat Trigger". Refer to screenshot below:

2. Modify device-tree source

Add new node led in device-tree source file linux/kernel/arch/arm/boot/dts/sp7021-demov3.dts to setup system-led as shown below:

led { compatible = "gpio-leds"; pinctrl-names = "default"; pinctrl-0 = <&gpio_leds_pins>; system-led { label = "system-led"; gpios = <&pctl 0 GPIO_ACTIVE_HIGH>; default-state = "off"; linux,default-trigger = "heartbeat"; }; };

Note that node led is sub-node of node soc@B.

Also, add a sub-node pinmux_gpio_leds-pins to node pctl as show below:

gpio_leds_pins: pinmux_gpio_leds-pins { sunplus,pins = < SPPCTL_IOPAD(0, SPPCTL_PCTL_G_GPIO, 0, SPPCTL_PCTL_L_OUT) >; };

Please note that to comply with Linux rules, after version 5.10.59, 4 property-names of pin node of SP7021 are changed as shown in table below:

5.4.35

5.10.59

5.4.35

5.10.59

sppctl,function

function

sppctl,groups

groups

sppctl,pins

sunplus,pins

sppctl,zero_func

sunplus,zerofunc

3. Build Linux image

Run make all to build the Linux image.