]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: imx-drm-core: fix buggy component registration
authorLothar Waßmann <LW@KARO-electronics.de>
Wed, 13 Aug 2014 13:13:14 +0000 (15:13 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 13 Aug 2014 13:13:14 +0000 (15:13 +0200)
Currently the imx-drm-core driver builds up a list of device nodes
found via the 'ports' property in DT. The DRM subsystem builds a
similar list of all drivers for the individual display-subsystem
components (crtc, ldb, ...) via the component_add() call.

The ldb driver presents a special case, since it supports two channels
which are represented in DT as two separate nodes.
When both LVDS channels are enabled, the component list in the
imx-drm-core driver will contain one element more than the component
list in the DRM subsystem. Thus, the DRM subsystem will never reach
the state in which all components are assembled and won't ever
initialize the display-subsystem.

Rather than registering all device nodes found in DT and handling the
'lvds-channel' special case in imx_drm_add_components() which is
called by the DRM subsystem once for each component added there, do it
in imx_drm_add_component(), which builds up the list of components in
the imx-drm-core driver.

This way both lists will have a matching number of entries and the DRM
subsystem will be properly initialized.

drivers/staging/imx-drm/imx-drm-core.c

index def8280d7ee664ba949ae2b2157d1d6bfefddd23..806a4b5b1ea18887b9aa68511c82f65dfdedb918 100644 (file)
@@ -560,13 +560,6 @@ static struct drm_driver imx_drm_driver = {
 static int compare_of(struct device *dev, void *data)
 {
        struct device_node *np = data;
-
-       /* Special case for LDB, one device for two channels */
-       if (of_node_cmp(np->name, "lvds-channel") == 0) {
-               np = of_get_parent(np);
-               of_node_put(np);
-       }
-
        return dev->of_node == np;
 }
 
@@ -618,6 +611,11 @@ static int imx_drm_add_component(struct device *dev, struct device_node *node)
 {
        struct imx_drm_component *component;
 
+       /* Special case for LDB, one device for two channels */
+       if (of_node_cmp(node->name, "lvds-channel") == 0) {
+               node = of_get_parent(node);
+               of_node_put(node);
+       }
        if (imx_drm_find_component(dev, node))
                return 0;