diff options
author | Dandawate Saket | 2013-04-29 01:27:04 -0500 |
---|---|---|
committer | Praneeth Bajjuri | 2013-07-12 18:58:15 -0500 |
commit | ae79403d8a52f9a094c7a06ee1b7dc89769335e2 (patch) | |
tree | 12e53f6245ea99dbd12cb21fe9bd3df951d2e95b /drivers | |
parent | f9c7785d97cd3a412305b2e56603c1b04fa20597 (diff) | |
download | kernel-video-ae79403d8a52f9a094c7a06ee1b7dc89769335e2.tar.gz kernel-video-ae79403d8a52f9a094c7a06ee1b7dc89769335e2.tar.xz kernel-video-ae79403d8a52f9a094c7a06ee1b7dc89769335e2.zip |
HDMI: Add edid read and clear functions
Add edid read and clear function for panel driver to use.
Change-Id: I64e91266ed20de4bfbfdfe4bbd1e426a414e1503
Signed-off-by: Dandawate Saket <dsaket@ti.com>
Diffstat (limited to 'drivers')
-rwxr-xr-x | drivers/video/omap2/dss/dss.h | 3 | ||||
-rwxr-xr-x | drivers/video/omap2/dss/hdmi.c | 61 |
2 files changed, 63 insertions, 1 deletions
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 3c3df510eae..981fcf86d72 100755 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -502,6 +502,9 @@ void sel_i2c(void); | |||
502 | void sel_hdmi(void); | 502 | void sel_hdmi(void); |
503 | int omapdss_hdmi_display_set_mode(struct omap_dss_device *dssdev, | 503 | int omapdss_hdmi_display_set_mode(struct omap_dss_device *dssdev, |
504 | struct fb_videomode *mode); | 504 | struct fb_videomode *mode); |
505 | u8 *hdmi_read_valid_edid(void); | ||
506 | void omapdss_hdmi_clear_edid(void); | ||
507 | ssize_t omapdss_get_edid(char *buf); | ||
505 | int hdmi_panel_init(void); | 508 | int hdmi_panel_init(void); |
506 | void hdmi_panel_exit(void); | 509 | void hdmi_panel_exit(void); |
507 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) || \ | 510 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) || \ |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index da50133b621..43f55938a58 100755 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -48,10 +48,11 @@ | |||
48 | #include "dss_features.h" | 48 | #include "dss_features.h" |
49 | 49 | ||
50 | /* HDMI EDID Length move this */ | 50 | /* HDMI EDID Length move this */ |
51 | #define HDMI_EDID_MAX_LENGTH 256 | 51 | #define HDMI_EDID_MAX_LENGTH 512 |
52 | #define EDID_TIMING_DESCRIPTOR_SIZE 0x12 | 52 | #define EDID_TIMING_DESCRIPTOR_SIZE 0x12 |
53 | #define EDID_DESCRIPTOR_BLOCK0_ADDRESS 0x36 | 53 | #define EDID_DESCRIPTOR_BLOCK0_ADDRESS 0x36 |
54 | #define EDID_DESCRIPTOR_BLOCK1_ADDRESS 0x80 | 54 | #define EDID_DESCRIPTOR_BLOCK1_ADDRESS 0x80 |
55 | #define EDID_HDMI_VENDOR_SPECIFIC_DATA_BLOCK 128 | ||
55 | #define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4 | 56 | #define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4 |
56 | #define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4 | 57 | #define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4 |
57 | 58 | ||
@@ -64,6 +65,8 @@ static struct { | |||
64 | #endif | 65 | #endif |
65 | int code; | 66 | int code; |
66 | int mode; | 67 | int mode; |
68 | u8 edid[HDMI_EDID_MAX_LENGTH]; | ||
69 | bool edid_set; | ||
67 | bool custom_set; | 70 | bool custom_set; |
68 | 71 | ||
69 | struct hdmi_ip_data ip_data; | 72 | struct hdmi_ip_data ip_data; |
@@ -94,6 +97,8 @@ static struct { | |||
94 | struct omap_dss_output output; | 97 | struct omap_dss_output output; |
95 | } hdmi; | 98 | } hdmi; |
96 | 99 | ||
100 | static const u8 edid_header[8] = {0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0}; | ||
101 | |||
97 | /* | 102 | /* |
98 | * Logic for the below structure : | 103 | * Logic for the below structure : |
99 | * user enters the CEA or VESA timings by specifying the HDMI/DVI code. | 104 | * user enters the CEA or VESA timings by specifying the HDMI/DVI code. |
@@ -616,6 +621,45 @@ end: return cm; | |||
616 | 621 | ||
617 | } | 622 | } |
618 | 623 | ||
624 | u8 *hdmi_read_valid_edid(void) | ||
625 | { | ||
626 | int ret, i; | ||
627 | |||
628 | if (hdmi.edid_set) | ||
629 | return hdmi.edid; | ||
630 | |||
631 | memset(hdmi.edid, 0, HDMI_EDID_MAX_LENGTH); | ||
632 | |||
633 | hdmi_runtime_get(); | ||
634 | |||
635 | ret = hdmi.ip_data.ops->read_edid(&hdmi.ip_data, hdmi.edid, | ||
636 | HDMI_EDID_MAX_LENGTH); | ||
637 | |||
638 | hdmi_runtime_put(); | ||
639 | |||
640 | for (i = 0; i < HDMI_EDID_MAX_LENGTH; i += 16) | ||
641 | DSSDBG("edid[%03x] = %02x %02x %02x %02x %02x %02x %02x %02x "\ | ||
642 | "%02x %02x %02x %02x %02x %02x %02x %02x\n", i, | ||
643 | hdmi.edid[i], hdmi.edid[i + 1], hdmi.edid[i + 2], | ||
644 | hdmi.edid[i + 3], hdmi.edid[i + 4], hdmi.edid[i + 5], | ||
645 | hdmi.edid[i + 6], hdmi.edid[i + 7], hdmi.edid[i + 8], | ||
646 | hdmi.edid[i + 9], hdmi.edid[i + 10], hdmi.edid[i + 11], | ||
647 | hdmi.edid[i + 12], hdmi.edid[i + 13], hdmi.edid[i + 14], | ||
648 | hdmi.edid[i + 15]); | ||
649 | |||
650 | if (ret) { | ||
651 | DSSWARN("failed to read E-EDID\n"); | ||
652 | return NULL; | ||
653 | } | ||
654 | if (memcmp(hdmi.edid, edid_header, sizeof(edid_header))) { | ||
655 | DSSWARN("failed to read E-EDID: wrong header\n"); | ||
656 | return NULL; | ||
657 | } | ||
658 | hdmi.edid_set = true; | ||
659 | |||
660 | return hdmi.edid; | ||
661 | } | ||
662 | |||
619 | unsigned long hdmi_get_pixel_clock(void) | 663 | unsigned long hdmi_get_pixel_clock(void) |
620 | { | 664 | { |
621 | /* HDMI Pixel Clock in Mhz */ | 665 | /* HDMI Pixel Clock in Mhz */ |
@@ -1271,6 +1315,19 @@ void omapdss_hdmi_core_disable(struct omap_dss_device *dssdev) | |||
1271 | mutex_unlock(&hdmi.lock); | 1315 | mutex_unlock(&hdmi.lock); |
1272 | } | 1316 | } |
1273 | 1317 | ||
1318 | void omapdss_hdmi_clear_edid(void) | ||
1319 | { | ||
1320 | hdmi.edid_set = false; | ||
1321 | hdmi.custom_set = false; | ||
1322 | } | ||
1323 | |||
1324 | ssize_t omapdss_get_edid(char *buf) | ||
1325 | { | ||
1326 | ssize_t size = hdmi.edid_set ? HDMI_EDID_MAX_LENGTH : 0; | ||
1327 | memcpy(buf, hdmi.edid, size); | ||
1328 | return size; | ||
1329 | } | ||
1330 | |||
1274 | static irqreturn_t hdmi_irq_handler(int irq, void *arg) | 1331 | static irqreturn_t hdmi_irq_handler(int irq, void *arg) |
1275 | { | 1332 | { |
1276 | int r = 0; | 1333 | int r = 0; |
@@ -1968,6 +2025,8 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev) | |||
1968 | goto err_panel_init; | 2025 | goto err_panel_init; |
1969 | } | 2026 | } |
1970 | 2027 | ||
2028 | hdmi.edid_set = false; | ||
2029 | |||
1971 | dss_debugfs_create_file("hdmi", hdmi_dump_regs); | 2030 | dss_debugfs_create_file("hdmi", hdmi_dump_regs); |
1972 | 2031 | ||
1973 | hdmi_init_output(pdev); | 2032 | hdmi_init_output(pdev); |