]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/gpu/drm/imx/imx-drm-core.c
Merge remote-tracking branch 'drm-misc/topic/drm-misc'
[karo-tx-linux.git] / drivers / gpu / drm / imx / imx-drm-core.c
index 74f505b0dd0280d47fcd9268e2b4d95a1ddae250..6faa735376ecdaf10faf42351d4edb7b92de2bb0 100644 (file)
@@ -49,8 +49,10 @@ struct imx_drm_crtc {
        struct imx_drm_crtc_helper_funcs        imx_drm_helper_funcs;
 };
 
+#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
 static int legacyfb_depth = 16;
 module_param(legacyfb_depth, int, 0444);
+#endif
 
 int imx_drm_crtc_id(struct imx_drm_crtc *crtc)
 {
@@ -60,26 +62,20 @@ EXPORT_SYMBOL_GPL(imx_drm_crtc_id);
 
 static void imx_drm_driver_lastclose(struct drm_device *drm)
 {
-#if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
        struct imx_drm_device *imxdrm = drm->dev_private;
 
        if (imxdrm->fbhelper)
                drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
-#endif
 }
 
 static int imx_drm_driver_unload(struct drm_device *drm)
 {
-#if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
        struct imx_drm_device *imxdrm = drm->dev_private;
-#endif
 
        drm_kms_helper_poll_fini(drm);
 
-#if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
        if (imxdrm->fbhelper)
                drm_fbdev_cma_fini(imxdrm->fbhelper);
-#endif
 
        component_unbind_all(drm->dev, drm);
 
@@ -145,10 +141,10 @@ void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc)
 }
 EXPORT_SYMBOL_GPL(imx_drm_handle_vblank);
 
-static int imx_drm_enable_vblank(struct drm_device *drm, int crtc)
+static int imx_drm_enable_vblank(struct drm_device *drm, unsigned int pipe)
 {
        struct imx_drm_device *imxdrm = drm->dev_private;
-       struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[crtc];
+       struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[pipe];
        int ret;
 
        if (!imx_drm_crtc)
@@ -163,10 +159,10 @@ static int imx_drm_enable_vblank(struct drm_device *drm, int crtc)
        return ret;
 }
 
-static void imx_drm_disable_vblank(struct drm_device *drm, int crtc)
+static void imx_drm_disable_vblank(struct drm_device *drm, unsigned int pipe)
 {
        struct imx_drm_device *imxdrm = drm->dev_private;
-       struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[crtc];
+       struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[pipe];
 
        if (!imx_drm_crtc)
                return;
@@ -215,11 +211,9 @@ EXPORT_SYMBOL_GPL(imx_drm_encoder_destroy);
 
 static void imx_drm_output_poll_changed(struct drm_device *drm)
 {
-#if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
        struct imx_drm_device *imxdrm = drm->dev_private;
 
        drm_fbdev_cma_hotplug_event(imxdrm->fbhelper);
-#endif
 }
 
 static struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
@@ -308,7 +302,7 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
         * The fb helper takes copies of key hardware information, so the
         * crtcs/connectors/encoders must not change after this point.
         */
-#if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
+#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
        if (legacyfb_depth != 16 && legacyfb_depth != 32) {
                dev_warn(drm->dev, "Invalid legacyfb_depth.  Defaulting to 16bpp\n");
                legacyfb_depth = 16;
@@ -487,7 +481,7 @@ static struct drm_driver imx_drm_driver = {
        .gem_prime_vmap         = drm_gem_cma_prime_vmap,
        .gem_prime_vunmap       = drm_gem_cma_prime_vunmap,
        .gem_prime_mmap         = drm_gem_cma_prime_mmap,
-       .get_vblank_counter     = drm_vblank_count,
+       .get_vblank_counter     = drm_vblank_no_hw_counter,
        .enable_vblank          = imx_drm_enable_vblank,
        .disable_vblank         = imx_drm_disable_vblank,
        .ioctls                 = imx_drm_ioctls,
@@ -531,59 +525,12 @@ static const struct component_master_ops imx_drm_ops = {
 
 static int imx_drm_platform_probe(struct platform_device *pdev)
 {
-       struct device_node *ep, *port, *remote;
-       struct component_match *match = NULL;
-       int ret;
-       int i;
-
-       /*
-        * Bind the IPU display interface ports first, so that
-        * imx_drm_encoder_parse_of called from encoder .bind callbacks
-        * works as expected.
-        */
-       for (i = 0; ; i++) {
-               port = of_parse_phandle(pdev->dev.of_node, "ports", i);
-               if (!port)
-                       break;
+       int ret = drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops);
 
-               component_match_add(&pdev->dev, &match, compare_of, port);
-       }
-
-       if (i == 0) {
-               dev_err(&pdev->dev, "missing 'ports' property\n");
-               return -ENODEV;
-       }
-
-       /* Then bind all encoders */
-       for (i = 0; ; i++) {
-               port = of_parse_phandle(pdev->dev.of_node, "ports", i);
-               if (!port)
-                       break;
-
-               for_each_child_of_node(port, ep) {
-                       remote = of_graph_get_remote_port_parent(ep);
-                       if (!remote || !of_device_is_available(remote)) {
-                               of_node_put(remote);
-                               continue;
-                       } else if (!of_device_is_available(remote->parent)) {
-                               dev_warn(&pdev->dev, "parent device of %s is not available\n",
-                                        remote->full_name);
-                               of_node_put(remote);
-                               continue;
-                       }
-
-                       component_match_add(&pdev->dev, &match, compare_of,
-                                           remote);
-                       of_node_put(remote);
-               }
-               of_node_put(port);
-       }
+       if (!ret)
+               ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
 
-       ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
-       if (ret)
-               return ret;
-
-       return component_master_add_with_match(&pdev->dev, &imx_drm_ops, match);
+       return ret;
 }
 
 static int imx_drm_platform_remove(struct platform_device *pdev)