linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support.
@ 2011-12-13 13:24 mythripk
  2011-12-13 13:24 ` [PATCH 1/3] OMAPDSS: HDMI: HPD support in boardfile mythripk
  0 siblings, 1 reply; 5+ messages in thread
From: mythripk @ 2011-12-13 13:24 UTC (permalink / raw)
  To: tomi.valkeinen, linux-omap; +Cc: Mythri P K

From: Mythri P K <mythripk@ti.com>

HDMI even if enabled by default should be powered on only when the cable is
connected. This is supported by the Hot-plug feature.
Now when HDMI is enabled the following steps are followed:
-Display enable for HDMI is based on Hot-plug-detect(HPD).
-It registers to the GPIO irq handler and checks if cable is connected,
	-If yes then it turns on HDMI
-If an HPD interrupt is received the corresponding IRQ handler is called where
it checks if it is a connect / disconnect based on which appropriate action
is taken. 


Mythri P K (3):
  OMAPDSS: HDMI: HPD support in boardfile
  OMAPDSS: HDMI: HPD support added to HDMI driver
  OMAPDSS: HDMI: Add option to enable HDMI in HPD mode

 arch/arm/mach-omap2/board-4430sdp.c    |   35 ++++--------
 arch/arm/mach-omap2/board-omap4panda.c |   35 ++++---------
 arch/arm/mach-omap2/display.c          |   20 ++++++--
 drivers/video/omap2/dss/dss.h          |    2 +
 drivers/video/omap2/dss/hdmi.c         |   92 ++++++++++++++++++++++++++-----
 drivers/video/omap2/dss/hdmi_panel.c   |   54 ++++++++++++++++++-
 include/video/omapdss.h                |   10 +++-
 7 files changed, 176 insertions(+), 72 deletions(-)

-- 
1.7.5.4


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

* [PATCH 1/3] OMAPDSS: HDMI: HPD support in boardfile
  2011-12-13 13:24 [PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support mythripk
@ 2011-12-13 13:24 ` mythripk
  2011-12-13 13:24   ` [PATCH 2/3] OMAPDSS: HDMI: HPD support added to HDMI driver mythripk
  2011-12-17  1:34   ` [PATCH 1/3] OMAPDSS: HDMI: HPD support in boardfile Tony Lindgren
  0 siblings, 2 replies; 5+ messages in thread
From: mythripk @ 2011-12-13 13:24 UTC (permalink / raw)
  To: tomi.valkeinen, linux-omap; +Cc: Mythri P K

From: Mythri P K <mythripk@ti.com>

Add support for HPD GPIO configuration in board file.
Also remove the enabling  of GPIO's required for HDMI from
hdmi driver file to display.c based on the GPIO #'s sent from
board file.

Signed-off-by: Mythri P K <mythripk@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c    |   35 ++++++++++---------------------
 arch/arm/mach-omap2/board-omap4panda.c |   35 +++++++++----------------------
 arch/arm/mach-omap2/display.c          |   20 ++++++++++++++---
 drivers/video/omap2/dss/hdmi.c         |   16 +-------------
 include/video/omapdss.h                |    6 ++++-
 5 files changed, 43 insertions(+), 69 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 1b7c5e5..ba32b81 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -52,8 +52,9 @@
 #define ETH_KS8851_QUART		138
 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO	184
 #define OMAP4_SFH7741_ENABLE_GPIO		188
-#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
+#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
+#define HDMI_GPIO_HPD 63
 #define DISPLAY_SEL_GPIO	59	/* LCD2/PicoDLP switch */
 #define DLP_POWER_ON_GPIO	40
 
@@ -596,27 +597,11 @@ static void __init omap_sfh7741prox_init(void)
 }
 
 static struct gpio sdp4430_hdmi_gpios[] = {
-	{ HDMI_GPIO_HPD,	GPIOF_OUT_INIT_HIGH,	"hdmi_gpio_hpd"   },
-	{ HDMI_GPIO_LS_OE,	GPIOF_OUT_INIT_HIGH,	"hdmi_gpio_ls_oe" },
+	{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)
-{
-	int status;
-
-	status = gpio_request_array(sdp4430_hdmi_gpios,
-				    ARRAY_SIZE(sdp4430_hdmi_gpios));
-	if (status)
-		pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
-
-	return status;
-}
-
-static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
-{
-	gpio_free(HDMI_GPIO_LS_OE);
-	gpio_free(HDMI_GPIO_HPD);
-}
 
 static struct nokia_dsi_panel_data dsi1_panel = {
 		.name		= "taal",
@@ -735,9 +720,8 @@ static struct omap_dss_device sdp4430_hdmi_device = {
 	.name = "hdmi",
 	.driver_name = "hdmi_panel",
 	.type = OMAP_DISPLAY_TYPE_HDMI,
-	.platform_enable = sdp4430_panel_enable_hdmi,
-	.platform_disable = sdp4430_panel_disable_hdmi,
 	.channel = OMAP_DSS_CHANNEL_DIGIT,
+	.hpd_gpio = 63,
 };
 
 static struct picodlp_panel_data sdp4430_picodlp_pdata = {
@@ -835,9 +819,12 @@ static void omap_4430sdp_display_init(void)
 	 * EDID read failure.
 	 */
 	if (cpu_is_omap446x() || (omap_rev() > OMAP4430_REV_ES2_2))
-		omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP);
+		omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP, HDMI_GPIO_HPD,
+				sdp4430_hdmi_gpios,
+				ARRAY_SIZE(sdp4430_hdmi_gpios));
 	else
-		omap_hdmi_init(0);
+		omap_hdmi_init(0, HDMI_GPIO_HPD, sdp4430_hdmi_gpios,
+				ARRAY_SIZE(sdp4430_hdmi_gpios));
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 212e06c..e13d116 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -51,8 +51,9 @@
 #define GPIO_HUB_NRESET		62
 #define GPIO_WIFI_PMENA		43
 #define GPIO_WIFI_IRQ		53
-#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
+#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
+#define HDMI_GPIO_HPD 63
 
 /* wl127x BT, FM, GPS connectivity chip */
 static int wl1271_gpios[] = {46, -1, -1};
@@ -479,35 +480,17 @@ int __init omap4_panda_dvi_init(void)
 }
 
 static struct gpio panda_hdmi_gpios[] = {
-	{ HDMI_GPIO_HPD,	GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd"   },
-	{ HDMI_GPIO_LS_OE,	GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
+	{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)
-{
-	int status;
-
-	status = gpio_request_array(panda_hdmi_gpios,
-				    ARRAY_SIZE(panda_hdmi_gpios));
-	if (status)
-		pr_err("Cannot request HDMI GPIOs\n");
-
-	return status;
-}
-
-static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev)
-{
-	gpio_free(HDMI_GPIO_LS_OE);
-	gpio_free(HDMI_GPIO_HPD);
-}
-
 static struct omap_dss_device  omap4_panda_hdmi_device = {
 	.name = "hdmi",
 	.driver_name = "hdmi_panel",
 	.type = OMAP_DISPLAY_TYPE_HDMI,
-	.platform_enable = omap4_panda_panel_enable_hdmi,
-	.platform_disable = omap4_panda_panel_disable_hdmi,
 	.channel = OMAP_DSS_CHANNEL_DIGIT,
+	.hpd_gpio = 63,
 };
 
 static struct omap_dss_device *omap4_panda_dss_devices[] = {
@@ -551,9 +534,11 @@ void omap4_panda_display_init(void)
 	 * EDID read failure.
 	 */
 	if (cpu_is_omap446x() || (omap_rev() > OMAP4430_REV_ES2_2))
-		omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP);
+		omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP, HDMI_GPIO_HPD,
+				panda_hdmi_gpios, ARRAY_SIZE(panda_hdmi_gpios));
 	else
-		omap_hdmi_init(0);
+		omap_hdmi_init(0, HDMI_GPIO_HPD, panda_hdmi_gpios,
+				ARRAY_SIZE(panda_hdmi_gpios));
 }
 
 static void __init omap4_panda_init(void)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index a75e179..10b47b1 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -29,6 +29,7 @@
 #include <plat/omap-pm.h>
 #include <plat/common.h>
 
+#include <linux/gpio.h>
 #include "mux.h"
 #include "control.h"
 #include "display.h"
@@ -97,14 +98,14 @@ static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initdata = {
 	{ "dss_hdmi", "omapdss_hdmi", -1 },
 };
 
-static void omap4_hdmi_mux_pads(int flags)
+static void omap4_hdmi_mux_pads(int flags, int hpd_gpio)
 {
 	u32 reg;
 	u16 control_i2c_1;
 
 	/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
 	omap_mux_init_signal("hdmi_hpd",
-			OMAP_PIN_INPUT_PULLUP);
+			OMAP_PIN_INPUT_PULLDOWN);
 	omap_mux_init_signal("hdmi_cec",
 			OMAP_PIN_INPUT_PULLUP);
 	/* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
@@ -112,6 +113,10 @@ static void omap4_hdmi_mux_pads(int flags)
 			OMAP_PIN_INPUT_PULLUP);
 	omap_mux_init_signal("hdmi_ddc_sda",
 			OMAP_PIN_INPUT_PULLUP);
+	omap_mux_init_signal("gpmc_wait2.gpio_100",
+			OMAP_PIN_INPUT_PULLDOWN);
+	/* HPD GPIO needs to be muxed*/
+	omap_mux_init_gpio(hpd_gpio, OMAP_PIN_INPUT | OMAP_PULL_ENA);
 
 	if (flags & OMAP_HDMI_EXTERNAL_PULLUP) {
 		control_i2c_1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1;
@@ -155,10 +160,17 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
 	return 0;
 }
 
-int omap_hdmi_init(int flags)
+int omap_hdmi_init(int flags, int hpd_gpio, struct gpio hdmi_gpios[], int size)
 {
+	int status;
+
+	status = gpio_request_array(hdmi_gpios, size);
+	if (status) {
+		pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
+		return status;
+	}
 	if (cpu_is_omap44xx())
-		omap4_hdmi_mux_pads(flags);
+		omap4_hdmi_mux_pads(flags, hpd_gpio);
 
 	return 0;
 }
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c56378c..36a7541 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -508,26 +508,15 @@ int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
 		goto err0;
 	}
 
-	if (dssdev->platform_enable) {
-		r = dssdev->platform_enable(dssdev);
-		if (r) {
-			DSSERR("failed to enable GPIO's\n");
-			goto err1;
-		}
-	}
-
 	r = hdmi_power_on(dssdev);
 	if (r) {
 		DSSERR("failed to power on device\n");
-		goto err2;
+		goto err1;
 	}
 
 	mutex_unlock(&hdmi.lock);
 	return 0;
 
-err2:
-	if (dssdev->platform_disable)
-		dssdev->platform_disable(dssdev);
 err1:
 	omap_dss_stop_device(dssdev);
 err0:
@@ -543,9 +532,6 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev)
 
 	hdmi_power_off(dssdev);
 
-	if (dssdev->platform_disable)
-		dssdev->platform_disable(dssdev);
-
 	omap_dss_stop_device(dssdev);
 
 	mutex_unlock(&hdmi.lock);
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index df585b5..ffd5d42 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -21,6 +21,7 @@
 #include <linux/list.h>
 #include <linux/kobject.h>
 #include <linux/device.h>
+#include <linux/gpio.h>
 
 #define DISPC_IRQ_FRAMEDONE		(1 << 0)
 #define DISPC_IRQ_VSYNC			(1 << 1)
@@ -312,7 +313,8 @@ struct omap_dss_board_info {
 /* Init with the board info */
 extern int omap_display_init(struct omap_dss_board_info *board_data);
 /* HDMI mux init*/
-extern int  omap_hdmi_init(int flags);
+extern int omap_hdmi_init(int flags, int hpd_gpio,
+			struct gpio hdmi_gpios[], int size);
 
 struct omap_display_platform_data {
 	struct omap_dss_board_info *board_data;
@@ -552,6 +554,8 @@ struct omap_dss_device {
 
 	int reset_gpio;
 
+	int hpd_gpio;
+
 	int max_backlight_level;
 
 	const char *name;
-- 
1.7.5.4


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

* [PATCH 2/3] OMAPDSS: HDMI: HPD support added to HDMI driver
  2011-12-13 13:24 ` [PATCH 1/3] OMAPDSS: HDMI: HPD support in boardfile mythripk
@ 2011-12-13 13:24   ` mythripk
  2011-12-13 13:24     ` [PATCH 3/3] OMAPDSS: HDMI: Add option to enable HDMI in HPD mode mythripk
  2011-12-17  1:34   ` [PATCH 1/3] OMAPDSS: HDMI: HPD support in boardfile Tony Lindgren
  1 sibling, 1 reply; 5+ messages in thread
From: mythripk @ 2011-12-13 13:24 UTC (permalink / raw)
  To: tomi.valkeinen, linux-omap; +Cc: Mythri P K

From: Mythri P K <mythripk@ti.com>

GPIO based handling of connect/disconnect of the HDMI cable
(Hot-plug detect)is added to the HDMI driver.

Signed-off-by: Mythri P K <mythripk@ti.com>
---
 drivers/video/omap2/dss/dss.h  |    2 +
 drivers/video/omap2/dss/hdmi.c |   76 ++++++++++++++++++++++++++++++++++++++++
 include/video/omapdss.h        |    3 ++
 3 files changed, 81 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 6308fc5..c1279a3 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -498,6 +498,8 @@ int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
 					struct omap_video_timings *timings);
 int omapdss_hdmi_read_edid(u8 *buf, int len);
 bool omapdss_hdmi_detect(void);
+int omapdss_hdmi_hpd_enable(struct omap_dss_device *dssdev);
+void omapdss_hdmi_hpd_disable(struct omap_dss_device *dssdev);
 int hdmi_panel_init(void);
 void hdmi_panel_exit(void);
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 36a7541..1fe8e84 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -67,9 +67,12 @@ static struct {
 	struct mutex lock;
 	struct omap_display_platform_data *pdata;
 	struct platform_device *pdev;
+	struct omap_dss_device *dssdev;
+
 	struct hdmi_ip_data ip_data;
 	int code;
 	int mode;
+	int hpd;
 
 	struct clk *sys_clk;
 } hdmi;
@@ -454,6 +457,32 @@ void hdmi_dump_regs(struct seq_file *s)
 	mutex_unlock(&hdmi.lock);
 }
 
+static int hdmi_get_current_hpd(void)
+{
+	return gpio_get_value(hdmi.dssdev->hpd_gpio);
+}
+
+static irqreturn_t hpd_enable_handler(int irq, void *ptr)
+{
+	DSSDBG("hpd enable %d\n", hdmi.hpd);
+
+	if (hdmi.hpd)
+		hdmi.dssdev->driver->default_enable(hdmi.dssdev);
+	else
+		hdmi.dssdev->driver->default_disable(hdmi.dssdev);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t hpd_irq_handler(int irq, void *ptr)
+{
+	hdmi.hpd = hdmi_get_current_hpd();
+
+	DSSDBG("hpd %d\n", hdmi.hpd);
+
+	return IRQ_WAKE_THREAD;
+}
+
 int omapdss_hdmi_read_edid(u8 *buf, int len)
 {
 	int r;
@@ -488,6 +517,41 @@ bool omapdss_hdmi_detect(void)
 	return r == 1;
 }
 
+void omapdss_hdmi_hpd_disable(struct omap_dss_device *dssdev)
+{
+	DSSDBG("Enter hdmi_hpd_disable\n");
+
+	if (hdmi.dssdev)
+		free_irq(gpio_to_irq(hdmi.dssdev->hpd_gpio), hpd_irq_handler);
+
+	mutex_unlock(&hdmi.lock);
+}
+
+int omapdss_hdmi_hpd_enable(struct omap_dss_device *dssdev)
+{
+	int r = 0;
+
+	DSSDBG("ENTER hdmi_hpd_enable\n");
+
+	mutex_lock(&hdmi.lock);
+
+	r = request_threaded_irq(gpio_to_irq(hdmi.dssdev->hpd_gpio),
+			hpd_irq_handler, hpd_enable_handler,
+			IRQF_DISABLED | IRQF_TRIGGER_RISING |
+			IRQF_TRIGGER_FALLING, "hpd", NULL);
+	if (r < 0) {
+		pr_err("hdmi: request_irq %d failed\n",
+			gpio_to_irq(hdmi.dssdev->hpd_gpio));
+		return -EINVAL;
+	}
+
+	r = hdmi_get_current_hpd();
+
+	mutex_unlock(&hdmi.lock);
+
+	return r;
+}
+
 int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
 {
 	int r = 0;
@@ -733,12 +797,24 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
 {
 	struct resource *hdmi_mem;
 	int r;
+	struct omap_dss_board_info *board_data;
 
 	hdmi.pdata = pdev->dev.platform_data;
 	hdmi.pdev = pdev;
 
 	mutex_init(&hdmi.lock);
 
+	/* save reference to HDMI device */
+	board_data = hdmi.pdata->board_data;
+	for (r = 0; r < board_data->num_devices; r++) {
+		if (board_data->devices[r]->type == OMAP_DISPLAY_TYPE_HDMI)
+			hdmi.dssdev = board_data->devices[r];
+	}
+	if (!hdmi.dssdev) {
+		DSSERR("can't get HDMI device\n");
+		return -EINVAL;
+	}
+
 	hdmi_mem = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0);
 	if (!hdmi_mem) {
 		DSSERR("can't get IORESOURCE_MEM HDMI\n");
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index ffd5d42..82e2c3e 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -630,6 +630,9 @@ struct omap_dss_driver {
 
 	int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
 	bool (*detect)(struct omap_dss_device *dssdev);
+
+	int (*default_enable)(struct omap_dss_device *dssdev);
+	void (*default_disable)(struct omap_dss_device *dssdev);
 };
 
 int omap_dss_register_driver(struct omap_dss_driver *);
-- 
1.7.5.4


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

* [PATCH 3/3] OMAPDSS: HDMI: Add option to enable HDMI in HPD mode
  2011-12-13 13:24   ` [PATCH 2/3] OMAPDSS: HDMI: HPD support added to HDMI driver mythripk
@ 2011-12-13 13:24     ` mythripk
  0 siblings, 0 replies; 5+ messages in thread
From: mythripk @ 2011-12-13 13:24 UTC (permalink / raw)
  To: tomi.valkeinen, linux-omap; +Cc: Mythri P K

From: Mythri P K <mythripk@ti.com>

Add option in the panel to enable HDMI in HPD mode to enable the interrupt to
detect cable connect/disconnect, HDMI will be powered on only when the cable is
connected and powered down when cable is disconnected.

Signed-off-by: Mythri P K <mythripk@ti.com>
---
 drivers/video/omap2/dss/hdmi_panel.c |   54 ++++++++++++++++++++++++++++++++--
 include/video/omapdss.h              |    1 +
 2 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c
index 533d5dc..0b8a8ac 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -61,7 +61,7 @@ static int hdmi_panel_enable(struct omap_dss_device *dssdev)
 
 	mutex_lock(&hdmi.hdmi_lock);
 
-	if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) {
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
 		r = -EINVAL;
 		goto err;
 	}
@@ -222,11 +222,57 @@ err:
 	return r;
 }
 
+static void hdmi_hpd_disable(struct omap_dss_device *dssdev)
+{
+	mutex_lock(&hdmi.hdmi_lock);
+
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE ||
+		dssdev->state == OMAP_DSS_DISPLAY_HOTPLUG)
+		omapdss_hdmi_hpd_disable(dssdev);
+
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+
+	mutex_unlock(&hdmi.hdmi_lock);
+}
+
+static int hdmi_hpd_enable(struct omap_dss_device *dssdev)
+{
+	int r = 0;
+	DSSDBG("ENTER hdmi_hpd_enable\n");
+
+	mutex_lock(&hdmi.hdmi_lock);
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) {
+		r = -EINVAL;
+		goto err;
+	}
+
+	r = omapdss_hdmi_hpd_enable(dssdev);
+
+	if (r < 0) {
+		DSSERR("failed to power on\n");
+		goto err;
+	} else if (r == 1) {
+		r = omapdss_hdmi_display_enable(dssdev);
+		if (r) {
+			DSSERR("failed to power on\n");
+			goto err;
+		}
+		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+	} else {
+		dssdev->state = OMAP_DSS_DISPLAY_HOTPLUG;
+	}
+
+err:	mutex_unlock(&hdmi.hdmi_lock);
+
+	return r;
+}
+
 static struct omap_dss_driver hdmi_driver = {
 	.probe		= hdmi_panel_probe,
 	.remove		= hdmi_panel_remove,
-	.enable		= hdmi_panel_enable,
-	.disable	= hdmi_panel_disable,
+	.enable		= hdmi_hpd_enable,
+	.disable	= hdmi_hpd_disable,
 	.suspend	= hdmi_panel_suspend,
 	.resume		= hdmi_panel_resume,
 	.get_timings	= hdmi_get_timings,
@@ -234,6 +280,8 @@ static struct omap_dss_driver hdmi_driver = {
 	.check_timings	= hdmi_check_timings,
 	.read_edid	= hdmi_read_edid,
 	.detect		= hdmi_detect,
+	.default_enable	= hdmi_panel_enable,
+	.default_disable = hdmi_panel_disable,
 	.driver			= {
 		.name   = "hdmi_panel",
 		.owner  = THIS_MODULE,
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 82e2c3e..5623a34 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -159,6 +159,7 @@ enum omap_dss_display_state {
 	OMAP_DSS_DISPLAY_DISABLED = 0,
 	OMAP_DSS_DISPLAY_ACTIVE,
 	OMAP_DSS_DISPLAY_SUSPENDED,
+	OMAP_DSS_DISPLAY_HOTPLUG,
 };
 
 /* XXX perhaps this should be removed */
-- 
1.7.5.4


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

* Re: [PATCH 1/3] OMAPDSS: HDMI: HPD support in boardfile
  2011-12-13 13:24 ` [PATCH 1/3] OMAPDSS: HDMI: HPD support in boardfile mythripk
  2011-12-13 13:24   ` [PATCH 2/3] OMAPDSS: HDMI: HPD support added to HDMI driver mythripk
@ 2011-12-17  1:34   ` Tony Lindgren
  1 sibling, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2011-12-17  1:34 UTC (permalink / raw)
  To: mythripk; +Cc: tomi.valkeinen, linux-omap

* mythripk@ti.com <mythripk@ti.com> [111213 05:01]:
> From: Mythri P K <mythripk@ti.com>
> 
> Add support for HPD GPIO configuration in board file.
> Also remove the enabling  of GPIO's required for HDMI from
> hdmi driver file to display.c based on the GPIO #'s sent from
> board file.
> 
> Signed-off-by: Mythri P K <mythripk@ti.com>

Few cosmetic comments below, otherwise this one looks OK
for Tomi to queue when he's happy with it:

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

> --- a/arch/arm/mach-omap2/board-4430sdp.c
> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> @@ -52,8 +52,9 @@
>  #define ETH_KS8851_QUART		138
>  #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO	184
>  #define OMAP4_SFH7741_ENABLE_GPIO		188
> -#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
> +#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */
>  #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
> +#define HDMI_GPIO_HPD 63
>  #define DISPLAY_SEL_GPIO	59	/* LCD2/PicoDLP switch */
>  #define DLP_POWER_ON_GPIO	40
>  
> @@ -596,27 +597,11 @@ static void __init omap_sfh7741prox_init(void)
>  }
>  
>  static struct gpio sdp4430_hdmi_gpios[] = {
> -	{ HDMI_GPIO_HPD,	GPIOF_OUT_INIT_HIGH,	"hdmi_gpio_hpd"   },
> -	{ HDMI_GPIO_LS_OE,	GPIOF_OUT_INIT_HIGH,	"hdmi_gpio_ls_oe" },
> +	{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" },
>  };

Please add the trailing comma to the array entries. Also check the
spacing, now there's no space in the beginning but one at the end?
  
> --- a/arch/arm/mach-omap2/board-omap4panda.c
> +++ b/arch/arm/mach-omap2/board-omap4panda.c
> @@ -51,8 +51,9 @@
>  #define GPIO_HUB_NRESET		62
>  #define GPIO_WIFI_PMENA		43
>  #define GPIO_WIFI_IRQ		53
> -#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
> +#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */
>  #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
> +#define HDMI_GPIO_HPD 63
>  
>  /* wl127x BT, FM, GPS connectivity chip */
>  static int wl1271_gpios[] = {46, -1, -1};
> @@ -479,35 +480,17 @@ int __init omap4_panda_dvi_init(void)
>  }
>  
>  static struct gpio panda_hdmi_gpios[] = {
> -	{ HDMI_GPIO_HPD,	GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd"   },
> -	{ HDMI_GPIO_LS_OE,	GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
> +	{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" },
>  };

Here too.
  
> --- a/arch/arm/mach-omap2/display.c
> +++ b/arch/arm/mach-omap2/display.c
> @@ -29,6 +29,7 @@
>  #include <plat/omap-pm.h>
>  #include <plat/common.h>
>  
> +#include <linux/gpio.h>
>  #include "mux.h"
>  #include "control.h"
>  #include "display.h"

This one will cause a merge conflict with common.h, but Tomi
already knows how to deal with that ;)

Regards,

Tony

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

end of thread, other threads:[~2011-12-17  1:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-13 13:24 [PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support mythripk
2011-12-13 13:24 ` [PATCH 1/3] OMAPDSS: HDMI: HPD support in boardfile mythripk
2011-12-13 13:24   ` [PATCH 2/3] OMAPDSS: HDMI: HPD support added to HDMI driver mythripk
2011-12-13 13:24     ` [PATCH 3/3] OMAPDSS: HDMI: Add option to enable HDMI in HPD mode mythripk
2011-12-17  1:34   ` [PATCH 1/3] OMAPDSS: HDMI: HPD support in boardfile 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).