arm64: dts: allwinner: h616: add LCD timing controller and display engine support
Subsystems (6)
cover arm64: dts: allwinner: h616: add LCD timing controller and display engine support
The H616 series of SoCs has an LCD timing controller as part of its display pipeline, capable of outputting to an LCD display, as well as HDMI and (depending on the SoC) composite TV signals. The pins are not exposed on all die variants, but the H700 variant is exposes RGB and LVDS pins. Building on the DE33 display engine patches on the list (https://lore.kernel.org/linux-sunxi/[email protected]), this patch series:
- adds the required device tree configuration for the display pipeline to the H616 (bus, display engine, mixer and timing controller)
- adds a quirk to the sun4i TCON driver for the Allwinner R40 (compatible with the H616/H618/H700/T507)
- describes the H616 RGB and LVDS GPIO pins
- adds the required pipeline endpoints to the device tree for the Anbernic RG35XX devices featuring this SoC
- adds LCD panel description, and required power supply configuration for the panel, backlight and GPIO pins for the RG35XX
Thanks to Jernej Skrabec for the initial out-of-tree patch for the T507.
Regards,
Ryan
Jernej Skrabec (4):
arm64: dts: allwinner: h616: add display engine, bus and mixer nodes drm/sun4i: tcon: Add support for R40 LCD
arm64: dts: allwinner: h616: Add TCON nodes to H616 DTSI
arm64: dts: allwinner: h616: add LCD, LVDS and PWM pins
Ryan Walklin (4):
bus: sun50i: add DE33 compatible string to the DE2 bus driver
dt-bindings: allwinner: Add TCON_TOP and TCON_LCD clock/reset defines
arm64: dts: allwinner: rg35xx: Enable LCD output
arm64: dts: allwinner: rg35xx: Add GPIO backlight control
.../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 221 ++++++++++++++++++ .../sun50i-h700-anbernic-rg35xx-2024.dts | 64 +++++ drivers/bus/sun50i-de2.c | 1 + drivers/gpu/drm/sun4i/sun4i_tcon.c | 9 + include/dt-bindings/clock/sun8i-tcon-top.h | 2 + 5 files changed, 297 insertions(+)
Signature · 1 line
2.48.1
PATCH 1/8 bus: sun50i: add DE33 compatible string to the DE2 bus driver
The Allwinner H616 series includes a newer display engine (DE33). Add a compatible string to the existing bus driver.
--- drivers/bus/sun50i-de2.c | 1 + 1 file changed, 1 insertion(+)
drivers/bus/sun50i-de2.c +1 -0
@@ -31,6 +31,7 @@ static void sun50i_de2_bus_remove(struct platform_device *pdev)static const struct of_device_id sun50i_de2_bus_of_match[] = { { .compatible ="allwinner,sun50i-a64-de2" , }, + { .compatible ="allwinner,sun50i-h616-de33" , }, {/* sentinel */ } };
Signature · 1 line
2.48.1
PATCH 2/8 arm64: dts: allwinner: h616: add display engine, bus and mixer nodes
In reply to Ryan WalklinFrom: Jernej Skrabec <[email protected]>
The Allwinner H616 and variants (H618, H700 and T507) have a new display engine variant (DE33). Support has been added to the existing DE2/DE3 sun4i driver in a previous patch series (x). The variant is selected via the appropriate mixer device tree compatible string.
Add the respective device-tree nodes for the DE, bus, clock and mixer to the H616 DTSI, and the matching SRAM section for the DE.
--- .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +56 -0
@@ -94,6 +94,12 @@ l2_cache: l2-cache { }; }; + de: display-engine { + compatible = "allwinner,sun50i-h6-display-engine"; + allwinner,pipelines = <&mixer0>; + status = "disabled"; + }; + reserved-memory { #address-cells = <2>; #size-cells = <2>;
@@ -150,6 +156,51 @@ soc { #size-cells = <1>; ranges = <0x0 0x0 0x0 0x40000000>; + bus: bus@1000000 { + compatible = "allwinner,sun50i-h616-de33", + "allwinner,sun50i-a64-de2"; + reg = <0x1000000 0x400000>; + allwinner,sram = <&de3_sram 1>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x1000000 0x400000>; + + display_clocks: clock@8000 { + compatible = "allwinner,sun50i-h616-de33-clk"; + reg = <0x8000 0x100>; + clocks = <&ccu CLK_DE>, <&ccu CLK_BUS_DE>; + clock-names = "mod", "bus"; + resets = <&ccu RST_BUS_DE>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + mixer0: mixer@100000 { + compatible = "allwinner,sun50i-h616-de33-mixer-0"; + reg = <0x100000 0x100000>, + <0x8100 0x40>, + <0x280000 0x20000>; + clocks = <&display_clocks CLK_BUS_MIXER0>, + <&display_clocks CLK_MIXER0>; + clock-names = "bus", "mod"; + resets = <&display_clocks RST_MIXER0>; + iommus = <&iommu 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + mixer0_out: port@1 { + reg = <1>; + + mixer0_out_tcon_top_mixer0: endpoint { + remote-endpoint = <&tcon_top_mixer0_in_mixer0>; + }; + }; + }; + }; + }; + crypto: crypto@1904000 { compatible = "allwinner,sun50i-h616-crypto"; reg = <0x01904000 0x800>;
@@ -173,6 +224,11 @@ sram_c: sram@28000 { #address-cells = <1>; #size-cells = <1>; ranges = <0 0x00028000 0x30000>; + + de3_sram: sram-section@0 { + compatible = "allwinner,sun50i-a64-sram-c"; + reg = <0x0000 0x1e000>; + }; }; };
Signature · 1 line
2.48.1
PATCH 3/8 dt-bindings: allwinner: Add TCON_TOP and TCON_LCD clock/reset defines
In reply to Ryan WalklinThe Allwinner H700 exposes RGB and LVDS pins as well as a HDMI connector. This requires additional clocks for the TCON_TOP and clock and resets for the TCON_LCD LCD controllers to be defined as per the T507 datasheet (which shares the same die).
--- include/dt-bindings/clock/sun8i-tcon-top.h | 2 ++ 1 file changed, 2 insertions(+)
include/dt-bindings/clock/sun8i-tcon-top.h +2 -0
@@ -7,5 +7,7 @@#define CLK_TCON_TOP_TV0 0#define CLK_TCON_TOP_TV1 1#define CLK_TCON_TOP_DSI 2 +#define CLK_TCON_TOP_LCD0 3 +#define CLK_TCON_TOP_LCD1 4#endif /* _DT_BINDINGS_CLOCK_SUN8I_TCON_TOP_H_ */
Signature · 1 line
2.48.1
PATCH 4/8 drm/sun4i: tcon: Add support for R40 LCD
In reply to Ryan WalklinFrom: Jernej Skrabec <[email protected]>
The Allwinner H616 and related SOCs have an LCD timing controller (TCON) which is compatible with the R40 SOC's controller and existing sun4i driver. The H616 does not expose this controller but the H700 and T507 (based on the same die) do. The controller supports LVDS and RGB output.
Add quirks and compatible string to cover these SOCs.
--- drivers/gpu/drm/sun4i/sun4i_tcon.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/sun4i/sun4i_tcon.c +9 -0
@@ -1528,6 +1528,14 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { .has_channel_1 = true, }; +static const struct sun4i_tcon_quirks sun8i_r40_lcd_quirks = { + .supports_lvds = true, + .has_channel_0 = true, + .set_mux = sun8i_r40_tcon_tv_set_mux, + .dclk_min_div =1 , + .setup_lvds_phy = sun6i_tcon_setup_lvds_phy, +}; +static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = { .has_channel_1 = true, .polarity_in_ch0 = true,
@@ -1569,6 +1577,7 @@ const struct of_device_id sun4i_tcon_of_table[] = { { .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks }, { .compatible = "allwinner,sun8i-a83t-tcon-lcd", .data = &sun8i_a83t_lcd_quirks }, { .compatible = "allwinner,sun8i-a83t-tcon-tv", .data = &sun8i_a83t_tv_quirks }, + { .compatible = "allwinner,sun8i-r40-tcon-lcd", .data = &sun8i_r40_lcd_quirks }, { .compatible = "allwinner,sun8i-r40-tcon-tv", .data = &sun8i_r40_tv_quirks }, { .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks }, { .compatible = "allwinner,sun9i-a80-tcon-lcd", .data = &sun9i_a80_tcon_lcd_quirks },
Signature · 1 line
2.48.1
PATCH 5/8 arm64: dts: allwinner: h616: Add TCON nodes to H616 DTSI
In reply to Ryan WalklinFrom: Jernej Skrabec <[email protected]>
The Allwinner H616 has a display pipeline similar to other Allwinner devices, specifically the A10, but using a newer display engine revision (DE33).
Not all output pins are exposed on all package variants, for example only the H700 and T507 have LCD pins exposed, but all variants support HDMI output. However on the die these are connected to a display engine via a TCON TOP and one or more timing controllers (TCONs).
HDMI output support is not provided in this series (but will be in a subsequent patch) so for now note this within the relevant node to prevent a DT compiler error.
Add TCON nodes for the TOP, and the LCD and TV timing controllers. The timing controllers are compatible with the existing R40 driver.
--- .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +133 -0
@@ -7,9 +7,12 @@ #include <dt-bindings/clock/sun50i-h616-ccu.h> #include <dt-bindings/clock/sun50i-h6-r-ccu.h> #include <dt-bindings/clock/sun6i-rtc.h> +#include <dt-bindings/clock/sun8i-de2.h> +#include <dt-bindings/clock/sun8i-tcon-top.h> #include <dt-bindings/reset/sun50i-h616-ccu.h> #include <dt-bindings/reset/sun50i-h6-r-ccu.h> #include <dt-bindings/thermal/thermal.h> +#include <dt-bindings/reset/sun8i-de2.h> / { interrupt-parent = <&gic>;
@@ -909,6 +912,136 @@ ohci3: usb@5311400 { status = "disabled"; }; + tcon_top: tcon-top@6510000 { + compatible = "allwinner,sun50i-h6-tcon-top"; + reg = <0x06510000 0x1000>; + clocks = <&ccu CLK_BUS_TCON_TOP>, + <&ccu CLK_TCON_TV0>; + clock-names = "bus", "tcon-tv0"; + clock-output-names = "tcon-top-tv0"; + #clock-cells = <0>; + resets = <&ccu RST_BUS_TCON_TOP>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + tcon_top_mixer0_in: port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + tcon_top_mixer0_in_mixer0: endpoint@0 { + reg = <0>; + remote-endpoint = <&mixer0_out_tcon_top_mixer0>; + }; + }; + + tcon_top_mixer0_out: port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + tcon_top_mixer0_out_tcon_lcd0: endpoint@0 { + reg = <0>; + remote-endpoint = <&tcon_lcd0_in_tcon_top_mixer0>; + }; + + tcon_top_mixer0_out_tcon_tv0: endpoint@2 { + reg = <2>; + remote-endpoint = <&tcon_tv0_in_tcon_top_mixer0>; + }; + }; + + tcon_top_hdmi_in: port@4 { + #address-cells = <1>; + #size-cells = <0>; + reg = <4>; + + tcon_top_hdmi_in_tcon_tv0: endpoint@0 { + reg = <0>; + remote-endpoint = <&tcon_tv0_out_tcon_top>; + }; + }; + + tcon_top_hdmi_out: port@5 { + reg = <5>; + + tcon_top_hdmi_out_hdmi: endpoint { + /* placeholder for HDMI - remote-endpoint = <&hdmi_in_tcon_top>;*/ + }; + }; + }; + }; + + tcon_lcd0: lcd-controller@6511000 { + compatible = "allwinner,sun8i-r40-tcon-lcd"; + reg = <0x06511000 0x1000>; + interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_TCON_LCD0>, <&ccu CLK_TCON_LCD0>; + clock-names = "ahb", "tcon-ch0"; + clock-output-names = "tcon-data-clock"; + #clock-cells = <0>; + resets = <&ccu RST_BUS_TCON_LCD0>, <&ccu RST_BUS_TCON_LCD1>; + reset-names = "lcd", "lvds"; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + tcon_lcd0_in: port@0 { + reg = <0>; + + tcon_lcd0_in_tcon_top_mixer0: endpoint { + remote-endpoint = <&tcon_top_mixer0_out_tcon_lcd0>; + }; + }; + + tcon_lcd0_out: port@1 { + reg = <1>; + }; + }; + }; + + tcon_tv0: lcd-controller@6515000 { + compatible = "allwinner,sun50i-h6-tcon-tv", + "allwinner,sun8i-r40-tcon-tv"; + reg = <0x06515000 0x1000>; + interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_TCON_TV0>, + <&tcon_top CLK_TCON_TOP_TV0>; + clock-names = "ahb", "tcon-ch1"; + #clock-cells = <0>; + resets = <&ccu RST_BUS_TCON_TV0>; + reset-names = "lcd"; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + tcon_tv0_in: port@0 { + reg = <0>; + + tcon_tv0_in_tcon_top_mixer0: endpoint { + remote-endpoint = <&tcon_top_mixer0_out_tcon_tv0>; + }; + }; + + tcon_tv0_out: port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + tcon_tv0_out_tcon_top: endpoint@1 { + reg = <1>; + remote-endpoint = <&tcon_top_hdmi_in_tcon_tv0>; + }; + }; + }; + }; + rtc: rtc@7000000 { compatible = "allwinner,sun50i-h616-rtc"; reg = <0x07000000 0x400>;
Signature · 1 line
2.48.1
PATCH 6/8 arm64: dts: allwinner: h616: add LCD, LVDS and PWM pins
In reply to Ryan WalklinFrom: Jernej Skrabec <[email protected]>
The Allwinner H616 (and its H618, H700 and T507 package variants with the same die) have 28 video output pins for RGB/SPI and LVDS display. These are in GPIO Bank D and are multiplexed.
In RGB mode, pins PD0-PD23 are for 24-bit RGB pixel output, pins PD24-PD27 are for clock, DE, HSYNC and VSYNC, and PD28 is a PWM backlight control.
In LVDS mode, pins PD0-PD9 are for LVDS0 and LVDS1, and can be configured by the H616 display engine for either one high-resolution (dual link) or two low resolution displays.
Add device tree nodes for the LCD, LVDS0, LVDS1 and PWM pins.
--- .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +32 -0
@@ -322,6 +322,32 @@ ir_rx_pin: ir-rx-pin { function = "ir_rx"; }; + /omit-if-no-ref/ + lcd0_rgb888_pins: lcd0-rgb888-pins { + pins = "PD0", "PD1", "PD2", "PD3", + "PD4", "PD5", "PD6", "PD7", + "PD8", "PD9", "PD10", "PD11", + "PD12", "PD13", "PD14", "PD15", + "PD16", "PD17", "PD18", "PD19", + "PD20", "PD21", "PD22", "PD23", + "PD24", "PD25", "PD26", "PD27"; + function = "lcd0"; + }; + + /omit-if-no-ref/ + lvds0_pins: lvds0-pins { + pins = "PD0", "PD1", "PD2", "PD3", "PD4", + "PD5", "PD6", "PD7", "PD8", "PD9"; + function = "lvds0"; + }; + + /omit-if-no-ref/ + lvds1_pins: lvds1-pins { + pins = "PD10", "PD11", "PD12", "PD13", "PD14", + "PD15", "PD16", "PD17", "PD18", "PD19"; + function = "lvds1"; + }; + mmc0_pins: mmc0-pins { pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
@@ -348,6 +374,12 @@ mmc2_pins: mmc2-pins { bias-pull-up; }; + /omit-if-no-ref/ + pwm0_pin: pwm0-pin { + pins = "PD28"; + function = "pwm0"; + }; + /omit-if-no-ref/ spi0_pins: spi0-pins { pins = "PC0", "PC2", "PC4";
Signature · 1 line
2.48.1
PATCH 7/8 arm64: dts: allwinner: rg35xx: Enable LCD output
In reply to Ryan WalklinThe RG35XX has a 640x480 RGB/SPI LCD panel, supported by the SoC display pipeline and an NV3052C controller. The H616 SOC's GPIO bank D contains the muxed display pins for RGB and LVDS output support.
Enable the display engine and LCD timing controller, configure the panel, and add a fixed 3.3v GPIO-controlled regulator for the panel, and a VCC supply for the display pins as per the other GPIO banks.
--- .../sun50i-h700-anbernic-rg35xx-2024.dts | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts +58 -0
@@ -175,6 +175,49 @@ reg_vcc5v: regulator-vcc5v { /* USB-C power input */ regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; }; + + reg_lcd: regulator-gpio-lcd-vdd { + compatible = "regulator-fixed"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vdd-lcd"; + gpio = <&pio 8 15 GPIO_ACTIVE_HIGH>; // PI15 + enable-active-high; + }; + + spi_lcd: spi { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + sck-gpios = <&pio 8 9 GPIO_ACTIVE_HIGH>; // PI9 + mosi-gpios = <&pio 8 10 GPIO_ACTIVE_HIGH>; // PI10 + cs-gpios = <&pio 8 8 GPIO_ACTIVE_HIGH>; // PI8 + num-chipselects = <1>; + + panel: panel@0 { + compatible = "anbernic,rg35xx-plus-panel"; + + reg = <0>; + + spi-max-frequency = <3125000>; + spi-3wire; + + reset-gpios = <&pio 8 14 GPIO_ACTIVE_LOW>; // PI14 + + backlight = <&backlight>; + power-supply = <®_lcd>; + + pinctrl-0 = <&lcd0_rgb888_pins>; + pinctrl-names = "default"; + + port { + panel_in_rgb: endpoint { + remote-endpoint = <&tcon_lcd0_out_lcd>; + }; + }; + }; + }; }; &codec {
@@ -187,6 +230,10 @@ &cpu0 { cpu-supply = <®_dcdc1>; }; +&de { + status = "okay"; +}; + &ehci0 { status = "okay"; };
@@ -206,6 +253,7 @@ &ohci0 { &pio { vcc-pa-supply = <®_cldo3>; vcc-pc-supply = <®_cldo3>; + vcc-pd-supply = <®_cldo3>; vcc-pe-supply = <®_cldo3>; vcc-pf-supply = <®_cldo3>; vcc-pg-supply = <®_aldo4>;
@@ -355,3 +403,13 @@ &usbotg { &usbphy { status = "okay"; }; + +&tcon_lcd0 { + status = "okay"; +}; + +&tcon_lcd0_out { + tcon_lcd0_out_lcd: endpoint@1 { + remote-endpoint = <&panel_in_rgb>; + }; +};
Signature · 1 line
2.48.1
PATCH 8/8 arm64: dts: allwinner: rg35xx: Add GPIO backlight control
In reply to Ryan WalklinThe LCD backlight for this device can be exposed as a simple GPIO- controlled device. It would be more accurately modelled using PWM to enable brightness control, however the PWM driver design for the H616 is not yet upstreamed.
Add a GPIO backlight node to the DTS.
--- .../boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts +6 -0
@@ -21,6 +21,12 @@ aliases { serial0 = &uart0; }; + backlight: backlight { + compatible = "gpio-backlight"; + gpios = <&pio 3 28 GPIO_ACTIVE_HIGH>; // PD28 + default-on; + }; + battery: battery { compatible = "simple-battery"; constant-charge-current-max-microamp = <1024000>;
Signature · 1 line
2.48.1
Re: [PATCH 8/8] arm64: dts: allwinner: rg35xx: Add GPIO backlight control
Tested on RG355XX-H
Quoted 29 lines · Ryan Walklin
The LCD backlight for this device can be exposed as a simple GPIO- controlled device. It would be more accurately modelled using PWM to enable brightness control, however the PWM driver design for the H616 is not yet upstreamed.
Add a GPIO backlight node to the DTS.
Signed-off-by Ryan Walklin <[email protected]>--- .../boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts +6
-0@@ -21,6 +21,12 @@ aliases { serial0 = &uart0; }; + backlight: backlight { + compatible = "gpio-backlight"; + gpios = <&pio 3 28 GPIO_ACTIVE_HIGH>; // PD28 + default-on; + }; + battery: battery { compatible = "simple-battery"; constant-charge-current-max-microamp = <1024000>;
Re: [PATCH 3/8] dt-bindings: allwinner: Add TCON_TOP and TCON_LCD clock/reset defines
In reply to Ryan WalklinQuoted 10 lines · Ryan Walklin
The Allwinner H700 exposes RGB and LVDS pins as well as a HDMI connector. This requires additional clocks for the
TCON_TOPand clock and resets for theTCON_LCDLCD controllers to be defined as per the T507 datasheet (which shares the same die).Signed-off-by Ryan Walklin <[email protected]>--- include/dt-bindings/clock/sun8i-tcon-top.h | 2 ++ 1 file changed, 2 insertions(+)
Jernej Škrabec
maintainerRe: [PATCH 1/8] bus: sun50i: add DE33 compatible string to the DE2 bus driver
In reply to Ryan WalklinDne nedelja, 16. februar 2025 ob 10:27:08 Srednjeevropski standardni čas je Ryan Walklin napisal(a):
Quoted 13 lines
The Allwinner H616 series includes a newer display engine (DE33). Add a compatible string to the existing bus driver.
Signed-off-by Ryan Walklin <[email protected]>--- drivers/bus/sun50i-de2.c | 1 + 1 file changed, 1 insertion(+)drivers/bus/sun50i-de2.c +0
-0
drivers/bus/sun50i-de2.c static void sun50i_de2_bus_remove(struct platform_device *pdev) · line 34
Quoted 4 lines
drivers/bus/sun50i-de2.c +1
-0@@ -31,6 +31,7 @@ static void sun50i_de2_bus_remove(struct platform_device *pdev)static const struct of_device_id sun50i_de2_bus_of_match[] = { { .compatible ="allwinner,sun50i-a64-de2" , }, + { .compatible ="allwinner,sun50i-h616-de33" , },
Since there is no functionality change, just go with h616 compatible with a64 fallback. No need to change the driver.
Best regards,
Jernej
Quoted 4 lines
drivers/bus/sun50i-de2.c +0
-0{/* sentinel */ } };
Jernej Škrabec
maintainerRe: [PATCH 5/8] arm64: dts: allwinner: h616: Add TCON nodes to H616 DTSI
In reply to Ryan WalklinDne nedelja, 16. februar 2025 ob 10:27:12 Srednjeevropski standardni čas je Ryan Walklin napisal(a):
Quoted 107 lines
From: Jernej Skrabec <[email protected]>
The Allwinner H616 has a display pipeline similar to other Allwinner devices, specifically the A10, but using a newer display engine revision (DE33).
Not all output pins are exposed on all package variants, for example only the H700 and T507 have LCD pins exposed, but all variants support HDMI output. However on the die these are connected to a display engine via a TCON TOP and one or more timing controllers (TCONs).
HDMI output support is not provided in this series (but will be in a subsequent patch) so for now note this within the relevant node to prevent a DT compiler error.
Add TCON nodes for the TOP, and the LCD and TV timing controllers. The timing controllers are compatible with the existing R40 driver.
Signed-off-by Jernej Skrabec <[email protected]>Signed-off-by Ryan Walklin <[email protected]>--- .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +65
-0@@ -7,9 +7,12 @@ #include <dt-bindings/clock/sun50i-h616-ccu.h> #include <dt-bindings/clock/sun50i-h6-r-ccu.h> #include <dt-bindings/clock/sun6i-rtc.h> +#include <dt-bindings/clock/sun8i-de2.h> +#include <dt-bindings/clock/sun8i-tcon-top.h> #include <dt-bindings/reset/sun50i-h616-ccu.h> #include <dt-bindings/reset/sun50i-h6-r-ccu.h> #include <dt-bindings/thermal/thermal.h> +#include <dt-bindings/reset/sun8i-de2.h> / { interrupt-parent = <&gic>;@@ -909,6 +912,136 @@ ohci3: usb@5311400 { status = "disabled"; }; + tcon_top: tcon-top@6510000 { + compatible = "allwinner,sun50i-h6-tcon-top"; + reg = <0x06510000 0x1000>; + clocks = <&ccu CLK_BUS_TCON_TOP>, + <&ccu CLK_TCON_TV0>; + clock-names = "bus", "tcon-tv0"; + clock-output-names = "tcon-top-tv0"; + #clock-cells = <0>; + resets = <&ccu RST_BUS_TCON_TOP>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + tcon_top_mixer0_in: port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + tcon_top_mixer0_in_mixer0: endpoint@0 { + reg = <0>; + remote-endpoint = <&mixer0_out_tcon_top_mixer0>; + }; + }; + + tcon_top_mixer0_out: port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + tcon_top_mixer0_out_tcon_lcd0: endpoint@0 { + reg = <0>; + remote-endpoint = <&tcon_lcd0_in_tcon_top_mixer0>; + }; + + tcon_top_mixer0_out_tcon_tv0: endpoint@2 { + reg = <2>; + remote-endpoint = <&tcon_tv0_in_tcon_top_mixer0>; + }; + }; + + tcon_top_hdmi_in: port@4 { + #address-cells = <1>; + #size-cells = <0>; + reg = <4>; + + tcon_top_hdmi_in_tcon_tv0: endpoint@0 { + reg = <0>; + remote-endpoint = <&tcon_tv0_out_tcon_top>; + }; + }; + + tcon_top_hdmi_out: port@5 { + reg = <5>; + + tcon_top_hdmi_out_hdmi: endpoint { + /* placeholder for HDMI - remote-endpoint = <&hdmi_in_tcon_top>;*/ + }; + }; + }; + }; +
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi ohci3: usb@5311400 { · line 986
Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +10
-0+ tcon_lcd0: lcd-controller@6511000 { + compatible = "allwinner,sun8i-r40-tcon-lcd"; + reg = <0x06511000 0x1000>; + interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_TCON_LCD0>, <&ccu CLK_TCON_LCD0>; + clock-names = "ahb", "tcon-ch0"; + clock-output-names = "tcon-data-clock"; + #clock-cells = <0>; + resets = <&ccu RST_BUS_TCON_LCD0>, <&ccu RST_BUS_TCON_LCD1>; + reset-names = "lcd", "lvds";
That's not true, is it? LVDS should be LVDS reset. Check my WIP patch:
https://github.com/jernejsk/linux-1/commit/8b090dc866d4c4b5b0a1804da021a9f44c67d5f1
It turns out that H616 clock driver missed LVDS reset, as it can be seen here:
https://github.com/jernejsk/linux-1/commit/88bad1a59876f5d385bcd45a363784ed2beec6ae#diff-b340c978bcdbe240f7b99f4d0d96ea130a8acb1a5786a8efbb24d9e7a0b14e53R1084
I also commented on this series:
https://lore.kernel.org/linux-sunxi/[email protected]/T/#t
Best regards,
Jernej
Quoted 62 lines
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +58
-0+ status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + tcon_lcd0_in: port@0 { + reg = <0>; + + tcon_lcd0_in_tcon_top_mixer0: endpoint { + remote-endpoint = <&tcon_top_mixer0_out_tcon_lcd0>; + }; + }; + + tcon_lcd0_out: port@1 { + reg = <1>; + }; + }; + }; + + tcon_tv0: lcd-controller@6515000 { + compatible = "allwinner,sun50i-h6-tcon-tv", + "allwinner,sun8i-r40-tcon-tv"; + reg = <0x06515000 0x1000>; + interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_TCON_TV0>, + <&tcon_top CLK_TCON_TOP_TV0>; + clock-names = "ahb", "tcon-ch1"; + #clock-cells = <0>; + resets = <&ccu RST_BUS_TCON_TV0>; + reset-names = "lcd"; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + tcon_tv0_in: port@0 { + reg = <0>; + + tcon_tv0_in_tcon_top_mixer0: endpoint { + remote-endpoint = <&tcon_top_mixer0_out_tcon_tv0>; + }; + }; + + tcon_tv0_out: port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + tcon_tv0_out_tcon_top: endpoint@1 { + reg = <1>; + remote-endpoint = <&tcon_top_hdmi_in_tcon_tv0>; + }; + }; + }; + }; + rtc: rtc@7000000 { compatible = "allwinner,sun50i-h616-rtc"; reg = <0x07000000 0x400>;
Jernej Škrabec
maintainerRe: [PATCH 7/8] arm64: dts: allwinner: rg35xx: Enable LCD output
In reply to Ryan WalklinDne nedelja, 16. februar 2025 ob 10:27:14 Srednjeevropski standardni čas je Ryan Walklin napisal(a):
Quoted 42 lines
The RG35XX has a 640x480 RGB/SPI LCD panel, supported by the SoC display pipeline and an NV3052C controller. The H616 SOC's GPIO bank D contains the muxed display pins for RGB and LVDS output support.
Enable the display engine and LCD timing controller, configure the panel, and add a fixed 3.3v GPIO-controlled regulator for the panel, and a VCC supply for the display pins as per the other GPIO banks.
Signed-off-by Ryan Walklin <[email protected]>--- .../sun50i-h700-anbernic-rg35xx-2024.dts | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts +21
-0@@ -175,6 +175,49 @@ reg_vcc5v: regulator-vcc5v { /* USB-C power input */ regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; }; + + reg_lcd: regulator-gpio-lcd-vdd { + compatible = "regulator-fixed"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vdd-lcd"; + gpio = <&pio 8 15 GPIO_ACTIVE_HIGH>; // PI15 + enable-active-high; + }; + + spi_lcd: spi { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + sck-gpios = <&pio 8 9 GPIO_ACTIVE_HIGH>; // PI9 + mosi-gpios = <&pio 8 10 GPIO_ACTIVE_HIGH>; // PI10 + cs-gpios = <&pio 8 8 GPIO_ACTIVE_HIGH>; // PI8 + num-chipselects = <1>; + + panel: panel@0 {
arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts reg_vcc5v: regulator-vcc5v { /* USB-C power input */ · line 208
Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts +10
-0+ compatible = "anbernic,rg35xx-plus-panel"; + + reg = <0>; + + spi-max-frequency = <3125000>; + spi-3wire; + + reset-gpios = <&pio 8 14 GPIO_ACTIVE_LOW>; // PI14 + + backlight = <&backlight>;
There is no backlight node at this point. Reverse patches 7 and 8 or better yet, merge them and put patch 8 message into comment to backlight node.
Best regards,
Jernej
Quoted 49 lines
arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts +27
-0+ power-supply = <®_lcd>; + + pinctrl-0 = <&lcd0_rgb888_pins>; + pinctrl-names = "default"; + + port { + panel_in_rgb: endpoint { + remote-endpoint = <&tcon_lcd0_out_lcd>; + }; + }; + }; + }; }; &codec {@@ -187,6 +230,10 @@ &cpu0 { cpu-supply = <®_dcdc1>; }; +&de { + status = "okay"; +}; + &ehci0 { status = "okay"; };@@ -206,6 +253,7 @@ &ohci0 { &pio { vcc-pa-supply = <®_cldo3>; vcc-pc-supply = <®_cldo3>; + vcc-pd-supply = <®_cldo3>; vcc-pe-supply = <®_cldo3>; vcc-pf-supply = <®_cldo3>; vcc-pg-supply = <®_aldo4>;@@ -355,3 +403,13 @@ &usbotg { &usbphy { status = "okay"; }; + +&tcon_lcd0 { + status = "okay"; +}; + +&tcon_lcd0_out { + tcon_lcd0_out_lcd: endpoint@1 { + remote-endpoint = <&panel_in_rgb>; + }; +};
Jernej Škrabec
maintainerRe: [PATCH 6/8] arm64: dts: allwinner: h616: add LCD, LVDS and PWM pins
In reply to Ryan WalklinDne nedelja, 16. februar 2025 ob 10:27:13 Srednjeevropski standardni čas je Ryan Walklin napisal(a):
Quoted 10 lines
From: Jernej Skrabec <[email protected]>
The Allwinner H616 (and its H618, H700 and T507 package variants with the same die) have 28 video output pins for RGB/SPI and LVDS display. These are in GPIO Bank D and are multiplexed.
In RGB mode, pins PD0-PD23 are for 24-bit RGB pixel output, pins PD24-PD27 are for clock, DE, HSYNC and VSYNC, and PD28 is a PWM backlight control.
Quoted 5 lines
In LVDS mode, pins PD0-PD9 are for LVDS0 and LVDS1, and can be configured by the H616 display engine for either one high-resolution (dual link) or two low resolution displays.
Add device tree nodes for the LCD, LVDS0, LVDS1 and PWM pins.
Let's just drop PWM pins. PWM support is not yet implemented and it doesn't fall into display themed patch anyway.
Best regards,
Jernej
Quoted 59 lines
Signed-off-by Jernej Skrabec <[email protected]>[[email protected]: add RGB, LVDS1 and PWM pin assignments]Signed-off-by Ryan Walklin <[email protected]>--- .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +32
-0@@ -322,6 +322,32 @@ ir_rx_pin: ir-rx-pin { function = "ir_rx"; }; + /omit-if-no-ref/ + lcd0_rgb888_pins: lcd0-rgb888-pins { + pins = "PD0", "PD1", "PD2", "PD3", + "PD4", "PD5", "PD6", "PD7", + "PD8", "PD9", "PD10", "PD11", + "PD12", "PD13", "PD14", "PD15", + "PD16", "PD17", "PD18", "PD19", + "PD20", "PD21", "PD22", "PD23", + "PD24", "PD25", "PD26", "PD27"; + function = "lcd0"; + }; + + /omit-if-no-ref/ + lvds0_pins: lvds0-pins { + pins = "PD0", "PD1", "PD2", "PD3", "PD4", + "PD5", "PD6", "PD7", "PD8", "PD9"; + function = "lvds0"; + }; + + /omit-if-no-ref/ + lvds1_pins: lvds1-pins { + pins = "PD10", "PD11", "PD12", "PD13", "PD14", + "PD15", "PD16", "PD17", "PD18", "PD19"; + function = "lvds1"; + }; + mmc0_pins: mmc0-pins { pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";@@ -348,6 +374,12 @@ mmc2_pins: mmc2-pins { bias-pull-up; }; + /omit-if-no-ref/ + pwm0_pin: pwm0-pin { + pins = "PD28"; + function = "pwm0"; + }; + /omit-if-no-ref/ spi0_pins: spi0-pins { pins = "PC0", "PC2", "PC4";
Re: [PATCH 1/8] bus: sun50i: add DE33 compatible string to the DE2 bus driver
In reply to Jernej ŠkrabecQuoted 9 lines · Jernej Škrabec
Dne nedelja, 16. februar 2025 ob 10:27:08 Srednjeevropski standardni čas je Ryan Walklin napisal(a):
drivers/bus/sun50i-de2.c static void sun50i_de2_bus_remove(struct platform_device *pdev) · line 34
Quoted 3 lines
static const struct
of_device_idsun50i_de2_bus_of_match[] = {drivers/bus/sun50i-de2.c +1
-0{ .compatible = "allwinner,sun50i-a64-de2", }, + { .compatible = "allwinner,sun50i-h616-de33", },Since there is no functionality change, just go with h616 compatible with a64 fallback. No need to change the driver.
Noted, thanks.
Regards,
Ryan
Re: [PATCH 5/8] arm64: dts: allwinner: h616: Add TCON nodes to H616 DTSI
In reply to Jernej ŠkrabecQuoted 8 lines · Jernej Škrabec
Dne nedelja, 16. februar 2025 ob 10:27:12 Srednjeevropski standardni
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi ohci3: usb@5311400 { · line 986
Quoted 4 lines
Add TCON nodes for the TOP, and the LCD and TV timing controllers. The timing controllers are compatible with the existing R40 driver.
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +2
-0+ resets = <&ccu RST_BUS_TCON_LCD0>, <&ccu RST_BUS_TCON_LCD1>; + reset-names = "lcd", "lvds";That's not true, is it? LVDS should be LVDS reset. Check my WIP patch:
https://github.com/jernejsk/linux-1/commit/8b090dc866d4c4b5b0a1804da021a9f44c67d5f1
Thanks, will correct for next version.
Quoted 6 lines
It turns out that H616 clock driver missed LVDS reset, as it can be seen here:
https://github.com/jernejsk/linux-1/commit/88bad1a59876f5d385bcd45a363784ed2beec6ae#diff-b340c978bcdbe240f7b99f4d0d96ea130a8acb1a5786a8efbb24d9e7a0b14e53R1084I also commented on this series:
https://lore.kernel.org/linux-sunxi/[email protected]/T/#t
Thanks, I will add those in for next version with this patch.
Regards,
Ryan
Re: [PATCH 6/8] arm64: dts: allwinner: h616: add LCD, LVDS and PWM pins
In reply to Jernej ŠkrabecQuoted 7 lines · Jernej Škrabec
Dne nedelja, 16. februar 2025 ob 10:27:13 Srednjeevropski standardni čas je Ryan Walklin napisal(a):
Quoted 2 lines
From: Jernej Skrabec <[email protected]>
Add device tree nodes for the LCD, LVDS0, LVDS1 and PWM pins.Let's just drop PWM pins. PWM support is not yet implemented and it doesn't fall into display themed patch anyway.
That's fine, this can be re-added when the PWM driver is implemented, and will squash the backlight and panel nodes in the next patch.
Ryan
Re: [PATCH 2/8] arm64: dts: allwinner: h616: add display engine, bus and mixer nodes
In reply to Ryan WalklinOn Sun, 16 Feb 2025 22:27:09 +1300
Ryan Walklin <[email protected]> wrote:
Hi,
Quoted 21 lines
From: Jernej Skrabec <[email protected]>
The Allwinner H616 and variants (H618, H700 and T507) have a new display engine variant (DE33). Support has been added to the existing DE2/DE3 sun4i driver in a previous patch series (x). The variant is selected via the appropriate mixer device tree compatible string.
Add the respective device-tree nodes for the DE, bus, clock and mixer to the H616 DTSI, and the matching SRAM section for the DE.
Signed-off-by Jernej Skrabec <[email protected]>Signed-off-by Ryan Walklin <[email protected]>--- .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +0
-0
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi l2_cache: l2-cache { · line 98
Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +2
-0@@ -94,6 +94,12 @@ l2_cache: l2-cache { }; }; + de: display-engine { + compatible = "allwinner,sun50i-h6-display-engine";
That should either be sun50i-h616-display-engine, or it should use a fallback. IIUC this "device" is just something more or less artificial that ties things together? I don't see any differences between the latest SoCs in the driver, but still we seem to use a separate compatible for every SoC there, which I guess is intentional?
Quoted 8 lines
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +4
-0+ allwinner,pipelines = <&mixer0>; + status = "disabled"; + }; + reserved-memory { #address-cells = <2>; #size-cells = <2>;
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi soc { · line 163
Quoted 8 lines
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +5
-0@@ -150,6 +156,51 @@ soc { #size-cells = <1>; ranges = <0x0 0x0 0x0 0x40000000>; + bus: bus@1000000 { + compatible = "allwinner,sun50i-h616-de33", + "allwinner,sun50i-a64-de2"; + reg = <0x1000000 0x400000>; + allwinner,sram = <&de3_sram 1>;
Should this label be de33_sram?
Quoted 9 lines
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +9
-0+ #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x1000000 0x400000>; + + display_clocks: clock@8000 { + compatible = "allwinner,sun50i-h616-de33-clk"; + reg = <0x8000 0x100>; + clocks = <&ccu CLK_DE>, <&ccu CLK_BUS_DE>; + clock-names = "mod", "bus";
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi soc { · line 182
Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +10
-0+ resets = <&ccu RST_BUS_DE>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + mixer0: mixer@100000 { + compatible = "allwinner,sun50i-h616-de33-mixer-0"; + reg = <0x100000 0x100000>, + <0x8100 0x40>, + <0x280000 0x20000>;
As mentioned in the binding patch, I think having reg-names here would help to make it clearer what those regions are for.
Quoted 25 lines
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +21
-0+ clocks = <&display_clocks CLK_BUS_MIXER0>, + <&display_clocks CLK_MIXER0>; + clock-names = "bus", "mod"; + resets = <&display_clocks RST_MIXER0>; + iommus = <&iommu 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + mixer0_out: port@1 { + reg = <1>; + + mixer0_out_tcon_top_mixer0: endpoint { + remote-endpoint = <&tcon_top_mixer0_in_mixer0>; + }; + }; + }; + }; + }; + crypto: crypto@1904000 { compatible = "allwinner,sun50i-h616-crypto"; reg = <0x01904000 0x800>;
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi sram_c: sram@28000 { · line 228
Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +2
-0@@ -173,6 +224,11 @@ sram_c: sram@28000 { #address-cells = <1>; #size-cells = <1>; ranges = <0 0x00028000 0x30000>; + + de3_sram: sram-section@0 {
de33_sram?
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi sram_c: sram@28000 { · line 229
Quoted 1 line
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +1
-0+ compatible = "allwinner,sun50i-a64-sram-c";
I think we need a new compatible, with the A64 as a fallback. The H6 seems to do this as well.
Cheers,
Andre
Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +2
-0+ reg = <0x0000 0x1e000>; + }; }; };