diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-08-25 10:12:56 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-09-30 09:16:45 -0400 |
commit | 470245652d98274568ac81a875c8312e73a433ef (patch) | |
tree | ceb154e43adf8ab7a13cd765365dc953bea50d2f /drivers/video | |
parent | fa70dc5f472ddc261ad429f2c12eb7ac31c90b87 (diff) |
OMAP: DSS2: HDMI: implement read_edid()
Implement read_edid() for HDMI by implementing necessary functions to
hdmi.c and to hdmi_omap4_panel.c.
Cc: Mythri P K <mythripk@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 1 | ||||
-rw-r--r-- | drivers/video/omap2/dss/hdmi.c | 19 | ||||
-rw-r--r-- | drivers/video/omap2/dss/hdmi_panel.c | 24 | ||||
-rw-r--r-- | drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 37 |
4 files changed, 63 insertions, 18 deletions
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 48bba53de0ab..2e7799c82960 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -494,6 +494,7 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev); | |||
494 | void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev); | 494 | void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev); |
495 | int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev, | 495 | int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev, |
496 | struct omap_video_timings *timings); | 496 | struct omap_video_timings *timings); |
497 | int omapdss_hdmi_read_edid(u8 *buf, int len); | ||
497 | int hdmi_panel_init(void); | 498 | int hdmi_panel_init(void); |
498 | void hdmi_panel_exit(void); | 499 | void hdmi_panel_exit(void); |
499 | 500 | ||
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index f503aa495b2f..8a04ee18d58f 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -372,7 +372,7 @@ static void hdmi_read_edid(struct omap_video_timings *dp) | |||
372 | if (!hdmi.edid_set) | 372 | if (!hdmi.edid_set) |
373 | ret = hdmi.ip_data.ops->read_edid(&hdmi.ip_data, hdmi.edid, | 373 | ret = hdmi.ip_data.ops->read_edid(&hdmi.ip_data, hdmi.edid, |
374 | HDMI_EDID_MAX_LENGTH); | 374 | HDMI_EDID_MAX_LENGTH); |
375 | if (!ret) { | 375 | if (ret > 0) { |
376 | if (!memcmp(hdmi.edid, edid_header, sizeof(edid_header))) { | 376 | if (!memcmp(hdmi.edid, edid_header, sizeof(edid_header))) { |
377 | /* search for timings of default resolution */ | 377 | /* search for timings of default resolution */ |
378 | get_edid_timing_data(hdmi.edid); | 378 | get_edid_timing_data(hdmi.edid); |
@@ -587,6 +587,23 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev) | |||
587 | } | 587 | } |
588 | } | 588 | } |
589 | 589 | ||
590 | int omapdss_hdmi_read_edid(u8 *buf, int len) | ||
591 | { | ||
592 | int r; | ||
593 | |||
594 | mutex_lock(&hdmi.lock); | ||
595 | |||
596 | r = hdmi_runtime_get(); | ||
597 | BUG_ON(r); | ||
598 | |||
599 | r = hdmi.ip_data.ops->read_edid(&hdmi.ip_data, buf, len); | ||
600 | |||
601 | hdmi_runtime_put(); | ||
602 | mutex_unlock(&hdmi.lock); | ||
603 | |||
604 | return r; | ||
605 | } | ||
606 | |||
590 | int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) | 607 | int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) |
591 | { | 608 | { |
592 | int r = 0; | 609 | int r = 0; |
diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c index 8c851e624ee6..624f170a5e92 100644 --- a/drivers/video/omap2/dss/hdmi_panel.c +++ b/drivers/video/omap2/dss/hdmi_panel.c | |||
@@ -185,6 +185,29 @@ err: | |||
185 | return r; | 185 | return r; |
186 | } | 186 | } |
187 | 187 | ||
188 | static int hdmi_read_edid(struct omap_dss_device *dssdev, u8 *buf, int len) | ||
189 | { | ||
190 | int r; | ||
191 | |||
192 | mutex_lock(&hdmi.hdmi_lock); | ||
193 | |||
194 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { | ||
195 | r = omapdss_hdmi_display_enable(dssdev); | ||
196 | if (r) | ||
197 | goto err; | ||
198 | } | ||
199 | |||
200 | r = omapdss_hdmi_read_edid(buf, len); | ||
201 | |||
202 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || | ||
203 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
204 | omapdss_hdmi_display_disable(dssdev); | ||
205 | err: | ||
206 | mutex_unlock(&hdmi.hdmi_lock); | ||
207 | |||
208 | return r; | ||
209 | } | ||
210 | |||
188 | static struct omap_dss_driver hdmi_driver = { | 211 | static struct omap_dss_driver hdmi_driver = { |
189 | .probe = hdmi_panel_probe, | 212 | .probe = hdmi_panel_probe, |
190 | .remove = hdmi_panel_remove, | 213 | .remove = hdmi_panel_remove, |
@@ -195,6 +218,7 @@ static struct omap_dss_driver hdmi_driver = { | |||
195 | .get_timings = hdmi_get_timings, | 218 | .get_timings = hdmi_get_timings, |
196 | .set_timings = hdmi_set_timings, | 219 | .set_timings = hdmi_set_timings, |
197 | .check_timings = hdmi_check_timings, | 220 | .check_timings = hdmi_check_timings, |
221 | .read_edid = hdmi_read_edid, | ||
198 | .driver = { | 222 | .driver = { |
199 | .name = "hdmi_panel", | 223 | .name = "hdmi_panel", |
200 | .owner = THIS_MODULE, | 224 | .owner = THIS_MODULE, |
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c index 403c66241477..d4cdfc2e6c5e 100644 --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | |||
@@ -370,29 +370,32 @@ int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, | |||
370 | { | 370 | { |
371 | int r = 0, n = 0, i = 0; | 371 | int r = 0, n = 0, i = 0; |
372 | int max_ext_blocks = (max_length / 128) - 1; | 372 | int max_ext_blocks = (max_length / 128) - 1; |
373 | int len; | ||
373 | 374 | ||
374 | r = hdmi_core_ddc_edid(ip_data, pedid, 0); | 375 | r = hdmi_core_ddc_edid(ip_data, pedid, 0); |
375 | if (r) { | 376 | if (r) |
376 | return r; | 377 | return r; |
377 | } else { | ||
378 | n = pedid[0x7e]; | ||
379 | 378 | ||
380 | /* | 379 | len = 128; |
381 | * README: need to comply with max_length set by the caller. | 380 | n = pedid[0x7e]; |
382 | * Better implementation should be to allocate necessary | ||
383 | * memory to store EDID according to nb_block field found | ||
384 | * in first block | ||
385 | */ | ||
386 | if (n > max_ext_blocks) | ||
387 | n = max_ext_blocks; | ||
388 | 381 | ||
389 | for (i = 1; i <= n; i++) { | 382 | /* |
390 | r = hdmi_core_ddc_edid(ip_data, pedid, i); | 383 | * README: need to comply with max_length set by the caller. |
391 | if (r) | 384 | * Better implementation should be to allocate necessary |
392 | return r; | 385 | * memory to store EDID according to nb_block field found |
393 | } | 386 | * in first block |
387 | */ | ||
388 | if (n > max_ext_blocks) | ||
389 | n = max_ext_blocks; | ||
390 | |||
391 | for (i = 1; i <= n; i++) { | ||
392 | r = hdmi_core_ddc_edid(ip_data, pedid, i); | ||
393 | if (r) | ||
394 | return r; | ||
395 | len += 128; | ||
394 | } | 396 | } |
395 | return 0; | 397 | |
398 | return len; | ||
396 | } | 399 | } |
397 | 400 | ||
398 | static void hdmi_core_init(struct hdmi_core_video_config *video_cfg, | 401 | static void hdmi_core_init(struct hdmi_core_video_config *video_cfg, |