[openwrt/openwrt] realtek: rtl931x: Add LED Sync configuration

LEDE Commits lede-commits at lists.infradead.org
Wed Sep 3 00:54:58 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/ea5a749311a5c1a5dce85915e0039b1db93f703e

commit ea5a749311a5c1a5dce85915e0039b1db93f703e
Author: Sven Eckelmann <sven at narfation.org>
AuthorDate: Wed Aug 20 05:19:31 2025 +0200

    realtek: rtl931x: Add LED Sync configuration
    
    The pinmux-related registers on the RTL931X SoC family are spread across
    various non-consecutive registers. It might be tempting to modify them
    directly in a specific driver (SPI, LED, etc.), but this would cause issues
    with parallel, non-locked read-modify-write operations, which are required
    to update individual portions of these registers.
    
    Instead, it is better to use the devicetree pinctrl properties to define
    the correct configurations for the various operation modes.
    
    One important setting here is the LED Sync bit. This allows the LED
    controller to generate an additional positive edge on the `STCP`
    ("STore Clock Pin", also known as `RCLK`) of the LED shift register after
    the actual content has already been shifted in using the normal shift
    clock. The LED shift register is then expected to copy the content from the
    shift register section into the storage registers, which act as the actual
    LED output control. This functionality is available in, and commonly used
    with, the SNx4HC595 family of shift registers.
    
    To activate it, simply register it in the default state of the
    "realtek,rtl83xx-switch" node:
    
        &switch0 {
            pinctrl-names = "default";
            pinctrl-0 = <&pinmux_enable_led_sync>;
            ....
        };
    
    It would be nicer when this can be directly added to the led subnode. But
    for this to work, `realtek,rtl9300-leds` must first be an actual driver
    (known to the driver core).
    
    [1] https://www.ti.com/lit/ds/symlink/sn74hc595.pdf
    
    Suggested-by: Bevan Weiss <bevan.weiss at gmail.com>
    Signed-off-by: Sven Eckelmann <sven at narfation.org>
    Link: https://github.com/openwrt/openwrt/pull/19815
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/linux/realtek/dts/rtl931x.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/target/linux/realtek/dts/rtl931x.dtsi b/target/linux/realtek/dts/rtl931x.dtsi
index 54a304019c..462c3ea9b0 100644
--- a/target/linux/realtek/dts/rtl931x.dtsi
+++ b/target/linux/realtek/dts/rtl931x.dtsi
@@ -231,6 +231,15 @@
 		pinctrl-single,function-mask = <0x1>;
 		#pinctrl-cells = <2>;
 
+		/* Enable GPIO 31 */
+		pinmux_disable_led_sync: disable-led-sync {
+			pinctrl-single,bits = <0x0 0x0 0x10000>;
+		};
+
+		pinmux_enable_led_sync: enable-led-sync {
+			pinctrl-single,bits = <0x0 0x10000 0x10000>;
+		};
+
 		/* Enable GPIO6 and GPIO7, possibly unknown others */
 		pinmux_disable_jtag: disable_jtag {
 			pinctrl-single,bits = <0x0 0x0 0x8000>;




More information about the lede-commits mailing list