From 2c62d430b6b3c20867e55465e0557a1543088f09 Mon Sep 17 00:00:00 2001
From: Eric Anholt <eric@anholt.net>
Date: Thu, 2 Jun 2016 15:09:35 -0700
Subject: [PATCH] BCM270X: Enable the DSI panel node in the VC4 overlay.

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts           |  5 ++++
 arch/arm/boot/dts/bcm2708-rpi-b.dts                |  5 ++++
 arch/arm/boot/dts/bcm2709-rpi-2-b.dts              |  5 ++++
 arch/arm/boot/dts/bcm270x.dtsi                     | 27 ++++++++++++++++++++++
 arch/arm/boot/dts/bcm2710-rpi-3-b.dts              |  5 ++++
 arch/arm/boot/dts/bcm2710.dtsi                     |  1 -
 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 22 ++++++++++++++++++
 7 files changed, 69 insertions(+), 1 deletion(-)

--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
@@ -154,3 +154,8 @@
 		sd_debug     = <&sdhost>,"brcm,debug";
 	};
 };
+
+&i2c_dsi {
+	gpios = <&gpio 28 0
+		 &gpio 29 0>;
+};
--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts
@@ -144,3 +144,8 @@
 		sd_debug     = <&sdhost>,"brcm,debug";
 	};
 };
+
+&i2c_dsi {
+	gpios = <&gpio 2 0
+		 &gpio 3 0>;
+};
--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
@@ -154,3 +154,8 @@
 		sd_debug     = <&sdhost>,"brcm,debug";
 	};
 };
+
+&i2c_dsi {
+	gpios = <&gpio 28 0
+		 &gpio 29 0>;
+};
--- a/arch/arm/boot/dts/bcm270x.dtsi
+++ b/arch/arm/boot/dts/bcm270x.dtsi
@@ -137,6 +137,29 @@
 			/* Add alias */
 			status = "disabled";
 		};
+
+		i2c_dsi: i2cdsi {
+			/* We have to use i2c-gpio because the
+			 * firmware is also polling another device
+			 * using the only hardware I2C bus that could
+			 * connect to these pins.
+			 */
+			compatible = "i2c-gpio";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+
+			pitouchscreen_bridge: bridge@45 {
+				compatible = "raspberrypi,touchscreen-bridge-i2c";
+				reg = <0x45>;
+			};
+
+			pitouchscreen_touch: bridge@38 {
+				compatible = "raspberrypi,touchscreen-ts-i2c";
+				reg = <0x38>;
+			};
+		};
+
 	};
 
 	vdd_5v0_reg: fixedregulator_5v0 {
@@ -155,3 +178,7 @@
 		regulator-always-on;
 	};
 };
+
+&dsi1 {
+	power-domains = <&power RPI_POWER_DOMAIN_DSI1>;
+};
--- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
@@ -201,3 +201,8 @@
 		sd_debug     = <&sdhost>,"brcm,debug";
 	};
 };
+
+&i2c_dsi {
+	gpios = <&gpio 44 0
+		 &gpio 45 0>;
+};
--- a/arch/arm/boot/dts/bcm2710.dtsi
+++ b/arch/arm/boot/dts/bcm2710.dtsi
@@ -145,4 +145,3 @@
 	interrupt-parent = <&local_intc>;
 	interrupts = <8>;
 };
-
--- a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts
+++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts
@@ -126,6 +126,28 @@
 		};
 	};
 
+	fragment@16 {
+		target = <&dsi1>;
+		__overlay__  {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			pitouchscreen: panel@0 {
+				compatible = "raspberrypi,touchscreen";
+				reg = <0>;
+				raspberrypi,touchscreen-bridge = <&pitouchscreen_bridge>;
+			};
+		};
+	};
+
+	fragment@17 {
+		target = <&i2c_dsi>;
+		__overlay__  {
+			status = "okay";
+		};
+	};
+
 	__overrides__ {
 		cma-256 = <0>,"+0-1-2-3-4";
 		cma-192 = <0>,"-0+1-2-3-4";