I'm still working on being able to trigger the LEDs, but I'm hitting a bit of a wall. The device uses a 74hc595
shift register driven by an SPI interface. Based on a lot of useful info from this thread, I've compiled my image with kmod-spi-gpio
and kmod-gpio-nxp-74hc164
.
This results in three entries in /sys/class/gpio
, namely gpiochip0
, gpiochip32
and gpiochip504
. When I run this script for gpiochip504
, I can actually toggle the LEDs on gpio 508, 509 and 511. Putting those in my DTS, however, does nothing.
I think I'm missing something with regards to addressing the correct gpiochip in my DTS, but I'm not sure which values to change. Maybe @robimarko has some insight?
The relevant part of the DTS file:
spi3 {
compatible = "spi-gpio";
#address-cells = <0x1>;
ranges;
status = "okay";
sck-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
mosi-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
cs-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
num-chipselects = <1>;
#size-cells = <0>;
gpio_spi: gpio_spi@0 {
compatible = "fairchild,74hc595";
reg = <0>;
gpio-controller;
#gpio-cells = <2>;
registers-number = <1>;
spi-max-frequency = <100000>;
};
};
gpio-leds {
compatible = "gpio-leds";
led_status_white {
label = "status:white";
gpios = <&gpio_spi 508 GPIO_ACTIVE_LOW>;
};
led_status_red {
label = "status:red";
gpios = <&gpio_spi 509 GPIO_ACTIVE_LOW>;
};
led_power_white {
label = "power:white";
gpios = <&gpio_spi 511 GPIO_ACTIVE_HIGH>;
};
};