Skip to contentSkip to conversation

ARM: dts: Support official Raspberry Pi 7inch touchscreen

RFC PATCH In review Detlev Casanova 4 participants 9 messages Apr 27, 2022 – Apr 28, 2022

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover ARM: dts: Support official Raspberry Pi 7inch touchscreen

Add a devicetree overlay to support the official Raspberry Pi 7inch touchscreen.

This also demuxes the i2c0 controller to support both pinctrls.

Changes in v2:
* The device tree in now an overlay
* The i2c demux patch is kept for now to have a working patch set. It has not been merged yet in [1].
* The device tree overlay doesn't use fragments. It is working as is but not enough literature was found to go one way or the other.

[1] https://www.spinics.net/lists/arm-kernel/msg944330.html

Detlev Casanova (3):
ARM: dts: bcm2*: Demux i2c0 with a pinctrl
of: Add support for -@ when compiling overlays
ARM: dto: Add bcm2711-rpi-7-inches-ts.dts overlay

 arch/arm/boot/dts/Makefile                    |   4 +
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts         |   1 +
 arch/arm/boot/dts/bcm2711.dtsi                |   2 +-
 arch/arm/boot/dts/bcm2835-rpi.dtsi            |   9 +-
 .../boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi    |   4 +
 arch/arm/boot/dts/bcm283x.dtsi                |  26 +++-
 arch/arm/boot/dts/overlays/Makefile           |   3 +
 .../dts/overlays/bcm2711-rpi-7-inches-ts.dts  | 125 ++++++++++++++++++
 arch/arm64/boot/dts/broadcom/Makefile         |   4 +
 .../arm64/boot/dts/broadcom/overlays/Makefile |   3 +
 .../overlays/bcm2711-rpi-7-inches-ts.dts      |   2 +
 drivers/of/Kconfig                            |   8 ++
 scripts/Makefile.lib                          |   9 +-
 13 files changed, 193 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi
 create mode 100644 arch/arm/boot/dts/overlays/Makefile
 create mode 100644 arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/overlays/Makefile
 create mode 100644 arch/arm64/boot/dts/broadcom/overlays/bcm2711-rpi-7-inches-ts.dts
Signature · 1 line
2.36.0
#1 lore raw

RFC PATCH v2 1/3 ARM: dts: bcm2*: Demux i2c0 with a pinctrl

The i2c0 device has 2 different busses controlled by a pinctrl. This commit separates the device node into 2 i2c devices:
* pin 0: Base i2c bus
* pin 44: DSI i2c bus

i2c0 is renamed to i2c0if so that device-trees referencing i2c0 don't break and use the i2c0 node defined in i2c0mux node.

i2c_csi_dsi can be used to control devices via the DSI i2c bus, used for DSI displays.

---
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts         |  1 +
 arch/arm/boot/dts/bcm2711.dtsi                |  2 +-
 arch/arm/boot/dts/bcm2835-rpi.dtsi            |  9 ++++---
 .../boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi    |  4 +++
 arch/arm/boot/dts/bcm283x.dtsi                | 26 ++++++++++++++++++-
 5 files changed, 37 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi
arch/arm/boot/dts/bcm2711-rpi-4-b.dts +1 -0
index 4432412044de..5dcce58817e6 100644
@@ -4,6 +4,7 @@
 #include "bcm2711-rpi.dtsi"
 #include "bcm283x-rpi-usb-peripheral.dtsi"
 #include "bcm283x-rpi-wifi-bt.dtsi"
+#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
 
 / {
 	compatible = "raspberrypi,4-model-b", "brcm,bcm2711";
arch/arm/boot/dts/bcm2711.dtsi +1 -1
index dff18fc9a906..96209ed89c36 100644
@@ -1045,7 +1045,7 @@ &cma {
 	alloc-ranges = <0x0 0x00000000 0x40000000>;
 };
 
-&i2c0 {
+&i2c0if {
 	compatible = "brcm,bcm2711-i2c", "brcm,bcm2835-i2c";
 	interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
 };
arch/arm/boot/dts/bcm2835-rpi.dtsi +6 -3
index 87ddcad76083..1e38f9f0e80e 100644
@@ -49,13 +49,16 @@ alt0: alt0 {
 	};
 };
 
-&i2c0 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&i2c0_gpio0>;
+&i2c0if {
 	status = "okay";
 	clock-frequency = <100000>;
 };
 
+&i2c0mux {
+	pinctrl-0 = <&i2c0_gpio0>;
+	status = "okay";
+};
+
 &i2c1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2c1_gpio2>;
arch/arm/boot/dts/bcm283x-rpi-i2c0mux_0_44.dtsi new file +4 -0
new file mode 100644
index 000000000000..119946d878db
@@ -0,0 +1,4 @@
+&i2c0mux {
+	pinctrl-0 = <&i2c0_gpio0>;
+	pinctrl-1 = <&i2c0_gpio44>;
+};
arch/arm/boot/dts/bcm283x.dtsi +25 -1
index c113661a6668..62d7ee513549 100644
@@ -336,7 +336,7 @@ spi: spi@7e204000 {
 			status = "disabled";
 		};
 
-		i2c0: i2c@7e205000 {
+		i2c0if: i2c@7e205000 {
 			compatible = "brcm,bcm2835-i2c";
 			reg = <0x7e205000 0x200>;
 			interrupts = <2 21>;
@@ -346,6 +346,30 @@ i2c0: i2c@7e205000 {
 			status = "disabled";
 		};
 
+		i2c0mux: i2c0mux {
+			compatible = "i2c-mux-pinctrl";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			i2c-parent = <&i2c0if>;
+
+			pinctrl-names = "i2c0", "i2c_csi_dsi";
+
+			status = "disabled";
+
+			i2c0: i2c@0 {
+				reg = <0>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+			};
+
+			i2c_csi_dsi: i2c@1 {
+				reg = <1>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+			};
+		};
+
 		dpi: dpi@7e208000 {
 			compatible = "brcm,bcm2835-dpi";
 			reg = <0x7e208000 0x8c>;
Signature · 1 line
2.36.0
#2 lore raw

RFC PATCH v2 2/3 of: Add support for -@ when compiling overlays

In reply to Detlev Casanova

This commit adds an option to compile all device trees with -@ to add the symbol table to the Device Tree Blobs.

It prepares the introduction of device tree overlays that are not applied on device trees at compile time (dtbo files.)

These device tree overlays will be used by either a bootloader or a linux userspace tool to extend the base device tree.

This is used e.g. for drivers that need device tree nodes for optional non plug and play devices, like an external DSI touchscreen panel that embeds different i2c devices to control it.

---
 drivers/of/Kconfig   | 8 ++++++++
 scripts/Makefile.lib | 9 +++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
drivers/of/Kconfig +8 -0
index 80b5fd44ab1c..28cf8d18ac45 100644
@@ -76,11 +76,19 @@ config OF_RESERVED_MEM
 config OF_RESOLVE
 	bool
 
+config OF_SYMBOLS
+	bool "Include device tree symbols"
+	help
+	  Loading a device tree overlay dynamically can require the base
+	  device tree symbols to be present.
+	  If this is enabled, the device tree blobs will be bigger.
+
 config OF_OVERLAY
 	bool "Device Tree overlays"
 	select OF_DYNAMIC
 	select OF_FLATTREE
 	select OF_RESOLVE
+	select OF_SYMBOLS
 	help
 	  Overlays are a method to dynamically modify part of the kernel's
 	  device tree with dynamically loaded data.
scripts/Makefile.lib +7 -2
index 79be57fdd32a..4c330e565297 100644
@@ -319,8 +319,13 @@ endif
 
 DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
 
-# Set -@ if the target is a base DTB that overlay is applied onto
-DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
+ifeq ($(CONFIG_OF_SYMBOLS),y)
+	# Add symbols in all devicetrees
+	DTC_FLAGS += -@
+else
+	# Set -@ if the target is a base DTB that overlay is applied onto
+	DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
+endif
 
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb= DTB     $@
Signature · 1 line
2.36.0
maintainer
#3 lore raw

Re: [RFC PATCH v2 2/3] of: Add support for -@ when compiling overlays

Quoted 2 lines · Detlev Casanova

This commit adds an option to compile all device trees with -@ to add the symbol table to the Device Tree Blobs.

Why would we want to tie this to the kernel config?

Globally enabling it has already been discussed and rejected.

Quoted 9 lines

It prepares the introduction of device tree overlays that are not applied on device trees at compile time (dtbo files.)

These device tree overlays will be used by either a bootloader or a linux userspace tool to extend the base device tree.

This is used e.g. for drivers that need device tree nodes for optional non plug and play devices, like an external DSI touchscreen panel that embeds different i2c devices to control it.

You can already set DTC_FLAGS per directory (and target?), so enable it for the dtbs that have overlays.

Quoted 6 lines
---
 drivers/of/Kconfig   | 8 ++++++++
 scripts/Makefile.lib | 9 +++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
#4 lore raw

Re: [RFC PATCH v2 2/3] of: Add support for -@ when compiling overlays

Quoted 14 lines · Rob Herring
Quoted 2 lines · Detlev Casanova

This commit adds an option to compile all device trees with -@ to add the symbol table to the Device Tree Blobs.

Why would we want to tie this to the kernel config?

Globally enabling it has already been discussed and rejected.

Quoted 6 lines

It prepares the introduction of device tree overlays that are not applied on device trees at compile time (dtbo files.)

These device tree overlays will be used by either a bootloader or a linux userspace tool to extend the base device tree.

Quoted 6 lines
Quoted 3 lines

This is used e.g. for drivers that need device tree nodes for optional non plug and play devices, like an external DSI touchscreen panel that embeds different i2c devices to control it.

You can already set DTC_FLAGS per directory (and target?), so enable it for the dtbs that have overlays.

Looks like this patch series from Aurelien should take care of that:

https://lore.kernel.org/linux-arm-kernel/20220427233607.1225419-1-
[email protected]/

Signature · 1 line
Florian
#5 lore raw

RFC PATCH v2 3/3 ARM: dto: Add bcm2711-rpi-7-inches-ts.dts overlay

In reply to Detlev Casanova

Add a device tree overlay to support the official Raspberrypi 7" touchscreen for the bcm2711 devices.

The panel is connected on the DSI 1 port and uses the simple-panel driver.

The device tree also makes sure to activate the pixelvalve[0-4] CRTC modules

---
 arch/arm/boot/dts/Makefile                    |   4 +
 arch/arm/boot/dts/overlays/Makefile           |   3 +
 .../dts/overlays/bcm2711-rpi-7-inches-ts.dts  | 125 ++++++++++++++++++
 arch/arm64/boot/dts/broadcom/Makefile         |   4 +
 .../arm64/boot/dts/broadcom/overlays/Makefile |   3 +
 .../overlays/bcm2711-rpi-7-inches-ts.dts      |   2 +
 6 files changed, 141 insertions(+)
 create mode 100644 arch/arm/boot/dts/overlays/Makefile
 create mode 100644 arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/overlays/Makefile
 create mode 100644 arch/arm64/boot/dts/broadcom/overlays/bcm2711-rpi-7-inches-ts.dts
arch/arm/boot/dts/Makefile +4 -0
index 235ad559acb2..eb0b0b121947 100644
@@ -1549,3 +1549,7 @@ dtb-$(CONFIG_ARCH_ASPEED) += \
 	aspeed-bmc-vegman-n110.dtb \
 	aspeed-bmc-vegman-rx20.dtb \
 	aspeed-bmc-vegman-sx20.dtb
+
+ifeq ($(CONFIG_OF_OVERLAY),y)
+subdir-y	+= overlays
+endif
arch/arm/boot/dts/overlays/Makefile new file +3 -0
new file mode 100644
index 000000000000..c90883dfaf91
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-7-inches-ts.dtbo
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +125 -0

125 lines not on this page · raw message

arch/arm64/boot/dts/broadcom/Makefile +4 -0
index c6882032a428..a6c43c5b053a 100644
@@ -7,6 +7,10 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \
 			      bcm2837-rpi-3-b-plus.dtb \
 			      bcm2837-rpi-cm3-io3.dtb
 
+ifeq ($(CONFIG_OF_OVERLAY),y)
+subdir-y	+= overlays
+endif
+
 subdir-y	+= bcm4908
 subdir-y	+= northstar2
 subdir-y	+= stingray
arch/arm64/boot/dts/broadcom/overlays/Makefile new file +3 -0
new file mode 100644
index 000000000000..c90883dfaf91
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-7-inches-ts.dtbo
arch/arm64/boot/dts/broadcom/overlays/bcm2711-rpi-7-inches-ts.dts new file +2 -0
new file mode 100644
index 000000000000..7d532b090305
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "arm/overlays/bcm2711-rpi-7-inches-ts.dts"
Signature · 1 line
2.36.0
maintainer
#6 lore raw

Re: [RFC PATCH v2 3/3] ARM: dto: Add bcm2711-rpi-7-inches-ts.dts overlay

Quoted 6 lines · Detlev Casanova

Add a device tree overlay to support the official Raspberrypi 7" touchscreen for the bcm2711 devices.

The panel is connected on the DSI 1 port and uses the simple-panel driver.

Quoted 7 lines

The device tree also makes sure to activate the pixelvalve[0-4] CRTC modules

---
 arch/arm/boot/dts/Makefile                    |   4 +
 arch/arm/boot/dts/overlays/Makefile           |   3 +
 .../dts/overlays/bcm2711-rpi-7-inches-ts.dts  | 125 ++++++++++++++++++

.dtso is preferred. I think... It was discussed, but I never got an updated patch to switch.

Quoted 6 lines
 arch/arm64/boot/dts/broadcom/Makefile         |   4 +
 .../arm64/boot/dts/broadcom/overlays/Makefile |   3 +
 .../overlays/bcm2711-rpi-7-inches-ts.dts      |   2 +
 6 files changed, 141 insertions(+)
 create mode 100644 arch/arm/boot/dts/overlays/Makefile
 create mode 100644 arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts

A global (to arm) 'overlays' directory will create the same mess that we have in arch/arm/boot/dts/. IMO, first you should move all the Broadcom dts files to a 'broadcom' subdirectory like we have for arm64.

Quoted 8 lines
 create mode 100644 arch/arm64/boot/dts/broadcom/overlays/Makefile
 create mode 100644 arch/arm64/boot/dts/broadcom/overlays/bcm2711-rpi-7-inches-ts.dts
arch/arm/boot/dts/Makefile +0 -0
index 235ad559acb2..eb0b0b121947 100644

arch/arm/boot/dts/Makefile dtb-$(CONFIG_ARCH_ASPEED) += \ · line 1554

Quoted 6 lines
arch/arm/boot/dts/Makefile +3 -0
@@ -1549,3 +1549,7 @@ dtb-$(CONFIG_ARCH_ASPEED) += \
 	aspeed-bmc-vegman-n110.dtb \
 	aspeed-bmc-vegman-rx20.dtb \
 	aspeed-bmc-vegman-sx20.dtb
+
+ifeq ($(CONFIG_OF_OVERLAY),y)
+subdir-y	+= overlays

I don't think this should depend on the config. If it does, you can do this in scripts/Makefile.lib by removing .dtbo targets. Or this could have been just:

subdir-$(CONFIG_OF_OVERLAY) += overlays

But I prefer the former so each platform is not picking their own way.

arch/arm/boot/dts/overlays/Makefile line 3

Quoted 10 lines
arch/arm/boot/dts/Makefile +1 -0
+endif
arch/arm/boot/dts/overlays/Makefile new file +3 -0
new file mode 100644
index 000000000000..c90883dfaf91
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-7-inches-ts.dtbo

The overlays should be applied to the base dtb(s) to ensure they actually apply and so we can validate them with schema. kbuild supports this already.

arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts line 1

Quoted 8 lines
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +1 -0
new file mode 100644
index 000000000000..de98a6c1079a
@@ -0,0 +1,125 @@
+// SPDX-License-Identifier: GPL-2.0

No one uses RPi with *BSD? Dual licensing is preferred. Of course, what this applies to should have similar licensing.

arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts line 10

Quoted 9 lines
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +9 -0
+
+/dts-v1/;
+/plugin/;
+
+&{/} {
+	#address-cells = <2>;
+	#size-cells = <1>;
+
+	panel_disp1: panel@0 {

What is '0' representing?

arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts line 15

Quoted 5 lines
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +5 -0
+		reg = <0 0 0>;
+		compatible = "raspberrypi,7inch-dsi", "simple-panel";
+		backlight = <&reg_display>;
+		power-supply = <&reg_display>;
+		status = "okay";

That's the default. Same thing in a few other spots.

arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts line 24

Quoted 9 lines
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +9 -0
+
+		port {
+			panel_in: endpoint {
+				remote-endpoint = <&bridge_out>;
+			};
+		};
+	};
+
+	reg_bridge: regulator@0 {

Oops! 2 different things at the same address!

arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts line 25

Quoted 1 line
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +1 -0
+		reg = <0 0 0>;

'regulator-fixed' doesn't have an address.

Quoted 25 lines
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +25 -0
+		compatible = "regulator-fixed";
+		regulator-name = "bridge_reg";
+		gpio = <&reg_display 0 0>;
+		vin-supply = <&reg_display>;
+		enable-active-high;
+		status = "okay";
+	};
+};
+
+&i2c_csi_dsi {
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	ft5406: touchscreen@38 {
+		compatible = "edt,edt-ft5506";
+		reg = <0x38>;
+		status = "okay";
+
+		vcc-supply = <&reg_display>;
+		reset-gpio = <&reg_display 1 1>;
+
+		touchscreen-size-x = < 800 >;
+		touchscreen-size-y = < 480 >;
+
+		touchscreen-inverted-x;

arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts line 60

Quoted 10 lines
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +10 -0
+		touchscreen-inverted-y;
+	};
+
+	reg_display: regulator@45 {
+		compatible = "raspberrypi,7inch-touchscreen-panel-regulator";
+		reg = <0x45>;
+		status = "okay";
+
+		gpio-controller;
+		#gpio-cells = <2>;

The regulator is a gpio-controller?

Quoted 10 lines
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +10 -0
+	};
+
+};
+
+&dsi1 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	status = "okay";
+

arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts line 79

Quoted 10 lines
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +9 -0
+	port {
+		dsi_out: endpoint {
+			remote-endpoint = <&bridge_in>;
+		};
+	};
+
+	bridge@0 {
 
+		#address-cells = <1>;
+		#size-cells = <0>;

Not valid here. But I shouldn't have to tell you this as the schema checks will. Please run them. Applied to a base should work for sure. As just a .dtbo, there's probably some issues, but complete nodes like this should validate fine.

Quoted 46 lines
arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts new file +46 -0
+
+		reg = <0>;
+		compatible = "toshiba,tc358762";
+
+		vddc-supply = <&reg_bridge>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				bridge_in: endpoint {
+					remote-endpoint = <&dsi_out>;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				bridge_out: endpoint {
+					remote-endpoint = <&panel_in>;
+				};
+			};
+		};
+	};
+};
+
+&pixelvalve0 {
+	status = "okay";
+};
+
+&pixelvalve1 {
+	status = "okay";
+};
+
+&pixelvalve2 {
+	status = "okay";
+};
+
+&pixelvalve3 {
+	status = "okay";
+};
+
+&pixelvalve4 {
+	status = "okay";
+};
#7 lore raw

Re: [RFC PATCH v2 3/3] ARM: dto: Add bcm2711-rpi-7-inches-ts.dts overlay

Hi Rob,

Quoted 9 lines · Rob Herring
Quoted 8 lines · Detlev Casanova

Add a device tree overlay to support the official Raspberrypi 7" touchscreen for the bcm2711 devices.

The panel is connected on the DSI 1 port and uses the simple-panel driver.

The device tree also makes sure to activate the pixelvalve[0-4] CRTC modules

Quoted 8 lines
Quoted 5 lines
---
 arch/arm/boot/dts/Makefile                    |   4 +
 arch/arm/boot/dts/overlays/Makefile           |   3 +
 .../dts/overlays/bcm2711-rpi-7-inches-ts.dts  | 125 ++++++++++++++++++

.dtso is preferred. I think... It was discussed, but I never got an updated patch to switch.

Unfortunately that switch indeed hasn't happened yet.
My main gripe with .dts for overlays is that you cannot know whether it's an overlay or not without reading the file's contents. Hence tools like make also cannot know, and you need to e.g. list all files explicitly in a Makefile.

Quoted 10 lines
Quoted 6 lines
 arch/arm64/boot/dts/broadcom/Makefile         |   4 +
 .../arm64/boot/dts/broadcom/overlays/Makefile |   3 +
 .../overlays/bcm2711-rpi-7-inches-ts.dts      |   2 +
 6 files changed, 141 insertions(+)
 create mode 100644 arch/arm/boot/dts/overlays/Makefile
 create mode 100644 arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts

A global (to arm) 'overlays' directory will create the same mess that we have in arch/arm/boot/dts/. IMO, first you should move all the Broadcom dts files to a 'broadcom' subdirectory like we have for arm64.

As I believe this display is not only used with real Raspberry Pi devices, it makes sense to not have it a broadcom directory. In fact it may be used on other architectures than arm, too, so I think we need an arch-agnostic directory for overlays[1]? This may need remapping of labels. I'm aware the rpi infrastructure has support for remapping labels when applying overlays during boot, but AFAIK this is not yet supported by fdtoverlay (or perhaps by a fork?)? Note that the remapping is also needed if you want to apply two instances of the same overlay.

Quoted 2 lines
Quoted 2 lines
 create mode 100644 arch/arm64/boot/dts/broadcom/overlays/Makefile
 create mode 100644 arch/arm64/boot/dts/broadcom/overlays/bcm2711-rpi-7-inches-ts.dts

And this one just includes the former, and thus sort-of serves as an example of my point above ;-)

[1] Note that this does not only apply to overlays: soon we will have a full SoC peripheral description in r9a07g043.dtsi to share between RZ/G2UL (arm64) and RZ/Five (riscv)).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer
#8 lore raw

Re: [RFC PATCH v2 3/3] ARM: dto: Add bcm2711-rpi-7-inches-ts.dts overlay

Quoted 18 lines · Geert Uytterhoeven

Hi Rob,

Quoted 15 lines · Rob Herring
Quoted 13 lines · Detlev Casanova

Add a device tree overlay to support the official Raspberrypi 7" touchscreen for the bcm2711 devices.

The panel is connected on the DSI 1 port and uses the simple-panel driver.

The device tree also makes sure to activate the pixelvalve[0-4] CRTC modules

---
 arch/arm/boot/dts/Makefile                    |   4 +
 arch/arm/boot/dts/overlays/Makefile           |   3 +
 .../dts/overlays/bcm2711-rpi-7-inches-ts.dts  | 125 ++++++++++++++++++
Quoted 8 lines
Quoted 2 lines

.dtso is preferred. I think... It was discussed, but I never got an updated patch to switch.

Unfortunately that switch indeed hasn't happened yet.
My main gripe with .dts for overlays is that you cannot know whether it's an overlay or not without reading the file's contents. Hence tools like make also cannot know, and you need to e.g. list all files explicitly in a Makefile.

See my reply in the other thread for that.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
 arch/arm64/boot/dts/broadcom/Makefile         |   4 +
 .../arm64/boot/dts/broadcom/overlays/Makefile |   3 +
 .../overlays/bcm2711-rpi-7-inches-ts.dts      |   2 +
 6 files changed, 141 insertions(+)
 create mode 100644 arch/arm/boot/dts/overlays/Makefile
 create mode 100644 arch/arm/boot/dts/overlays/bcm2711-rpi-7-inches-ts.dts
Quoted 6 lines
Quoted 3 lines

A global (to arm) 'overlays' directory will create the same mess that we have in arch/arm/boot/dts/. IMO, first you should move all the Broadcom dts files to a 'broadcom' subdirectory like we have for arm64.

As I believe this display is not only used with real Raspberry Pi devices, it makes sense to not have it a broadcom directory.

Then at a minimum 'bcm2711' in the name is not appropriate.

I'm doubtful that as-is the overlay would apply to boards outside of RPi's. For this to work (well), there needs to be a connector node to translate between connector resources and the base board resources. See the recent mikrobus thread[2].

Quoted 2 lines

In fact it may be used on other architectures than arm, too, so I think we need an arch-agnostic directory for overlays[1]?

Probably so.

Personally, I would prefer no DTs under /arch.

Quoted 5 lines

This may need remapping of labels. I'm aware the rpi infrastructure has support for remapping labels when applying overlays during boot, but AFAIK this is not yet supported by fdtoverlay (or perhaps by a fork?)? Note that the remapping is also needed if you want to apply two instances of the same overlay.

First I've heard of label remapping... I have a lot of concerns about using labels for overlays. For starters, with a flip of a switch (-@), they all become an ABI when they were not previously. I think at a minimum, we need an annotation so that a subset can be exported. Anything that's an ABI, we should be documenting and reviewing.

The requirement for overlays upstream is that they are applied at build time to a base DT. Otherwise, we can't validate them completely. So if there's a label remapping dependency on these, sounds like there is some more work to do. The first being getting agreement that label remapping is the right approach.

Common label names or some remapping for targets kind of works, but easily falls apart. For example, GPIO (or any provider with identifier cells) numbering or SPI CS numbering would be different.

Rob

[2] https://lore.kernel.org/all/YmFo+EntwxIsco%[email protected]/