diff mbox series

[4/5] arm: dts: v3s: Add support for simple-framebuffer with DE2/TCON

Message ID 20200916141052.4808-5-m.cerveny@computer.org
State Changes Requested
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series sunxi: video: Add V3S simple-framebuffer | expand

Commit Message

Martin Cerveny Sept. 16, 2020, 2:10 p.m. UTC
Add support for DE2 and TCON connected LCD display.
Add support for export as "allwinner,simple-framebuffer"
with "mixer0-lcd0" pipeline.

Signed-off-by: Martin Cerveny <m.cerveny@computer.org>
---
 arch/arm/dts/sun8i-v3s.dtsi | 128 ++++++++++++++++++++++++++++++++++--
 1 file changed, 124 insertions(+), 4 deletions(-)

Comments

Martin Cerveny Sept. 16, 2020, 3:53 p.m. UTC | #1
On Wed, 16 Sep 2020, Maxime Ripard wrote:
> On Wed, Sep 16, 2020 at 04:10:51PM +0200, Martin Cerveny wrote:
>> Add support for DE2 and TCON connected LCD display.
>> Add support for export as "allwinner,simple-framebuffer"
>> with "mixer0-lcd0" pipeline.
>>
>> Signed-off-by: Martin Cerveny <m.cerveny@computer.org>
>
> You shouldn't do multiple things at once. If you need to, then split it into several patches.
>
> Maxime

How to split - is three sufficient ?
- pwm pins & registration
- LCD pins & DE/TCOM registration
- choosen framebuffer-lcd

Regards.
Maxime Ripard Sept. 21, 2020, 1:05 p.m. UTC | #2
On Wed, Sep 16, 2020 at 05:53:35PM +0200, Martin Cerveny wrote:
> On Wed, 16 Sep 2020, Maxime Ripard wrote:
> > On Wed, Sep 16, 2020 at 04:10:51PM +0200, Martin Cerveny wrote:
> > > Add support for DE2 and TCON connected LCD display.
> > > Add support for export as "allwinner,simple-framebuffer"
> > > with "mixer0-lcd0" pipeline.
> > > 
> > > Signed-off-by: Martin Cerveny <m.cerveny@computer.org>
> > 
> > You shouldn't do multiple things at once. If you need to, then split it into several patches.
> > 
> > Maxime
> 
> How to split - is three sufficient ?
> - pwm pins & registration
> - LCD pins & DE/TCOM registration
> - choosen framebuffer-lcd

Yep, that sounds reasonable.

For the last one though, we generally favor just sync'ing the Linux
device tree

Maxime
diff mbox series

Patch

diff --git a/arch/arm/dts/sun8i-v3s.dtsi b/arch/arm/dts/sun8i-v3s.dtsi
index ebefc0fefe..59ad5945a1 100644
--- a/arch/arm/dts/sun8i-v3s.dtsi
+++ b/arch/arm/dts/sun8i-v3s.dtsi
@@ -44,12 +44,28 @@ 
 #include <dt-bindings/reset/sun8i-v3s-ccu.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/pinctrl/sun4i-a10.h>
+#include <dt-bindings/clock/sun8i-de2.h>
 
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
 	interrupt-parent = <&gic>;
 
+	chosen {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		framebuffer-lcd {
+			compatible = "allwinner,simple-framebuffer",
+				     "simple-framebuffer";
+			allwinner,pipeline = "mixer0-lcd0";
+			clocks = <&display_clocks CLK_MIXER0>,
+				 <&ccu CLK_TCON0>;
+			status = "disabled";
+		};
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -90,12 +106,90 @@ 
 		};
 	};
 
+	de: display-engine {
+		compatible = "allwinner,sun8i-v3s-display-engine";
+		allwinner,pipelines = <&mixer0>;
+		status = "disabled";
+	};
+
 	soc {
 		compatible = "simple-bus";
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges;
 
+		display_clocks: clock@1000000 {
+			compatible = "allwinner,sun8i-v3s-de2-clk";
+			reg = <0x01000000 0x10000>;
+			clocks = <&ccu CLK_BUS_DE>,
+				 <&ccu CLK_DE>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&ccu RST_BUS_DE>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+		};
+
+		mixer0: mixer@1100000 {
+			compatible = "allwinner,sun8i-v3s-de2-mixer";
+			reg = <0x01100000 0x100000>;
+			clocks = <&display_clocks 0>,
+				 <&display_clocks 6>;
+			clock-names = "bus",
+				      "mod";
+			resets = <&display_clocks 0>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				mixer0_out: port@1 {
+					reg = <1>;
+
+					mixer0_out_tcon0: endpoint {
+						remote-endpoint = <&tcon0_in_mixer0>;
+					};
+				};
+			};
+		};
+
+		tcon0: lcd-controller@1c0c000 {
+			compatible = "allwinner,sun8i-v3s-tcon";
+			reg = <0x01c0c000 0x1000>;
+			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_TCON0>,
+				 <&ccu CLK_TCON0>;
+			clock-names = "ahb",
+				      "tcon-ch0";
+			clock-output-names = "tcon-pixel-clock";
+			#clock-cells = <0>;
+			resets = <&ccu RST_BUS_TCON0>;
+			reset-names = "lcd";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				tcon0_in: port@0 {
+					reg = <0>;
+
+					tcon0_in_mixer0: endpoint {
+						remote-endpoint = <&mixer0_out_tcon0>;
+					};
+				};
+
+				tcon0_out: port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <1>;
+					tcon0_out_lcd: endpoint@0 {
+						reg = <0>;
+					};
+				};
+			};
+		};
+
 		mmc0: mmc@01c0f000 {
 			compatible = "allwinner,sun7i-a20-mmc";
 			reg = <0x01c0f000 0x1000>;
@@ -208,10 +302,12 @@ 
 			interrupt-controller;
 			#interrupt-cells = <3>;
 
-			uart0_pins_a: uart0@0 {
-				pins = "PB8", "PB9";
-				function = "uart0";
-				bias-pull-up;
+			lcd_pins: lcd-pins {
+				pins = "PE0", "PE1", "PE2", "PE3", "PE4", "PE5",
+				       "PE6", "PE7", "PE8", "PE9", "PE10", "PE11",
+				       "PE12", "PE13", "PE14", "PE15", "PE16", "PE17",
+				       "PE18", "PE19", "PE23", "PE24";
+				function = "lcd";
 			};
 
 			mmc0_pins_a: mmc0@0 {
@@ -221,6 +317,22 @@ 
 				drive-strength = <30>;
 				bias-pull-up;
 			};
+
+			pwm0_pins: pwm0-pins {
+				pins = "PB4";
+				function = "pwm0";
+			};
+
+			pwm1_pins: pwm1-pins {
+				pins = "PB5";
+				function = "pwm1";
+			};
+
+			uart0_pins_a: uart0@0 {
+				pins = "PB8", "PB9";
+				function = "uart0";
+				bias-pull-up;
+			};
 		};
 
 		timer@01c20c00 {
@@ -280,5 +392,13 @@ 
 			#interrupt-cells = <3>;
 			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
 		};
+
+		pwm: pwm@1c21400 {
+			compatible = "allwinner,sun7i-a20-pwm";
+			reg = <0x01c21400 0x400>;
+			clocks = <&osc24M>;
+			#pwm-cells = <3>;
+			status = "disabled";
+		};
 	};
 };