devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
@ 2019-11-25 13:10 Tomi Valkeinen
  2019-11-25 13:10 ` [PATCH 2/4] ARM: dts: am437x-epos-evm: " Tomi Valkeinen
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Tomi Valkeinen @ 2019-11-25 13:10 UTC (permalink / raw)
  To: linux-omap, devicetree, tony
  Cc: robh+dt, mark.rutland, dri-devel, Tomi Valkeinen

Add HDMI support for AM437x GP EVM. The HDMI uses SiI9022 HDMI encoder,
and is mutually exclusive with the LCD. The choice between LCD and HDMI
is made by booting either with am437x-gp-evm.dtb or
am437x-gp-evm-hdmi.dtb.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/boot/dts/Makefile               |   1 +
 arch/arm/boot/dts/am437x-gp-evm-hdmi.dts | 112 +++++++++++++++++++++++
 2 files changed, 113 insertions(+)
 create mode 100644 arch/arm/boot/dts/am437x-gp-evm-hdmi.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index b21b3a64641a..612149069180 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -779,6 +779,7 @@ dtb-$(CONFIG_SOC_AM43XX) += \
 	am43x-epos-evm.dtb \
 	am437x-cm-t43.dtb \
 	am437x-gp-evm.dtb \
+	am437x-gp-evm-hdmi.dtb \
 	am437x-idk-evm.dtb \
 	am437x-sbc-t43.dtb \
 	am437x-sk-evm.dtb
diff --git a/arch/arm/boot/dts/am437x-gp-evm-hdmi.dts b/arch/arm/boot/dts/am437x-gp-evm-hdmi.dts
new file mode 100644
index 000000000000..580a1e3e0dcd
--- /dev/null
+++ b/arch/arm/boot/dts/am437x-gp-evm-hdmi.dts
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+/* AM437x GP EVM with HDMI output */
+
+#include "am437x-gp-evm.dts"
+
+/delete-node/ &lcd0;
+
+/ {
+	aliases {
+		display0 = &hdmi;
+	};
+
+	hdmi: connector {
+		compatible = "hdmi-connector";
+		label = "hdmi";
+
+		type = "b";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = <&sii9022_out>;
+			};
+		};
+	};
+
+	sound@1 {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "HDMI";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,bitclock-master = <&hdmi_dailink_master>;
+		simple-audio-card,frame-master = <&hdmi_dailink_master>;
+		hdmi_dailink_master: simple-audio-card,cpu {
+			sound-dai = <&mcasp1>;
+			system-clock-frequency = <24000000>;
+			system-clock-direction-out;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&sii9022>;
+		};
+	};
+
+	sii9022_mclk: sii9022_mclk {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <12000000>;
+	};
+};
+
+&lcd_bl {
+	status = "disabled";
+};
+
+&sound0 {
+	status = "disabled";
+};
+
+&tlv320aic3106 {
+	status = "disabled";
+};
+
+&i2c1 {
+	sii9022: sii9022@3b {
+		#sound-dai-cells = <0>;
+		compatible = "sil,sii9022";
+		reg = <0x3b>;
+
+		interrupt-parent = <&gpio3>;
+		interrupts = <24 IRQ_TYPE_LEVEL_LOW>;
+
+		sil,i2s-data-lanes = < 0 >;
+		clocks = <&sii9022_mclk>;
+		clock-names = "mclk";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+
+				sii9022_in: endpoint {
+					remote-endpoint = <&dpi_out>;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+
+				sii9022_out: endpoint {
+					remote-endpoint = <&hdmi_connector_in>;
+				};
+			};
+		};
+	};
+};
+
+&dpi_out {
+	remote-endpoint = <&sii9022_in>;
+	data-lines = <24>;
+};
+
+/* Override SelLCDorHDMI from am437x-gp-evm.dts to select HDMI */
+&gpio5 {
+	p8 {
+		output-low;
+	};
+};
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/4] ARM: dts: am437x-epos-evm: add HDMI support
  2019-11-25 13:10 [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support Tomi Valkeinen
@ 2019-11-25 13:10 ` Tomi Valkeinen
  2019-11-25 13:10 ` [PATCH 3/4] ARM: dts: dra76-evm: add HDMI output Tomi Valkeinen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Tomi Valkeinen @ 2019-11-25 13:10 UTC (permalink / raw)
  To: linux-omap, devicetree, tony
  Cc: robh+dt, mark.rutland, dri-devel, Jyri Sarha, Tomi Valkeinen

From: Jyri Sarha <jsarha@ti.com>

Add HDMI support for AM43x EPOS EVM. The HDMI uses SiI9022 HDMI
encoder for audio and display, and it is mutually exclusive with the
LCD and analogue audio. The choice between LCD + analogue audio and
HDMI + HDMI-audio is made by booting either with am43x-epos-evm.dtb or
am43x-epos-evm-hdmi.dtb.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/boot/dts/Makefile                |   1 +
 arch/arm/boot/dts/am43x-epos-evm-hdmi.dts | 120 ++++++++++++++++++++++
 2 files changed, 121 insertions(+)
 create mode 100644 arch/arm/boot/dts/am43x-epos-evm-hdmi.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 612149069180..43ba465596ad 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -777,6 +777,7 @@ dtb-$(CONFIG_ARCH_OMAP4) += \
 	omap4-var-stk-om44.dtb
 dtb-$(CONFIG_SOC_AM43XX) += \
 	am43x-epos-evm.dtb \
+	am43x-epos-evm-hdmi.dtb \
 	am437x-cm-t43.dtb \
 	am437x-gp-evm.dtb \
 	am437x-gp-evm-hdmi.dtb \
diff --git a/arch/arm/boot/dts/am43x-epos-evm-hdmi.dts b/arch/arm/boot/dts/am43x-epos-evm-hdmi.dts
new file mode 100644
index 000000000000..314e9e8c513c
--- /dev/null
+++ b/arch/arm/boot/dts/am43x-epos-evm-hdmi.dts
@@ -0,0 +1,120 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+/* AM437x EPOS EVM with HDMI output */
+
+#include "am43x-epos-evm.dts"
+
+/delete-node/ &lcd0;
+
+/ {
+	aliases {
+		display0 = &hdmi;
+	};
+
+	hdmi: connector {
+		compatible = "hdmi-connector";
+		label = "hdmi";
+
+		type = "b";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = <&sii9022_out>;
+			};
+		};
+	};
+
+	sound@1 {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "HDMI";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,bitclock-master = <&hdmi_dailink_master>;
+		simple-audio-card,frame-master = <&hdmi_dailink_master>;
+		hdmi_dailink_master: simple-audio-card,cpu {
+			sound-dai = <&mcasp1>;
+			system-clock-frequency = <24000000>;
+			system-clock-direction-out;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&sii9022>;
+		};
+	};
+
+	sii9022_mclk: sii9022_mclk {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <12000000>;
+	};
+};
+
+&lcd_bl {
+	status = "disabled";
+};
+
+&sound0 {
+	status = "disabled";
+};
+
+&tlv320aic3111 {
+	status = "disabled";
+};
+
+&am43xx_pinmux {
+	sii9022_pins: sii9022_pins {
+		pinctrl-single,pins = <
+			AM4372_IOPAD(0x848, PIN_INPUT | MUX_MODE7)	/* gpmc_a2.gpio1_18 */
+		>;
+	};
+};
+
+&i2c2 {
+	sii9022: sii9022@3b {
+		#sound-dai-cells = <0>;
+		compatible = "sil,sii9022";
+		reg = <0x3b>;
+
+		interrupt-parent = <&gpio1>;
+		interrupts = <18 IRQ_TYPE_LEVEL_LOW>;
+
+		sil,i2s-data-lanes = < 0 >;
+		clocks = <&sii9022_mclk>;
+		clock-names = "mclk";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+
+				sii9022_in: endpoint {
+					remote-endpoint = <&dpi_out>;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+
+				sii9022_out: endpoint {
+					remote-endpoint = <&hdmi_connector_in>;
+				};
+			};
+		};
+	};
+};
+
+&dpi_out {
+	remote-endpoint = <&sii9022_in>;
+	data-lines = <24>;
+};
+
+/* Override SelLCDorHDMI from am437x-epos-evm.dts to select HDMI */
+&gpio2 {
+	p1 {
+		output-low;
+	};
+};
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/4] ARM: dts: dra76-evm: add HDMI output
  2019-11-25 13:10 [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support Tomi Valkeinen
  2019-11-25 13:10 ` [PATCH 2/4] ARM: dts: am437x-epos-evm: " Tomi Valkeinen
@ 2019-11-25 13:10 ` Tomi Valkeinen
  2019-11-25 13:11 ` [PATCH 4/4] ARM: dts: am57xx-idk-common: add HDMI to the common dtsi Tomi Valkeinen
  2019-12-12 17:21 ` [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support Tony Lindgren
  3 siblings, 0 replies; 15+ messages in thread
From: Tomi Valkeinen @ 2019-11-25 13:10 UTC (permalink / raw)
  To: linux-omap, devicetree, tony
  Cc: robh+dt, mark.rutland, dri-devel, Tomi Valkeinen

Add DRA76 EVM HDMI output for the base board.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/boot/dts/dra76-evm.dts | 66 +++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/arch/arm/boot/dts/dra76-evm.dts b/arch/arm/boot/dts/dra76-evm.dts
index 1fb6f13fb5e2..86a3e79909a8 100644
--- a/arch/arm/boot/dts/dra76-evm.dts
+++ b/arch/arm/boot/dts/dra76-evm.dts
@@ -13,6 +13,13 @@
 	model = "TI DRA762 EVM";
 	compatible = "ti,dra76-evm", "ti,dra762", "ti,dra7";
 
+	aliases {
+		display0 = &hdmi0;
+
+		sound0 = &sound0;
+		sound1 = &hdmi;
+	};
+
 	memory@0 {
 		device_type = "memory";
 		reg = <0x0 0x80000000 0x0 0x80000000>;
@@ -116,6 +123,48 @@
 		regulator-min-microvolt = <1800000>;
 		regulator-max-microvolt = <1800000>;
 	};
+
+	hdmi0: connector {
+		compatible = "hdmi-connector";
+		label = "hdmi";
+
+		type = "a";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = <&tpd12s015_out>;
+			};
+		};
+	};
+
+	tpd12s015: encoder {
+		compatible = "ti,tpd12s015";
+
+		gpios = <&gpio7 30 GPIO_ACTIVE_HIGH>,   /* gpio7_30, CT CP HPD */
+			<&gpio7 31 GPIO_ACTIVE_HIGH>,   /* gpio7_31, LS OE */
+			<&gpio7 12 GPIO_ACTIVE_HIGH>;   /* gpio7_12/sp1_cs2, HPD */
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+
+				tpd12s015_in: endpoint {
+					remote-endpoint = <&hdmi_out>;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+
+				tpd12s015_out: endpoint {
+					remote-endpoint = <&hdmi_connector_in>;
+				};
+			};
+		};
+	};
 };
 
 &i2c1 {
@@ -411,6 +460,23 @@
 	phy-supply = <&ldo3_reg>;
 };
 
+&dss {
+	status = "ok";
+	vdda_video-supply = <&ldo5_reg>;
+};
+
+&hdmi {
+	status = "ok";
+
+	vdda-supply = <&ldo1_reg>;
+
+	port {
+		hdmi_out: endpoint {
+			remote-endpoint = <&tpd12s015_in>;
+		};
+	};
+};
+
 &qspi {
 	spi-max-frequency = <96000000>;
 	m25p80@0 {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/4] ARM: dts: am57xx-idk-common: add HDMI to the common dtsi
  2019-11-25 13:10 [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support Tomi Valkeinen
  2019-11-25 13:10 ` [PATCH 2/4] ARM: dts: am437x-epos-evm: " Tomi Valkeinen
  2019-11-25 13:10 ` [PATCH 3/4] ARM: dts: dra76-evm: add HDMI output Tomi Valkeinen
@ 2019-11-25 13:11 ` Tomi Valkeinen
  2019-12-12 17:21 ` [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support Tony Lindgren
  3 siblings, 0 replies; 15+ messages in thread
From: Tomi Valkeinen @ 2019-11-25 13:11 UTC (permalink / raw)
  To: linux-omap, devicetree, tony
  Cc: robh+dt, mark.rutland, dri-devel, Tomi Valkeinen

AM571x/AM572x/AM574x IDK base boards have HDMI output. Add DT nodes to
am57xx-idk-common.dtsi to enable HDMI.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/boot/dts/am57xx-idk-common.dtsi | 59 ++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/arch/arm/boot/dts/am57xx-idk-common.dtsi b/arch/arm/boot/dts/am57xx-idk-common.dtsi
index 423855a2a2d6..a9c8f2859aea 100644
--- a/arch/arm/boot/dts/am57xx-idk-common.dtsi
+++ b/arch/arm/boot/dts/am57xx-idk-common.dtsi
@@ -9,6 +9,7 @@
 	aliases {
 		rtc0 = &tps659038_rtc;
 		rtc1 = &rtc;
+		display0 = &hdmi0;
 	};
 
 	chosen {
@@ -96,6 +97,48 @@
 			default-state = "off";
 		};
 	};
+
+	hdmi0: connector@0 {
+		compatible = "hdmi-connector";
+		label = "hdmi";
+
+		type = "a";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = <&tpd12s015_out>;
+			};
+		};
+	};
+
+	tpd12s015: encoder@0 {
+		compatible = "ti,tpd12s016", "ti,tpd12s015";
+
+		gpios = <0>, /* optional CT_CP_HPD */
+			<0>, /* optional LS_OE */
+			<&gpio7 12 GPIO_ACTIVE_HIGH>;	/* HPD */
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+
+				tpd12s015_in: endpoint@0 {
+					remote-endpoint = <&hdmi_out>;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+
+				tpd12s015_out: endpoint@0 {
+					remote-endpoint = <&hdmi_connector_in>;
+				};
+			};
+		};
+	};
 };
 
 &dra7_pmx_core {
@@ -490,3 +533,19 @@
 &cpu0 {
 	vdd-supply = <&smps12_reg>;
 };
+
+&hdmi {
+	status = "okay";
+
+	vdda-supply = <&ldo4_reg>;
+
+	port {
+		hdmi_out: endpoint {
+			remote-endpoint = <&tpd12s015_in>;
+		};
+	};
+};
+
+&dss {
+	status = "okay";
+};
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-11-25 13:10 [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support Tomi Valkeinen
                   ` (2 preceding siblings ...)
  2019-11-25 13:11 ` [PATCH 4/4] ARM: dts: am57xx-idk-common: add HDMI to the common dtsi Tomi Valkeinen
@ 2019-12-12 17:21 ` Tony Lindgren
  2019-12-12 17:31   ` Tony Lindgren
  3 siblings, 1 reply; 15+ messages in thread
From: Tony Lindgren @ 2019-12-12 17:21 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, devicetree, robh+dt, mark.rutland, dri-devel

Hi,

* Tomi Valkeinen <tomi.valkeinen@ti.com> [191125 05:11]:
> Add HDMI support for AM437x GP EVM. The HDMI uses SiI9022 HDMI encoder,
> and is mutually exclusive with the LCD. The choice between LCD and HDMI
> is made by booting either with am437x-gp-evm.dtb or
> am437x-gp-evm-hdmi.dtb.

So Linux kernel needs a new board device tree file to toggle a GPIO line
to switch between LCD mode and HDMI?

That does not sound very user friendly for something that's supposed
to be hot pluggabe :)

> +/* Override SelLCDorHDMI from am437x-gp-evm.dts to select HDMI */
> +&gpio5 {
> +	p8 {
> +		output-low;
> +	};
> +};

How about just leave the gpio unconfigured and document that a userspace
tool or /sys/kernel/debug/gpio is needed to toggle between the modes?

Regards,

Tony

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-12-12 17:21 ` [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support Tony Lindgren
@ 2019-12-12 17:31   ` Tony Lindgren
  2019-12-13  9:24     ` Tomi Valkeinen
  2019-12-13 12:36     ` Tomi Valkeinen
  0 siblings, 2 replies; 15+ messages in thread
From: Tony Lindgren @ 2019-12-12 17:31 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: linux-omap, devicetree, robh+dt, mark.rutland, dri-devel, Linus Walleij

* Tony Lindgren <tony@atomide.com> [191212 17:21]:
> Hi,
> 
> * Tomi Valkeinen <tomi.valkeinen@ti.com> [191125 05:11]:
> > Add HDMI support for AM437x GP EVM. The HDMI uses SiI9022 HDMI encoder,
> > and is mutually exclusive with the LCD. The choice between LCD and HDMI
> > is made by booting either with am437x-gp-evm.dtb or
> > am437x-gp-evm-hdmi.dtb.
> 
> So Linux kernel needs a new board device tree file to toggle a GPIO line
> to switch between LCD mode and HDMI?
> 
> That does not sound very user friendly for something that's supposed
> to be hot pluggabe :)
> 
> > +/* Override SelLCDorHDMI from am437x-gp-evm.dts to select HDMI */
> > +&gpio5 {
> > +	p8 {
> > +		output-low;
> > +	};
> > +};
> 
> How about just leave the gpio unconfigured and document that a userspace
> tool or /sys/kernel/debug/gpio is needed to toggle between the modes?

Adding also Linus Walleij to Cc in case he has some ideas here.

Anyways, I'm applying the changes to dra76-evm am57xx-idk-common
into omap-for-v5.6/dt as they have no GPIO pin limitation.

I'd like to hear comments from folks on the first two though.

Regards,

Tony

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-12-12 17:31   ` Tony Lindgren
@ 2019-12-13  9:24     ` Tomi Valkeinen
  2019-12-13 10:42       ` Laurent Pinchart
  2019-12-13 12:36     ` Tomi Valkeinen
  1 sibling, 1 reply; 15+ messages in thread
From: Tomi Valkeinen @ 2019-12-13  9:24 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-omap, devicetree, robh+dt, mark.rutland, dri-devel,
	Linus Walleij, Laurent Pinchart

On 12/12/2019 19:31, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [191212 17:21]:
>> Hi,
>>
>> * Tomi Valkeinen <tomi.valkeinen@ti.com> [191125 05:11]:
>>> Add HDMI support for AM437x GP EVM. The HDMI uses SiI9022 HDMI encoder,
>>> and is mutually exclusive with the LCD. The choice between LCD and HDMI
>>> is made by booting either with am437x-gp-evm.dtb or
>>> am437x-gp-evm-hdmi.dtb.
>>
>> So Linux kernel needs a new board device tree file to toggle a GPIO line
>> to switch between LCD mode and HDMI?
>>
>> That does not sound very user friendly for something that's supposed
>> to be hot pluggabe :)

True. We've had this for a long time in the TI kernel. I don't know how to implement this better, 
except perhaps with DT overlays, but that's essentially the same method.

>>> +/* Override SelLCDorHDMI from am437x-gp-evm.dts to select HDMI */
>>> +&gpio5 {
>>> +	p8 {
>>> +		output-low;
>>> +	};
>>> +};
>>
>> How about just leave the gpio unconfigured and document that a userspace
>> tool or /sys/kernel/debug/gpio is needed to toggle between the modes?

That sounds much worse than two dts files. How does X or weston know about the gpio?

And the "external" gpio wouldn't work well with DRM. We need to add all the displays at probe time, 
so we'd have LCD and HDMI. The gpio makes one of those operable, but only the external parts. The 
display controller has just one output, and we'd have a conflict there too as both displays would be 
connected to that single output. And as the display controller driver doesn't know about the gpio, 
it would fail "randomly" for one of the displays if the other one is already enabled by the userspace.

I think the correct way would be to have DRM framework understand that we have two displays, which 
are mutually exclusive, and the display pipeline drivers would have the means to switch the gpio. 
And that the display setup could be communicated properly to the userspace, and the userspace would 
understand it. I don't think any of those exists.

So, the only good solution I have figured out is to just say that we have a single display at 
runtime, defined by the dt file.

On some boards (k2g-evm, if I recall right) we have similar HW setup, but with a physical switch. We 
use the same method there, with two dts files. Again, if I recall right, the switch setting can be 
seen by the SW, so if there's a better solution to the AM4 case, probably similar could be used with 
k2g-evm, where the drivers would react to the user changing the switch.

  Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-12-13  9:24     ` Tomi Valkeinen
@ 2019-12-13 10:42       ` Laurent Pinchart
  2019-12-13 10:56         ` Tomi Valkeinen
  0 siblings, 1 reply; 15+ messages in thread
From: Laurent Pinchart @ 2019-12-13 10:42 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, linux-omap, devicetree, robh+dt, mark.rutland,
	dri-devel, Linus Walleij

Hi Tomi,

On Fri, Dec 13, 2019 at 11:24:02AM +0200, Tomi Valkeinen wrote:
> On 12/12/2019 19:31, Tony Lindgren wrote:
> > * Tony Lindgren <tony@atomide.com> [191212 17:21]:
> >> Hi,
> >>
> >> * Tomi Valkeinen <tomi.valkeinen@ti.com> [191125 05:11]:
> >>> Add HDMI support for AM437x GP EVM. The HDMI uses SiI9022 HDMI encoder,
> >>> and is mutually exclusive with the LCD. The choice between LCD and HDMI
> >>> is made by booting either with am437x-gp-evm.dtb or
> >>> am437x-gp-evm-hdmi.dtb.
> >>
> >> So Linux kernel needs a new board device tree file to toggle a GPIO line
> >> to switch between LCD mode and HDMI?
> >>
> >> That does not sound very user friendly for something that's supposed
> >> to be hot pluggabe :)
> 
> True. We've had this for a long time in the TI kernel. I don't know how to implement this better, 
> except perhaps with DT overlays, but that's essentially the same method.
> 
> >>> +/* Override SelLCDorHDMI from am437x-gp-evm.dts to select HDMI */
> >>> +&gpio5 {
> >>> +	p8 {
> >>> +		output-low;
> >>> +	};
> >>> +};
> >>
> >> How about just leave the gpio unconfigured and document that a userspace
> >> tool or /sys/kernel/debug/gpio is needed to toggle between the modes?
> 
> That sounds much worse than two dts files. How does X or weston know about the gpio?
> 
> And the "external" gpio wouldn't work well with DRM. We need to add all the displays at probe time, 
> so we'd have LCD and HDMI. The gpio makes one of those operable, but only the external parts. The 
> display controller has just one output, and we'd have a conflict there too as both displays would be 
> connected to that single output. And as the display controller driver doesn't know about the gpio, 
> it would fail "randomly" for one of the displays if the other one is already enabled by the userspace.
> 
> I think the correct way would be to have DRM framework understand that we have two displays, which 
> are mutually exclusive, and the display pipeline drivers would have the means to switch the gpio. 
> And that the display setup could be communicated properly to the userspace, and the userspace would 
> understand it. I don't think any of those exists.

Isn't this what possible_clones in drm_encoder is for ? It notifies
userspace of mutual exclusions between encoders.

> So, the only good solution I have figured out is to just say that we have a single display at 
> runtime, defined by the dt file.
> 
> On some boards (k2g-evm, if I recall right) we have similar HW setup, but with a physical switch. We 
> use the same method there, with two dts files. Again, if I recall right, the switch setting can be 
> seen by the SW, so if there's a better solution to the AM4 case, probably similar could be used with 
> k2g-evm, where the drivers would react to the user changing the switch.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-12-13 10:42       ` Laurent Pinchart
@ 2019-12-13 10:56         ` Tomi Valkeinen
  2019-12-13 11:42           ` Laurent Pinchart
  0 siblings, 1 reply; 15+ messages in thread
From: Tomi Valkeinen @ 2019-12-13 10:56 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, linux-omap, devicetree, robh+dt, mark.rutland,
	dri-devel, Linus Walleij

On 13/12/2019 12:42, Laurent Pinchart wrote:

>> I think the correct way would be to have DRM framework understand that we have two displays, which
>> are mutually exclusive, and the display pipeline drivers would have the means to switch the gpio.
>> And that the display setup could be communicated properly to the userspace, and the userspace would
>> understand it. I don't think any of those exists.
> 
> Isn't this what possible_clones in drm_encoder is for ? It notifies
> userspace of mutual exclusions between encoders.

Hmm, how would that work here? Isn't encoder cloning about having two encoders, which take the input 
from the same video source, and then outputting to two displays?

  Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-12-13 10:56         ` Tomi Valkeinen
@ 2019-12-13 11:42           ` Laurent Pinchart
  2019-12-13 12:04             ` Tomi Valkeinen
  0 siblings, 1 reply; 15+ messages in thread
From: Laurent Pinchart @ 2019-12-13 11:42 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, linux-omap, devicetree, robh+dt, mark.rutland,
	dri-devel, Linus Walleij

Hi Tomi,

On Fri, Dec 13, 2019 at 12:56:31PM +0200, Tomi Valkeinen wrote:
> On 13/12/2019 12:42, Laurent Pinchart wrote:
> 
> >> I think the correct way would be to have DRM framework understand that we have two displays, which
> >> are mutually exclusive, and the display pipeline drivers would have the means to switch the gpio.
> >> And that the display setup could be communicated properly to the userspace, and the userspace would
> >> understand it. I don't think any of those exists.
> > 
> > Isn't this what possible_clones in drm_encoder is for ? It notifies
> > userspace of mutual exclusions between encoders.
> 
> Hmm, how would that work here? Isn't encoder cloning about having two encoders, which take the input 
> from the same video source, and then outputting to two displays?

That's the idea. If you have one encoder for HDMI and one for the panel,
you can mark them as non-clonable, and then only one of the two can be
active at a time.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-12-13 11:42           ` Laurent Pinchart
@ 2019-12-13 12:04             ` Tomi Valkeinen
  2019-12-13 12:28               ` Laurent Pinchart
  0 siblings, 1 reply; 15+ messages in thread
From: Tomi Valkeinen @ 2019-12-13 12:04 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, linux-omap, devicetree, robh+dt, mark.rutland,
	dri-devel, Linus Walleij

On 13/12/2019 13:42, Laurent Pinchart wrote:
> Hi Tomi,
> 
> On Fri, Dec 13, 2019 at 12:56:31PM +0200, Tomi Valkeinen wrote:
>> On 13/12/2019 12:42, Laurent Pinchart wrote:
>>
>>>> I think the correct way would be to have DRM framework understand that we have two displays, which
>>>> are mutually exclusive, and the display pipeline drivers would have the means to switch the gpio.
>>>> And that the display setup could be communicated properly to the userspace, and the userspace would
>>>> understand it. I don't think any of those exists.
>>>
>>> Isn't this what possible_clones in drm_encoder is for ? It notifies
>>> userspace of mutual exclusions between encoders.
>>
>> Hmm, how would that work here? Isn't encoder cloning about having two encoders, which take the input
>> from the same video source, and then outputting to two displays?
> 
> That's the idea. If you have one encoder for HDMI and one for the panel,
> you can mark them as non-clonable, and then only one of the two can be
> active at a time.

We have a single DPI output from the SoC. That goes to the panel, or to SiI9022 bridge, depending on 
the GPIO switch.

So... In the DT file, we would have multiple endpoints in the same output port in DSS, one going to 
the panel, one to the SiI9022? omapdrm could then create two encoders, one abstracting the DPI 
output and the connection to the panel, one abstracting the DPI output and SiI9022?

And then someone would need to handle the GPIO, and set it based on the output used. These kind of 
gpios are always difficult, as they don't belong anywhere =).

  Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-12-13 12:04             ` Tomi Valkeinen
@ 2019-12-13 12:28               ` Laurent Pinchart
  2019-12-13 12:33                 ` Tomi Valkeinen
  0 siblings, 1 reply; 15+ messages in thread
From: Laurent Pinchart @ 2019-12-13 12:28 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, linux-omap, devicetree, robh+dt, mark.rutland,
	dri-devel, Linus Walleij

Hi Tomi,

On Fri, Dec 13, 2019 at 02:04:30PM +0200, Tomi Valkeinen wrote:
> On 13/12/2019 13:42, Laurent Pinchart wrote:
> > On Fri, Dec 13, 2019 at 12:56:31PM +0200, Tomi Valkeinen wrote:
> >> On 13/12/2019 12:42, Laurent Pinchart wrote:
> >>
> >>>> I think the correct way would be to have DRM framework understand that we have two displays, which
> >>>> are mutually exclusive, and the display pipeline drivers would have the means to switch the gpio.
> >>>> And that the display setup could be communicated properly to the userspace, and the userspace would
> >>>> understand it. I don't think any of those exists.
> >>>
> >>> Isn't this what possible_clones in drm_encoder is for ? It notifies
> >>> userspace of mutual exclusions between encoders.
> >>
> >> Hmm, how would that work here? Isn't encoder cloning about having two encoders, which take the input
> >> from the same video source, and then outputting to two displays?
> > 
> > That's the idea. If you have one encoder for HDMI and one for the panel,
> > you can mark them as non-clonable, and then only one of the two can be
> > active at a time.
> 
> We have a single DPI output from the SoC. That goes to the panel, or to SiI9022 bridge, depending on 
> the GPIO switch.
> 
> So... In the DT file, we would have multiple endpoints in the same output port in DSS, one going to 
> the panel, one to the SiI9022? omapdrm could then create two encoders, one abstracting the DPI 
> output and the connection to the panel, one abstracting the DPI output and SiI9022?

That's the idea, yes.

> And then someone would need to handle the GPIO, and set it based on the output used. These kind of 
> gpios are always difficult, as they don't belong anywhere =).

https://lore.kernel.org/lkml/20191211061911.238393-5-hsinyi@chromium.org/

Still, the infrastructure in omapdrm would need quite a bit of work.
We're just about to get a helper layer for linear pipelines merged, and
we already need to go one step further :-)

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-12-13 12:28               ` Laurent Pinchart
@ 2019-12-13 12:33                 ` Tomi Valkeinen
  2019-12-13 14:57                   ` Tony Lindgren
  0 siblings, 1 reply; 15+ messages in thread
From: Tomi Valkeinen @ 2019-12-13 12:33 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, linux-omap, devicetree, robh+dt, mark.rutland,
	dri-devel, Linus Walleij

On 13/12/2019 14:28, Laurent Pinchart wrote:

>> So... In the DT file, we would have multiple endpoints in the same output port in DSS, one going to
>> the panel, one to the SiI9022? omapdrm could then create two encoders, one abstracting the DPI
>> output and the connection to the panel, one abstracting the DPI output and SiI9022?
> 
> That's the idea, yes.
> 
>> And then someone would need to handle the GPIO, and set it based on the output used. These kind of
>> gpios are always difficult, as they don't belong anywhere =).
> 
> https://lore.kernel.org/lkml/20191211061911.238393-5-hsinyi@chromium.org/
> 
> Still, the infrastructure in omapdrm would need quite a bit of work.
> We're just about to get a helper layer for linear pipelines merged, and
> we already need to go one step further :-)

Alright, sounds like this will be doable in the future. So let's drop this and the epos HDMI patches 
for now.

This does sound like quite a bit of work, as you say, so I have no idea when we can get there (on 
the omapdrm side). In the minimum we should first get the big omapdrm rework done, in order to avoid 
nasty conflicts.

Thanks for educating me =).

  Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-12-12 17:31   ` Tony Lindgren
  2019-12-13  9:24     ` Tomi Valkeinen
@ 2019-12-13 12:36     ` Tomi Valkeinen
  1 sibling, 0 replies; 15+ messages in thread
From: Tomi Valkeinen @ 2019-12-13 12:36 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-omap, devicetree, robh+dt, mark.rutland, dri-devel, Linus Walleij

On 12/12/2019 19:31, Tony Lindgren wrote:

> Anyways, I'm applying the changes to dra76-evm am57xx-idk-common
> into omap-for-v5.6/dt as they have no GPIO pin limitation.

Thanks!

> I'd like to hear comments from folks on the first two though.

Just to summarize the discussion, let's drop the first two patches (am4).

  Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support
  2019-12-13 12:33                 ` Tomi Valkeinen
@ 2019-12-13 14:57                   ` Tony Lindgren
  0 siblings, 0 replies; 15+ messages in thread
From: Tony Lindgren @ 2019-12-13 14:57 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Laurent Pinchart, linux-omap, devicetree, robh+dt, mark.rutland,
	dri-devel, Linus Walleij

* Tomi Valkeinen <tomi.valkeinen@ti.com> [191213 12:34]:
> On 13/12/2019 14:28, Laurent Pinchart wrote:
> 
> > > So... In the DT file, we would have multiple endpoints in the same output port in DSS, one going to
> > > the panel, one to the SiI9022? omapdrm could then create two encoders, one abstracting the DPI
> > > output and the connection to the panel, one abstracting the DPI output and SiI9022?
> > 
> > That's the idea, yes.
> > 
> > > And then someone would need to handle the GPIO, and set it based on the output used. These kind of
> > > gpios are always difficult, as they don't belong anywhere =).
> > 
> > https://lore.kernel.org/lkml/20191211061911.238393-5-hsinyi@chromium.org/
> > 
> > Still, the infrastructure in omapdrm would need quite a bit of work.
> > We're just about to get a helper layer for linear pipelines merged, and
> > we already need to go one step further :-)
> 
> Alright, sounds like this will be doable in the future. So let's drop this
> and the epos HDMI patches for now.

Oh OK. Sounds like no other solution is usable right now short of
separate dts files like you've done.

> This does sound like quite a bit of work, as you say, so I have no idea when
> we can get there (on the omapdrm side). In the minimum we should first get
> the big omapdrm rework done, in order to avoid nasty conflicts.
> 
> Thanks for educating me =).

Sounds a nice plan though :)

Thanks,

Tony

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-12-13 20:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 13:10 [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support Tomi Valkeinen
2019-11-25 13:10 ` [PATCH 2/4] ARM: dts: am437x-epos-evm: " Tomi Valkeinen
2019-11-25 13:10 ` [PATCH 3/4] ARM: dts: dra76-evm: add HDMI output Tomi Valkeinen
2019-11-25 13:11 ` [PATCH 4/4] ARM: dts: am57xx-idk-common: add HDMI to the common dtsi Tomi Valkeinen
2019-12-12 17:21 ` [PATCH 1/4] ARM: dts: am437x-gp-evm: add HDMI support Tony Lindgren
2019-12-12 17:31   ` Tony Lindgren
2019-12-13  9:24     ` Tomi Valkeinen
2019-12-13 10:42       ` Laurent Pinchart
2019-12-13 10:56         ` Tomi Valkeinen
2019-12-13 11:42           ` Laurent Pinchart
2019-12-13 12:04             ` Tomi Valkeinen
2019-12-13 12:28               ` Laurent Pinchart
2019-12-13 12:33                 ` Tomi Valkeinen
2019-12-13 14:57                   ` Tony Lindgren
2019-12-13 12:36     ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).