Adding support for Sagemcom F@st 3864OP, missing driver for 74HC164D LED expander

How to use the hardware serial led driver on the BCM96268 SOC?

The problem has been solved. But one last question remains, gpio38 and gpio39 control the LEDs on the WAN RJ45, how to make the hardware or the OS handle them? E.g. indicating the connection status, speed, and activities...

I'm working on porting OpenWRT to a new device (Segamcom F@st 3864OP), the relevant information and patched source code can be found at
https://github.com/rikka0w0/fast3864op-hacks and https://github.com/rikka0w0/openwrt-fast3864op, respectively.

I can see a 74HC164D on the PCB, which drives a few LEDs. Manually toggling GPIO0 and GPIO1 (via /sys/class/gpio) and probing the chip's pins proved that they are the clock pin and the data pin of the 74HC164D.

Now I need to make Linux recognize those LEDs attached to 74HC164D by appending something to the DTS file. In the SOC's DTS I can see the following:

			pinctrl_serial_led: serial_led {
				pinctrl_serial_led_clk: serial_led_clk {
					function = "serial_led_clk";
					pins = "gpio0";
				};

				pinctrl_serial_led_data: serial_led_data {
					function = "serial_led_data";
					pins = "gpio1";
				};
			};

which suggests that the SOC has some kind of hardware to control an external 74HC164D as an IO expander.

After searching the Internet I'm still not sure how to edit the DTS file. Some thread suggested the gpio-74x164 driver, but its code assumes that the 74HC164D must be connected to an SPI interface (either hardware or bit-banged). I'm 90% sure that gpio-74x164 cannot be used.

Is there any existing driver available for the serial led driver on the BCM96268 SOC? Or I will have to implement it myself or just simply bit-bang it somehow?

Thanks,

I figured out how to do that, here is the example:

This is how to define LEDs that directly connect to the SOC's GPIO:

/ {
	......
	leds {
		compatible = "gpio-leds";

		led@8 {
			gpios = <&pinctrl 8 GPIO_ACTIVE_LOW>;
			label = "green:internet";
		};
		......
	};
};

This is how to define LEDs that are attached to the 74HC164D expander (The data and clock wires are driven by the SOC's hardware automatically):

&leds {
	status = "okay";
	brcm,serial-leds;
	brcm,serial-dat-low;
	brcm,serial-shift-inv;

	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_serial_led>;

	led@0 {
		reg = <0>;
		active-low;
		label = "green:wps";
	};
	......
};

One last question remains, gpio38 and gpio39 control the LEDs on the WAN RJ45, how to make the hardware or the OS handle them? E.g. indicating the connection status, speed, and activities...

1 Like