]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/mediatek: Use correct device pointer to get CMDQ client register
authorChun-Kuang Hu <chunkuang.hu@kernel.org>
Mon, 19 Oct 2020 00:15:22 +0000 (08:15 +0800)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Mon, 28 Dec 2020 23:11:12 +0000 (07:11 +0800)
Some ddp component use mmsys device pointer to get CMDQ client
register, this would get mmsys' CMDQ client register, so use
each ddp component's device pointer to get.

Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_disp_color.c
drivers/gpu/drm/mediatek/mtk_disp_ovl.c
drivers/gpu/drm/mediatek/mtk_disp_rdma.c
drivers/gpu/drm/mediatek/mtk_dpi.c
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
drivers/gpu/drm/mediatek/mtk_drm_drv.c
drivers/gpu/drm/mediatek/mtk_dsi.c

index 6048cbc9f0ec63da9c96d49230bc75d09444912d..6ee4515dc272181b8ccc346a91a101cb6faf8702 100644 (file)
@@ -118,7 +118,7 @@ static int mtk_disp_color_probe(struct platform_device *pdev)
                return comp_id;
        }
 
-       ret = mtk_ddp_comp_init(dev, dev->of_node, &priv->ddp_comp, comp_id,
+       ret = mtk_ddp_comp_init(dev->of_node, &priv->ddp_comp, comp_id,
                                &mtk_disp_color_funcs);
        if (ret) {
                if (ret != -EPROBE_DEFER)
index 74ef6fc0528b6e783c3134164ae32048a498f7cf..f8e99d67132d297096294dc120027d6e9330dbdd 100644 (file)
@@ -384,7 +384,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
                return comp_id;
        }
 
-       ret = mtk_ddp_comp_init(dev, dev->of_node, &priv->ddp_comp, comp_id,
+       ret = mtk_ddp_comp_init(dev->of_node, &priv->ddp_comp, comp_id,
                                &mtk_disp_ovl_funcs);
        if (ret) {
                if (ret != -EPROBE_DEFER)
index d46b8ae1d08008bb9dd968f8774ca74ed6afbd24..a3c487ea8344bd825ee39023f4e9a330c9dd4ff1 100644 (file)
@@ -292,7 +292,7 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
                return comp_id;
        }
 
-       ret = mtk_ddp_comp_init(dev, dev->of_node, &priv->ddp_comp, comp_id,
+       ret = mtk_ddp_comp_init(dev->of_node, &priv->ddp_comp, comp_id,
                                &mtk_disp_rdma_funcs);
        if (ret) {
                if (ret != -EPROBE_DEFER)
index 52f11a63a3304a616352b7d56d8b1fd1f6602c24..81b43b640d4592898c196b9c0b1e26317024844b 100644 (file)
@@ -775,7 +775,7 @@ static int mtk_dpi_probe(struct platform_device *pdev)
                return comp_id;
        }
 
-       ret = mtk_ddp_comp_init(dev, dev->of_node, &dpi->ddp_comp, comp_id,
+       ret = mtk_ddp_comp_init(dev->of_node, &dpi->ddp_comp, comp_id,
                                &mtk_dpi_funcs);
        if (ret) {
                dev_err(dev, "Failed to initialize component: %d\n", ret);
index cab53431ceec4b167c2509b35e023ba8d7cb8157..1730b3ddef7024f70403a9fb6c17c64b1076ea45 100644 (file)
@@ -465,10 +465,11 @@ unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
        return ret;
 }
 
-int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
-                     struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id,
-                     const struct mtk_ddp_comp_funcs *funcs)
+int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
+                     enum mtk_ddp_comp_id comp_id, const struct mtk_ddp_comp_funcs *funcs)
 {
+       struct platform_device *comp_pdev;
+       struct device *dev;
        enum mtk_ddp_comp_type type;
        struct device_node *larb_node;
        struct platform_device *larb_pdev;
@@ -506,10 +507,16 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
        if (IS_ERR(comp->clk))
                return PTR_ERR(comp->clk);
 
+       comp_pdev = of_find_device_by_node(node);
+       if (!comp_pdev) {
+               DRM_INFO("Waiting for device %s\n", node->full_name);
+               return -EPROBE_DEFER;
+       }
+       dev = &comp_pdev->dev;
+
 #if IS_REACHABLE(CONFIG_MTK_CMDQ)
        if (of_address_to_resource(node, 0, &res) != 0) {
                dev_err(dev, "Missing reg in %s node\n", node->full_name);
-               put_device(&larb_pdev->dev);
                return -EINVAL;
        }
        comp->regs_pa = res.start;
index 5aa52b7afeecbed8b3abe0d7d741c5bbde2fb684..6353f050fdf50d7c2083801dc5de490e88e2c800 100644 (file)
@@ -172,9 +172,8 @@ int mtk_ddp_comp_get_id(struct device_node *node,
                        enum mtk_ddp_comp_type comp_type);
 unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
                                                struct mtk_ddp_comp ddp_comp);
-int mtk_ddp_comp_init(struct device *dev, struct device_node *comp_node,
-                     struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id,
-                     const struct mtk_ddp_comp_funcs *funcs);
+int mtk_ddp_comp_init(struct device_node *comp_node, struct mtk_ddp_comp *comp,
+                     enum mtk_ddp_comp_id comp_id, const struct mtk_ddp_comp_funcs *funcs);
 int mtk_ddp_comp_register(struct drm_device *drm, struct mtk_ddp_comp *comp);
 void mtk_ddp_comp_unregister(struct drm_device *drm, struct mtk_ddp_comp *comp);
 void mtk_dither_set(struct mtk_ddp_comp *comp, unsigned int bpc,
index 2f717df28a77a4ef81022f5a9a5d8e8b86ff3421..221aac9d1f6625a509ce64c335ef09e49d7aa7e1 100644 (file)
@@ -512,7 +512,7 @@ static int mtk_drm_probe(struct platform_device *pdev)
                                goto err_node;
                        }
 
-                       ret = mtk_ddp_comp_init(dev->parent, node, comp,
+                       ret = mtk_ddp_comp_init(node, comp,
                                                comp_id, NULL);
                        if (ret) {
                                of_node_put(node);
index 65fd99c528af2446119bb1109f9636627619003d..a71cf1f52f8b4e83976ecffd68de4bfda2c01d3d 100644 (file)
@@ -1097,7 +1097,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
                goto err_unregister_host;
        }
 
-       ret = mtk_ddp_comp_init(dev, dev->of_node, &dsi->ddp_comp, comp_id,
+       ret = mtk_ddp_comp_init(dev->of_node, &dsi->ddp_comp, comp_id,
                                &mtk_dsi_funcs);
        if (ret) {
                dev_err(dev, "Failed to initialize component: %d\n", ret);