summaryrefslogtreecommitdiff
path: root/drivers/video/omap2/dss/display.c
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2014-03-20 10:09:19 +0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-03-20 10:13:50 +0400
commit17d5ca91cfc59ae91da5ff9da74ab09a9a2a17d9 (patch)
treea45f944e15a2600ec20ca4ec11b23d4641095e8e /drivers/video/omap2/dss/display.c
parentb7e4ab50418d5b34ab0dae95193dd71190e1fb50 (diff)
parentc86907b59f505863ec7839471e889330982a596e (diff)
downloadlinux-17d5ca91cfc59ae91da5ff9da74ab09a9a2a17d9.tar.xz
Merge branch '3.15/dss-dt' into 3.15/fbdev
Merge OMAP DSS DT support
Diffstat (limited to 'drivers/video/omap2/dss/display.c')
-rw-r--r--drivers/video/omap2/dss/display.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index 9f19ae22944c..2412a0dd0c13 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/platform_device.h>
+#include <linux/of.h>
#include <video/omapdss.h>
#include "dss.h"
@@ -133,9 +134,32 @@ static int disp_num_counter;
int omapdss_register_display(struct omap_dss_device *dssdev)
{
struct omap_dss_driver *drv = dssdev->driver;
+ int id;
- snprintf(dssdev->alias, sizeof(dssdev->alias),
- "display%d", disp_num_counter++);
+ /*
+ * Note: this presumes all the displays are either using DT or non-DT,
+ * which normally should be the case. This also presumes that all
+ * displays either have an DT alias, or none has.
+ */
+
+ if (dssdev->dev->of_node) {
+ id = of_alias_get_id(dssdev->dev->of_node, "display");
+
+ if (id < 0)
+ id = disp_num_counter++;
+ } else {
+ id = disp_num_counter++;
+ }
+
+ snprintf(dssdev->alias, sizeof(dssdev->alias), "display%d", id);
+
+ /* Use 'label' property for name, if it exists */
+ if (dssdev->dev->of_node)
+ of_property_read_string(dssdev->dev->of_node, "label",
+ &dssdev->name);
+
+ if (dssdev->name == NULL)
+ dssdev->name = dssdev->alias;
if (drv && drv->get_resolution == NULL)
drv->get_resolution = omapdss_default_get_resolution;