video: tegra: Add hook for DDC enable
PATCH 1/2 video: tegra: Add hook for DDC enable
Some output types like HDMI need to take special action when performing a DDC transaction such as an EDID read. This adds hooks to give platform code the opportunity to set up for DDC transactions.
For HDMI, DDC access is enabled before the debouncing delay is applied; this is necessary for some HDMI sinks to give the +5V time to settle and the i2c microcontroller in the sink (powered off the +5V from the cable) time to power up.
---
I tested this on a couple of different HDMI sinks and a couple of different Tegra boards. With these changes, EDID reads succeed every hotplug (they were intermittent before), and I verified with a multimeter that +5V is not on in the steady state when HDMI output is disabled.
arch/arm/mach-tegra/include/mach/dc.h | 6 ++++ drivers/video/tegra/dc/dc.c | 24 +++++++++++++++++ drivers/video/tegra/dc/dc_priv.h | 8 ++++- drivers/video/tegra/dc/hdmi.c | 46 ++++++++++++++++++++------------ 4 files changed, 65 insertions(+), 19 deletions(-)
arch/arm/mach-tegra/include/mach/dc.h +6 -0
@@ -71,6 +71,12 @@ struct tegra_dc_out {int (*enable)(void );int (*disable)(void ); +/* +* Some output types require special handling when attempting to read +* the EDID over DDC (such as HDMI enabling +5V). +*/ +void (*enable_ddc)(void ); +void (*disable_ddc)(void ); };/* bits for tegra_dc_out.flags */
drivers/video/tegra/dc/dc.c +24 -0
@@ -1033,6 +1033,28 @@ static void tegra_dc_init(struct tegra_dc *dc)tegra_dc_program_mode (dc, &dc->mode); } +void tegra_dc_enable_ddc (struct tegra_dc *dc) +{ +if (dc->ddc_enabled) +return ; + +if (dc->out && dc->out->enable_ddc) + dc->out->enable_ddc (); + + dc->ddc_enabled = true; +} + +void tegra_dc_disable_ddc (struct tegra_dc *dc) +{ +if (!dc->ddc_enabled) +return ; + +if (dc->out && dc->out->disable_ddc) + dc->out->disable_ddc (); + + dc->ddc_enabled = false; +} +static bool _tegra_dc_enable (struct tegra_dc *dc) {if (dc->mode.pclk ==0 )
@@ -1040,6 +1062,7 @@ static bool _tegra_dc_enable(struct tegra_dc *dc)tegra_dc_io_start (dc); +tegra_dc_enable_ddc (dc);if (dc->out && dc->out->enable) dc->out->enable ();
@@ -1086,6 +1109,7 @@ static void _tegra_dc_disable(struct tegra_dc *dc)if (dc->out && dc->out->disable) dc->out->disable (); +tegra_dc_disable_ddc (dc);/* flush any pending syncpt waits */ while (dc->syncpt_min < dc->syncpt_max) {
drivers/video/tegra/dc/dc_priv.h +6 -2
@@ -36,8 +36,8 @@ struct tegra_dc_out_ops {int (*init)(struct tegra_dc *dc);/* destroy output. dc clocks are not on at this point */ void (*destroy)(struct tegra_dc *dc); -/* detect connected display. can sleep.*/ -bool (*detect)(struct tegra_dc *dc); +/* detect connected display. */ +void (*detect)(struct tegra_dc *dc);/* enable output. dc clocks are on at this point */ void (*enable)(struct tegra_dc *dc);/* disable output. dc clocks are on at this point */
@@ -63,6 +63,7 @@ struct tegra_dc {struct clk *emc_clk;bool enabled; +bool ddc_enabled;bool suspended;struct tegra_dc_out *out;
@@ -138,6 +139,9 @@ static inline void *tegra_dc_get_outdata(struct tegra_dc *dc)void tegra_dc_setup_clk (struct tegra_dc *dc,struct clk *clk); +void tegra_dc_enable_ddc (struct tegra_dc *dc); +void tegra_dc_disable_ddc (struct tegra_dc *dc); +extern struct tegra_dc_out_ops tegra_dc_rgb_ops;extern struct tegra_dc_out_ops tegra_dc_hdmi_ops;
drivers/video/tegra/dc/hdmi.c +29 -17
83 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH 2/2 arm: tegra: ventana: Enable HDMI +5V for DDC
In reply to a message not in the archiveThe HDMI specification says that +5V must be enabled when using DDC or TMDS signals. This change fills in the hook for Ventana to set the correct GPIO to provide this power during DDC transactions.
Additionally, initialize the +5V gpio to disabled, to save power until it's needed.
---
I actually only tested this with Seaboard, but they should be electrically the same as far as HDMI goes and Seaboard support doesn't exist in this branch.
arch/arm/mach-tegra/board-ventana-panel.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-)
arch/arm/mach-tegra/board-ventana-panel.c +6 -7
@@ -109,16 +109,14 @@ static int ventana_panel_disable(void)return 0 ; } -static int ventana_hdmi_enable (void ) +static void ventana_hdmi_enable_ddc (void ) {gpio_set_value (ventana_hdmi_enb,1 ); -return 0 ; } -static int ventana_hdmi_disable (void ) +static void ventana_hdmi_disable_ddc (void ) {gpio_set_value (ventana_hdmi_enb,0 ); -return 0 ; }static struct resource ventana_disp1_resources[] = {
@@ -222,8 +220,8 @@ static struct tegra_dc_out ventana_disp2_out = { .align = TEGRA_DC_ALIGN_MSB, .order = TEGRA_DC_ORDER_RED_BLUE, - .enable = ventana_hdmi_enable, - .disable = ventana_hdmi_disable, + .enable_ddc = ventana_hdmi_enable_ddc, + .disable_ddc = ventana_hdmi_disable_ddc, };static struct tegra_dc_platform_data ventana_disp1_pdata = {
@@ -304,8 +302,9 @@ int __init ventana_panel_init(void)tegra_gpio_enable (ventana_lvds_shutdown);gpio_request (ventana_hdmi_enb,"hdmi_5v_en" ); -gpio_direction_output (ventana_hdmi_enb,0 ); +gpio_direction_output (ventana_hdmi_enb,1 );tegra_gpio_enable (ventana_hdmi_enb); +gpio_set_value (ventana_hdmi_enb,0 );gpio_request (ventana_hdmi_hpd,"hdmi_hpd" );gpio_direction_input (ventana_hdmi_hpd);
Signature · 1 line
1.7.3.4
PATCH v2 1/2 video: tegra: Add hook for DDC enable
In reply to a message not in the archiveSome output types like HDMI need to take special action when performing a DDC transaction such as an EDID read. This adds hooks to give platform code the opportunity to set up for DDC transactions.
For HDMI, DDC access is enabled before the debouncing delay is applied; this is necessary for some HDMI sinks to give the +5V time to settle and the i2c microcontroller in the sink (powered off the +5V from the cable) time to power up.
---
I tested this on a couple of different HDMI sinks and a couple of different Tegra boards. With these changes, EDID reads succeed every hotplug (they were intermittent before), and I verified with a multimeter that +5V is not on in the steady state when HDMI output is disabled.
Version 2 of this patch is unchanged (pushing out again to update path 2/2)
This patchset applies to the linux-tegra-2.6.36 branch.
arch/arm/mach-tegra/include/mach/dc.h | 6 ++++ drivers/video/tegra/dc/dc.c | 24 +++++++++++++++++ drivers/video/tegra/dc/dc_priv.h | 8 ++++- drivers/video/tegra/dc/hdmi.c | 46 ++++++++++++++++++++------------ 4 files changed, 65 insertions(+), 19 deletions(-)
arch/arm/mach-tegra/include/mach/dc.h +6 -0
@@ -71,6 +71,12 @@ struct tegra_dc_out {int (*enable)(void );int (*disable)(void ); +/* +* Some output types require special handling when attempting to read +* the EDID over DDC (such as HDMI enabling +5V). +*/ +void (*enable_ddc)(void ); +void (*disable_ddc)(void ); };/* bits for tegra_dc_out.flags */
drivers/video/tegra/dc/dc.c +24 -0
@@ -1033,6 +1033,28 @@ static void tegra_dc_init(struct tegra_dc *dc)tegra_dc_program_mode (dc, &dc->mode); } +void tegra_dc_enable_ddc (struct tegra_dc *dc) +{ +if (dc->ddc_enabled) +return ; + +if (dc->out && dc->out->enable_ddc) + dc->out->enable_ddc (); + + dc->ddc_enabled = true; +} + +void tegra_dc_disable_ddc (struct tegra_dc *dc) +{ +if (!dc->ddc_enabled) +return ; + +if (dc->out && dc->out->disable_ddc) + dc->out->disable_ddc (); + + dc->ddc_enabled = false; +} +static bool _tegra_dc_enable (struct tegra_dc *dc) {if (dc->mode.pclk ==0 )
@@ -1040,6 +1062,7 @@ static bool _tegra_dc_enable(struct tegra_dc *dc)tegra_dc_io_start (dc); +tegra_dc_enable_ddc (dc);if (dc->out && dc->out->enable) dc->out->enable ();
@@ -1086,6 +1109,7 @@ static void _tegra_dc_disable(struct tegra_dc *dc)if (dc->out && dc->out->disable) dc->out->disable (); +tegra_dc_disable_ddc (dc);/* flush any pending syncpt waits */ while (dc->syncpt_min < dc->syncpt_max) {
drivers/video/tegra/dc/dc_priv.h +6 -2
@@ -36,8 +36,8 @@ struct tegra_dc_out_ops {int (*init)(struct tegra_dc *dc);/* destroy output. dc clocks are not on at this point */ void (*destroy)(struct tegra_dc *dc); -/* detect connected display. can sleep.*/ -bool (*detect)(struct tegra_dc *dc); +/* detect connected display. */ +void (*detect)(struct tegra_dc *dc);/* enable output. dc clocks are on at this point */ void (*enable)(struct tegra_dc *dc);/* disable output. dc clocks are on at this point */
@@ -63,6 +63,7 @@ struct tegra_dc {struct clk *emc_clk;bool enabled; +bool ddc_enabled;bool suspended;struct tegra_dc_out *out;
@@ -138,6 +139,9 @@ static inline void *tegra_dc_get_outdata(struct tegra_dc *dc)void tegra_dc_setup_clk (struct tegra_dc *dc,struct clk *clk); +void tegra_dc_enable_ddc (struct tegra_dc *dc); +void tegra_dc_disable_ddc (struct tegra_dc *dc); +extern struct tegra_dc_out_ops tegra_dc_rgb_ops;extern struct tegra_dc_out_ops tegra_dc_hdmi_ops;
drivers/video/tegra/dc/hdmi.c +29 -17
83 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH v2 2/2 arm: tegra: ventana: Enable HDMI +5V for DDC
In reply to a message not in the archiveThe HDMI specification says that +5V must be enabled when using DDC or TMDS signals. This change fills in the hook for Ventana to set the correct GPIO to provide this power during DDC transactions.
Additionally, initialize the +5V gpio to disabled, to save power until it's needed.
---
I actually only tested this with Seaboard, but they should be electrically the same as far as HDMI goes and Seaboard support doesn't exist in this branch.
Version 2 removes some silliness in the gpio init due to my misunderstanding of gpio_direction_output()'s second argument.
This patchset applies to the linux-tegra-2.6.36 branch.
arch/arm/mach-tegra/board-ventana-panel.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
arch/arm/mach-tegra/board-ventana-panel.c +4 -6
@@ -109,16 +109,14 @@ static int ventana_panel_disable(void)return 0 ; } -static int ventana_hdmi_enable (void ) +static void ventana_hdmi_enable_ddc (void ) {gpio_set_value (ventana_hdmi_enb,1 ); -return 0 ; } -static int ventana_hdmi_disable (void ) +static void ventana_hdmi_disable_ddc (void ) {gpio_set_value (ventana_hdmi_enb,0 ); -return 0 ; }static struct resource ventana_disp1_resources[] = {
@@ -222,8 +220,8 @@ static struct tegra_dc_out ventana_disp2_out = { .align = TEGRA_DC_ALIGN_MSB, .order = TEGRA_DC_ORDER_RED_BLUE, - .enable = ventana_hdmi_enable, - .disable = ventana_hdmi_disable, + .enable_ddc = ventana_hdmi_enable_ddc, + .disable_ddc = ventana_hdmi_disable_ddc, };static struct tegra_dc_platform_data ventana_disp1_pdata = {
Signature · 1 line
1.7.3.4