From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
Cc: archit@ti.com, mythripk@ti.com, Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH 04/12] OMAP: DSS2: HDMI: implement read_edid()
Date: Wed, 31 Aug 2011 13:23:15 +0000 [thread overview]
Message-ID: <1314797003-17638-5-git-send-email-tomi.valkeinen@ti.com> (raw)
In-Reply-To: <1314797003-17638-1-git-send-email-tomi.valkeinen@ti.com>
Implement read_edid() for HDMI by implementing necessary functions to
hdmi.c and to hdmi_omap4_panel.c.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dss.h | 1 +
drivers/video/omap2/dss/hdmi.c | 60 ++++++++++++++++++---------
drivers/video/omap2/dss/hdmi_omap4_panel.c | 24 +++++++++++
3 files changed, 65 insertions(+), 20 deletions(-)
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 57b1a01..6102b80 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -492,6 +492,7 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev);
void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev);
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);
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 8f8ae0e..5e66cb8 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -471,29 +471,32 @@ static int read_edid(u8 *pedid, u16 max_length)
{
int r = 0, n = 0, i = 0;
int max_ext_blocks = (max_length / 128) - 1;
+ int len;
r = hdmi_core_ddc_edid(pedid, 0);
- if (r) {
+ if (r)
return r;
- } else {
- n = pedid[0x7e];
- /*
- * README: need to comply with max_length set by the caller.
- * Better implementation should be to allocate necessary
- * memory to store EDID according to nb_block field found
- * in first block
- */
- if (n > max_ext_blocks)
- n = max_ext_blocks;
+ len = 128;
+ n = pedid[0x7e];
- for (i = 1; i <= n; i++) {
- r = hdmi_core_ddc_edid(pedid, i);
- if (r)
- return r;
- }
+ /*
+ * README: need to comply with max_length set by the caller.
+ * Better implementation should be to allocate necessary
+ * memory to store EDID according to nb_block field found
+ * in first block
+ */
+ if (n > max_ext_blocks)
+ n = max_ext_blocks;
+
+ for (i = 1; i <= n; i++) {
+ r = hdmi_core_ddc_edid(pedid, i);
+ if (r)
+ return r;
+ len += 128;
}
- return 0;
+
+ return len;
}
static int get_timings_index(void)
@@ -660,7 +663,7 @@ static void hdmi_read_edid(struct omap_video_timings *dp)
if (!hdmi.edid_set)
ret = read_edid(hdmi.edid, HDMI_EDID_MAX_LENGTH);
- if (!ret) {
+ if (ret > 0) {
if (!memcmp(hdmi.edid, edid_header, sizeof(edid_header))) {
/* search for timings of default resolution */
get_edid_timing_data(hdmi.edid);
@@ -1242,6 +1245,23 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev)
}
}
+int omapdss_hdmi_read_edid(u8 *buf, int len)
+{
+ int r;
+
+ mutex_lock(&hdmi.lock);
+
+ r = hdmi_runtime_get();
+ BUG_ON(r);
+
+ r = read_edid(buf, len);
+
+ hdmi_runtime_put();
+ mutex_unlock(&hdmi.lock);
+
+ return r;
+}
+
int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
{
int r = 0;
diff --git a/drivers/video/omap2/dss/hdmi_omap4_panel.c b/drivers/video/omap2/dss/hdmi_omap4_panel.c
index 25d5fb2..7adaf7a 100644
--- a/drivers/video/omap2/dss/hdmi_omap4_panel.c
+++ b/drivers/video/omap2/dss/hdmi_omap4_panel.c
@@ -185,6 +185,29 @@ err:
return r;
}
+static int hdmi_read_edid(struct omap_dss_device *dssdev, u8 *buf, int len)
+{
+ int r;
+
+ mutex_lock(&hdmi.hdmi_lock);
+
+ if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) {
+ r = omapdss_hdmi_display_enable(dssdev);
+ if (r)
+ goto err;
+ }
+
+ r = omapdss_hdmi_read_edid(buf, len);
+
+ if (dssdev->state = OMAP_DSS_DISPLAY_DISABLED ||
+ dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED)
+ omapdss_hdmi_display_disable(dssdev);
+err:
+ mutex_unlock(&hdmi.hdmi_lock);
+
+ return r;
+}
+
static struct omap_dss_driver hdmi_driver = {
.probe = hdmi_panel_probe,
.remove = hdmi_panel_remove,
@@ -195,6 +218,7 @@ static struct omap_dss_driver hdmi_driver = {
.get_timings = hdmi_get_timings,
.set_timings = hdmi_set_timings,
.check_timings = hdmi_check_timings,
+ .read_edid = hdmi_read_edid,
.driver = {
.name = "hdmi_panel",
.owner = THIS_MODULE,
--
1.7.4.1
next prev parent reply other threads:[~2011-08-31 13:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 13:23 [PATCH 00/12] OMAP: DSS2: EDID & detect support Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 01/12] OMAP: DSS2: add read_edid() to omap_dss_driver struct Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 02/12] OMAP: DSS2: add detect() " Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 03/12] OMAP: DSS2: HDMI: make set_timing saner Tomi Valkeinen
2011-08-31 13:23 ` Tomi Valkeinen [this message]
2011-08-31 13:23 ` [PATCH 05/12] OMAP: DSS2: HDMI: remove edid parsing Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 06/12] OMAP: DSS2: HDMI: split hdmi_core_ddc_edid Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 07/12] OMAP: DSS2: HDMI: clean up edid reading & fix checksum Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 08/12] OMAP: DSS2: HDMI: remove error prints in check_timings Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 09/12] OMAP: DSS2: HDMI: implement detect() Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 10/12] OMAP: DSS2: Generic-dpi: add detect & read_edid support Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 11/12] OMAP: Panda & Beagle: DVI: Add i2c_bus_num Tomi Valkeinen
2011-08-31 15:00 ` Andy Doan
2011-08-31 18:09 ` Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 12/12] OMAPFB: find best mode from edid Tomi Valkeinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1314797003-17638-5-git-send-email-tomi.valkeinen@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=archit@ti.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mythripk@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).