aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-07 08:48:45 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-18 09:15:04 -0400
commit5eeb55f8703d2af3181599c085b21ce023a0f942 (patch)
treed17774a6683e19ab1fa89048279946117b91a404
parent6b41785836f184df585e33cd6b940852fb9299ed (diff)
OMAPDSS: cleanup dss_recheck_connections further
Cleanup dss_recheck_connections, move and rename it to a static dss_init_connections function inside display.c. Improve the function to return errors, and implement a matching dss_uninit_connections that can be used to free the mgr->dssdev link. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/omap2/dss/core.c5
-rw-r--r--drivers/video/omap2/dss/display.c62
-rw-r--r--drivers/video/omap2/dss/dss.h1
-rw-r--r--drivers/video/omap2/dss/overlay.c32
4 files changed, 60 insertions, 40 deletions
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 9315ece90ff1..c4fd7687f3a3 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -352,7 +352,6 @@ static int dss_driver_probe(struct device *dev)
352 int r; 352 int r;
353 struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver); 353 struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver);
354 struct omap_dss_device *dssdev = to_dss_device(dev); 354 struct omap_dss_device *dssdev = to_dss_device(dev);
355 bool force;
356 355
357 DSSDBG("driver_probe: dev %s/%s, drv %s\n", 356 DSSDBG("driver_probe: dev %s/%s, drv %s\n",
358 dev_name(dev), dssdev->driver_name, 357 dev_name(dev), dssdev->driver_name,
@@ -362,10 +361,6 @@ static int dss_driver_probe(struct device *dev)
362 if (r) 361 if (r)
363 return r; 362 return r;
364 363
365 force = core.default_display_name &&
366 strcmp(core.default_display_name, dssdev->name) == 0;
367 dss_recheck_connections(dssdev, force);
368
369 r = dssdrv->probe(dssdev); 364 r = dssdrv->probe(dssdev);
370 365
371 if (r) { 366 if (r) {
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index f7190109bd91..db83ae81a713 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -320,11 +320,66 @@ void omapdss_default_get_timings(struct omap_dss_device *dssdev,
320} 320}
321EXPORT_SYMBOL(omapdss_default_get_timings); 321EXPORT_SYMBOL(omapdss_default_get_timings);
322 322
323/*
324 * Connect dssdev to a manager if the manager is free or if force is specified.
325 * Connect all overlays to that manager if they are free or if force is
326 * specified.
327 */
328static int dss_init_connections(struct omap_dss_device *dssdev, bool force)
329{
330 struct omap_overlay_manager *mgr;
331 int i, r;
332
333 WARN_ON(dssdev->manager);
334
335 mgr = omap_dss_get_overlay_manager(dssdev->channel);
336
337 if (mgr->device && !force)
338 return 0;
339
340 if (mgr->device)
341 mgr->unset_device(mgr);
342
343 r = mgr->set_device(mgr, dssdev);
344 if (r) {
345 DSSERR("failed to set initial manager\n");
346 return r;
347 }
348
349 for (i = 0; i < omap_dss_get_num_overlays(); ++i) {
350 struct omap_overlay *ovl = omap_dss_get_overlay(i);
351
352 if (!ovl->manager || force) {
353 if (ovl->manager)
354 ovl->unset_manager(ovl);
355
356 r = ovl->set_manager(ovl, mgr);
357 if (r) {
358 DSSERR("failed to set initial overlay\n");
359 return r;
360 }
361 }
362 }
363
364 return 0;
365}
366
367static void dss_uninit_connections(struct omap_dss_device *dssdev)
368{
369 if (dssdev->manager)
370 dssdev->manager->unset_device(dssdev->manager);
371}
372
323int dss_init_device(struct platform_device *pdev, 373int dss_init_device(struct platform_device *pdev,
324 struct omap_dss_device *dssdev) 374 struct omap_dss_device *dssdev)
325{ 375{
326 struct device_attribute *attr; 376 struct device_attribute *attr;
327 int i, r; 377 int i, r;
378 const char *def_disp_name = dss_get_default_display_name();
379 bool force;
380
381 force = def_disp_name && strcmp(def_disp_name, dssdev->name) == 0;
382 dss_init_connections(dssdev, force);
328 383
329 /* create device sysfs files */ 384 /* create device sysfs files */
330 i = 0; 385 i = 0;
@@ -336,6 +391,8 @@ int dss_init_device(struct platform_device *pdev,
336 device_remove_file(&dssdev->dev, attr); 391 device_remove_file(&dssdev->dev, attr);
337 } 392 }
338 393
394 dss_uninit_connections(dssdev);
395
339 DSSERR("failed to create sysfs file\n"); 396 DSSERR("failed to create sysfs file\n");
340 return r; 397 return r;
341 } 398 }
@@ -348,6 +405,8 @@ int dss_init_device(struct platform_device *pdev,
348 while ((attr = display_sysfs_attrs[i++]) != NULL) 405 while ((attr = display_sysfs_attrs[i++]) != NULL)
349 device_remove_file(&dssdev->dev, attr); 406 device_remove_file(&dssdev->dev, attr);
350 407
408 dss_uninit_connections(dssdev);
409
351 DSSERR("failed to create sysfs display link\n"); 410 DSSERR("failed to create sysfs display link\n");
352 return r; 411 return r;
353 } 412 }
@@ -366,8 +425,7 @@ void dss_uninit_device(struct platform_device *pdev,
366 while ((attr = display_sysfs_attrs[i++]) != NULL) 425 while ((attr = display_sysfs_attrs[i++]) != NULL)
367 device_remove_file(&dssdev->dev, attr); 426 device_remove_file(&dssdev->dev, attr);
368 427
369 if (dssdev->manager) 428 dss_uninit_connections(dssdev);
370 dssdev->manager->unset_device(dssdev->manager);
371} 429}
372 430
373static int dss_suspend_device(struct device *dev, void *data) 431static int dss_suspend_device(struct device *dev, void *data)
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 98e82731c60a..7a3fea66b411 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -263,7 +263,6 @@ void dss_manager_kobj_uninit(struct omap_overlay_manager *mgr);
263void dss_init_overlays(struct platform_device *pdev); 263void dss_init_overlays(struct platform_device *pdev);
264void dss_uninit_overlays(struct platform_device *pdev); 264void dss_uninit_overlays(struct platform_device *pdev);
265void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr); 265void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr);
266void dss_recheck_connections(struct omap_dss_device *dssdev, bool force);
267int dss_ovl_simple_check(struct omap_overlay *ovl, 266int dss_ovl_simple_check(struct omap_overlay *ovl,
268 const struct omap_overlay_info *info); 267 const struct omap_overlay_info *info);
269int dss_ovl_check(struct omap_overlay *ovl, struct omap_overlay_info *info, 268int dss_ovl_check(struct omap_overlay *ovl, struct omap_overlay_info *info,
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c
index 1bf05efffe13..52455a0609cb 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -105,38 +105,6 @@ void dss_init_overlays(struct platform_device *pdev)
105 } 105 }
106} 106}
107 107
108/* connect overlays to the new device, if not already connected. if force
109 * selected, connect always. */
110void dss_recheck_connections(struct omap_dss_device *dssdev, bool force)
111{
112 struct omap_overlay_manager *mgr = NULL;
113 int i;
114
115 mgr = omap_dss_get_overlay_manager(dssdev->channel);
116
117 if (!mgr->device || force) {
118 if (mgr->device)
119 mgr->unset_device(mgr);
120 mgr->set_device(mgr, dssdev);
121 }
122
123 if (mgr) {
124 dispc_runtime_get();
125
126 for (i = 0; i < dss_feat_get_num_ovls(); i++) {
127 struct omap_overlay *ovl;
128 ovl = omap_dss_get_overlay(i);
129 if (!ovl->manager || force) {
130 if (ovl->manager)
131 ovl->unset_manager(ovl);
132 ovl->set_manager(ovl, mgr);
133 }
134 }
135
136 dispc_runtime_put();
137 }
138}
139
140void dss_uninit_overlays(struct platform_device *pdev) 108void dss_uninit_overlays(struct platform_device *pdev)
141{ 109{
142 int i; 110 int i;