Skip to contentSkip to conversation

video: ARM CLCD: Add DT support

PATCH Superseded Pawel Moll 3 participants 14 messages Sep 16, 2013 – Sep 23, 2013

Subsystems (3)

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Pawel Moll

author
#0 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

This patch adds basic DT bindings for the PL11x CLCD controllers and make their fbdev driver use them (initially only TFT panels are supported).

---
Changes since v2:
- replaced video-ram phandle with arm,pl11x,framebuffer-base
- replaced panel-* properties with arm,pl11x,panel-data-pads
- replaced max-framebuffer-size with max-memory-bandwidth
- modified clcdfb_of_init_tft_panel() to use the pads data and take differences between PL110 and PL110 into account

Changes since v1:
- minor code cleanups as suggested by Sylwester Nawrocki

 .../devicetree/bindings/video/arm,pl11x.txt        | 145 +++++++++++
 drivers/video/Kconfig                              |   1 +
 drivers/video/amba-clcd.c                          | 268 +++++++++++++++++++++
 3 files changed, 414 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/arm,pl11x.txt
Documentation/devicetree/bindings/video/arm,pl11x.txt new file +145 -0
new file mode 100644
index 0000000..418ee06
@@ -0,0 +1,145 @@
+* ARM PrimeCell Color LCD Controller PL110/PL111
+
+See also Documentation/devicetree/bindings/arm/primecell.txt
+
+Required properties:
+
+- compatible: must be one of:
+			"arm,pl110", "arm,primecell"
+			"arm,pl111", "arm,primecell"
+- reg: base address and size of the control registers block
+- interrupts: either a single interrupt specifier representing the
+		combined interrupt output (CLCDINTR) or an array of
+		four interrupt specifiers for CLCDMBEINTR,
+		CLCDVCOMPINTR, CLCDLNBUINTR, CLCDFUFINTR; in the
+		latter case interrupt names must be specified
+		(see below)
+- interrupt-names: when four interrupts are specified, their names:
+			"mbe", "vcomp", "lnbu", "fuf"
+			must be specified in order respective to the
+			interrupt specifiers
+- clocks: contains phandle and clock specifier pairs for the entries
+		in the clock-names property. See
+		Documentation/devicetree/binding/clock/clock-bindings.txt
+- clocks names: should contain "clcdclk" and "apb_pclk"
+- arm,pl11x,panel-data-pads: array of 24 cells, each of them describing
+				a function of one of the CLD pads,
+				starting from 0 up to 23; each pad can
+				be described by one of the following values:
+	- 0: reserved (not connected)
+	- 0x100-0x107: color upper STN panel data 0 to 7
+	- 0x110-0x117: color lower STN panel data 0 to 7
+	- 0x200-0x207: mono upper STN panel data 0 to 7
+	- 0x210-0x217: mono lower STN panel data 0 to 7
+	- 0x300-0x307: red component bit 0 to 7 of TFT panel data
+	- 0x310-0x317: green component bit 0 to 7 of TFT panel data
+	- 0x320-0x327: blue component bit 0 to 7 of TFT panel data
+	- 0x330: intensity bit of TFT panel data
+				Example sets of values for standard
+				panel interfaces:
+	- PL110 single colour STN panel:
+			<0x107 0x106 0x105 0x104 0x103 0x102 0x101 0x100>,
+			<0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>;
+	- PL110 dual colour STN panel:
+			<0x107 0x106 0x105 0x104 0x103 0x102 0x101 0x100>,
+			<0x117 0x116 0x115 0x114 0x113 0x112 0x111 0x110>,
+			<0 0 0 0 0 0 0 0>;
+	- PL110 single mono 4-bit STN panel:
+			<0x203 0x202 0x201 0x200>,
+			<0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>;
+	- PL110 dual mono 4-bit STN panel:
+			<0x203 0x202 0x201 0x200>, <0 0 0 0>,
+			<0x213 0x212 0x211 0x210>,
+			<0 0 0 0 0 0 0 0 0 0 0 0>;
+	- PL110 single mono 8-bit STN panel:
+			<0x207 0x206 0x205 0x204 0x203 0x202 0x201 0x200>,
+			<0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>;
+	- PL110 dual mono 8-bit STN panel:
+			<0x207 0x206 0x205 0x204 0x203 0x202 0x201 0x200>,
+			<0x217 0x216 0x215 0x214 0x213 0x212 0x211 0x210>,
+			<0 0 0 0 0 0 0 0>;
+	- PL110 TFT (1:)5:5:5 panel:
+			<0x330 0x300 0x301 0x302 0x303 0x304>,
+			<0x330 0x310 0x311 0x312 0x313 0x314>,
+			<0x330 0x320 0x321 0x322 0x323 0x324>,
+			<0 0 0 0 0 0>
+	- PL110 and PL111 TFT RGB 888 panel:
+			<0x300 0x301 0x302 0x303 0x304 0x305 0x306 0x307>,
+			<0x310 0x311 0x312 0x313 0x314 0x315 0x316 0x317>,
+			<0x320 0x321 0x322 0x323 0x324 0x325 0x326 0x327>;
+	- PL111 single colour STN panel:
+			<0x100 0x101 0x102 0x103 0x104 0x105 0x106 0x107>,
+			<0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>;
+	- PL111 dual colour STN panel:
+			<0x100 0x101 0x102 0x103 0x104 0x105 0x106 0x107>,
+			<0x110 0x111 0x112 0x113 0x114 0x115 0x116 0x117>,
+			<0 0 0 0 0 0 0 0>;
+	- PL111 single mono 4-bit STN panel:
+			<0x200 0x201 0x202 0x203>,
+			<0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>;
+	- PL111 dual mono 4-bit STN panel:
+			<0x200 0x201 0x202 0x203>, <0 0 0 0>,
+			<0x210 0x211 0x212 0x213>,
+			<0 0 0 0 0 0 0 0 0 0 0 0>;
+	- PL111 single mono 8-bit STN panel:
+			<0x200 0x201 0x202 0x203 0x204 0x205 0x206 0x207>,
+			<0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>;
+	- PL111 dual mono 8-bit STN panel:
+			<0x200 0x201 0x202 0x203 0x204 0x205 0x206 0x207>,
+			<0x210 0x211 0x212 0x213 0x214 0x215 0x216 0x217>,
+			<0 0 0 0 0 0 0 0>;
+	- PL111 TFT 4:4:4 panel:
+			<0 0 0 0>, <0x300 0x301 0x302 0x303>,
+			<0 0 0 0>, <0x310 0x311 0x312 0x313>,
+			<0 0 0 0>, <0x320 0x321 0x322 0x323>;
+	- PL111 TFT 5:6:5 panel:
+			<0 0 0>, <0x300 0x301 0x302 0x303 0x304>,
+			<0 0>, <0x310 0x311 0x312 0x313 0x314 0x315>,
+			<0 0 0>, <0x320 0x321 0x322 0x323 0x324>;
+	- PL111 TFT (1):5:5:5 panel:
+			<0 0 0>, <0x300 0x301 0x302 0x303 0x304>,
+			<0 0>, <0x330 0x310 0x311 0x312 0x313 0x314>,
+			<0 0 0>, <0x320 0x321 0x322 0x323 0x324>;
+
+Optional properties:
+
+- arm,pl11x,framebuffer-base: a pair of two values, address and size,
+				defining the framebuffer to be used;
+				to be used only if it is *not*
+				part of normal memory, as described
+				in /memory node
+- max-memory-bandwidth: maximum bandwidth in bytes per second that the
+			cell's memory interface can handle
+- display-timings: standard display timings sub-node, defining possible
+			video modes of a connected panel; for details see
+			Documentation/devicetree/bindings/video/display-timing.txt
+
+Example:
+
+			clcd at 1f0000 {
+				compatible = "arm,pl111", "arm,primecell";
+				reg = <0x1f0000 0x1000>;
+				interrupts = <14>;
+				clocks = <&v2m_oscclk1>, <&smbclk>;
+				clock-names = "clcdclk", "apb_pclk";
+
+				arm,pl11x,panel-data-pads = <0x300 0x301 0x302 0x303 0x304 0x305 0x306 0x307>,
+							    <0x310 0x311 0x312 0x313 0x314 0x315 0x316 0x317>,
+							    <0x320 0x321 0x322 0x323 0x324 0x325 0x326 0x327>;
+				arm,pl11x,framebuffer-base = <0x18000000 0x00800000>;
+				max-memory-bandwidth = <36864000>; /* bps, 640x480 at 60 16bpp */
+				display-timings {
+					native-mode = <&v2m_clcd_timing0>;
+					v2m_clcd_timing0: vga {
+						clock-frequency = <25175000>;
+						hactive = <640>;
+						hback-porch = <40>;
+						hfront-porch = <24>;
+						hsync-len = <96>;
+						vactive = <480>;
+						vback-porch = <32>;
+						vfront-porch = <11>;
+						vsync-len = <2>;
+					};
+				};
+			};
drivers/video/Kconfig +1 -0
index 4cf1e1d..375bf63 100644
@@ -316,6 +316,7 @@ config FB_ARMCLCD
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
+	select VIDEOMODE_HELPERS if OF
 	help
 	  This framebuffer device driver is for the ARM PrimeCell PL110
 	  Colour LCD controller.  ARM PrimeCells provide the building
drivers/video/amba-clcd.c +268 -0

286 lines not on this page · raw message

Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH v3 2/2 ARM: vexpress: Add CLCD Device Tree properties

... for V2M-P1 motherboard CLCD (limited to 640x480 16bpp and using dedicated video RAM bank) and for V2P-CA9 (up to 1024x768 16bpp).

---
 arch/arm/boot/dts/vexpress-v2m-rs1.dtsi | 22 +++++++++++++++++++++-
 arch/arm/boot/dts/vexpress-v2m.dtsi     | 22 +++++++++++++++++++++-
 arch/arm/boot/dts/vexpress-v2p-ca9.dts  | 19 +++++++++++++++++++
 3 files changed, 61 insertions(+), 2 deletions(-)
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi +21 -1
index ac870fb..8226149 100644
@@ -233,6 +233,26 @@
 				interrupts = <14>;
 				clocks = <&v2m_oscclk1>, <&smbclk>;
 				clock-names = "clcdclk", "apb_pclk";
+
+				arm,pl11x,panel-data-pads = <0x300 0x301 0x302 0x303 0x304 0x305 0x306 0x307>,
+							    <0x310 0x311 0x312 0x313 0x314 0x315 0x316 0x317>,
+							    <0x320 0x321 0x322 0x323 0x324 0x325 0x326 0x327>;
+				arm,pl11x,framebuffer-base = <0x18000000 0x00800000>;
+				max-memory-bandwidth = <36864000>; /* Bps, 640x480 at 60 16bpp */
+				display-timings {
+					native-mode = <&v2m_clcd_timing0>;
+					v2m_clcd_timing0: vga {
+						clock-frequency = <25175000>;
+						hactive = <640>;
+						hback-porch = <40>;
+						hfront-porch = <24>;
+						hsync-len = <96>;
+						vactive = <480>;
+						vback-porch = <32>;
+						vfront-porch = <11>;
+						vsync-len = <2>;
+					};
+				};
 			};
 		};
 
@@ -282,7 +302,7 @@
 				/* CLCD clock */
 				compatible = "arm,vexpress-osc";
 				arm,vexpress-sysreg,func = <1 1>;
-				freq-range = <23750000 63500000>;
+				freq-range = <23750000 65000000>;
 				#clock-cells = <0>;
 				clock-output-names = "v2m:oscclk1";
 			};
arch/arm/boot/dts/vexpress-v2m.dtsi +21 -1
index f142036..4befe1c 100644
@@ -232,6 +232,26 @@
 				interrupts = <14>;
 				clocks = <&v2m_oscclk1>, <&smbclk>;
 				clock-names = "clcdclk", "apb_pclk";
+
+				arm,pl11x,panel-data-pads = <0x300 0x301 0x302 0x303 0x304 0x305 0x306 0x307>,
+							    <0x310 0x311 0x312 0x313 0x314 0x315 0x316 0x317>,
+							    <0x320 0x321 0x322 0x323 0x324 0x325 0x326 0x327>;
+				arm,pl11x,framebuffer-base = <0x4c000000 0x00800000>;
+				max-memory-bandwidth = <36864000>; /* Bps, 640x480 at 60 16bpp */
+				display-timings {
+					native-mode = <&v2m_clcd_timing0>;
+					v2m_clcd_timing0: vga {
+						clock-frequency = <25175000>;
+						hactive = <640>;
+						hback-porch = <40>;
+						hfront-porch = <24>;
+						hsync-len = <96>;
+						vactive = <480>;
+						vback-porch = <32>;
+						vfront-porch = <11>;
+						vsync-len = <2>;
+					};
+				};
 			};
 		};
 
@@ -281,7 +301,7 @@
 				/* CLCD clock */
 				compatible = "arm,vexpress-osc";
 				arm,vexpress-sysreg,func = <1 1>;
-				freq-range = <23750000 63500000>;
+				freq-range = <23750000 65000000>;
 				#clock-cells = <0>;
 				clock-output-names = "v2m:oscclk1";
 			};
arch/arm/boot/dts/vexpress-v2p-ca9.dts +19 -0
index 62d9b22..5eb68b8 100644
@@ -73,6 +73,25 @@
 		interrupts = <0 44 4>;
 		clocks = <&oscclk1>, <&oscclk2>;
 		clock-names = "clcdclk", "apb_pclk";
+
+		arm,pl11x,panel-data-pads = <0x300 0x301 0x302 0x303 0x304 0x305 0x306 0x307>,
+					    <0x310 0x311 0x312 0x313 0x314 0x315 0x316 0x317>,
+					    <0x320 0x321 0x322 0x323 0x324 0x325 0x326 0x327>;
+		max-memory-bandwidth = <94371840>; /* Bps, 1024x768 at 60 16bpp */
+		display-timings {
+			native-mode = <&clcd_timing0>;
+			clcd_timing0: xga {
+				clock-frequency = <63500127>;
+				hactive = <1024>;
+				hback-porch = <152>;
+				hfront-porch = <48>;
+				hsync-len = <104>;
+				vactive = <768>;
+				vback-porch = <23>;
+				vfront-porch = <3>;
+				vsync-len = <4>;
+			};
+		};
 	};
 
 	memory-controller at 100e0000 {
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

In reply to Pawel Moll
Quoted 6 lines · Pawel Moll

This patch adds basic DT bindings for the PL11x CLCD controllers and make their fbdev driver use them (initially only TFT panels are supported).

Documentation/devicetree/bindings/video/arm,pl11x.txt +0 -0
 

Documentation/devicetree/bindings/video/arm,pl11x.txt line 20

Quoted 10 lines
Documentation/devicetree/bindings/video/arm,pl11x.txt +10 -0
+- interrupts: either a single interrupt specifier representing the
+		combined interrupt output (CLCDINTR) or an array of
+		four interrupt specifiers for CLCDMBEINTR,
+		CLCDVCOMPINTR, CLCDLNBUINTR, CLCDFUFINTR; in the
+		latter case interrupt names must be specified
+		(see below)
+- interrupt-names: when four interrupts are specified, their names:
+			"mbe", "vcomp", "lnbu", "fuf"
+			must be specified in order respective to the
+			interrupt specifiers

I think the binding should either always use names as the key, or use indices in interrupts as the key. Hence, I'd word that more like:

- interrupt-names: either the single entry "combined" representing a combined interrupt output (CLCDINTR), or the four entries "mbe", "vcomp", "lnbu", "fuf" representing the individual CLCDMBEINTR, CLCDVCOMPINTR, CLCDLNBUINTR, CLCDFUFINTR interrupts.
- interrupts: contains an interrupt specifier for each entry in interrupt-names.

Documentation/devicetree/bindings/video/arm,pl11x.txt line 30

Quoted 6 lines

+- arm,pl11x,panel-data-pads: array of 24 cells, each of them describing

Documentation/devicetree/bindings/video/arm,pl11x.txt +5 -0
+				a function of one of the CLD pads,
+				starting from 0 up to 23; each pad can
+				be described by one of the following values:
+	- 0: reserved (not connected)
+	- 0x100-0x107: color upper STN panel data 0 to 7

...

I assume those are the raw values that go into the HW?

Documentation/devicetree/bindings/video/arm,pl11x.txt line 42

Quoted 5 lines
Documentation/devicetree/bindings/video/arm,pl11x.txt +5 -0
+				Example sets of values for standard
+				panel interfaces:
+	- PL110 single colour STN panel:
+			<0x107 0x106 0x105 0x104 0x103 0x102 0x101 0x100>,
+			<0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>;

The indentation of the introductory text seems a little odd. Do we really need so many examples?

Documentation/devicetree/bindings/video/arm,pl11x.txt line 110

Quoted 7 lines
Documentation/devicetree/bindings/video/arm,pl11x.txt +7 -0
+Optional properties:
+
+- arm,pl11x,framebuffer-base: a pair of two values, address and size,
+				defining the framebuffer to be used;
+				to be used only if it is *not*
+				part of normal memory, as described
+				in /memory node

If the framebuffer is part of /memory, what happens then? Is the address not fixed (so the HW isn't yet set up) and hence a driver should allocate it?

author
#3 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

Quoted 11 lines · Stephen Warren

I think the binding should either always use names as the key, or use indices in interrupts as the key. Hence, I'd word that more like:

- interrupt-names: either the single entry "combined" representing a combined interrupt output (CLCDINTR), or the four entries "mbe", "vcomp", "lnbu", "fuf" representing the individual CLCDMBEINTR, CLCDVCOMPINTR, CLCDLNBUINTR, CLCDFUFINTR interrupts.
- interrupts: contains an interrupt specifier for each entry in interrupt-names.

Cool, works for me.

Quoted 10 lines

Documentation/devicetree/bindings/video/arm,pl11x.txt line 30

Quoted 6 lines

+- arm,pl11x,panel-data-pads: array of 24 cells, each of them describing

Documentation/devicetree/bindings/video/arm,pl11x.txt new file +5 -0
+				a function of one of the CLD pads,
+				starting from 0 up to 23; each pad can
+				be described by one of the following values:
+	- 0: reserved (not connected)
+	- 0x100-0x107: color upper STN panel data 0 to 7

...

I assume those are the raw values that go into the HW?

Quoted 7 lines

Documentation/devicetree/bindings/video/arm,pl11x.txt line 42

Quoted 5 lines
Documentation/devicetree/bindings/video/arm,pl11x.txt new file +5 -0
+				Example sets of values for standard
+				panel interfaces:
+	- PL110 single colour STN panel:
+			<0x107 0x106 0x105 0x104 0x103 0x102 0x101 0x100>,
+			<0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>;

The indentation of the introductory text seems a little odd.

It follows the first paragraph of this property description. But I may re-format all this stuff. Really looking forward some the formal syntax :-)

Quoted 1 line

Do we really need so many examples?

They cover all standard cases. If I was to write a tree for a new platform not knowing anything about CLCD, I think I'd appreciate this and don't believe this extra kB or two is a problem. Do you?

Quoted 11 lines

Documentation/devicetree/bindings/video/arm,pl11x.txt line 110

Quoted 7 lines
Documentation/devicetree/bindings/video/arm,pl11x.txt new file +7 -0
+Optional properties:
+
+- arm,pl11x,framebuffer-base: a pair of two values, address and size,
+				defining the framebuffer to be used;
+				to be used only if it is *not*
+				part of normal memory, as described
+				in /memory node

If the framebuffer is part of /memory, what happens then? Is the address not fixed (so the HW isn't yet set up) and hence a driver should allocate it?

Yes, if it wants to display anything :-) And as this is a normal and expected behaviour, I don't think it deserves a note in the documentation. I'm open to any suggestions that would make the wording above emphasize the "weirdness" of situations requiring the property.

Pawe?

author
#4 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

Uh, sorry, missed one...

Quoted 10 lines · Pawel Moll
Quoted 9 lines · Stephen Warren

Documentation/devicetree/bindings/video/arm,pl11x.txt line 30

Quoted 6 lines

+- arm,pl11x,panel-data-pads: array of 24 cells, each of them describing

Documentation/devicetree/bindings/video/arm,pl11x.txt new file +5 -0
+				a function of one of the CLD pads,
+				starting from 0 up to 23; each pad can
+				be described by one of the following values:
+	- 0: reserved (not connected)
+	- 0x100-0x107: color upper STN panel data 0 to 7

...

I assume those are the raw values that go into the HW?

No, they can be considered "labels", defining the way pads are used (wired). Then, basing on this information, the driver is configuring the cell, eg. selecting STN or TFT mode (thus switching the output between panel formatter and raw RGB data source).

Pawe?

#5 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

Quoted 12 lines · Pawel Moll

Uh, sorry, missed one...

Quoted 9 lines · Pawel Moll
Quoted 8 lines · Stephen Warren
Quoted 6 lines

+- arm,pl11x,panel-data-pads: array of 24 cells, each of them describing

Documentation/devicetree/bindings/video/arm,pl11x.txt new file +5 -0
+				a function of one of the CLD pads,
+				starting from 0 up to 23; each pad can
+				be described by one of the following values:
+	- 0: reserved (not connected)
+	- 0x100-0x107: color upper STN panel data 0 to 7

...

Quoted 6 lines
Quoted 1 line
Quoted 1 line

I assume those are the raw values that go into the HW?

No, they can be considered "labels", defining the way pads are used (wired). Then, basing on this information, the driver is configuring the cell, eg. selecting STN or TFT mode (thus switching the output between panel formatter and raw RGB data source).

Oh, why not just use the raw values from the HW registers for this?

#6 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

In reply to Pawel Moll
Quoted 9 lines · Pawel Moll
Quoted 4 lines · Stephen Warren

I think the binding should either always use names as the key, or use indices in interrupts as the key. Hence, I'd word that more like:

Do we really need so many examples?

They cover all standard cases. If I was to write a tree for a new platform not knowing anything about CLCD, I think I'd appreciate this and don't believe this extra kB or two is a problem. Do you?

I guess it's not a problem. It's just unusual.

Quoted 12 lines
Quoted 11 lines

Documentation/devicetree/bindings/video/arm,pl11x.txt line 110

Quoted 7 lines
Documentation/devicetree/bindings/video/arm,pl11x.txt new file +7 -0
+Optional properties:
+
+- arm,pl11x,framebuffer-base: a pair of two values, address and size,
+				defining the framebuffer to be used;
+				to be used only if it is *not*
+				part of normal memory, as described
+				in /memory node

If the framebuffer is part of /memory, what happens then? Is the address not fixed (so the HW isn't yet set up) and hence a driver should allocate it?

Quoted 4 lines

Yes, if it wants to display anything :-) And as this is a normal and expected behaviour, I don't think it deserves a note in the documentation. I'm open to any suggestions that would make the wording above emphasize the "weirdness" of situations requiring the property.

Perhaps:

A pair of two values, address and size, defining the framebuffer to be used. If not present, the framebuffer may be located anywhere in memory.

Or, is this intended to represent where the HW is already scanning out from? If so, then perhaps:

A pair of two values, address and size, defining the location of the framebuffer that the controller is currently configured to display. If not present, the controller may or may not already be active.

(although presumably if the controller is already active, then the address can simply be read out of the HW register, so there's no need for a DT property).

author
#7 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

Quoted 17 lines · Stephen Warren
Quoted 12 lines
Quoted 11 lines

Documentation/devicetree/bindings/video/arm,pl11x.txt line 110

Quoted 7 lines
Documentation/devicetree/bindings/video/arm,pl11x.txt new file +7 -0
+Optional properties:
+
+- arm,pl11x,framebuffer-base: a pair of two values, address and size,
+				defining the framebuffer to be used;
+				to be used only if it is *not*
+				part of normal memory, as described
+				in /memory node

If the framebuffer is part of /memory, what happens then? Is the address not fixed (so the HW isn't yet set up) and hence a driver should allocate it?

Quoted 4 lines

Yes, if it wants to display anything :-) And as this is a normal and expected behaviour, I don't think it deserves a note in the documentation. I'm open to any suggestions that would make the wording above emphasize the "weirdness" of situations requiring the property.

Quoted 4 lines

Perhaps:

A pair of two values, address and size, defining the framebuffer to be used. If not present, the framebuffer may be located anywhere in memory.

Works with me, thanks!

Quoted 10 lines · Stephen Warren
Quoted 10 lines · Pawel Moll
Quoted 9 lines · Stephen Warren
Quoted 8 lines
Quoted 6 lines

+- arm,pl11x,panel-data-pads: array of 24 cells, each of them describing

Documentation/devicetree/bindings/video/arm,pl11x.txt new file +5 -0
+				a function of one of the CLD pads,
+				starting from 0 up to 23; each pad can
+				be described by one of the following values:
+	- 0: reserved (not connected)
+	- 0x100-0x107: color upper STN panel data 0 to 7

...

Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

I assume those are the raw values that go into the HW?

No, they can be considered "labels", defining the way pads are used (wired). Then, basing on this information, the driver is configuring the cell, eg. selecting STN or TFT mode (thus switching the output between panel formatter and raw RGB data source).

Oh, why not just use the raw values from the HW registers for this?

How do you mean? Based on the the way the "LCD data" lines are wired up, the driver has to decide whether to select STN (LCDControl &= ~(1<<5)) or TFT mode (LCDControl |= 1<<5), then figures out what memory pixel formats are possible (based on this will set LCDControl[3..1] in runtime, depending on the mode selected by the user). There isn't a separate register as such configuring output pads. It's just the way they can used depends on the way they're wired up.

Pawe?

#8 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

Quoted 20 lines · Pawel Moll
Quoted 10 lines · Stephen Warren
Quoted 10 lines · Pawel Moll
Quoted 9 lines · Stephen Warren
Quoted 8 lines
Quoted 6 lines

+- arm,pl11x,panel-data-pads: array of 24 cells, each of them describing

Documentation/devicetree/bindings/video/arm,pl11x.txt new file +5 -0
+				a function of one of the CLD pads,
+				starting from 0 up to 23; each pad can
+				be described by one of the following values:
+	- 0: reserved (not connected)
+	- 0x100-0x107: color upper STN panel data 0 to 7

...

Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

I assume those are the raw values that go into the HW?

No, they can be considered "labels", defining the way pads are used (wired). Then, basing on this information, the driver is configuring the cell, eg. selecting STN or TFT mode (thus switching the output between panel formatter and raw RGB data source).

Oh, why not just use the raw values from the HW registers for this?

Quoted 7 lines

How do you mean? Based on the the way the "LCD data" lines are wired up, the driver has to decide whether to select STN (LCDControl &= ~(1<<5)) or TFT mode (LCDControl |= 1<<5), then figures out what memory pixel formats are possible (based on this will set LCDControl[3..1] in runtime, depending on the mode selected by the user). There isn't a separate register as such configuring output pads. It's just the way they can used depends on the way they're wired up.

It sounds like you could just put LCDControl & 0x2e in the DT rather than using values such as 0x100..0x107, which don't appear to match the register format you mentioned above.

#9 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

Quoted 3 lines · Stephen Warren

It sounds like you could just put LCDControl & 0x2e in the DT rather than using values such as 0x100..0x107, which don't appear to match the register format you mentioned above.

No. Platforms which route the outputs to something like VGA or HDMI can change the framebuffer format. Your suggestions is far too restrictive.

#10 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

Quoted 7 lines · Russell King - ARM Linux
Quoted 3 lines · Stephen Warren

It sounds like you could just put LCDControl & 0x2e in the DT rather than using values such as 0x100..0x107, which don't appear to match the register format you mentioned above.

No. Platforms which route the outputs to something like VGA or HDMI can change the framebuffer format. Your suggestions is far too restrictive.

Surely the DT should describe the HW setup only. Usually, a particular HW setup can support multiple different framebuffer formats. Hence, the DT wouldn't/shouldn't imply anything about the framebuffer format, but simply which wires are connected to the LCD.

#11 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

Quoted 6 lines · Stephen Warren
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Stephen Warren

It sounds like you could just put LCDControl & 0x2e in the DT rather than using values such as 0x100..0x107, which don't appear to match the register format you mentioned above.

Quoted 7 lines
Quoted 2 lines

No. Platforms which route the outputs to something like VGA or HDMI can change the framebuffer format. Your suggestions is far too restrictive.

Surely the DT should describe the HW setup only. Usually, a particular HW setup can support multiple different framebuffer formats. Hence, the DT wouldn't/shouldn't imply anything about the framebuffer format, but simply which wires are connected to the LCD.

Quite, and putting the contents of the LCDControl register - even just bits 5 and 3-1 results in you having to modify the DT and reboot the kernel just to change the framebuffer format. That's why I'm objecting to your comment.

When I rewrote the way the CLCD driver handles the various panels, I did it with full information on how the hardware was being used at that time. That is precisely why I came up with the capability system, where we describe which formats the hardware can support up to the interface, separately from the formats which the attached device - be it a LCD panel, VGA socket or HDMI socket - can support. The resulting set of formats which can be used are a union of these.

Suggesting that we can do this by putting register values into DT is completely wrong - if that were possible, I wouldn't have come up with this capability system to sort this mess out in the first place - I could've just hard-coded the register values and said to everyone "tough, on these platforms you only get RGB444 support and that's it."

#12 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

Quoted 15 lines · Russell King - ARM Linux
Quoted 6 lines · Stephen Warren
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Stephen Warren

It sounds like you could just put LCDControl & 0x2e in the DT rather than using values such as 0x100..0x107, which don't appear to match the register format you mentioned above.

Quoted 7 lines
Quoted 2 lines

No. Platforms which route the outputs to something like VGA or HDMI can change the framebuffer format. Your suggestions is far too restrictive.

Surely the DT should describe the HW setup only. Usually, a particular HW setup can support multiple different framebuffer formats. Hence, the DT wouldn't/shouldn't imply anything about the framebuffer format, but simply which wires are connected to the LCD.

Quoted 4 lines

Quite, and putting the contents of the LCDControl register - even just bits 5 and 3-1 results in you having to modify the DT and reboot the kernel just to change the framebuffer format. That's why I'm objecting to your comment.

Oh, so these particular registers define both the output signal muxing for the pins and the FB data format? If so, yes it's not correct to put the register values into DT. I assumed that the HW would have a separate representation of those two concepts, in different registers or at least different fields in the same register. If not, there is indeed no choice but to make up some arbitrary values to represent just the pinmuxing :-(

#13 lore raw

PATCH v3 1/2 video: ARM CLCD: Add DT support

Quoted 21 lines · Stephen Warren
Quoted 15 lines · Russell King - ARM Linux
Quoted 6 lines · Stephen Warren
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Stephen Warren

It sounds like you could just put LCDControl & 0x2e in the DT rather than using values such as 0x100..0x107, which don't appear to match the register format you mentioned above.

Quoted 7 lines
Quoted 2 lines

No. Platforms which route the outputs to something like VGA or HDMI can change the framebuffer format. Your suggestions is far too restrictive.

Surely the DT should describe the HW setup only. Usually, a particular HW setup can support multiple different framebuffer formats. Hence, the DT wouldn't/shouldn't imply anything about the framebuffer format, but simply which wires are connected to the LCD.

Quoted 4 lines

Quite, and putting the contents of the LCDControl register - even just bits 5 and 3-1 results in you having to modify the DT and reboot the kernel just to change the framebuffer format. That's why I'm objecting to your comment.

Quoted 6 lines

Oh, so these particular registers define both the output signal muxing for the pins and the FB data format? If so, yes it's not correct to put the register values into DT. I assumed that the HW would have a separate representation of those two concepts, in different registers or at least different fields in the same register. If not, there is indeed no choice but to make up some arbitrary values to represent just the pinmuxing :-(

Unfortunately not. Parameters such as TFT, and dual can be specified by DT, but the difficulty comes with the pixel wiring.

With a PL110 in TFT mode, the representation of which signals represent what are a function of the selected BPP:

Panel:
24bpp: Blue[7:0]=CLD[23:16] Green[7:0]=CLD[15:8] Red[7:0]=CLD[7:0] 18bpp: Blue[4:0]=CLD[17:13] Green[4:0]=CLD[11:7] Red[4:0]=CLD[5:1]

       Intensity = CLD[12], CLD[6], CLD[0]

24bpp signalling is used when a framebuffer format of 24bpp mode is selected, otherwise the 18bpp signalling is used.

The PL110 in 16bpp does not support for anything but 1555 mode when wired up as above, but some people want 565 mode. That's achievable (and is used on Versatile) by adjusting the wiring via a FPGA:

       Blue = CLD[12,17:14] Green = [13,11:7] Blue = CLD[5:1]

This gives us the RGB565 mode on PL110. Now, consider a platform which wants to use this - if the panel is wired up directly to the CLCD like that, then it will only support RGB565.

If you were connecting a 4:4:4 panel, a similar thing is possible, and may be preferable to have the standard framebuffer format in memory to do this.

So, the supportable framebuffer foramts depends entirely on how the display is wired up to the controller.

Now, for PL111, things are simpler - it supports 5551, 565 and 444 modes natively, so supports all the standard framebuffer formats. The output wiring is different and more sane. In this case, CLD[23] is always the MSB blue bit, CLD[15] is always the MSB green bit, and CLD[7] is always the MSB red bit. So here, the wiring matters very much less.

However, even here the "capabilities" play a role. Does driving a TFT 444 panel being driven in 24-bit mode make sense? Yes, it'll work but the least significant four bits are lost. What about the other way around? A TFT 888 panel in 12bpp mode? Well, in that case the least sigificant four bits are marked up as "reserved" - and even if they are held at zero, you're going to lose some colour range on the panel because white will be equivalent to colour f0f0f0 not ffffff.

Hence, we probably want to have even here some way to say "I want this hardware to only support framebuffer formats of X".

My feeling is that even though these capabilities are not part of the actual hardware spec, they're well worth implementing directly in DT as they're describing what the *hardware* as a whole is capable of.

Moreover, I created the capabilities purely as a way to describe what the hardware and panel are capable of. Isn't that what DT is all about too?