]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commitdiff
HDMI: Add edid read and clear functions
authorDandawate Saket <dsaket@ti.com>
Mon, 29 Apr 2013 06:27:04 +0000 (23:27 -0700)
committerPraneeth Bajjuri <praneeth@ti.com>
Fri, 12 Jul 2013 23:58:15 +0000 (18:58 -0500)
Add edid read and clear function for panel driver to use.

Change-Id: I64e91266ed20de4bfbfdfe4bbd1e426a414e1503
Signed-off-by: Dandawate Saket <dsaket@ti.com>
drivers/video/omap2/dss/dss.h
drivers/video/omap2/dss/hdmi.c

index 3c3df510eae2fee76868b0cf6b30b2692bec753e..981fcf86d728d6bc8111e7f7be6a10f759e3ac18 100755 (executable)
@@ -502,6 +502,9 @@ void sel_i2c(void);
 void sel_hdmi(void);
 int omapdss_hdmi_display_set_mode(struct omap_dss_device *dssdev,
                                        struct fb_videomode *mode);
+u8 *hdmi_read_valid_edid(void);
+void omapdss_hdmi_clear_edid(void);
+ssize_t omapdss_get_edid(char *buf);
 int hdmi_panel_init(void);
 void hdmi_panel_exit(void);
 #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) || \
index da50133b62165270388ca638bdb351071eb63012..43f55938a5831ae054f5544ed6ea126b923c14d1 100755 (executable)
 #include "dss_features.h"
 
 /* HDMI EDID Length move this */
-#define HDMI_EDID_MAX_LENGTH                   256
+#define HDMI_EDID_MAX_LENGTH                   512
 #define EDID_TIMING_DESCRIPTOR_SIZE            0x12
 #define EDID_DESCRIPTOR_BLOCK0_ADDRESS         0x36
 #define EDID_DESCRIPTOR_BLOCK1_ADDRESS         0x80
+#define EDID_HDMI_VENDOR_SPECIFIC_DATA_BLOCK   128
 #define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR     4
 #define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR     4
 
@@ -64,6 +65,8 @@ static struct {
 #endif
        int code;
        int mode;
+       u8 edid[HDMI_EDID_MAX_LENGTH];
+       bool edid_set;
        bool custom_set;
 
        struct hdmi_ip_data ip_data;
@@ -94,6 +97,8 @@ static struct {
        struct omap_dss_output output;
 } hdmi;
 
+static const u8 edid_header[8] = {0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0};
+
 /*
  * Logic for the below structure :
  * user enters the CEA or VESA timings by specifying the HDMI/DVI code.
@@ -616,6 +621,45 @@ end:       return cm;
 
 }
 
+u8 *hdmi_read_valid_edid(void)
+{
+       int ret, i;
+
+       if (hdmi.edid_set)
+               return hdmi.edid;
+
+       memset(hdmi.edid, 0, HDMI_EDID_MAX_LENGTH);
+
+       hdmi_runtime_get();
+
+       ret = hdmi.ip_data.ops->read_edid(&hdmi.ip_data, hdmi.edid,
+                                                 HDMI_EDID_MAX_LENGTH);
+
+       hdmi_runtime_put();
+
+       for (i = 0; i < HDMI_EDID_MAX_LENGTH; i += 16)
+               DSSDBG("edid[%03x] = %02x %02x %02x %02x %02x %02x %02x %02x "\
+                       "%02x %02x %02x %02x %02x %02x %02x %02x\n", i,
+                       hdmi.edid[i], hdmi.edid[i + 1], hdmi.edid[i + 2],
+                       hdmi.edid[i + 3], hdmi.edid[i + 4], hdmi.edid[i + 5],
+                       hdmi.edid[i + 6], hdmi.edid[i + 7], hdmi.edid[i + 8],
+                       hdmi.edid[i + 9], hdmi.edid[i + 10], hdmi.edid[i + 11],
+                       hdmi.edid[i + 12], hdmi.edid[i + 13], hdmi.edid[i + 14],
+                       hdmi.edid[i + 15]);
+
+       if (ret) {
+               DSSWARN("failed to read E-EDID\n");
+               return NULL;
+       }
+       if (memcmp(hdmi.edid, edid_header, sizeof(edid_header))) {
+               DSSWARN("failed to read E-EDID: wrong header\n");
+               return NULL;
+       }
+       hdmi.edid_set = true;
+
+       return hdmi.edid;
+}
+
 unsigned long hdmi_get_pixel_clock(void)
 {
        /* HDMI Pixel Clock in Mhz */
@@ -1271,6 +1315,19 @@ void omapdss_hdmi_core_disable(struct omap_dss_device *dssdev)
        mutex_unlock(&hdmi.lock);
 }
 
+void omapdss_hdmi_clear_edid(void)
+{
+       hdmi.edid_set = false;
+       hdmi.custom_set = false;
+}
+
+ssize_t omapdss_get_edid(char *buf)
+{
+       ssize_t size = hdmi.edid_set ? HDMI_EDID_MAX_LENGTH : 0;
+       memcpy(buf, hdmi.edid, size);
+       return size;
+}
+
 static irqreturn_t hdmi_irq_handler(int irq, void *arg)
 {
        int r = 0;
@@ -1968,6 +2025,8 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
                goto err_panel_init;
        }
 
+        hdmi.edid_set = false;
+
        dss_debugfs_create_file("hdmi", hdmi_dump_regs);
 
        hdmi_init_output(pdev);