Re: [PATCH v4 11/17] drm/mediatek: Get rid of mtk_smi_larb_get/put

From: Chun-Kuang Hu
Date: Sat May 30 2020 - 07:08:57 EST


Hi, Yong:

Yong Wu <yong.wu@xxxxxxxxxxxx> æ 2020å5æ30æ éå äå4:27åéï
>
> MediaTek IOMMU has already added the device_link between the consumer
> and smi-larb device. If the drm device call the pm_runtime_get_sync,
> the smi-larb's pm_runtime_get_sync also be called automatically.
>

Acked-by: Chun-Kuang Hu <chunkuang.hu@xxxxxxxxxx>

> CC: CK Hu <ck.hu@xxxxxxxxxxxx>
> CC: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
> Signed-off-by: Yong Wu <yong.wu@xxxxxxxxxxxx>
> Reviewed-by: Evan Green <evgreen@xxxxxxxxxxxx>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 9 ---------
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 21 ---------------------
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 -
> 3 files changed, 31 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index c9bc844..d4c4078 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -8,7 +8,6 @@
> #include <linux/soc/mediatek/mtk-cmdq.h>
>
> #include <asm/barrier.h>
> -#include <soc/mediatek/smi.h>
>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_plane_helper.h>
> @@ -532,12 +531,6 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
>
> DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
>
> - ret = mtk_smi_larb_get(comp->larb_dev);
> - if (ret) {
> - DRM_ERROR("Failed to get larb: %d\n", ret);
> - return;
> - }
> -
> ret = pm_runtime_get_sync(comp->dev);
> if (ret < 0)
> DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n",
> @@ -545,7 +538,6 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
>
> ret = mtk_crtc_ddp_hw_init(mtk_crtc);
> if (ret) {
> - mtk_smi_larb_put(comp->larb_dev);
> pm_runtime_put(comp->dev);
> return;
> }
> @@ -582,7 +574,6 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
>
> drm_crtc_vblank_off(crtc);
> mtk_crtc_ddp_hw_fini(mtk_crtc);
> - mtk_smi_larb_put(comp->larb_dev);
> ret = pm_runtime_put(comp->dev);
> if (ret < 0)
> DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n",
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index 593027a..a6e7f3a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -432,8 +432,6 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
> const struct mtk_ddp_comp_funcs *funcs)
> {
> enum mtk_ddp_comp_type type;
> - struct device_node *larb_node;
> - struct platform_device *larb_pdev;
> #if IS_REACHABLE(CONFIG_MTK_CMDQ)
> struct resource res;
> struct cmdq_client_reg cmdq_reg;
> @@ -468,31 +466,12 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
> if (IS_ERR(comp->clk))
> return PTR_ERR(comp->clk);
>
> - /* Only DMA capable components need the LARB property */
> - comp->larb_dev = NULL;
> if (type != MTK_DISP_OVL &&
> type != MTK_DISP_OVL_2L &&
> type != MTK_DISP_RDMA &&
> type != MTK_DISP_WDMA)
> return 0;
>
> - larb_node = of_parse_phandle(node, "mediatek,larb", 0);
> - if (!larb_node) {
> - dev_err(dev,
> - "Missing mediadek,larb phandle in %pOF node\n", node);
> - return -EINVAL;
> - }
> -
> - larb_pdev = of_find_device_by_node(larb_node);
> - if (!larb_pdev) {
> - dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
> - of_node_put(larb_node);
> - return -EPROBE_DEFER;
> - }
> - of_node_put(larb_node);
> -
> - comp->larb_dev = &larb_pdev->dev;
> -
> comp->dev = dev;
>
> #if IS_REACHABLE(CONFIG_MTK_CMDQ)
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> index 4c063e0..11c7120 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> @@ -98,7 +98,6 @@ struct mtk_ddp_comp {
> struct clk *clk;
> void __iomem *regs;
> int irq;
> - struct device *larb_dev;
> struct device *dev;
> enum mtk_ddp_comp_id id;
> const struct mtk_ddp_comp_funcs *funcs;
> --
> 1.9.1
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-mediatek