drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fri, 5 Aug 2022 11:56:30 +0000 (14:56 +0300)
committerRob Clark <robdclark@chromium.org>
Sun, 18 Sep 2022 16:38:02 +0000 (09:38 -0700)
The commit 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master
components") changed the MDP5 driver to look for the interconnect paths
in the MDSS device rather than in the MDP5 device itself. This was left
unnoticed since on my testing devices the interconnects probably didn't
reach the sync state.

Rather than just using the MDP5 device for ICC path lookups for the MDP5
devices, introduce an additional helper to check both MDP5/DPU and MDSS
nodes. This will be helpful for the MDP5->DPU conversion, since the
driver will have to check both nodes.

Fixes: 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master components")
Reported-by: Marijn Suijten <marijn.suijten@somainline.org>
Reported-by: Yassine Oudjana <y.oudjana@protonmail.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Marijn Suijten <marijn.suijten@somainline.org> # On sdm630
Tested-by: Yassine Oudjana <y.oudjana@protonmail.com> # msm8996
Patchwork: https://patchwork.freedesktop.org/patch/496488/
Link: https://lore.kernel.org/r/20220805115630.506391-1-dmitry.baryshkov@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
drivers/gpu/drm/msm/msm_drv.h
drivers/gpu/drm/msm/msm_io_utils.c

index 008e1420e6e5510b6592261df110bac7480e4495..8646fd0603cbf88a9824b9ae58921516bf1030fa 100644 (file)
@@ -384,12 +384,9 @@ static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms)
        struct icc_path *path1;
        struct drm_device *dev = dpu_kms->dev;
        struct device *dpu_dev = dev->dev;
-       struct device *mdss_dev = dpu_dev->parent;
 
-       /* Interconnects are a part of MDSS device tree binding, not the
-        * MDP/DPU device. */
-       path0 = of_icc_get(mdss_dev, "mdp0-mem");
-       path1 = of_icc_get(mdss_dev, "mdp1-mem");
+       path0 = msm_icc_get(dpu_dev, "mdp0-mem");
+       path1 = msm_icc_get(dpu_dev, "mdp1-mem");
 
        if (IS_ERR_OR_NULL(path0))
                return PTR_ERR_OR_ZERO(path0);
index d2a48caf9d27ee87c05668ac405bff9bab0d94dd..b0d21838a13439027f1df3c3fd23b21c857eb1e5 100644 (file)
@@ -902,12 +902,9 @@ fail:
 
 static int mdp5_setup_interconnect(struct platform_device *pdev)
 {
-       /* Interconnects are a part of MDSS device tree binding, not the
-        * MDP5 device. */
-       struct device *mdss_dev = pdev->dev.parent;
-       struct icc_path *path0 = of_icc_get(mdss_dev, "mdp0-mem");
-       struct icc_path *path1 = of_icc_get(mdss_dev, "mdp1-mem");
-       struct icc_path *path_rot = of_icc_get(mdss_dev, "rotator-mem");
+       struct icc_path *path0 = msm_icc_get(&pdev->dev, "mdp0-mem");
+       struct icc_path *path1 = msm_icc_get(&pdev->dev, "mdp1-mem");
+       struct icc_path *path_rot = msm_icc_get(&pdev->dev, "rotator-mem");
 
        if (IS_ERR(path0))
                return PTR_ERR(path0);
index 4229a722208891143095825f00f39db31e32f5b1..f6670f82e350a8290095c40cabf7244ac8383d69 100644 (file)
@@ -467,6 +467,8 @@ void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name,
                phys_addr_t *size);
 void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name);
 
+struct icc_path *msm_icc_get(struct device *dev, const char *name);
+
 #define msm_writel(data, addr) writel((data), (addr))
 #define msm_readl(addr) readl((addr))
 
index 7b504617833adc849e8fb033614fea395e1c2d63..d02cd29ce8299eacb62cd3bc57e924cfe2ba5c41 100644 (file)
@@ -5,6 +5,8 @@
  * Author: Rob Clark <robdclark@gmail.com>
  */
 
+#include <linux/interconnect.h>
+
 #include "msm_drv.h"
 
 /*
@@ -124,3 +126,23 @@ void msm_hrtimer_work_init(struct msm_hrtimer_work *work,
        work->worker = worker;
        kthread_init_work(&work->work, fn);
 }
+
+struct icc_path *msm_icc_get(struct device *dev, const char *name)
+{
+       struct device *mdss_dev = dev->parent;
+       struct icc_path *path;
+
+       path = of_icc_get(dev, name);
+       if (path)
+               return path;
+
+       /*
+        * If there are no interconnects attached to the corresponding device
+        * node, of_icc_get() will return NULL.
+        *
+        * If the MDP5/DPU device node doesn't have interconnects, lookup the
+        * path in the parent (MDSS) device.
+        */
+       return of_icc_get(mdss_dev, name);
+
+}