]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/msm: Remove non-DT code in msm_drv
authorArchit Taneja <architt@codeaurora.org>
Wed, 18 Nov 2015 06:45:14 +0000 (12:15 +0530)
committerRob Clark <robdclark@gmail.com>
Mon, 14 Dec 2015 15:38:29 +0000 (10:38 -0500)
Support for non-DT kernels was mainly to use v3.4 downstream kernels.
This is no longer a priority now as we have reasonable support upstream.

Remove CONFIG_OF from the top level msm_drv.c file. While we're at it,
clean up the data matching process using of_device_get_match_data.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_drv.h

index b88ce514eb8e75d58bf069a52ac1f704605ce0d5..06df8aaab37599e75c5de9dc04ea59d39d58bd97 100644 (file)
@@ -237,20 +237,9 @@ static int msm_unload(struct drm_device *dev)
 
 static int get_mdp_ver(struct platform_device *pdev)
 {
-#ifdef CONFIG_OF
-       static const struct of_device_id match_types[] = { {
-               .compatible = "qcom,mdss_mdp",
-               .data   = (void *)5,
-       }, {
-               /* end node */
-       } };
        struct device *dev = &pdev->dev;
-       const struct of_device_id *match;
-       match = of_match_node(match_types, dev->of_node);
-       if (match)
-               return (int)(unsigned long)match->data;
-#endif
-       return 4;
+
+       return (int) (unsigned long) of_device_get_match_data(dev);
 }
 
 #include <linux/of_address.h>
@@ -258,10 +247,10 @@ static int get_mdp_ver(struct platform_device *pdev)
 static int msm_init_vram(struct drm_device *dev)
 {
        struct msm_drm_private *priv = dev->dev_private;
+       struct device_node *node;
        unsigned long size = 0;
        int ret = 0;
 
-#ifdef CONFIG_OF
        /* In the device-tree world, we could have a 'memory-region'
         * phandle, which gives us a link to our "vram".  Allocating
         * is all nicely abstracted behind the dma api, but we need
@@ -278,7 +267,6 @@ static int msm_init_vram(struct drm_device *dev)
         *     as corruption on screen before we have a chance to
         *     load and do initial modeset)
         */
-       struct device_node *node;
 
        node = of_parse_phandle(dev->dev->of_node, "memory-region", 0);
        if (node) {
@@ -288,14 +276,12 @@ static int msm_init_vram(struct drm_device *dev)
                        return ret;
                size = r.end - r.start;
                DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start);
-       } else
-#endif
 
-       /* if we have no IOMMU, then we need to use carveout allocator.
-        * Grab the entire CMA chunk carved out in early startup in
-        * mach-msm:
-        */
-       if (!iommu_present(&platform_bus_type)) {
+               /* if we have no IOMMU, then we need to use carveout allocator.
+                * Grab the entire CMA chunk carved out in early startup in
+                * mach-msm:
+                */
+       } else if (!iommu_present(&platform_bus_type)) {
                DRM_INFO("using %s VRAM carveout\n", vram);
                size = memparse(vram, NULL);
        }
@@ -1035,9 +1021,9 @@ static const struct dev_pm_ops msm_pm_ops = {
  * Componentized driver support:
  */
 
-#ifdef CONFIG_OF
-/* NOTE: the CONFIG_OF case duplicates the same code as exynos or imx
- * (or probably any other).. so probably some room for some helpers
+/*
+ * NOTE: duplication of the same code as exynos or imx (or probably any other).
+ * so probably some room for some helpers
  */
 static int compare_of(struct device *dev, void *data)
 {
@@ -1062,12 +1048,6 @@ static int add_components(struct device *dev, struct component_match **matchptr,
 
        return 0;
 }
-#else
-static int compare_dev(struct device *dev, void *data)
-{
-       return dev == data;
-}
-#endif
 
 static int msm_drm_bind(struct device *dev)
 {
@@ -1091,35 +1071,9 @@ static const struct component_master_ops msm_drm_ops = {
 static int msm_pdev_probe(struct platform_device *pdev)
 {
        struct component_match *match = NULL;
-#ifdef CONFIG_OF
+
        add_components(&pdev->dev, &match, "connectors");
        add_components(&pdev->dev, &match, "gpus");
-#else
-       /* For non-DT case, it kinda sucks.  We don't actually have a way
-        * to know whether or not we are waiting for certain devices (or if
-        * they are simply not present).  But for non-DT we only need to
-        * care about apq8064/apq8060/etc (all mdp4/a3xx):
-        */
-       static const char *devnames[] = {
-                       "hdmi_msm.0", "kgsl-3d0.0",
-       };
-       int i;
-
-       DBG("Adding components..");
-
-       for (i = 0; i < ARRAY_SIZE(devnames); i++) {
-               struct device *dev;
-
-               dev = bus_find_device_by_name(&platform_bus_type,
-                               NULL, devnames[i]);
-               if (!dev) {
-                       dev_info(&pdev->dev, "still waiting for %s\n", devnames[i]);
-                       return -EPROBE_DEFER;
-               }
-
-               component_match_add(&pdev->dev, &match, compare_dev, dev);
-       }
-#endif
 
        pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
        return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match);
@@ -1138,8 +1092,8 @@ static const struct platform_device_id msm_id[] = {
 };
 
 static const struct of_device_id dt_match[] = {
-       { .compatible = "qcom,mdp" },      /* mdp4 */
-       { .compatible = "qcom,mdss_mdp" }, /* mdp5 */
+       { .compatible = "qcom,mdp", .data = (void *) 4 },     /* mdp4 */
+       { .compatible = "qcom,mdss_mdp", .data = (void *) 5 }, /* mdp5 */
        {}
 };
 MODULE_DEVICE_TABLE(of, dt_match);
index 9a713b7a009ddad628f349b3561ca2e658ac8304..c1e7bba2fdb7f6aac791da4c62de61b4fd5e8231 100644 (file)
 #include <linux/iommu.h>
 #include <linux/types.h>
 #include <linux/of_graph.h>
+#include <linux/of_device.h>
 #include <asm/sizes.h>
 
-#ifndef CONFIG_OF
-#include <mach/board.h>
-#include <mach/socinfo.h>
-#include <mach/iommu_domains.h>
-#endif
-
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>