Skip to contentSkip to conversation

HDMI support for Tegra114 Dalmore

PATCH Superseded Mikko Perttunen 3 participants 16 messages Aug 28, 2013 – Aug 29, 2013

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Mikko Perttunen

author maintainer
#0 lore raw

cover HDMI support for Tegra114 Dalmore

This patchset adds HDMI support for the Tegra114 Dalmore board. Tested with 1080p DVI and HDMI monitors.

Mikko Perttunen (5):
host1x: hdmi: Add Tegra114 support
host1x: hdmi: Detect whether display is connected with HDMI or DVI
clk: tegra114: Initialize clocks needed for HDMI
ARM: tegra: Add host1x, dc and hdmi to Tegra114 device tree
ARM: tegra: Add hdmi to Tegra114 Dalmore device tree

 arch/arm/boot/dts/tegra114-dalmore.dts |  17 ++++
 arch/arm/boot/dts/tegra114.dtsi        |  43 ++++++++++
 drivers/clk/tegra/clk-tegra114.c       |   3 +
 drivers/gpu/host1x/drm/drm.c           |   1 +
 drivers/gpu/host1x/drm/hdmi.c          | 110 +++++++++++++++++++++++-
 drivers/gpu/host1x/drm/hdmi.h          | 152 +++++++++++++++++++++++++++++++++
 6 files changed, 323 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.1.5
author maintainer
#1 lore raw

PATCH 1/5 host1x: hdmi: Add Tegra114 support

Add Tegra114 TMDS configuration, add new peak_current field and use new place for drive current override bit on Tegra114 platform.

---
 drivers/gpu/host1x/drm/drm.c  |   1 +
 drivers/gpu/host1x/drm/hdmi.c | 102 +++++++++++++++++++++++++++-
 drivers/gpu/host1x/drm/hdmi.h | 152 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 252 insertions(+), 3 deletions(-)
drivers/gpu/host1x/drm/drm.c +1 -0
index 8c61cee..37f5166 100644
@@ -88,6 +88,7 @@ static int host1x_parse_dt(struct host1x_drm *host1x)
 		"nvidia,tegra30-dc",
 		"nvidia,tegra30-hdmi",
 		"nvidia,tegra30-gr2d",
+		"nvidia,tegra114-hdmi",
 	};
 	unsigned int i;
 	int err;
drivers/gpu/host1x/drm/hdmi.c +99 -3

132 lines not on this page · raw message

drivers/gpu/host1x/drm/hdmi.h +152 -0

174 lines not on this page · raw message

Signature · 1 line
1.8.1.5
author maintainer
#2 lore raw

PATCH 2/5 host1x: hdmi: Detect whether display is connected with HDMI or DVI

In reply to Mikko Perttunen

Use EDID data to determine whether the display supports HDMI or just DVI. This used to be hardcoded to be HDMI, which broke support for DVI displays that couldn't understand the interspersed audio/other data.

If the EDID data isn't available, default to DVI, which should be a safer choice.

---
 drivers/gpu/host1x/drm/hdmi.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/host1x/drm/hdmi.c +8 -0
index d81fac8..140339b 100644
@@ -702,6 +702,14 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
 	unsigned long value;
 	int retries = 1000;
 	int err;
+	struct drm_property_blob *edid_blob = output->connector.edid_blob_ptr;
+
+	if (edid_blob && edid_blob->data &&
+		drm_detect_hdmi_monitor((struct edid *)edid_blob->data)) {
+		hdmi->dvi = false;
+	} else {
+		hdmi->dvi = true;
+	}
 
 	pclk = mode->clock * 1000;
 	h_sync_width = mode->hsync_end - mode->hsync_start;
Signature · 1 line
1.8.1.5
author maintainer
#6 lore raw

PATCH 3/5 clk: tegra114: Initialize clocks needed for HDMI

In reply to Mikko Perttunen

Add host1x, disp1 and disp2 clocks to the clock initialization table. These clocks are required for HDMI support.

---
 drivers/clk/tegra/clk-tegra114.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/tegra/clk-tegra114.c +3 -0
index cd94b0c..a491dea 100644
@@ -2211,6 +2211,9 @@ static struct tegra_clk_init_table init_table[] __initdata = {
 	{i2s4, pll_a_out0, 11289600, 0},
 	{dfll_soc, pll_p, 51000000, 1},
 	{dfll_ref, pll_p, 51000000, 1},
+	{host1x, pll_c, 150000000, 0},
+	{disp1, pll_p, 600000000, 0},
+	{disp2, pll_p, 600000000, 0},
 	{clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */
 };
 
Signature · 1 line
1.8.1.5
author maintainer
#7 lore raw

PATCH 4/5 ARM: tegra: Add host1x, dc and hdmi to Tegra114 device tree

In reply to Mikko Perttunen

Add host1x, dc (display controller) and hdmi devices to Tegra114 device tree.

---
 arch/arm/boot/dts/tegra114.dtsi | 43 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm/boot/dts/tegra114.dtsi +43 -0
index 2905145..ce5a95c 100644
@@ -27,6 +27,49 @@
 			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
 	};
 
+	host1x {
+		compatible = "nvidia,tegra114-host1x", "nvidia,tegra30-host1x",
+				"simple-bus";
+		reg = <0x50000000 0x00028000>;
+		interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>,
+				<GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&tegra_car TEGRA114_CLK_HOST1X>;
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		ranges = <0x54000000 0x54000000 0x04000000>;
+
+		dc@54200000 {
+			compatible = "nvidia,tegra114-dc", "nvidia,tegra30-dc";
+			reg = <0x54200000 0x00040000>;
+			interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA114_CLK_DISP1>,
+				    <&tegra_car TEGRA114_CLK_PLL_P>;
+			clock-names = "disp1", "parent";
+		};
+
+		dc@54240000 {
+			compatible = "nvidia,tegra114-dc", "nvidia,tegra30-dc";
+			reg = <0x54240000 0x00040000>;
+			interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA114_CLK_DISP2>,
+				    <&tegra_car TEGRA114_CLK_PLL_P>;
+			clock-names = "disp2", "parent";
+		};
+
+		hdmi {
+			compatible = "nvidia,tegra114-hdmi";
+			reg = <0x54280000 0x00040000>;
+			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA114_CLK_HDMI>,
+				    <&tegra_car TEGRA114_CLK_PLL_D_OUT0>;
+			clock-names = "hdmi", "parent";
+
+			status = "disabled";
+		};
+	};
+
 	timer@60005000 {
 		compatible = "nvidia,tegra114-timer", "nvidia,tegra20-timer";
 		reg = <0x60005000 0x400>;
Signature · 1 line
1.8.1.5
author maintainer
#12 lore raw

PATCH 5/5 ARM: tegra: Add hdmi to Tegra114 Dalmore device tree

In reply to Mikko Perttunen

Add hdmi node to Dalmore device tree to supply Dalmore-specific
data: VDD and PLL regulators for HDMI port, DDC bus and HDMI cable hotplug GPIO.

---
 arch/arm/boot/dts/tegra114-dalmore.dts | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm/boot/dts/tegra114-dalmore.dts +17 -0
index 6023028..50e6fb4 100644
@@ -713,6 +713,17 @@
 		};
 	};
 
+	host1x {
+		hdmi {
+			status = "okay";
+
+			vdd-supply = <&vdd_hdmi_reg>;
+			pll-supply = <&palmas_smps3_reg>;
+			nvidia,ddc-i2c-bus = <&hdmi_ddc>;
+			nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;
+		};
+	};
+
 	serial@70006300 {
 		status = "okay";
 	};
@@ -740,6 +751,10 @@
 		};
 	};
 
+	hdmi_ddc: i2c@7000c700 {
+		status = "okay";
+	};
+
 	i2c@7000d000 {
 		status = "okay";
 		clock-frequency = <400000>;
@@ -1169,6 +1184,8 @@
 			regulator-min-microvolt = <5000000>;
 			regulator-max-microvolt = <5000000>;
 			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;
 			gpio = <&gpio TEGRA_GPIO(K, 1) GPIO_ACTIVE_HIGH>;
 			vin-supply = <&tps65090_dcdc1_reg>;
 		};
Signature · 1 line
1.8.1.5
#3 lore raw

Re: [PATCH 2/5] host1x: hdmi: Detect whether display is connected with HDMI or DVI

In reply to Mikko Perttunen
Quoted 21 lines · Mikko Perttunen

Use EDID data to determine whether the display supports HDMI or just DVI. This used to be hardcoded to be HDMI, which broke support for DVI displays that couldn't understand the interspersed audio/other data.

If the EDID data isn't available, default to DVI, which should be a safer choice.

---
 drivers/gpu/host1x/drm/hdmi.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/host1x/drm/hdmi.c +1 -0
index d81fac8..140339b 100644
@@ -702,6 +702,14 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
 	unsigned long value;
 	int retries = 1000;
 	int err;
+	struct drm_property_blob *edid_blob = output->connector.edid_blob_ptr;

drivers/gpu/host1x/drm/hdmi.c static int tegra_output_hdmi_enable(struct tegra_output *output) · line 715

Quoted 10 lines
drivers/gpu/host1x/drm/hdmi.c +7 -0
+
+	if (edid_blob && edid_blob->data &&
+		drm_detect_hdmi_monitor((struct edid *)edid_blob->data)) {
+		hdmi->dvi = false;
+	} else {
+		hdmi->dvi = true;
+	}
 
 	pclk = mode->clock * 1000;
 	h_sync_width = mode->hsync_end - mode->hsync_start;

Odd, now that I see that code I remember that there was a similar patch a few months back, but it was never applied for some reason:

	http://lists.freedesktop.org/archives/dri-devel/2013-January/033509.html

That was already reviewed by me and Jon Mayo, so I'll go ahead and apply that one instead.

Thierry

#8 lore raw

Re: [PATCH 4/5] ARM: tegra: Add host1x, dc and hdmi to Tegra114 device tree

In reply to Mikko Perttunen
Quoted 2 lines · Mikko Perttunen

Add host1x, dc (display controller) and hdmi devices to Tegra114 device tree.

"DC" and "HDMI".

Quoted 11 lines
---
 arch/arm/boot/dts/tegra114.dtsi | 43 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm/boot/dts/tegra114.dtsi +0 -0
index 2905145..ce5a95c 100644

arch/arm/boot/dts/tegra114.dtsi line 31

Quoted 5 lines
arch/arm/boot/dts/tegra114.dtsi +2 -0
@@ -27,6 +27,49 @@
 			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
 	};
 
+	host1x {
+		compatible = "nvidia,tegra114-host1x", "nvidia,tegra30-host1x",

I don't think that's correct. The Tegra114 host1x is not backwards compatible with the Tegra30 host1x.

That said, I have a local patch that is a bit more complete in that it adds other host1x devices as listed in the TRM as well. But I'll leave it up to Stephen how he prefers to handle that. It should be fine to defer adding nodes for additional hardware blocks when the supporting drivers are merged. We've done it for other devices as well.

arch/arm/boot/dts/tegra114.dtsi line 35

Quoted 4 lines
arch/arm/boot/dts/tegra114.dtsi +4 -0
+				"simple-bus";
+		reg = <0x50000000 0x00028000>;
+		interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>,
+				<GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;

I think this should be indented with the previous line. Also other SoC .dtsi files use a single entry, as in:

		interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH
			      GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;

arch/arm/boot/dts/tegra114.dtsi line 66

Quoted 6 lines
arch/arm/boot/dts/tegra114.dtsi +6 -0
+		hdmi {
+			compatible = "nvidia,tegra114-hdmi";
+			reg = <0x54280000 0x00040000>;
+			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA114_CLK_HDMI>,
+				    <&tegra_car TEGRA114_CLK_PLL_D_OUT0>;

Any reason why we can't use pll_d2_out0 here, like we do on Tegra30?

Thierry

#13 lore raw

Re: [PATCH 5/5] ARM: tegra: Add hdmi to Tegra114 Dalmore device tree

In reply to Mikko Perttunen
Quoted 1 line · Mikko Perttunen

Add hdmi node to Dalmore device tree to supply Dalmore-specific

s/hdmi/HDMI/

Quoted 1 line
arch/arm/boot/dts/tegra114-dalmore.dts +0 -0

[...]

arch/arm/boot/dts/tegra114-dalmore.dts line 722

Quoted 7 lines
arch/arm/boot/dts/tegra114-dalmore.dts +7 -0
+	host1x {
+		hdmi {
+			status = "okay";
+
+			vdd-supply = <&vdd_hdmi_reg>;
+			pll-supply = <&palmas_smps3_reg>;
+			nvidia,ddc-i2c-bus = <&hdmi_ddc>;

I prefer to use a blank line to separate "standard" from "vendor-specific" properties.

arch/arm/boot/dts/tegra114-dalmore.dts line 723

Quoted 1 line
arch/arm/boot/dts/tegra114-dalmore.dts +1 -0
+			nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;

Other .dts files split this so it doesn't exceed 80 characters. I'm not sure how useful that is as a general rule for DT source files, though.

arch/arm/boot/dts/tegra114-dalmore.dts line 1188

Quoted 9 lines
arch/arm/boot/dts/tegra114-dalmore.dts +2 -0
 	i2c@7000d000 {
 		status = "okay";
 		clock-frequency = <400000>;
@@ -1169,6 +1184,8 @@
 			regulator-min-microvolt = <5000000>;
 			regulator-max-microvolt = <5000000>;
 			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;

This warrants at least a mention in the commit message.

Thierry

author maintainer
#4 lore raw

Re: [PATCH 2/5] host1x: hdmi: Detect whether display is connected with HDMI or DVI

In reply to Thierry Reding
Quoted 40 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 21 lines · Mikko Perttunen

Use EDID data to determine whether the display supports HDMI or just DVI. This used to be hardcoded to be HDMI, which broke support for DVI displays that couldn't understand the interspersed audio/other data.

If the EDID data isn't available, default to DVI, which should be a safer choice.

---
  drivers/gpu/host1x/drm/hdmi.c | 8 ++++++++
  1 file changed, 8 insertions(+)
drivers/gpu/host1x/drm/hdmi.c +1 -0
index d81fac8..140339b 100644
@@ -702,6 +702,14 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
  	unsigned long value;
  	int retries = 1000;
  	int err;
+	struct drm_property_blob *edid_blob = output->connector.edid_blob_ptr;

drivers/gpu/host1x/drm/hdmi.c static int tegra_output_hdmi_enable(struct tegra_output *output) · line 715

Quoted 10 lines
drivers/gpu/host1x/drm/hdmi.c +7 -0
+
+	if (edid_blob && edid_blob->data &&
+		drm_detect_hdmi_monitor((struct edid *)edid_blob->data)) {
+		hdmi->dvi = false;
+	} else {
+		hdmi->dvi = true;
+	}
 
  	pclk = mode->clock * 1000;
  	h_sync_width = mode->hsync_end - mode->hsync_start;

Odd, now that I see that code I remember that there was a similar patch a few months back, but it was never applied for some reason:

	http://lists.freedesktop.org/archives/dri-devel/2013-January/033509.html
Quoted 8 lines

That was already reviewed by me and Jon Mayo, so I'll go ahead and apply that one instead.

Thierry

* Unknown Key
* 0x7F3EB3A1

That patch seems to cause a warning for me:
drivers/gpu/host1x/drm/hdmi.c: In function ‘tegra_output_hdmi_enable’:
drivers/gpu/host1x/drm/hdmi.c:706:2: warning: passing argument 1 of ‘drm_detect_hdmi_monitor’ discards ‘const’ qualifier from pointer target type [enabled by default] include/drm/drm_crtc.h:1037:13: note: expected ‘struct edid *’ but argument is of type ‘const struct edid *’

Looks much nicer though.

author maintainer
#9 lore raw

Re: [PATCH 4/5] ARM: tegra: Add host1x, dc and hdmi to Tegra114 device tree

In reply to Thierry Reding
Quoted 7 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 2 lines · Mikko Perttunen

Add host1x, dc (display controller) and hdmi devices to Tegra114 device tree.

"DC" and "HDMI".

Will fix.

Quoted 21 lines
Quoted 12 lines
---
  arch/arm/boot/dts/tegra114.dtsi | 43 +++++++++++++++++++++++++++++++++++++++++
  1 file changed, 43 insertions(+)
arch/arm/boot/dts/tegra114.dtsi +0 -0
index 2905145..ce5a95c 100644

arch/arm/boot/dts/tegra114.dtsi line 31

Quoted 5 lines
arch/arm/boot/dts/tegra114.dtsi +2 -0
@@ -27,6 +27,49 @@
  			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
  	};
 
+	host1x {
+		compatible = "nvidia,tegra114-host1x", "nvidia,tegra30-host1x",

I don't think that's correct. The Tegra114 host1x is not backwards compatible with the Tegra30 host1x.

Quoted 5 lines

That said, I have a local patch that is a bit more complete in that it adds other host1x devices as listed in the TRM as well. But I'll leave it up to Stephen how he prefers to handle that. It should be fine to defer adding nodes for additional hardware blocks when the supporting drivers are merged. We've done it for other devices as well.

Ok. Will need to add tegra114-host1x to the host1x driver compat strings, then, but I guess that's better than having it wrong in the DT.

Quoted 9 lines

arch/arm/boot/dts/tegra114.dtsi line 35

Quoted 5 lines
arch/arm/boot/dts/tegra114.dtsi +4 -0
+				"simple-bus";
+		reg = <0x50000000 0x00028000>;
+		interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>,
+				<GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;

I think this should be indented with the previous line. Also other SoC .dtsi files use a single entry, as in:

Quoted 3 lines
		interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH
			      GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;

Will fix.

Quoted 8 lines

arch/arm/boot/dts/tegra114.dtsi line 66

Quoted 6 lines
arch/arm/boot/dts/tegra114.dtsi +6 -0
+		hdmi {
+			compatible = "nvidia,tegra114-hdmi";
+			reg = <0x54280000 0x00040000>;
+			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA114_CLK_HDMI>,
+				    <&tegra_car TEGRA114_CLK_PLL_D_OUT0>;

Any reason why we can't use pll_d2_out0 here, like we do on Tegra30?

I have this set to PLL_D because I don't have panel support so disp1 will be the HDMI DC. However, it doesn't seem to matter which one is specified here. I have also tested HDMI with disp2 and that works too.

Quoted 6 lines

Thierry

* Unknown Key
* 0x7F3EB3A1

author maintainer
#14 lore raw

Re: [PATCH 5/5] ARM: tegra: Add hdmi to Tegra114 Dalmore device tree

In reply to Thierry Reding
Quoted 6 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 1 line · Mikko Perttunen

Add hdmi node to Dalmore device tree to supply Dalmore-specific

s/hdmi/HDMI/

Will fix.

Quoted 13 lines
Quoted 2 lines
arch/arm/boot/dts/tegra114-dalmore.dts +0 -0

[...]

arch/arm/boot/dts/tegra114-dalmore.dts line 722

Quoted 7 lines
arch/arm/boot/dts/tegra114-dalmore.dts +7 -0
+	host1x {
+		hdmi {
+			status = "okay";
+
+			vdd-supply = <&vdd_hdmi_reg>;
+			pll-supply = <&palmas_smps3_reg>;
+			nvidia,ddc-i2c-bus = <&hdmi_ddc>;

I prefer to use a blank line to separate "standard" from "vendor-specific" properties.

Will fix.

Quoted 5 lines

arch/arm/boot/dts/tegra114-dalmore.dts line 723

Quoted 2 lines
arch/arm/boot/dts/tegra114-dalmore.dts +1 -0
+			nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;

Other .dts files split this so it doesn't exceed 80 characters. I'm not sure how useful that is as a general rule for DT source files, though.

Will fix. I guess check_patch.pl doesn't check for line length in *.dts.

Quoted 12 lines

arch/arm/boot/dts/tegra114-dalmore.dts line 1188

Quoted 10 lines
  	i2c@7000d000 {
  		status = "okay";
  		clock-frequency = <400000>;
arch/arm/boot/dts/tegra114-dalmore.dts +2 -0
@@ -1169,6 +1184,8 @@
  			regulator-min-microvolt = <5000000>;
  			regulator-max-microvolt = <5000000>;
  			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;

This warrants at least a mention in the commit message.

Hmm, yeah. Looks like the HDMI driver only enables the Vdd in tegra_output_hdmi_enable, which is too late at least for DDC. I guess a better patch would be to enable it earlier. In _probe?

Quoted 6 lines

Thierry

* Unknown Key
* 0x7F3EB3A1

#5 lore raw

Re: [PATCH 2/5] host1x: hdmi: Detect whether display is connected with HDMI or DVI

In reply to Mikko Perttunen
Quoted 50 lines · Mikko Perttunen
Quoted 40 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 21 lines · Mikko Perttunen

Use EDID data to determine whether the display supports HDMI or just DVI. This used to be hardcoded to be HDMI, which broke support for DVI displays that couldn't understand the interspersed audio/other data.

If the EDID data isn't available, default to DVI, which should be a safer choice.

---
 drivers/gpu/host1x/drm/hdmi.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/host1x/drm/hdmi.c +1 -0
index d81fac8..140339b 100644
@@ -702,6 +702,14 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
 	unsigned long value;
 	int retries = 1000;
 	int err;
+	struct drm_property_blob *edid_blob = output->connector.edid_blob_ptr;

drivers/gpu/host1x/drm/hdmi.c static int tegra_output_hdmi_enable(struct tegra_output *output) · line 715

Quoted 10 lines
drivers/gpu/host1x/drm/hdmi.c +7 -0
+
+	if (edid_blob && edid_blob->data &&
+		drm_detect_hdmi_monitor((struct edid *)edid_blob->data)) {
+		hdmi->dvi = false;
+	} else {
+		hdmi->dvi = true;
+	}
 
 	pclk = mode->clock * 1000;
 	h_sync_width = mode->hsync_end - mode->hsync_start;

Odd, now that I see that code I remember that there was a similar patch a few months back, but it was never applied for some reason:

	http://lists.freedesktop.org/archives/dri-devel/2013-January/033509.html
Quoted 8 lines

That was already reviewed by me and Jon Mayo, so I'll go ahead and apply that one instead.

Thierry

* Unknown Key
* 0x7F3EB3A1

Quoted 7 lines

That patch seems to cause a warning for me:
drivers/gpu/host1x/drm/hdmi.c: In function ‘tegra_output_hdmi_enable’:
drivers/gpu/host1x/drm/hdmi.c:706:2: warning: passing argument 1 of ‘drm_detect_hdmi_monitor’ discards ‘const’ qualifier from pointer target type [enabled by default] include/drm/drm_crtc.h:1037:13: note: expected ‘struct edid *’ but argument is of type ‘const struct edid *’

Given the discussion about this back in January, I think the best way, at least for now, is to keep a copy of the EDID data so that it can actually be modified.

But looking at the problem more closely, I don't think the patch from January is quite correct. The problem is that it uses the EDID stored within the struct tegra_output. That's problematic because that field is not updated when EDID is probed via DDC. That would make the patch that you proposed more correct.

Thierry

#10 lore raw

Re: [PATCH 4/5] ARM: tegra: Add host1x, dc and hdmi to Tegra114 device tree

In reply to Mikko Perttunen
Quoted 1 line · Mikko Perttunen

On 08/28/2013 03:25 PM, Thierry Reding wrote:

[...]

Quoted 25 lines
Quoted 19 lines
Quoted 10 lines
---
 arch/arm/boot/dts/tegra114.dtsi | 43 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm/boot/dts/tegra114.dtsi +0 -0
index 2905145..ce5a95c 100644

arch/arm/boot/dts/tegra114.dtsi line 31

Quoted 5 lines
arch/arm/boot/dts/tegra114.dtsi +2 -0
@@ -27,6 +27,49 @@
 			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
 	};
 
+	host1x {
+		compatible = "nvidia,tegra114-host1x", "nvidia,tegra30-host1x",

I don't think that's correct. The Tegra114 host1x is not backwards compatible with the Tegra30 host1x.

Quoted 5 lines

That said, I have a local patch that is a bit more complete in that it adds other host1x devices as listed in the TRM as well. But I'll leave it up to Stephen how he prefers to handle that. It should be fine to defer adding nodes for additional hardware blocks when the supporting drivers are merged. We've done it for other devices as well.

Quoted 3 lines

Ok. Will need to add tegra114-host1x to the host1x driver compat strings, then, but I guess that's better than having it wrong in the DT.

I think that's not all. I have local patches that also introduce a v2 of host1x, because the number of syncpoints is different. There may also be other differences, but Terje might be more qualified to answer that.

Quoted 9 lines
Quoted 8 lines

arch/arm/boot/dts/tegra114.dtsi line 66

Quoted 6 lines
arch/arm/boot/dts/tegra114.dtsi +6 -0
+		hdmi {
+			compatible = "nvidia,tegra114-hdmi";
+			reg = <0x54280000 0x00040000>;
+			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&tegra_car TEGRA114_CLK_HDMI>,
+				    <&tegra_car TEGRA114_CLK_PLL_D_OUT0>;

Any reason why we can't use pll_d2_out0 here, like we do on Tegra30?

Quoted 4 lines

I have this set to PLL_D because I don't have panel support so disp1 will be the HDMI DC. However, it doesn't seem to matter which one is specified here. I have also tested HDMI with disp2 and that works too.

Well eventually we'll add panel support and I think it'd be good to stay consistent as to what clocks are used for the internal and external displays.

Thierry

#15 lore raw

Re: [PATCH 5/5] ARM: tegra: Add hdmi to Tegra114 Dalmore device tree

In reply to Mikko Perttunen
Quoted 2 lines · Mikko Perttunen
Quoted 1 line · Thierry Reding

On Wed, Aug 28, 2013 at 01:40:59PM +0300, Mikko Perttunen wrote:

[...]

Quoted 11 lines
Quoted 7 lines

arch/arm/boot/dts/tegra114-dalmore.dts line 1188

Quoted 5 lines
arch/arm/boot/dts/tegra114-dalmore.dts +2 -0
 			regulator-min-microvolt = <5000000>;
 			regulator-max-microvolt = <5000000>;
 			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;

This warrants at least a mention in the commit message.

Hmm, yeah. Looks like the HDMI driver only enables the Vdd in tegra_output_hdmi_enable, which is too late at least for DDC. I guess a better patch would be to enable it earlier. In _probe?

I don't think that would be much better. That way the supply will still always be on, independent of whether we're actually using HDMI or not. I'm thinking that perhaps we need to allow HDMI to override get_modes() by something custom. That should also help with the EDID problem in the earlier patch.

Thierry

#11 lore raw

Re: [PATCH 4/5] ARM: tegra: Add host1x, dc and hdmi to Tegra114 device tree

In reply to Thierry Reding
Quoted 3 lines · Thierry Reding

I think that's not all. I have local patches that also introduce a v2 of host1x, because the number of syncpoints is different. There may also be other differences, but Terje might be more qualified to answer that.

Tegra4 host1x has an extra channel(totals 9), which caused bitfields in a couple of registers to shift. The registers are mainly used in the debug code to dump the channel FIFO. Same number of sync points as Tegra3, but 12 wait bases.

Other changes are minor and driver already deals with them, for example 32-bit versus 16-bit sync point value comparison.

Terje