All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] OMAPDSS: HDMI: Cache EDID
@ 2012-06-27 14:17 ` jaswinder.singh
  0 siblings, 0 replies; 44+ messages in thread
From: jaswinder.singh @ 2012-06-27 14:05 UTC (permalink / raw)
  To: tomi.valkeinen, mythripk
  Cc: linux-omap, linux-fbdev, andy.green, n-dechesne, patches, Jassi Brar

From: Jassi Brar <jaswinder.singh@linaro.org>

We can easily keep track of latest EDID from the display and hence avoid
expensive EDID re-reads over I2C.
This could also help some cheapo displays that provide EDID reliably only
immediately after asserting HPD and not later.
Even with good displays, there is something in OMAPDSS that apparantly
messes up DDC occasionally while EDID is being read, giving the
  "operation stopped when reading edid" error.

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
---
 drivers/video/omap2/dss/hdmi.c            |    1 +
 drivers/video/omap2/dss/ti_hdmi.h         |    2 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   15 +++++++++++++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 0738090..9853621 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -758,6 +758,7 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 	hdmi.ip_data.core_av_offset = HDMI_CORE_AV;
 	hdmi.ip_data.pll_offset = HDMI_PLLCTRL;
 	hdmi.ip_data.phy_offset = HDMI_PHY;
+	hdmi.ip_data.edid_len = 0; /* Invalidate EDID Cache */
 	mutex_init(&hdmi.ip_data.lock);
 
 	hdmi_panel_init();
diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index cc292b8..4735860 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -178,6 +178,8 @@ struct hdmi_ip_data {
 	/* ti_hdmi_4xxx_ip private data. These should be in a separate struct */
 	int hpd_gpio;
 	struct mutex lock;
+	u8 edid_cached[256];
+	unsigned edid_len;
 };
 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 04acca9..b5c3dc4 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -243,10 +243,13 @@ static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data)
 
 	hpd = gpio_get_value(ip_data->hpd_gpio);
 
-	if (hpd)
+	if (hpd) {
 		r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
-	else
+	} else {
+		/* Invalidate EDID Cache */
+		ip_data->edid_len = 0;
 		r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON);
+	}
 
 	if (r) {
 		DSSERR("Failed to %s PHY TX power\n",
@@ -454,6 +457,11 @@ int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data,
 {
 	int r, l;
 
+	if (ip_data->edid_len) {
+		memcpy(edid, ip_data->edid_cached, ip_data->edid_len);
+		return ip_data->edid_len;
+	}
+
 	if (len < 128)
 		return -EINVAL;
 
@@ -474,6 +482,9 @@ int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data,
 		l += 128;
 	}
 
+	ip_data->edid_len = l;
+	memcpy(ip_data->edid_cached, edid, l);
+
 	return l;
 }
 
-- 
1.7.4.1


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

end of thread, other threads:[~2012-06-28 16:32 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-27 14:05 [PATCH 3/3] OMAPDSS: HDMI: Cache EDID jaswinder.singh
2012-06-27 14:17 ` jaswinder.singh
2012-06-28  7:48 ` Tomi Valkeinen
2012-06-28  7:48   ` Tomi Valkeinen
2012-06-28  9:48   ` Jassi Brar
2012-06-28  9:51     ` Jassi Brar
2012-06-28 10:14     ` Tomi Valkeinen
2012-06-28 10:14       ` Tomi Valkeinen
2012-06-28 10:47       ` Jassi Brar
2012-06-28 10:59         ` Jassi Brar
2012-06-28 10:58         ` Jassi Brar
2012-06-28 11:10           ` Jassi Brar
2012-06-28 11:10           ` Tomi Valkeinen
2012-06-28 11:10             ` Tomi Valkeinen
2012-06-28 11:38             ` Tomi Valkeinen
2012-06-28 11:38               ` Tomi Valkeinen
2012-06-28 12:15               ` Andy Green
2012-06-28 12:15                 ` Andy Green
2012-06-28 12:03             ` Andy Green
2012-06-28 12:03               ` Andy Green
2012-06-28 13:08               ` Tomi Valkeinen
2012-06-28 13:08                 ` Tomi Valkeinen
2012-06-28 13:13               ` Jassi Brar
2012-06-28 13:25                 ` Jassi Brar
2012-06-28 13:31                 ` Tomi Valkeinen
2012-06-28 13:31                   ` Tomi Valkeinen
2012-06-28 15:14                   ` Jassi Brar
2012-06-28 15:26                     ` Jassi Brar
2012-06-28 15:27                     ` Tomi Valkeinen
2012-06-28 15:27                       ` Tomi Valkeinen
2012-06-28 15:48                       ` Jassi Brar
2012-06-28 15:51                         ` Jassi Brar
2012-06-28 16:20                         ` Jassi Brar
2012-06-28 16:32                           ` Jassi Brar
2012-06-28 15:14                 ` Tomi Valkeinen
2012-06-28 15:14                   ` Tomi Valkeinen
2012-06-28 15:18                   ` Jassi Brar
2012-06-28 15:30                     ` Jassi Brar
2012-06-28 12:31             ` Jassi Brar
2012-06-28 12:43               ` Jassi Brar
2012-06-28 13:35           ` Tomi Valkeinen
2012-06-28 13:35             ` Tomi Valkeinen
2012-06-28 11:04         ` Tomi Valkeinen
2012-06-28 11:04           ` Tomi Valkeinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.