aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2011-08-29 11:10:20 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-09-30 09:16:47 -0400
commit759593ffa7e05ebea9b21135cad179982331f5d8 (patch)
tree3162f08919d9f6e6ca94b8124c2ff9e5f25d5d98 /drivers/video
parent468c1b934c0367d15f90314ae316cd33551f70a5 (diff)
OMAP: DSS2: HDMI: implement detect()
Implement detect() by checking the hot plug detect status. The implementation is not very good, as it always turns on the HDMI output to get the detection working. HDMI driver needs improvements so that we could enable only core parts of it. 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.h1
-rw-r--r--drivers/video/omap2/dss/dss_features.c1
-rw-r--r--drivers/video/omap2/dss/hdmi.c17
-rw-r--r--drivers/video/omap2/dss/hdmi_panel.c25
-rw-r--r--drivers/video/omap2/dss/ti_hdmi.h3
-rw-r--r--drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c12
6 files changed, 59 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 2e7799c8296..f58c302b730 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -495,6 +495,7 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev);
495int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev, 495int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
496 struct omap_video_timings *timings); 496 struct omap_video_timings *timings);
497int omapdss_hdmi_read_edid(u8 *buf, int len); 497int omapdss_hdmi_read_edid(u8 *buf, int len);
498bool omapdss_hdmi_detect(void);
498int hdmi_panel_init(void); 499int hdmi_panel_init(void);
499void hdmi_panel_exit(void); 500void hdmi_panel_exit(void);
500 501
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index 076f399a915..ab4166590a7 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -440,6 +440,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
440 .phy_enable = ti_hdmi_4xxx_phy_enable, 440 .phy_enable = ti_hdmi_4xxx_phy_enable,
441 .phy_disable = ti_hdmi_4xxx_phy_disable, 441 .phy_disable = ti_hdmi_4xxx_phy_disable,
442 .read_edid = ti_hdmi_4xxx_read_edid, 442 .read_edid = ti_hdmi_4xxx_read_edid,
443 .detect = ti_hdmi_4xxx_detect,
443 .pll_enable = ti_hdmi_4xxx_pll_enable, 444 .pll_enable = ti_hdmi_4xxx_pll_enable,
444 .pll_disable = ti_hdmi_4xxx_pll_disable, 445 .pll_disable = ti_hdmi_4xxx_pll_disable,
445 .video_enable = ti_hdmi_4xxx_wp_video_start, 446 .video_enable = ti_hdmi_4xxx_wp_video_start,
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index fb85ce5a8ab..78186700266 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -449,6 +449,23 @@ int omapdss_hdmi_read_edid(u8 *buf, int len)
449 return r; 449 return r;
450} 450}
451 451
452bool omapdss_hdmi_detect(void)
453{
454 int r;
455
456 mutex_lock(&hdmi.lock);
457
458 r = hdmi_runtime_get();
459 BUG_ON(r);
460
461 r = hdmi.ip_data.ops->detect(&hdmi.ip_data);
462
463 hdmi_runtime_put();
464 mutex_unlock(&hdmi.lock);
465
466 return r == 1;
467}
468
452int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) 469int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
453{ 470{
454 int r = 0; 471 int r = 0;
diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c
index 71aa8134f4f..533d5dc634d 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -25,6 +25,7 @@
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <video/omapdss.h> 27#include <video/omapdss.h>
28#include <linux/slab.h>
28 29
29#include "dss.h" 30#include "dss.h"
30 31
@@ -198,6 +199,29 @@ err:
198 return r; 199 return r;
199} 200}
200 201
202static bool hdmi_detect(struct omap_dss_device *dssdev)
203{
204 int r;
205
206 mutex_lock(&hdmi.hdmi_lock);
207
208 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) {
209 r = omapdss_hdmi_display_enable(dssdev);
210 if (r)
211 goto err;
212 }
213
214 r = omapdss_hdmi_detect();
215
216 if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED ||
217 dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED)
218 omapdss_hdmi_display_disable(dssdev);
219err:
220 mutex_unlock(&hdmi.hdmi_lock);
221
222 return r;
223}
224
201static struct omap_dss_driver hdmi_driver = { 225static struct omap_dss_driver hdmi_driver = {
202 .probe = hdmi_panel_probe, 226 .probe = hdmi_panel_probe,
203 .remove = hdmi_panel_remove, 227 .remove = hdmi_panel_remove,
@@ -209,6 +233,7 @@ static struct omap_dss_driver hdmi_driver = {
209 .set_timings = hdmi_set_timings, 233 .set_timings = hdmi_set_timings,
210 .check_timings = hdmi_check_timings, 234 .check_timings = hdmi_check_timings,
211 .read_edid = hdmi_read_edid, 235 .read_edid = hdmi_read_edid,
236 .detect = hdmi_detect,
212 .driver = { 237 .driver = {
213 .name = "hdmi_panel", 238 .name = "hdmi_panel",
214 .owner = THIS_MODULE, 239 .owner = THIS_MODULE,
diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index 390cd85b122..d48603c8e23 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -94,6 +94,8 @@ struct ti_hdmi_ip_ops {
94 94
95 int (*read_edid)(struct hdmi_ip_data *ip_data, u8 *edid, int len); 95 int (*read_edid)(struct hdmi_ip_data *ip_data, u8 *edid, int len);
96 96
97 bool (*detect)(struct hdmi_ip_data *ip_data);
98
97 int (*pll_enable)(struct hdmi_ip_data *ip_data); 99 int (*pll_enable)(struct hdmi_ip_data *ip_data);
98 100
99 void (*pll_disable)(struct hdmi_ip_data *ip_data); 101 void (*pll_disable)(struct hdmi_ip_data *ip_data);
@@ -114,6 +116,7 @@ struct hdmi_ip_data {
114int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data); 116int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
115void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data); 117void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
116int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, u8 *edid, int len); 118int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, u8 *edid, int len);
119bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data);
117void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start); 120void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start);
118int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data); 121int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data);
119void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data); 122void ti_hdmi_4xxx_pll_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 e9885dcc412..da7fe50fc12 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -416,6 +416,18 @@ int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data,
416 return l; 416 return l;
417} 417}
418 418
419bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data)
420{
421 int r;
422
423 void __iomem *base = hdmi_core_sys_base(ip_data);
424
425 /* HPD */
426 r = REG_GET(base, HDMI_CORE_SYS_SYS_STAT, 1, 1);
427
428 return r == 1;
429}
430
419static void hdmi_core_init(struct hdmi_core_video_config *video_cfg, 431static void hdmi_core_init(struct hdmi_core_video_config *video_cfg,
420 struct hdmi_core_infoframe_avi *avi_cfg, 432 struct hdmi_core_infoframe_avi *avi_cfg,
421 struct hdmi_core_packet_enable_repeat *repeat_cfg) 433 struct hdmi_core_packet_enable_repeat *repeat_cfg)