linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] OMAPDSS: HDMI PHY burnout fix
@ 2012-01-17 12:48 Tomi Valkeinen
  2012-01-17 12:48 ` [PATCH 1/6] OMAP: 4430SDP/Panda: use gpio_free_array to free HDMI gpios Tomi Valkeinen
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Tomi Valkeinen @ 2012-01-17 12:48 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, mythripk; +Cc: archit, x0132446, Tomi Valkeinen

The main patch in this set is the last one, which implements a fix for the HW
bug on OMAP4 which causes physical damage to the board if the HDMI cable is not
connected but HDMI output is enabled.

The preceding patches are small cleanups/fixes for HDMI GPIOs so that the fix
can be implemented.

Note that I haven't gotten a confirmation that using LDO_ON for the HDMI PHY
power fixes the issue. So whether the fix works or not is unclear.

 Tomi

Tomi Valkeinen (6):
  OMAP: 4430SDP/Panda: use gpio_free_array to free HDMI gpios
  OMAP: 4430SDP/Panda: rename HPD GPIO to CT_CP_HPD
  OMAPDSS: remove wrong HDMI HPD muxing
  OMAP: 4430SDP/Panda: setup HDMI GPIO muxes
  OMAP: 4430SDP/Panda: add HDMI HPD gpio
  OMAPDSS: HDMI: PHY burnout fix

 arch/arm/mach-omap2/board-4430sdp.c       |   18 ++++++--
 arch/arm/mach-omap2/board-omap4panda.c    |   18 ++++++--
 arch/arm/mach-omap2/display.c             |    4 --
 drivers/video/omap2/dss/hdmi.c            |    3 +
 drivers/video/omap2/dss/ti_hdmi.h         |    4 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   68 +++++++++++++++++++++++++++--
 include/video/omapdss.h                   |    5 ++
 7 files changed, 104 insertions(+), 16 deletions(-)

-- 
1.7.4.1


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

* [PATCH 1/6] OMAP: 4430SDP/Panda: use gpio_free_array to free HDMI gpios
  2012-01-17 12:48 [PATCH 0/6] OMAPDSS: HDMI PHY burnout fix Tomi Valkeinen
@ 2012-01-17 12:48 ` Tomi Valkeinen
  2012-01-17 12:48 ` [PATCH 3/6] OMAPDSS: remove wrong HDMI HPD muxing Tomi Valkeinen
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Tomi Valkeinen @ 2012-01-17 12:48 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, mythripk; +Cc: archit, x0132446, Tomi Valkeinen

Instead of freeing the GPIOs individually, use gpio_free_array().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c    |    3 +--
 arch/arm/mach-omap2/board-omap4panda.c |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 4af874a..d7017f2 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -614,8 +614,7 @@ static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
 
 static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
 {
-	gpio_free(HDMI_GPIO_LS_OE);
-	gpio_free(HDMI_GPIO_HPD);
+	gpio_free_array(sdp4430_hdmi_gpios, ARRAY_SIZE(sdp4430_hdmi_gpios));
 }
 
 static struct nokia_dsi_panel_data dsi1_panel = {
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 00103e3..b9f90ba 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -497,8 +497,7 @@ static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
 
 static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev)
 {
-	gpio_free(HDMI_GPIO_LS_OE);
-	gpio_free(HDMI_GPIO_HPD);
+	gpio_free_array(panda_hdmi_gpios, ARRAY_SIZE(panda_hdmi_gpios));
 }
 
 static struct omap_dss_device  omap4_panda_hdmi_device = {
-- 
1.7.4.1


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

* [PATCH 3/6] OMAPDSS: remove wrong HDMI HPD muxing
  2012-01-17 12:48 [PATCH 0/6] OMAPDSS: HDMI PHY burnout fix Tomi Valkeinen
  2012-01-17 12:48 ` [PATCH 1/6] OMAP: 4430SDP/Panda: use gpio_free_array to free HDMI gpios Tomi Valkeinen
@ 2012-01-17 12:48 ` Tomi Valkeinen
  2012-01-17 12:49 ` [PATCH 4/6] OMAP: 4430SDP/Panda: setup HDMI GPIO muxes Tomi Valkeinen
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Tomi Valkeinen @ 2012-01-17 12:48 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, mythripk; +Cc: archit, x0132446, Tomi Valkeinen

"hdmi_hpd" pin is muxed to INPUT and PULLUP, but the pin is not
currently used, and in the future when it is used, the pin is used as a
GPIO and is board specific, not an OMAP4 wide thing.

So remove the muxing for now.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/display.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index ffd9bd9..d6e65e2 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -102,12 +102,8 @@ static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags)
 	u32 reg;
 	u16 control_i2c_1;
 
-	/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
-	omap_mux_init_signal("hdmi_hpd",
-			OMAP_PIN_INPUT_PULLUP);
 	omap_mux_init_signal("hdmi_cec",
 			OMAP_PIN_INPUT_PULLUP);
-	/* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
 	omap_mux_init_signal("hdmi_ddc_scl",
 			OMAP_PIN_INPUT_PULLUP);
 	omap_mux_init_signal("hdmi_ddc_sda",
-- 
1.7.4.1


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

* [PATCH 4/6] OMAP: 4430SDP/Panda: setup HDMI GPIO muxes
  2012-01-17 12:48 [PATCH 0/6] OMAPDSS: HDMI PHY burnout fix Tomi Valkeinen
  2012-01-17 12:48 ` [PATCH 1/6] OMAP: 4430SDP/Panda: use gpio_free_array to free HDMI gpios Tomi Valkeinen
  2012-01-17 12:48 ` [PATCH 3/6] OMAPDSS: remove wrong HDMI HPD muxing Tomi Valkeinen
@ 2012-01-17 12:49 ` Tomi Valkeinen
  2012-01-17 12:49 ` [PATCH 5/6] OMAP: 4430SDP/Panda: add HDMI HPD gpio Tomi Valkeinen
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Tomi Valkeinen @ 2012-01-17 12:49 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, mythripk; +Cc: archit, x0132446, Tomi Valkeinen

The HDMI GPIO pins LS_OE and CT_CP_HPD are not currently configured.
This patch configures them as output pins.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c    |    3 +++
 arch/arm/mach-omap2/board-omap4panda.c |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index ae0c09f..5dcc8df 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -833,6 +833,9 @@ static void omap_4430sdp_display_init(void)
 		omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
 	else
 		omap_hdmi_init(0);
+
+	omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
+	omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 133b5a7..06a7075 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -549,6 +549,9 @@ void omap4_panda_display_init(void)
 		omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
 	else
 		omap_hdmi_init(0);
+
+	omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
+	omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
 }
 
 static void __init omap4_panda_init(void)
-- 
1.7.4.1


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

* [PATCH 5/6] OMAP: 4430SDP/Panda: add HDMI HPD gpio
  2012-01-17 12:48 [PATCH 0/6] OMAPDSS: HDMI PHY burnout fix Tomi Valkeinen
                   ` (2 preceding siblings ...)
  2012-01-17 12:49 ` [PATCH 4/6] OMAP: 4430SDP/Panda: setup HDMI GPIO muxes Tomi Valkeinen
@ 2012-01-17 12:49 ` Tomi Valkeinen
  2012-01-17 20:44   ` Archit
  2012-01-17 13:04 ` [PATCH 6/6] OMAPDSS: HDMI: PHY burnout fix Tomi Valkeinen
  2012-01-20 14:49 ` [PATCH 0/6] OMAPDSS: HDMI " Tony Lindgren
  5 siblings, 1 reply; 9+ messages in thread
From: Tomi Valkeinen @ 2012-01-17 12:49 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, mythripk; +Cc: archit, x0132446, Tomi Valkeinen

Both Panda and 4430SDP use GPIO 64 as HDMI hot-plug-detect. Configure
this GPIO in the board files.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c    |    3 +++
 arch/arm/mach-omap2/board-omap4panda.c |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 5dcc8df..a776c26 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -54,6 +54,7 @@
 #define OMAP4_SFH7741_ENABLE_GPIO		188
 #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
+#define HDMI_GPIO_HPD  63 /* Hotplug detect */
 #define DISPLAY_SEL_GPIO	59	/* LCD2/PicoDLP switch */
 #define DLP_POWER_ON_GPIO	40
 
@@ -598,6 +599,7 @@ static void __init omap_sfh7741prox_init(void)
 static struct gpio sdp4430_hdmi_gpios[] = {
 	{ HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" },
 	{ HDMI_GPIO_LS_OE,	GPIOF_OUT_INIT_HIGH,	"hdmi_gpio_ls_oe" },
+	{ HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" },
 };
 
 static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
@@ -836,6 +838,7 @@ static void omap_4430sdp_display_init(void)
 
 	omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
 	omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
+	omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 06a7075..b22a288 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -53,6 +53,7 @@
 #define GPIO_WIFI_IRQ		53
 #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
+#define HDMI_GPIO_HPD  63 /* Hotplug detect */
 
 /* wl127x BT, FM, GPS connectivity chip */
 static int wl1271_gpios[] = {46, -1, -1};
@@ -481,6 +482,7 @@ int __init omap4_panda_dvi_init(void)
 static struct gpio panda_hdmi_gpios[] = {
 	{ HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" },
 	{ HDMI_GPIO_LS_OE,	GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
+	{ HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" },
 };
 
 static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
@@ -552,6 +554,7 @@ void omap4_panda_display_init(void)
 
 	omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
 	omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
+	omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
 }
 
 static void __init omap4_panda_init(void)
-- 
1.7.4.1


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

* [PATCH 6/6] OMAPDSS: HDMI: PHY burnout fix
  2012-01-17 12:48 [PATCH 0/6] OMAPDSS: HDMI PHY burnout fix Tomi Valkeinen
                   ` (3 preceding siblings ...)
  2012-01-17 12:49 ` [PATCH 5/6] OMAP: 4430SDP/Panda: add HDMI HPD gpio Tomi Valkeinen
@ 2012-01-17 13:04 ` Tomi Valkeinen
  2012-01-20 14:49 ` [PATCH 0/6] OMAPDSS: HDMI " Tony Lindgren
  5 siblings, 0 replies; 9+ messages in thread
From: Tomi Valkeinen @ 2012-01-17 13:04 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, mythripk; +Cc: archit, x0132446, Tomi Valkeinen

A hardware bug in the OMAP4 HDMI PHY causes physical damage to the board
if the HDMI PHY is powered on when the cable is not connected.

This patch solves the problem by adding hot-plug-detection into the HDMI
IP driver. This is not a real HPD support in the sense that nobody else
than the IP driver gets to know about the HPD events, but is only meant
to fix the HW bug.

The strategy is simple: If the display device is turned off by the user,
the PHY power is set to OFF. When the display device is turned on by the
user, the PHY power is set either to LDOON or TXON, depending on whether
the HDMI cable is connected.

The reason to avoid PHY OFF when the display device is on, but the cable
is disconnected, is that when the PHY is turned OFF, the HDMI IP is not
"ticking" and thus the DISPC does not receive pixel clock from the HDMI
IP. This would, for example, prevent any VSYNCs from happening, and
would thus affect the users of omapdss. By using LDOON when the cable is
disconnected we'll avoid the HW bug, but keep the HDMI working as usual
from the user's point of view.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c       |    5 ++
 arch/arm/mach-omap2/board-omap4panda.c    |    5 ++
 drivers/video/omap2/dss/hdmi.c            |    3 +
 drivers/video/omap2/dss/ti_hdmi.h         |    4 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   68 +++++++++++++++++++++++++++--
 include/video/omapdss.h                   |    5 ++
 6 files changed, 86 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index a776c26..d4fe511 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -732,6 +732,10 @@ static void sdp4430_lcd_init(void)
 		pr_err("%s: Could not get lcd2_reset_gpio\n", __func__);
 }
 
+static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
+	.hpd_gpio = HDMI_GPIO_HPD,
+};
+
 static struct omap_dss_device sdp4430_hdmi_device = {
 	.name = "hdmi",
 	.driver_name = "hdmi_panel",
@@ -739,6 +743,7 @@ static struct omap_dss_device sdp4430_hdmi_device = {
 	.platform_enable = sdp4430_panel_enable_hdmi,
 	.platform_disable = sdp4430_panel_disable_hdmi,
 	.channel = OMAP_DSS_CHANNEL_DIGIT,
+	.data = &sdp4430_hdmi_data,
 };
 
 static struct picodlp_panel_data sdp4430_picodlp_pdata = {
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index b22a288..c28ef20 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -502,6 +502,10 @@ static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev)
 	gpio_free_array(panda_hdmi_gpios, ARRAY_SIZE(panda_hdmi_gpios));
 }
 
+static struct omap_dss_hdmi_data omap4_panda_hdmi_data = {
+	.hpd_gpio = HDMI_GPIO_HPD,
+};
+
 static struct omap_dss_device  omap4_panda_hdmi_device = {
 	.name = "hdmi",
 	.driver_name = "hdmi_panel",
@@ -509,6 +513,7 @@ static struct omap_dss_device  omap4_panda_hdmi_device = {
 	.platform_enable = omap4_panda_panel_enable_hdmi,
 	.platform_disable = omap4_panda_panel_disable_hdmi,
 	.channel = OMAP_DSS_CHANNEL_DIGIT,
+	.data = &omap4_panda_hdmi_data,
 };
 
 static struct omap_dss_device *omap4_panda_dss_devices[] = {
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 92a6679..3b76a20 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -469,6 +469,7 @@ bool omapdss_hdmi_detect(void)
 
 int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
 {
+	struct omap_dss_hdmi_data *priv = dssdev->data;
 	int r = 0;
 
 	DSSDBG("ENTER hdmi_display_enable\n");
@@ -481,6 +482,8 @@ int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
 		goto err0;
 	}
 
+	hdmi.ip_data.hpd_gpio = priv->hpd_gpio;
+
 	r = omap_dss_start_device(dssdev);
 	if (r) {
 		DSSERR("failed to start device\n");
diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index 26ec6d1..cb6f0f2 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -122,6 +122,10 @@ struct hdmi_ip_data {
 	const struct ti_hdmi_ip_ops *ops;
 	struct hdmi_config cfg;
 	struct hdmi_pll_info pll_data;
+
+	/* ti_hdmi_4xxx_ip private data. These should be in a separate struct */
+	int hpd_gpio;
+	bool phy_tx_enabled;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index a229ae7..34e58dd 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -28,6 +28,7 @@
 #include <linux/delay.h>
 #include <linux/string.h>
 #include <linux/seq_file.h>
+#include <linux/gpio.h>
 
 #include "ti_hdmi_4xxx_ip.h"
 #include "dss.h"
@@ -223,6 +224,49 @@ void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data)
 	hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF);
 }
 
+static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data)
+{
+	unsigned long flags;
+	bool hpd;
+	int r;
+	/* this should be in ti_hdmi_4xxx_ip private data */
+	static DEFINE_SPINLOCK(phy_tx_lock);
+
+	spin_lock_irqsave(&phy_tx_lock, flags);
+
+	hpd = gpio_get_value(ip_data->hpd_gpio);
+
+	if (hpd = ip_data->phy_tx_enabled) {
+		spin_unlock_irqrestore(&phy_tx_lock, flags);
+		return 0;
+	}
+
+	if (hpd)
+		r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
+	else
+		r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON);
+
+	if (r) {
+		DSSERR("Failed to %s PHY TX power\n",
+				hpd ? "enable" : "disable");
+		goto err;
+	}
+
+	ip_data->phy_tx_enabled = hpd;
+err:
+	spin_unlock_irqrestore(&phy_tx_lock, flags);
+	return r;
+}
+
+static irqreturn_t hpd_irq_handler(int irq, void *data)
+{
+	struct hdmi_ip_data *ip_data = data;
+
+	hdmi_check_hpd_state(ip_data);
+
+	return IRQ_HANDLED;
+}
+
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
 {
 	u16 r = 0;
@@ -232,10 +276,6 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
 	if (r)
 		return r;
 
-	r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
-	if (r)
-		return r;
-
 	/*
 	 * Read address 0 in order to get the SCP reset done completed
 	 * Dummy access performed to make sure reset is done
@@ -257,12 +297,32 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
 	/* Write to phy address 3 to change the polarity control */
 	REG_FLD_MOD(phy_base, HDMI_TXPHY_PAD_CFG_CTRL, 0x1, 27, 27);
 
+	r = request_threaded_irq(gpio_to_irq(ip_data->hpd_gpio),
+			NULL, hpd_irq_handler,
+			IRQF_DISABLED | IRQF_TRIGGER_RISING |
+			IRQF_TRIGGER_FALLING, "hpd", ip_data);
+	if (r) {
+		DSSERR("HPD IRQ request failed\n");
+		hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
+		return r;
+	}
+
+	r = hdmi_check_hpd_state(ip_data);
+	if (r) {
+		free_irq(gpio_to_irq(ip_data->hpd_gpio), ip_data);
+		hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
+		return r;
+	}
+
 	return 0;
 }
 
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data)
 {
+	free_irq(gpio_to_irq(ip_data->hpd_gpio), ip_data);
+
 	hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
+	ip_data->phy_tx_enabled = false;
 }
 
 static int hdmi_core_ddc_init(struct hdmi_ip_data *ip_data)
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 062b3b2..483f67c 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -590,6 +590,11 @@ struct omap_dss_device {
 	int (*get_backlight)(struct omap_dss_device *dssdev);
 };
 
+struct omap_dss_hdmi_data
+{
+	int hpd_gpio;
+};
+
 struct omap_dss_driver {
 	struct device_driver driver;
 
-- 
1.7.4.1


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

* Re: [PATCH 5/6] OMAP: 4430SDP/Panda: add HDMI HPD gpio
  2012-01-17 12:49 ` [PATCH 5/6] OMAP: 4430SDP/Panda: add HDMI HPD gpio Tomi Valkeinen
@ 2012-01-17 20:44   ` Archit
  2012-01-18  6:39     ` Tomi Valkeinen
  0 siblings, 1 reply; 9+ messages in thread
From: Archit @ 2012-01-17 20:44 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev, mythripk, archit, x0132446

On Tuesday 17 January 2012 06:19 PM, Tomi Valkeinen wrote:
> Both Panda and 4430SDP use GPIO 64 as HDMI hot-plug-detect. Configure
> this GPIO in the board files.

Minor comment: the commit message says GPIO 64, and the macros use gpio 
63. Is this done intentionally?

Archit

>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
>   arch/arm/mach-omap2/board-4430sdp.c    |    3 +++
>   arch/arm/mach-omap2/board-omap4panda.c |    3 +++
>   2 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> index 5dcc8df..a776c26 100644
> --- a/arch/arm/mach-omap2/board-4430sdp.c
> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> @@ -54,6 +54,7 @@
>   #define OMAP4_SFH7741_ENABLE_GPIO		188
>   #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
>   #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
> +#define HDMI_GPIO_HPD  63 /* Hotplug detect */
>   #define DISPLAY_SEL_GPIO	59	/* LCD2/PicoDLP switch */
>   #define DLP_POWER_ON_GPIO	40
>
> @@ -598,6 +599,7 @@ static void __init omap_sfh7741prox_init(void)
>   static struct gpio sdp4430_hdmi_gpios[] = {
>   	{ HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" },
>   	{ HDMI_GPIO_LS_OE,	GPIOF_OUT_INIT_HIGH,	"hdmi_gpio_ls_oe" },
> +	{ HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" },
>   };
>
>   static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
> @@ -836,6 +838,7 @@ static void omap_4430sdp_display_init(void)
>
>   	omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
>   	omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
> +	omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
>   }
>
>   #ifdef CONFIG_OMAP_MUX
> diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
> index 06a7075..b22a288 100644
> --- a/arch/arm/mach-omap2/board-omap4panda.c
> +++ b/arch/arm/mach-omap2/board-omap4panda.c
> @@ -53,6 +53,7 @@
>   #define GPIO_WIFI_IRQ		53
>   #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
>   #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
> +#define HDMI_GPIO_HPD  63 /* Hotplug detect */
>
>   /* wl127x BT, FM, GPS connectivity chip */
>   static int wl1271_gpios[] = {46, -1, -1};
> @@ -481,6 +482,7 @@ int __init omap4_panda_dvi_init(void)
>   static struct gpio panda_hdmi_gpios[] = {
>   	{ HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" },
>   	{ HDMI_GPIO_LS_OE,	GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
> +	{ HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" },
>   };
>
>   static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
> @@ -552,6 +554,7 @@ void omap4_panda_display_init(void)
>
>   	omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
>   	omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
> +	omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
>   }
>
>   static void __init omap4_panda_init(void)


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

* Re: [PATCH 5/6] OMAP: 4430SDP/Panda: add HDMI HPD gpio
  2012-01-17 20:44   ` Archit
@ 2012-01-18  6:39     ` Tomi Valkeinen
  0 siblings, 0 replies; 9+ messages in thread
From: Tomi Valkeinen @ 2012-01-18  6:39 UTC (permalink / raw)
  To: Archit; +Cc: linux-omap, linux-fbdev, mythripk, archit, x0132446

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

On Wed, 2012-01-18 at 02:02 +0530, Archit wrote:
> On Tuesday 17 January 2012 06:19 PM, Tomi Valkeinen wrote:
> > Both Panda and 4430SDP use GPIO 64 as HDMI hot-plug-detect. Configure
> > this GPIO in the board files.
> 
> Minor comment: the commit message says GPIO 64, and the macros use gpio 
> 63. Is this done intentionally?

Thanks, it's a typo. HPD gpio is 63.

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 0/6] OMAPDSS: HDMI PHY burnout fix
  2012-01-17 12:48 [PATCH 0/6] OMAPDSS: HDMI PHY burnout fix Tomi Valkeinen
                   ` (4 preceding siblings ...)
  2012-01-17 13:04 ` [PATCH 6/6] OMAPDSS: HDMI: PHY burnout fix Tomi Valkeinen
@ 2012-01-20 14:49 ` Tony Lindgren
  5 siblings, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2012-01-20 14:49 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev, mythripk, archit, x0132446

* Tomi Valkeinen <tomi.valkeinen@ti.com> [120117 04:16]:
> The main patch in this set is the last one, which implements a fix for the HW
> bug on OMAP4 which causes physical damage to the board if the HDMI cable is not
> connected but HDMI output is enabled.
> 
> The preceding patches are small cleanups/fixes for HDMI GPIOs so that the fix
> can be implemented.
> 
> Note that I haven't gotten a confirmation that using LDO_ON for the HDMI PHY
> power fixes the issue. So whether the fix works or not is unclear.

Feel free to merge via fb tree. For the arch/arm/*omap*/* parts:

Acked-by: Tony Lindgren <tony@atomide.com>

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

end of thread, other threads:[~2012-01-20 14:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-17 12:48 [PATCH 0/6] OMAPDSS: HDMI PHY burnout fix Tomi Valkeinen
2012-01-17 12:48 ` [PATCH 1/6] OMAP: 4430SDP/Panda: use gpio_free_array to free HDMI gpios Tomi Valkeinen
2012-01-17 12:48 ` [PATCH 3/6] OMAPDSS: remove wrong HDMI HPD muxing Tomi Valkeinen
2012-01-17 12:49 ` [PATCH 4/6] OMAP: 4430SDP/Panda: setup HDMI GPIO muxes Tomi Valkeinen
2012-01-17 12:49 ` [PATCH 5/6] OMAP: 4430SDP/Panda: add HDMI HPD gpio Tomi Valkeinen
2012-01-17 20:44   ` Archit
2012-01-18  6:39     ` Tomi Valkeinen
2012-01-17 13:04 ` [PATCH 6/6] OMAPDSS: HDMI: PHY burnout fix Tomi Valkeinen
2012-01-20 14:49 ` [PATCH 0/6] OMAPDSS: HDMI " Tony Lindgren

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).