Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices

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>

authored by

Dmitry Baryshkov and committed by
Rob Clark
5ccdceca feda34d1

+29 -11
+2 -5
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
··· 384 384 struct icc_path *path1; 385 385 struct drm_device *dev = dpu_kms->dev; 386 386 struct device *dpu_dev = dev->dev; 387 - struct device *mdss_dev = dpu_dev->parent; 388 387 389 - /* Interconnects are a part of MDSS device tree binding, not the 390 - * MDP/DPU device. */ 391 - path0 = of_icc_get(mdss_dev, "mdp0-mem"); 392 - path1 = of_icc_get(mdss_dev, "mdp1-mem"); 388 + path0 = msm_icc_get(dpu_dev, "mdp0-mem"); 389 + path1 = msm_icc_get(dpu_dev, "mdp1-mem"); 393 390 394 391 if (IS_ERR_OR_NULL(path0)) 395 392 return PTR_ERR_OR_ZERO(path0);
+3 -6
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
··· 902 902 903 903 static int mdp5_setup_interconnect(struct platform_device *pdev) 904 904 { 905 - /* Interconnects are a part of MDSS device tree binding, not the 906 - * MDP5 device. */ 907 - struct device *mdss_dev = pdev->dev.parent; 908 - struct icc_path *path0 = of_icc_get(mdss_dev, "mdp0-mem"); 909 - struct icc_path *path1 = of_icc_get(mdss_dev, "mdp1-mem"); 910 - struct icc_path *path_rot = of_icc_get(mdss_dev, "rotator-mem"); 905 + struct icc_path *path0 = msm_icc_get(&pdev->dev, "mdp0-mem"); 906 + struct icc_path *path1 = msm_icc_get(&pdev->dev, "mdp1-mem"); 907 + struct icc_path *path_rot = msm_icc_get(&pdev->dev, "rotator-mem"); 911 908 912 909 if (IS_ERR(path0)) 913 910 return PTR_ERR(path0);
+2
drivers/gpu/drm/msm/msm_drv.h
··· 467 467 phys_addr_t *size); 468 468 void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name); 469 469 470 + struct icc_path *msm_icc_get(struct device *dev, const char *name); 471 + 470 472 #define msm_writel(data, addr) writel((data), (addr)) 471 473 #define msm_readl(addr) readl((addr)) 472 474
+22
drivers/gpu/drm/msm/msm_io_utils.c
··· 5 5 * Author: Rob Clark <robdclark@gmail.com> 6 6 */ 7 7 8 + #include <linux/interconnect.h> 9 + 8 10 #include "msm_drv.h" 9 11 10 12 /* ··· 125 123 work->timer.function = msm_hrtimer_worktimer; 126 124 work->worker = worker; 127 125 kthread_init_work(&work->work, fn); 126 + } 127 + 128 + struct icc_path *msm_icc_get(struct device *dev, const char *name) 129 + { 130 + struct device *mdss_dev = dev->parent; 131 + struct icc_path *path; 132 + 133 + path = of_icc_get(dev, name); 134 + if (path) 135 + return path; 136 + 137 + /* 138 + * If there are no interconnects attached to the corresponding device 139 + * node, of_icc_get() will return NULL. 140 + * 141 + * If the MDP5/DPU device node doesn't have interconnects, lookup the 142 + * path in the parent (MDSS) device. 143 + */ 144 + return of_icc_get(mdss_dev, name); 145 + 128 146 }