Commit 6ea6f827 authored by Chun-Kuang Hu's avatar Chun-Kuang Hu

drm/mediatek: Use correct device pointer to get CMDQ client register

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: default avatarChun-Kuang Hu <chunkuang.hu@kernel.org>
parent c822584e
...@@ -118,7 +118,7 @@ static int mtk_disp_color_probe(struct platform_device *pdev) ...@@ -118,7 +118,7 @@ static int mtk_disp_color_probe(struct platform_device *pdev)
return comp_id; 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); &mtk_disp_color_funcs);
if (ret) { if (ret) {
if (ret != -EPROBE_DEFER) if (ret != -EPROBE_DEFER)
......
...@@ -384,7 +384,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev) ...@@ -384,7 +384,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
return comp_id; 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); &mtk_disp_ovl_funcs);
if (ret) { if (ret) {
if (ret != -EPROBE_DEFER) if (ret != -EPROBE_DEFER)
......
...@@ -292,7 +292,7 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) ...@@ -292,7 +292,7 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
return comp_id; 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); &mtk_disp_rdma_funcs);
if (ret) { if (ret) {
if (ret != -EPROBE_DEFER) if (ret != -EPROBE_DEFER)
......
...@@ -775,7 +775,7 @@ static int mtk_dpi_probe(struct platform_device *pdev) ...@@ -775,7 +775,7 @@ static int mtk_dpi_probe(struct platform_device *pdev)
return comp_id; 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); &mtk_dpi_funcs);
if (ret) { if (ret) {
dev_err(dev, "Failed to initialize component: %d\n", ret); dev_err(dev, "Failed to initialize component: %d\n", ret);
......
...@@ -465,10 +465,11 @@ unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm, ...@@ -465,10 +465,11 @@ unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
return ret; return ret;
} }
int mtk_ddp_comp_init(struct device *dev, struct device_node *node, int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id, enum mtk_ddp_comp_id comp_id, const struct mtk_ddp_comp_funcs *funcs)
const struct mtk_ddp_comp_funcs *funcs)
{ {
struct platform_device *comp_pdev;
struct device *dev;
enum mtk_ddp_comp_type type; enum mtk_ddp_comp_type type;
struct device_node *larb_node; struct device_node *larb_node;
struct platform_device *larb_pdev; struct platform_device *larb_pdev;
...@@ -506,10 +507,16 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node, ...@@ -506,10 +507,16 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
if (IS_ERR(comp->clk)) if (IS_ERR(comp->clk))
return PTR_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 IS_REACHABLE(CONFIG_MTK_CMDQ)
if (of_address_to_resource(node, 0, &res) != 0) { if (of_address_to_resource(node, 0, &res) != 0) {
dev_err(dev, "Missing reg in %s node\n", node->full_name); dev_err(dev, "Missing reg in %s node\n", node->full_name);
put_device(&larb_pdev->dev);
return -EINVAL; return -EINVAL;
} }
comp->regs_pa = res.start; comp->regs_pa = res.start;
......
...@@ -172,9 +172,8 @@ int mtk_ddp_comp_get_id(struct device_node *node, ...@@ -172,9 +172,8 @@ int mtk_ddp_comp_get_id(struct device_node *node,
enum mtk_ddp_comp_type comp_type); enum mtk_ddp_comp_type comp_type);
unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm, unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
struct mtk_ddp_comp ddp_comp); struct mtk_ddp_comp ddp_comp);
int mtk_ddp_comp_init(struct device *dev, struct device_node *comp_node, int mtk_ddp_comp_init(struct device_node *comp_node, struct mtk_ddp_comp *comp,
struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id, enum mtk_ddp_comp_id comp_id, const struct mtk_ddp_comp_funcs *funcs);
const struct mtk_ddp_comp_funcs *funcs);
int mtk_ddp_comp_register(struct drm_device *drm, struct mtk_ddp_comp *comp); 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_ddp_comp_unregister(struct drm_device *drm, struct mtk_ddp_comp *comp);
void mtk_dither_set(struct mtk_ddp_comp *comp, unsigned int bpc, void mtk_dither_set(struct mtk_ddp_comp *comp, unsigned int bpc,
......
...@@ -512,7 +512,7 @@ static int mtk_drm_probe(struct platform_device *pdev) ...@@ -512,7 +512,7 @@ static int mtk_drm_probe(struct platform_device *pdev)
goto err_node; goto err_node;
} }
ret = mtk_ddp_comp_init(dev->parent, node, comp, ret = mtk_ddp_comp_init(node, comp,
comp_id, NULL); comp_id, NULL);
if (ret) { if (ret) {
of_node_put(node); of_node_put(node);
......
...@@ -1097,7 +1097,7 @@ static int mtk_dsi_probe(struct platform_device *pdev) ...@@ -1097,7 +1097,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
goto err_unregister_host; 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); &mtk_dsi_funcs);
if (ret) { if (ret) {
dev_err(dev, "Failed to initialize component: %d\n", ret); dev_err(dev, "Failed to initialize component: %d\n", ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment