Commit f6d0086fa6b9be817ca473567417a096757a4188

Authored by Tomi Valkeinen
Committed by Jyri Sarha
1 parent f69da64f93

drm/omap: ensure all displays have been probed

DRM offers no ways to add new displays after the DRM driver has been
loaded. This causes issues on boards that have multiple displays, and
omapdrm is loaded when some of them are loaded but not all. The result
is that omapdrm starts with the displays that were loaded at that time,
ignoring the displays loaded later.

This patch changes the behavior so that omapdrm ensures all display are
loaded which have an alias in the .dts file.

The downside is that this prevents omapdrm from loading if, say, the
user has not compiled a kernel module for one of the displays, or
there's some kind of failure in one of the displays. Thus, after this
patch, all the displays have to work, or none does.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>

Showing 1 changed file with 27 additions and 0 deletions Side-by-side Diff

drivers/gpu/drm/omapdrm/omap_drv.c
... ... @@ -94,11 +94,38 @@
94 94 dssdev->driver->disconnect(dssdev);
95 95 }
96 96  
  97 +static bool dssdev_with_alias_exists(const char *alias)
  98 +{
  99 + struct omap_dss_device *dssdev = NULL;
  100 +
  101 + for_each_dss_dev(dssdev) {
  102 + if (strcmp(alias, dssdev->alias) == 0) {
  103 + omap_dss_put_device(dssdev);
  104 + return true;
  105 + }
  106 + }
  107 +
  108 + return false;
  109 +}
  110 +
97 111 static int omap_connect_dssdevs(void)
98 112 {
99 113 int r;
100 114 struct omap_dss_device *dssdev = NULL;
101 115 bool no_displays = true;
  116 + struct device_node *aliases;
  117 + struct property *pp;
  118 +
  119 + aliases = of_find_node_by_path("/aliases");
  120 + if (aliases) {
  121 + for_each_property_of_node(aliases, pp) {
  122 + if (strncmp(pp->name, "display", 7) != 0)
  123 + continue;
  124 +
  125 + if (dssdev_with_alias_exists(pp->name) == false)
  126 + return -EPROBE_DEFER;
  127 + }
  128 + }
102 129  
103 130 for_each_dss_dev(dssdev) {
104 131 r = dssdev->driver->connect(dssdev);