diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/omap2/dss/display.c | 78 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 77 |
2 files changed, 73 insertions, 82 deletions
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 90edd718e9e7..6d33112c599c 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c | |||
@@ -320,86 +320,21 @@ 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 | /* | 323 | int dss_init_device(struct platform_device *pdev, |
324 | * Connect dssdev to a manager if the manager is free or if force is specified. | 324 | struct omap_dss_device *dssdev) |
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 | { | 325 | { |
326 | struct device_attribute *attr; | ||
330 | struct omap_dss_output *out; | 327 | struct omap_dss_output *out; |
331 | struct omap_overlay_manager *mgr; | ||
332 | int i, r; | 328 | int i, r; |
333 | 329 | ||
334 | out = omapdss_get_output_from_dssdev(dssdev); | 330 | out = omapdss_get_output_from_dssdev(dssdev); |
335 | 331 | ||
336 | WARN_ON(dssdev->output); | ||
337 | WARN_ON(out->device); | ||
338 | |||
339 | r = omapdss_output_set_device(out, dssdev); | 332 | r = omapdss_output_set_device(out, dssdev); |
340 | if (r) { | 333 | if (r) { |
341 | DSSERR("failed to connect output to new device\n"); | 334 | DSSERR("failed to connect output to new device\n"); |
342 | return r; | 335 | return r; |
343 | } | 336 | } |
344 | 337 | ||
345 | mgr = omap_dss_get_overlay_manager(dssdev->channel); | ||
346 | |||
347 | if (mgr->output && !force) | ||
348 | return 0; | ||
349 | |||
350 | if (mgr->output) | ||
351 | mgr->unset_output(mgr); | ||
352 | |||
353 | r = mgr->set_output(mgr, out); | ||
354 | if (r) { | ||
355 | DSSERR("failed to connect manager to output of new device\n"); | ||
356 | |||
357 | /* remove the output-device connection we just made */ | ||
358 | omapdss_output_unset_device(out); | ||
359 | return r; | ||
360 | } | ||
361 | |||
362 | for (i = 0; i < omap_dss_get_num_overlays(); ++i) { | ||
363 | struct omap_overlay *ovl = omap_dss_get_overlay(i); | ||
364 | |||
365 | if (!ovl->manager || force) { | ||
366 | if (ovl->manager) | ||
367 | ovl->unset_manager(ovl); | ||
368 | |||
369 | r = ovl->set_manager(ovl, mgr); | ||
370 | if (r) { | ||
371 | DSSERR("failed to set initial overlay\n"); | ||
372 | return r; | ||
373 | } | ||
374 | } | ||
375 | } | ||
376 | |||
377 | return 0; | ||
378 | } | ||
379 | |||
380 | static void dss_uninit_connections(struct omap_dss_device *dssdev) | ||
381 | { | ||
382 | if (dssdev->output) { | ||
383 | struct omap_overlay_manager *mgr = dssdev->output->manager; | ||
384 | |||
385 | if (mgr) | ||
386 | mgr->unset_output(mgr); | ||
387 | |||
388 | omapdss_output_unset_device(dssdev->output); | ||
389 | } | ||
390 | } | ||
391 | |||
392 | int dss_init_device(struct platform_device *pdev, | ||
393 | struct omap_dss_device *dssdev) | ||
394 | { | ||
395 | struct device_attribute *attr; | ||
396 | int i, r; | ||
397 | const char *def_disp_name = omapdss_get_default_display_name(); | ||
398 | bool force; | ||
399 | |||
400 | force = def_disp_name && strcmp(def_disp_name, dssdev->name) == 0; | ||
401 | dss_init_connections(dssdev, force); | ||
402 | |||
403 | /* create device sysfs files */ | 338 | /* create device sysfs files */ |
404 | i = 0; | 339 | i = 0; |
405 | while ((attr = display_sysfs_attrs[i++]) != NULL) { | 340 | while ((attr = display_sysfs_attrs[i++]) != NULL) { |
@@ -410,7 +345,7 @@ int dss_init_device(struct platform_device *pdev, | |||
410 | device_remove_file(&dssdev->dev, attr); | 345 | device_remove_file(&dssdev->dev, attr); |
411 | } | 346 | } |
412 | 347 | ||
413 | dss_uninit_connections(dssdev); | 348 | omapdss_output_unset_device(dssdev->output); |
414 | 349 | ||
415 | DSSERR("failed to create sysfs file\n"); | 350 | DSSERR("failed to create sysfs file\n"); |
416 | return r; | 351 | return r; |
@@ -424,7 +359,7 @@ int dss_init_device(struct platform_device *pdev, | |||
424 | while ((attr = display_sysfs_attrs[i++]) != NULL) | 359 | while ((attr = display_sysfs_attrs[i++]) != NULL) |
425 | device_remove_file(&dssdev->dev, attr); | 360 | device_remove_file(&dssdev->dev, attr); |
426 | 361 | ||
427 | dss_uninit_connections(dssdev); | 362 | omapdss_output_unset_device(dssdev->output); |
428 | 363 | ||
429 | DSSERR("failed to create sysfs display link\n"); | 364 | DSSERR("failed to create sysfs display link\n"); |
430 | return r; | 365 | return r; |
@@ -444,7 +379,8 @@ void dss_uninit_device(struct platform_device *pdev, | |||
444 | while ((attr = display_sysfs_attrs[i++]) != NULL) | 379 | while ((attr = display_sysfs_attrs[i++]) != NULL) |
445 | device_remove_file(&dssdev->dev, attr); | 380 | device_remove_file(&dssdev->dev, attr); |
446 | 381 | ||
447 | dss_uninit_connections(dssdev); | 382 | if (dssdev->output) |
383 | omapdss_output_unset_device(dssdev->output); | ||
448 | } | 384 | } |
449 | 385 | ||
450 | static int dss_suspend_device(struct device *dev, void *data) | 386 | static int dss_suspend_device(struct device *dev, void *data) |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index ba4630830e09..af2844a34644 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -2369,15 +2369,52 @@ static int omapfb_init_display(struct omapfb2_device *fbdev, | |||
2369 | return 0; | 2369 | return 0; |
2370 | } | 2370 | } |
2371 | 2371 | ||
2372 | static int omapfb_init_connections(struct omapfb2_device *fbdev, | ||
2373 | struct omap_dss_device *dssdev) | ||
2374 | { | ||
2375 | int i, r; | ||
2376 | struct omap_overlay_manager *mgr = NULL; | ||
2377 | |||
2378 | for (i = 0; i < fbdev->num_managers; i++) { | ||
2379 | mgr = fbdev->managers[i]; | ||
2380 | |||
2381 | if (dssdev->channel == mgr->id) | ||
2382 | break; | ||
2383 | } | ||
2384 | |||
2385 | if (i == fbdev->num_managers) | ||
2386 | return -ENODEV; | ||
2387 | |||
2388 | if (mgr->output) | ||
2389 | mgr->unset_output(mgr); | ||
2390 | |||
2391 | r = mgr->set_output(mgr, dssdev->output); | ||
2392 | if (r) | ||
2393 | return r; | ||
2394 | |||
2395 | for (i = 0; i < fbdev->num_overlays; i++) { | ||
2396 | struct omap_overlay *ovl = fbdev->overlays[i]; | ||
2397 | |||
2398 | if (ovl->manager) | ||
2399 | ovl->unset_manager(ovl); | ||
2400 | |||
2401 | r = ovl->set_manager(ovl, mgr); | ||
2402 | if (r) | ||
2403 | dev_warn(fbdev->dev, | ||
2404 | "failed to connect overlay %s to manager %s\n", | ||
2405 | ovl->name, mgr->name); | ||
2406 | } | ||
2407 | |||
2408 | return 0; | ||
2409 | } | ||
2410 | |||
2372 | static int __init omapfb_probe(struct platform_device *pdev) | 2411 | static int __init omapfb_probe(struct platform_device *pdev) |
2373 | { | 2412 | { |
2374 | struct omapfb2_device *fbdev = NULL; | 2413 | struct omapfb2_device *fbdev = NULL; |
2375 | int r = 0; | 2414 | int r = 0; |
2376 | int i; | 2415 | int i; |
2377 | struct omap_overlay *ovl; | ||
2378 | struct omap_dss_device *def_display; | 2416 | struct omap_dss_device *def_display; |
2379 | struct omap_dss_device *dssdev; | 2417 | struct omap_dss_device *dssdev; |
2380 | struct omap_dss_device *ovl_device; | ||
2381 | 2418 | ||
2382 | DBG("omapfb_probe\n"); | 2419 | DBG("omapfb_probe\n"); |
2383 | 2420 | ||
@@ -2445,15 +2482,33 @@ static int __init omapfb_probe(struct platform_device *pdev) | |||
2445 | for (i = 0; i < fbdev->num_managers; i++) | 2482 | for (i = 0; i < fbdev->num_managers; i++) |
2446 | fbdev->managers[i] = omap_dss_get_overlay_manager(i); | 2483 | fbdev->managers[i] = omap_dss_get_overlay_manager(i); |
2447 | 2484 | ||
2448 | /* gfx overlay should be the default one. find a display | 2485 | def_display = NULL; |
2449 | * connected to that, and use it as default display */ | 2486 | |
2450 | ovl = omap_dss_get_overlay(0); | 2487 | for (i = 0; i < fbdev->num_displays; ++i) { |
2451 | ovl_device = ovl->get_device(ovl); | 2488 | struct omap_dss_device *dssdev; |
2452 | if (ovl_device) { | 2489 | const char *def_name; |
2453 | def_display = ovl_device; | 2490 | |
2454 | } else { | 2491 | def_name = omapdss_get_default_display_name(); |
2455 | dev_warn(&pdev->dev, "cannot find default display\n"); | 2492 | |
2456 | def_display = NULL; | 2493 | dssdev = fbdev->displays[i].dssdev; |
2494 | |||
2495 | if (def_name == NULL || | ||
2496 | (dssdev->name && strcmp(def_name, dssdev->name) == 0)) { | ||
2497 | def_display = dssdev; | ||
2498 | break; | ||
2499 | } | ||
2500 | } | ||
2501 | |||
2502 | if (def_display == NULL) { | ||
2503 | dev_err(fbdev->dev, "failed to find default display\n"); | ||
2504 | r = -EINVAL; | ||
2505 | goto cleanup; | ||
2506 | } | ||
2507 | |||
2508 | r = omapfb_init_connections(fbdev, def_display); | ||
2509 | if (r) { | ||
2510 | dev_err(fbdev->dev, "failed to init overlay connections\n"); | ||
2511 | goto cleanup; | ||
2457 | } | 2512 | } |
2458 | 2513 | ||
2459 | if (def_mode && strlen(def_mode) > 0) { | 2514 | if (def_mode && strlen(def_mode) > 0) { |