aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-10-10 03:56:05 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-12-07 10:05:55 -0500
commit74b65ec24560ab0df0e7b789fa91cde4a442f169 (patch)
tree2d322869cb9ea6d9196e6743dbb7d67138b2cd30 /drivers/video/omap2
parent6abae7a18a8c9dbec96915eb924dc06288a47b02 (diff)
OMAPDSS: add manager ops
The output drivers need some operations from the overlay managers, like enable and set_timings. These will affect the dispc registers, and need to be synchronized with the composition-side changes with overlays and overlay managers. We want to handle these calls in the apply.c in the compatibility mode, but when in non-compat mode, the calls need to be handled by some other component (e.g. omapdrm). To make this possible, this patch creates a set of function pointers in a dss_mgr_ops struct, that is used to redirect the calls into the correct destination. The non-compat users can install their mgr ops with dss_install_mgr_ops() function. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2')
-rw-r--r--drivers/video/omap2/dss/apply.c36
-rw-r--r--drivers/video/omap2/dss/dss.h13
-rw-r--r--drivers/video/omap2/dss/output.c44
3 files changed, 87 insertions, 6 deletions
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 038876a68d1..70eaa8f70e9 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -781,7 +781,7 @@ static void mgr_clear_shadow_dirty(struct omap_overlay_manager *mgr)
781 } 781 }
782} 782}
783 783
784void dss_mgr_start_update(struct omap_overlay_manager *mgr) 784static void dss_mgr_start_update_compat(struct omap_overlay_manager *mgr)
785{ 785{
786 struct mgr_priv_data *mp = get_mgr_priv(mgr); 786 struct mgr_priv_data *mp = get_mgr_priv(mgr);
787 unsigned long flags; 787 unsigned long flags;
@@ -1021,7 +1021,7 @@ static void dss_setup_fifos(void)
1021 } 1021 }
1022} 1022}
1023 1023
1024int dss_mgr_enable(struct omap_overlay_manager *mgr) 1024static int dss_mgr_enable_compat(struct omap_overlay_manager *mgr)
1025{ 1025{
1026 struct mgr_priv_data *mp = get_mgr_priv(mgr); 1026 struct mgr_priv_data *mp = get_mgr_priv(mgr);
1027 unsigned long flags; 1027 unsigned long flags;
@@ -1071,7 +1071,7 @@ err:
1071 return r; 1071 return r;
1072} 1072}
1073 1073
1074void dss_mgr_disable(struct omap_overlay_manager *mgr) 1074static void dss_mgr_disable_compat(struct omap_overlay_manager *mgr)
1075{ 1075{
1076 struct mgr_priv_data *mp = get_mgr_priv(mgr); 1076 struct mgr_priv_data *mp = get_mgr_priv(mgr);
1077 unsigned long flags; 1077 unsigned long flags;
@@ -1208,7 +1208,7 @@ static void dss_apply_mgr_timings(struct omap_overlay_manager *mgr,
1208 mp->extra_info_dirty = true; 1208 mp->extra_info_dirty = true;
1209} 1209}
1210 1210
1211void dss_mgr_set_timings(struct omap_overlay_manager *mgr, 1211static void dss_mgr_set_timings_compat(struct omap_overlay_manager *mgr,
1212 const struct omap_video_timings *timings) 1212 const struct omap_video_timings *timings)
1213{ 1213{
1214 unsigned long flags; 1214 unsigned long flags;
@@ -1236,7 +1236,7 @@ static void dss_apply_mgr_lcd_config(struct omap_overlay_manager *mgr,
1236 mp->extra_info_dirty = true; 1236 mp->extra_info_dirty = true;
1237} 1237}
1238 1238
1239void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr, 1239static void dss_mgr_set_lcd_config_compat(struct omap_overlay_manager *mgr,
1240 const struct dss_lcd_mgr_config *config) 1240 const struct dss_lcd_mgr_config *config)
1241{ 1241{
1242 unsigned long flags; 1242 unsigned long flags;
@@ -1501,13 +1501,21 @@ err:
1501 return r; 1501 return r;
1502} 1502}
1503 1503
1504static const struct dss_mgr_ops apply_mgr_ops = {
1505 .start_update = dss_mgr_start_update_compat,
1506 .enable = dss_mgr_enable_compat,
1507 .disable = dss_mgr_disable_compat,
1508 .set_timings = dss_mgr_set_timings_compat,
1509 .set_lcd_config = dss_mgr_set_lcd_config_compat,
1510};
1511
1504static int compat_refcnt; 1512static int compat_refcnt;
1505static DEFINE_MUTEX(compat_init_lock); 1513static DEFINE_MUTEX(compat_init_lock);
1506 1514
1507int omapdss_compat_init(void) 1515int omapdss_compat_init(void)
1508{ 1516{
1509 struct platform_device *pdev = dss_get_core_pdev(); 1517 struct platform_device *pdev = dss_get_core_pdev();
1510 int i; 1518 int i, r;
1511 1519
1512 mutex_lock(&compat_init_lock); 1520 mutex_lock(&compat_init_lock);
1513 1521
@@ -1548,10 +1556,24 @@ int omapdss_compat_init(void)
1548 ovl->get_device = &dss_ovl_get_device; 1556 ovl->get_device = &dss_ovl_get_device;
1549 } 1557 }
1550 1558
1559 r = dss_install_mgr_ops(&apply_mgr_ops);
1560 if (r)
1561 goto err_mgr_ops;
1562
1551out: 1563out:
1552 mutex_unlock(&compat_init_lock); 1564 mutex_unlock(&compat_init_lock);
1553 1565
1554 return 0; 1566 return 0;
1567
1568err_mgr_ops:
1569 dss_uninit_overlay_managers(pdev);
1570 dss_uninit_overlays(pdev);
1571
1572 compat_refcnt--;
1573
1574 mutex_unlock(&compat_init_lock);
1575
1576 return r;
1555} 1577}
1556EXPORT_SYMBOL(omapdss_compat_init); 1578EXPORT_SYMBOL(omapdss_compat_init);
1557 1579
@@ -1564,6 +1586,8 @@ void omapdss_compat_uninit(void)
1564 if (--compat_refcnt > 0) 1586 if (--compat_refcnt > 0)
1565 goto out; 1587 goto out;
1566 1588
1589 dss_uninstall_mgr_ops();
1590
1567 dss_uninit_overlay_managers(pdev); 1591 dss_uninit_overlay_managers(pdev);
1568 dss_uninit_overlays(pdev); 1592 dss_uninit_overlays(pdev);
1569out: 1593out:
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 9ce798645b2..5cc13ea2b5a 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -523,4 +523,17 @@ static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr)
523} 523}
524#endif 524#endif
525 525
526struct dss_mgr_ops {
527 void (*start_update)(struct omap_overlay_manager *mgr);
528 int (*enable)(struct omap_overlay_manager *mgr);
529 void (*disable)(struct omap_overlay_manager *mgr);
530 void (*set_timings)(struct omap_overlay_manager *mgr,
531 const struct omap_video_timings *timings);
532 void (*set_lcd_config)(struct omap_overlay_manager *mgr,
533 const struct dss_lcd_mgr_config *config);
534};
535
536int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops);
537void dss_uninstall_mgr_ops(void);
538
526#endif 539#endif
diff --git a/drivers/video/omap2/dss/output.c b/drivers/video/omap2/dss/output.c
index 1a84b79d558..9527ee6a769 100644
--- a/drivers/video/omap2/dss/output.c
+++ b/drivers/video/omap2/dss/output.c
@@ -113,3 +113,47 @@ struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id)
113 113
114 return NULL; 114 return NULL;
115} 115}
116
117static const struct dss_mgr_ops *dss_mgr_ops;
118
119int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops)
120{
121 if (dss_mgr_ops)
122 return -EBUSY;
123
124 dss_mgr_ops = mgr_ops;
125
126 return 0;
127}
128
129void dss_uninstall_mgr_ops(void)
130{
131 dss_mgr_ops = NULL;
132}
133
134void dss_mgr_set_timings(struct omap_overlay_manager *mgr,
135 const struct omap_video_timings *timings)
136{
137 dss_mgr_ops->set_timings(mgr, timings);
138}
139
140void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr,
141 const struct dss_lcd_mgr_config *config)
142{
143 dss_mgr_ops->set_lcd_config(mgr, config);
144}
145
146int dss_mgr_enable(struct omap_overlay_manager *mgr)
147{
148 return dss_mgr_ops->enable(mgr);
149}
150
151void dss_mgr_disable(struct omap_overlay_manager *mgr)
152{
153 dss_mgr_ops->disable(mgr);
154}
155
156void dss_mgr_start_update(struct omap_overlay_manager *mgr)
157{
158 dss_mgr_ops->start_update(mgr);
159}