HDMI support for Tegra114 Dalmore
Subsystems (6)
Mikko Perttunen
maintainerv2 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 (6):
host1x: hdmi: Add Tegra114 support
host1x: hdmi: Detect whether display is connected with HDMI or DVI
host1x: hdmi: Enable Vdd earlier for hotplug/DDC
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 | 42 +++++++++ drivers/clk/tegra/clk-tegra114.c | 3 + drivers/gpu/host1x/dev.c | 1 + drivers/gpu/host1x/drm/drm.c | 1 + drivers/gpu/host1x/drm/hdmi.c | 125 ++++++++++++++++++++++++--- drivers/gpu/host1x/drm/hdmi.h | 152 +++++++++++++++++++++++++++++++++ 7 files changed, 331 insertions(+), 10 deletions(-)
Signature · 1 line
1.8.1.5
Mikko Perttunen
maintainerPATCH v2 1/6 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/dev.c | 1 + drivers/gpu/host1x/drm/drm.c | 1 + drivers/gpu/host1x/drm/hdmi.c | 102 +++++++++++++++++++++++++++- drivers/gpu/host1x/drm/hdmi.h | 152 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 253 insertions(+), 3 deletions(-)
drivers/gpu/host1x/dev.c +1 -0
@@ -80,6 +80,7 @@ static const struct host1x_info host1x01_info = { };static struct of_device_id host1x_of_match[] = { + { .compatible ="nvidia,tegra114-host1x" , .data = &host1x01_info, }, { .compatible ="nvidia,tegra30-host1x" , .data = &host1x01_info, }, { .compatible ="nvidia,tegra20-host1x" , .data = &host1x01_info, }, { },
drivers/gpu/host1x/drm/drm.c +1 -0
@@ -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
Mikko Perttunen
maintainerPATCH v2 2/6 host1x: hdmi: Detect whether display is connected with HDMI or DVI
In reply to Mikko PerttunenUse 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
@@ -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
Mikko Perttunen
maintainerPATCH v2 3/6 host1x: hdmi: Enable Vdd earlier for hotplug/DDC
In reply to Mikko PerttunenThe Vdd regulator used to be enabled only at tegra_output_hdmi_enable, which is called after a sink is detected. However, the HDMI hotplug pin works by returning the voltage supplied by the Vdd pin, so this meant that the hotplug pin was never asserted and the sink was not detected unless the Vdd regulator was set to be always on.
This patch moves the enable to the tegra_hdmi_drm_init function to make sure the regulator will get enabled.
--- drivers/gpu/host1x/drm/hdmi.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/host1x/drm/hdmi.c +8 -7
@@ -716,12 +716,6 @@ static int tegra_output_hdmi_enable(struct tegra_output *output) h_back_porch = mode->htotal - mode->hsync_end; h_front_porch = mode->hsync_start - mode->hdisplay; - err =regulator_enable (hdmi->vdd); -if (err <0 ) { -dev_err (hdmi->dev,"failed to enable VDD regulator: %d\n" , err); -return err; - } - err =regulator_enable (hdmi->pll);if (err <0 ) {dev_err (hdmi->dev,"failed to enable PLL regulator: %d\n" , err);
@@ -943,7 +937,6 @@ static int tegra_output_hdmi_disable(struct tegra_output *output)tegra_periph_reset_assert (hdmi->clk);clk_disable (hdmi->clk);regulator_disable (hdmi->pll); -regulator_disable (hdmi->vdd);return 0 ; }
@@ -1240,6 +1233,12 @@ static int tegra_hdmi_drm_init(struct host1x_client *client,struct tegra_hdmi *hdmi =host1x_client_to_hdmi (client);int err; + err =regulator_enable (hdmi->vdd); +if (err <0 ) { +dev_err (client->dev,"vdd regulator enable failed: %d\n" , err); +return err; + } + hdmi->output.type =TEGRA_OUTPUT_HDMI ; hdmi->output.dev = client->dev; hdmi->output.ops = &hdmi_ops;
@@ -1283,6 +1282,8 @@ static int tegra_hdmi_drm_exit(struct host1x_client *client)return err; } +regulator_disable (hdmi->vdd); +return 0 ; }
Signature · 1 line
1.8.1.5
Mikko Perttunen
maintainerPATCH v2 4/6 clk: tegra114: Initialize clocks needed for HDMI
In reply to Mikko PerttunenAdd 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
@@ -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
Mikko Perttunen
maintainerPATCH v2 5/6 ARM: tegra: Add host1x, DC and HDMI to Tegra114 device tree
In reply to Mikko PerttunenAdd host1x, DC (display controller) and HDMI devices to Tegra114 device tree.
--- arch/arm/boot/dts/tegra114.dtsi | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
arch/arm/boot/dts/tegra114.dtsi +42 -0
@@ -27,6 +27,48 @@ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; }; + host1x { + compatible = "nvidia,tegra114-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_D2_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
Mikko Perttunen
maintainerPATCH v2 6/6 ARM: tegra: Add HDMI to Tegra114 Dalmore device tree
In reply to Mikko PerttunenAdd 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
@@ -713,6 +713,19 @@ }; }; + 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 +753,10 @@ }; }; + hdmi_ddc: i2c@7000c700 { + status = "okay"; + }; + i2c@7000d000 { status = "okay"; clock-frequency = <400000>;
Signature · 1 line
1.8.1.5
Re: [PATCH v2 1/6] host1x: hdmi: Add Tegra114 support
In reply to Mikko Perttunendrivers/gpu/host1x/dev.c static const struct host1x_info host1x01_info = { · line 83
Quoted 7 lines · Mikko Perttunen
Add Tegra114 TMDS configuration, add new
peak_currentfield and use new place for drive current override bit on Tegra114 platform.drivers/gpu/host1x/dev.c +1
-0static struct of_device_id host1x_of_match[] = { + { .compatible ="nvidia,tegra114-host1x" , .data = &host1x01_info, },
We should add that value to the host1x DT binding documentation.
drivers/gpu/host1x/drm/hdmi.c static void tegra_hdmi_setup_tmds(struct tegra_hdmi *hdmi, · line 677
Quoted 13 lines
drivers/gpu/host1x/drm/hdmi.c +2
-2static const struct tegra_hdmi_audio_config *tegra_hdmi_get_audio_config (unsigned int audio_freq,unsigned int pclk) {@@ -593,8 +673,20 @@ static void tegra_hdmi_setup_tmds(struct tegra_hdmi *hdmi,tegra_hdmi_writel (hdmi, tmds->pll1,HDMI_NV_PDISP_SOR_PLL1 );tegra_hdmi_writel (hdmi, tmds->pe_current,HDMI_NV_PDISP_PE_CURRENT ); - value = tmds->drive_current |DRIVE_CURRENT_FUSE_OVERRIDE ; -tegra_hdmi_writel (hdmi, value,HDMI_NV_PDISP_SOR_LANE_DRIVE_CURRENT ); +if (of_device_is_compatible (hdmi->dev->of_node, +"nvidia,tegra114-hdmi" )) {
We shouldn't do this at run-time. Rather, set tegra_hdmi_of_match[]'s .data field to a structure that represents the various features of the HW, and then make this code conditional upon a feature flag in that structure.
Re: [PATCH v2 2/6] host1x: hdmi: Detect whether display is connected with HDMI or DVI
In reply to Mikko PerttunenQuoted 6 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.
This seems like a bug-fix that might even be worth CC: stable?
Re: [PATCH v2 3/6] host1x: hdmi: Enable Vdd earlier for hotplug/DDC
In reply to Mikko PerttunenQuoted 8 lines · Mikko Perttunen
The Vdd regulator used to be enabled only at
tegra_output_hdmi_enable, which is called after a sink is detected. However, the HDMI hotplug pin works by returning the voltage supplied by the Vdd pin, so this meant that the hotplug pin was never asserted and the sink was not detected unless the Vdd regulator was set to be always on.This patch moves the enable to the
tegra_hdmi_drm_initfunction to make sure the regulator will get enabled.
The DT binding document isn't very clear on this topic (and should be fixed): What is this regulator intended to control? If this regulator solely controls the supply to the hotplug detection circuit, this change makes sense. If the regulator mainly supplies something else (e.g. part of the HDMI core on the Tegra chip), then perhaps this change isn't correct. The correct approach might be to introduce another (optional) regulator specifically for the hotplug circuit. Presumably both DT properties vdd-supply and hotplug-supply could point at the same regulator if that's the way the HW was wired up.
Re: [PATCH v2 4/6] clk: tegra114: Initialize clocks needed for HDMI
In reply to Mikko PerttunenQuoted 2 lines · Mikko Perttunen
Add host1x, disp1 and disp2 clocks to the clock initialization table. These clocks are required for HDMI support.
This patch should be sent to Mike Turquette so it can be taken through the clock tree.
Re: [PATCH v2 5/6] ARM: tegra: Add host1x, DC and HDMI to Tegra114 device tree
In reply to Mikko PerttunenQuoted 2 lines · Mikko Perttunen
Add host1x, DC (display controller) and HDMI devices to Tegra114 device tree.
Patches 5 and 6 should be sent separately to the Tegra maintainer (me) to be taken through the Tegra tree.
Re: [PATCH v2 1/6] host1x: hdmi: Add Tegra114 support
In reply to Stephen WarrenQuoted 10 lines · Stephen Warren
drivers/gpu/host1x/dev.c static const struct host1x_info host1x01_info = { · line 83
Quoted 7 lines · Mikko Perttunen
Add Tegra114 TMDS configuration, add new
peak_currentfield and use new place for drive current override bit on Tegra114 platform.drivers/gpu/host1x/dev.c +1
-0static struct of_device_id host1x_of_match[] = { + { .compatible ="nvidia,tegra114-host1x" , .data = &host1x01_info, },We should add that value to the host1x DT binding documentation.
That should be superseeded by a patch from my Tegra114 DSI series. Note that Tegra114 also uses a slightly updated version of host1x.
Quoted 9 lines
Quoted 9 lines
drivers/gpu/host1x/drm/hdmi.c +0
-0static const struct tegra_hdmi_audio_config *tegra_hdmi_get_audio_config (unsigned int audio_freq,unsigned int pclk) {@@ -593,8 +673,20 @@ static void tegra_hdmi_setup_tmds(struct tegra_hdmi *hdmi,tegra_hdmi_writel (hdmi, tmds->pll1,HDMI_NV_PDISP_SOR_PLL1 );tegra_hdmi_writel (hdmi, tmds->pe_current,HDMI_NV_PDISP_PE_CURRENT );
Quoted 9 lines
drivers/gpu/host1x/drm/hdmi.c static void tegra_hdmi_setup_tmds(struct tegra_hdmi *hdmi, · line 677
Quoted 4 lines
drivers/gpu/host1x/drm/hdmi.c +2
-2- value = tmds->drive_current |DRIVE_CURRENT_FUSE_OVERRIDE ; -tegra_hdmi_writel (hdmi, value,HDMI_NV_PDISP_SOR_LANE_DRIVE_CURRENT ); +if (of_device_is_compatible (hdmi->dev->of_node, +"nvidia,tegra114-hdmi" )) {We shouldn't do this at run-time. Rather, set tegra_hdmi_of_match[]'s .data field to a structure that represents the various features of the HW, and then make this code conditional upon a feature flag in that structure.
I'll take a look at how this could be done. There are a few other places where we do this check at runtime, so that should be converted at the same time.
Thierry
Re: [PATCH v2 2/6] host1x: hdmi: Detect whether display is connected with HDMI or DVI
In reply to Stephen WarrenQuoted 9 lines · Stephen Warren
Quoted 6 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.
This seems like a bug-fix that might even be worth CC: stable?
Possibly. The patch reaches deeply into some DRM structures, which I'd like to avoid. I'll have another look to see if it can be done in a slightly different way.
Thierry
Re: [PATCH v2 3/6] host1x: hdmi: Enable Vdd earlier for hotplug/DDC
In reply to Stephen WarrenQuoted 10 lines · Stephen Warren
Quoted 8 lines · Mikko Perttunen
The Vdd regulator used to be enabled only at
tegra_output_hdmi_enable, which is called after a sink is detected. However, the HDMI hotplug pin works by returning the voltage supplied by the Vdd pin, so this meant that the hotplug pin was never asserted and the sink was not detected unless the Vdd regulator was set to be always on.This patch moves the enable to the
tegra_hdmi_drm_initfunction to make sure the regulator will get enabled.
Quoted 14 lines
The DT binding document isn't very clear on this topic (and should be fixed): What is this regulator intended to control? If this regulator solely controls the supply to the hotplug detection circuit, this change makes sense. If the regulator mainly supplies something else (e.g. part of the HDMI core on the Tegra chip), then perhaps this change isn't correct. The correct approach might be to introduce another (optional) regulator specifically for the hotplug circuit. Presumably both DT properties vdd-supply and hotplug-supply could point at the same regulator if that's the way the HW was wired up.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
AFAICT, it controls the Vdd pin on the HDMI port, so it just affects the hotplug pin and the DDC I2C bus power.
Re: [PATCH v2 3/6] host1x: hdmi: Enable Vdd earlier for hotplug/DDC
Quoted 26 lines · Mikko Perttunen
Quoted 10 lines · Stephen Warren
Quoted 8 lines · Mikko Perttunen
The Vdd regulator used to be enabled only at
tegra_output_hdmi_enable, which is called after a sink is detected. However, the HDMI hotplug pin works by returning the voltage supplied by the Vdd pin, so this meant that the hotplug pin was never asserted and the sink was not detected unless the Vdd regulator was set to be always on.This patch moves the enable to the
tegra_hdmi_drm_initfunction to make sure the regulator will get enabled.Quoted 14 lines
The DT binding document isn't very clear on this topic (and should be fixed): What is this regulator intended to control? If this regulator solely controls the supply to the hotplug detection circuit, this change makes sense. If the regulator mainly supplies something else (e.g. part of the HDMI core on the Tegra chip), then perhaps this change isn't correct. The correct approach might be to introduce another (optional) regulator specifically for the hotplug circuit. Presumably both DT properties vdd-supply and hotplug-supply could point at the same regulator if that's the way the HW was wired up.
Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines
AFAICT, it controls the Vdd pin on the HDMI port, so it just affects the hotplug pin and the DDC I2C bus power.
Ah OK, then this code change makes sense. It'd be useful to put what you just wrote into the binding doc.