diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-09-25 04:23:14 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-09-25 04:23:14 -0400 |
commit | c0ca7c38c5d35c12a9b94ef42842b325dfd2a3cd (patch) | |
tree | 2190b0a91130b8b9c7f0e562ea5d28a885f3eb19 /drivers/video/omap2/dss/display.c | |
parent | 524d9f48a64dbe1ec3a276b57ac2a422fc14af07 (diff) | |
parent | 5274484b821bb2cf34a697624ef14084c31b16ce (diff) |
Merge omapdss single-dssdev series
This series contains patches that change how omapdss's panel devices
(omap_dss_device) are initialized and registered. There are two patches that
change behaviour, the rest are just cleanups:
The patch "omap_dss_register_device() doesn't take display index" affects the
number for the "displayX" sysfs files. This hopefully doesn't affect the
userspace, as the number has never been a clear indication of what the
particular display is.
The patch "register only one display device per output" affects how panel
devices are created. Currently we support multiple panels per output, i.e. you
could have DVI and an LCD displays using the same DPI output, as long as the
DVI and LCD are not used at the same time.
This patch changes the omapdss driver to only register one display device per
output. If there are multiple displays for the output, either the first one is
picked or, if def_display has been defined in kernel parameters and the
def_display is one of the displays for this output, the def_display is picked.
See the patch for more information.
OMAPDSS: alloc dssdevs dynamically
OMAPDSS: cleanup dss_recheck_connections further
OMAPDSS: cleanup dss_recheck_connections
OMAPDSS: handle errors in dss_init_device
OMAPDSS: explicitely initialize dssdev->channel for new displays
OMAPDSS: register only one display device per output
OMAPDSS: Add dss_get_default_display_name()
OMAPDSS: omap_dss_register_device() doesn't take display index
Diffstat (limited to 'drivers/video/omap2/dss/display.c')
-rw-r--r-- | drivers/video/omap2/dss/display.c | 85 |
1 files changed, 78 insertions, 7 deletions
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 5f09d503d619..db83ae81a713 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c | |||
@@ -320,26 +320,98 @@ void omapdss_default_get_timings(struct omap_dss_device *dssdev, | |||
320 | } | 320 | } |
321 | EXPORT_SYMBOL(omapdss_default_get_timings); | 321 | EXPORT_SYMBOL(omapdss_default_get_timings); |
322 | 322 | ||
323 | void dss_init_device(struct platform_device *pdev, | 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 | */ | ||
328 | static 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 | |||
367 | static void dss_uninit_connections(struct omap_dss_device *dssdev) | ||
368 | { | ||
369 | if (dssdev->manager) | ||
370 | dssdev->manager->unset_device(dssdev->manager); | ||
371 | } | ||
372 | |||
373 | int 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; | 377 | int i, r; |
328 | int 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); | ||
329 | 383 | ||
330 | /* create device sysfs files */ | 384 | /* create device sysfs files */ |
331 | i = 0; | 385 | i = 0; |
332 | while ((attr = display_sysfs_attrs[i++]) != NULL) { | 386 | while ((attr = display_sysfs_attrs[i++]) != NULL) { |
333 | r = device_create_file(&dssdev->dev, attr); | 387 | r = device_create_file(&dssdev->dev, attr); |
334 | if (r) | 388 | if (r) { |
389 | for (i = i - 2; i >= 0; i--) { | ||
390 | attr = display_sysfs_attrs[i]; | ||
391 | device_remove_file(&dssdev->dev, attr); | ||
392 | } | ||
393 | |||
394 | dss_uninit_connections(dssdev); | ||
395 | |||
335 | DSSERR("failed to create sysfs file\n"); | 396 | DSSERR("failed to create sysfs file\n"); |
397 | return r; | ||
398 | } | ||
336 | } | 399 | } |
337 | 400 | ||
338 | /* create display? sysfs links */ | 401 | /* create display? sysfs links */ |
339 | r = sysfs_create_link(&pdev->dev.kobj, &dssdev->dev.kobj, | 402 | r = sysfs_create_link(&pdev->dev.kobj, &dssdev->dev.kobj, |
340 | dev_name(&dssdev->dev)); | 403 | dev_name(&dssdev->dev)); |
341 | if (r) | 404 | if (r) { |
405 | while ((attr = display_sysfs_attrs[i++]) != NULL) | ||
406 | device_remove_file(&dssdev->dev, attr); | ||
407 | |||
408 | dss_uninit_connections(dssdev); | ||
409 | |||
342 | DSSERR("failed to create sysfs display link\n"); | 410 | DSSERR("failed to create sysfs display link\n"); |
411 | return r; | ||
412 | } | ||
413 | |||
414 | return 0; | ||
343 | } | 415 | } |
344 | 416 | ||
345 | void dss_uninit_device(struct platform_device *pdev, | 417 | void dss_uninit_device(struct platform_device *pdev, |
@@ -353,8 +425,7 @@ void dss_uninit_device(struct platform_device *pdev, | |||
353 | while ((attr = display_sysfs_attrs[i++]) != NULL) | 425 | while ((attr = display_sysfs_attrs[i++]) != NULL) |
354 | device_remove_file(&dssdev->dev, attr); | 426 | device_remove_file(&dssdev->dev, attr); |
355 | 427 | ||
356 | if (dssdev->manager) | 428 | dss_uninit_connections(dssdev); |
357 | dssdev->manager->unset_device(dssdev->manager); | ||
358 | } | 429 | } |
359 | 430 | ||
360 | static int dss_suspend_device(struct device *dev, void *data) | 431 | static int dss_suspend_device(struct device *dev, void *data) |