LED

Intruduction

There are two LED lights on the Face-RK3399, Blue LED (GPIO2_D3) and Yellow LED (GPIO2_D2).

LED can be controlled by using LED subsystem or directly operating GPIO.

Standard Linux defines the LED subsystem specifically for LED devices. Both LEDS in the Face-RK3399 are defined as devices. Users can control this two leds through the directory /sys/class/leds/.

The default state of LED on the development board is:

  • Blue : Turn on when the system is powered on.

  • Yellow : User-defined.

Users can control each LED by entering commands to its brightness properties via echo:

root@rk3399_firefly_face:~ # echo 0 >/sys/class/leds/firefly:blue:power/brightness  #Blue LED off
root@rk3399_firefly_face:~ # echo 1 >/sys/class/leds/firefly:blue:power/brightness  #Blue LED on

The LED node is defined in the kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-port.dts:

leds {
    compatible = "gpio-leds";
    power{
        label = "firefly:blue:power";
        linux,default-trigger = "ir-power-click";
        default-state = "on";
        gpios = <&gpio2 27 GPIO_ACTIVE_HIGH>;
        pinctrl-names = "default";
        pinctrl-0 = <&led_power>;
    };
    user{
        label = "firefly:yellow:user";
        linux,default-trigger = "ir-user-click";
        default-state = "off";
        gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>;
        pinctrl-names = "default";
        pinctrl-0 = <&led_user>;
    };
};

If it is Face-X1 Face Recognition All-In-One PC, the three control lights on the fill light panel correspond to the following:

/sys/class/leds/face:green:user/brightness    #Green LED
/sys/class/leds/face:red:user/brightness      #Red LED
/sys/class/leds/face:white:user/brightness    #White LED

The LED node is defined in the kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-face.dtsi:

face_leds {
    compatible = "gpio-leds";
        face_green_led: face_green {
            label = "face:green:user";
            linux,default-trigger = "ir-user-click";
            default-state = "off";
            gpios = <&gpio3 0 GPIO_ACTIVE_HIGH>;
            pinctrl-names = "default";
            pinctrl-0 = <&led_user>;
        };
        face_red_led: face_red {
            label = "face:red:user";
            linux,default-trigger = "ir-user-click";
            default-state = "off";
            gpios = <&gpio3 1 GPIO_ACTIVE_HIGH>;
            pinctrl-names = "default";
            pinctrl-0 = <&led_user>;
        };
        face_white_led: face_white {
            label = "face:white:user";
            linux,default-trigger = "ir-user-click";
            default-state = "on";
            gpios = <&gpio4 27 GPIO_ACTIVE_HIGH>;
            pinctrl-names = "default";
            pinctrl-0 = <&led_user>;
        };
};

Whileusing Face-X2 Face Recognition All-In-One PC, three leds as blow:

/sys/class/leds/face:green:user/brightness
/sys/class/leds/face:red:user/brightness 
/sys/pwm/face_white_led

White led brightness range from 0-8 using the command:

echo x > /sys/pwm/face_white_led