aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/omapfb/omapfb-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/omap2/omapfb/omapfb-main.c')
-rw-r--r--drivers/video/omap2/omapfb/omapfb-main.c67
1 files changed, 50 insertions, 17 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 8d02f164c8c6..ec2d132c782d 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -2417,6 +2417,55 @@ static int omapfb_init_connections(struct omapfb2_device *fbdev,
2417 return 0; 2417 return 0;
2418} 2418}
2419 2419
2420static struct omap_dss_device *
2421omapfb_find_default_display(struct omapfb2_device *fbdev)
2422{
2423 const char *def_name;
2424 int i;
2425
2426 /*
2427 * Search with the display name from the user or the board file,
2428 * comparing to display names and aliases
2429 */
2430
2431 def_name = omapdss_get_default_display_name();
2432
2433 if (def_name) {
2434 for (i = 0; i < fbdev->num_displays; ++i) {
2435 struct omap_dss_device *dssdev;
2436
2437 dssdev = fbdev->displays[i].dssdev;
2438
2439 if (dssdev->name && strcmp(def_name, dssdev->name) == 0)
2440 return dssdev;
2441
2442 if (strcmp(def_name, dssdev->alias) == 0)
2443 return dssdev;
2444 }
2445
2446 /* def_name given but not found */
2447 return NULL;
2448 }
2449
2450 /* then look for DT alias display0 */
2451 for (i = 0; i < fbdev->num_displays; ++i) {
2452 struct omap_dss_device *dssdev;
2453 int id;
2454
2455 dssdev = fbdev->displays[i].dssdev;
2456
2457 if (dssdev->dev->of_node == NULL)
2458 continue;
2459
2460 id = of_alias_get_id(dssdev->dev->of_node, "display");
2461 if (id == 0)
2462 return dssdev;
2463 }
2464
2465 /* return the first display we have in the list */
2466 return fbdev->displays[0].dssdev;
2467}
2468
2420static int omapfb_probe(struct platform_device *pdev) 2469static int omapfb_probe(struct platform_device *pdev)
2421{ 2470{
2422 struct omapfb2_device *fbdev = NULL; 2471 struct omapfb2_device *fbdev = NULL;
@@ -2494,23 +2543,7 @@ static int omapfb_probe(struct platform_device *pdev)
2494 for (i = 0; i < fbdev->num_managers; i++) 2543 for (i = 0; i < fbdev->num_managers; i++)
2495 fbdev->managers[i] = omap_dss_get_overlay_manager(i); 2544 fbdev->managers[i] = omap_dss_get_overlay_manager(i);
2496 2545
2497 def_display = NULL; 2546 def_display = omapfb_find_default_display(fbdev);
2498
2499 for (i = 0; i < fbdev->num_displays; ++i) {
2500 struct omap_dss_device *dssdev;
2501 const char *def_name;
2502
2503 def_name = omapdss_get_default_display_name();
2504
2505 dssdev = fbdev->displays[i].dssdev;
2506
2507 if (def_name == NULL ||
2508 (dssdev->name && strcmp(def_name, dssdev->name) == 0)) {
2509 def_display = dssdev;
2510 break;
2511 }
2512 }
2513
2514 if (def_display == NULL) { 2547 if (def_display == NULL) {
2515 dev_err(fbdev->dev, "failed to find default display\n"); 2548 dev_err(fbdev->dev, "failed to find default display\n");
2516 r = -EPROBE_DEFER; 2549 r = -EPROBE_DEFER;