[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAOTY__ZvG7UbbSsvv0H8ZKBovqTtHaq4+oiGNZrgF-6eKmi2g@mail.gmail.com>
Date: Sat, 30 May 2020 19:07:39 +0800
From: Chun-Kuang Hu <chunkuang.hu@...nel.org>
To: Yong Wu <yong.wu@...iatek.com>
Cc: Matthias Brugger <matthias.bgg@...il.com>,
Joerg Roedel <joro@...tes.org>,
Rob Herring <robh+dt@...nel.org>,
Will Deacon <will.deacon@....com>, youlin.pei@...iatek.com,
Nicolas Boichat <drinkcat@...omium.org>,
Evan Green <evgreen@...omium.org>, eizan@...omium.org,
Matthias Kaehlcke <mka@...omium.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Yongqiang Niu <yongqiang.niu@...iatek.com>,
CK Hu <ck.hu@...iatek.com>, devicetree@...r.kernel.org,
cui.zhang@...iatek.com, Tomasz Figa <tfiga@...gle.com>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>, ming-fan.chen@...iatek.com,
anan.sun@...iatek.com, acourbot@...omium.org,
srv_heupstream <srv_heupstream@...iatek.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
chao.hao@...iatek.com, iommu@...ts.linux-foundation.org,
Robin Murphy <robin.murphy@....com>
Subject: Re: [PATCH v4 10/17] drm/mediatek: Add pm runtime support for ovl and rdma
Hi, Yong:
Yong Wu <yong.wu@...iatek.com> 於 2020年5月30日 週六 下午4:26寫道:
>
> From: Yongqiang Niu <yongqiang.niu@...iatek.com>
>
> Display use the dispsys device to call pm_rumtime_get_sync before.
> This patch add pm_runtime_xx with ovl and rdma device whose nodes has
> "iommus" property, then display could help pm_runtime_get for smi via
> ovl or rdma device.
>
> This is a preparing patch that smi cleaning up "mediatek,larb".
>
Acked-by: Chun-Kuang Hu <chunkuang.hu@...nel.org>
> CC: CK Hu <ck.hu@...iatek.com>
> Signed-off-by: Yongqiang Niu <yongqiang.niu@...iatek.com>
> Signed-off-by: Yong Wu <yong.wu@...iatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 9 ++++++++-
> drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 9 ++++++++-
> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 12 +++++++++++-
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 2 ++
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 +
> 5 files changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index 891d80c..17c9baa 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -11,6 +11,7 @@
> #include <linux/of_device.h>
> #include <linux/of_irq.h>
> #include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> #include <linux/soc/mediatek/mtk-cmdq.h>
>
> #include "mtk_drm_crtc.h"
> @@ -399,9 +400,13 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
> return ret;
> }
>
> + pm_runtime_enable(dev);
> +
> ret = component_add(dev, &mtk_disp_ovl_component_ops);
> - if (ret)
> + if (ret) {
> + pm_runtime_disable(dev);
> dev_err(dev, "Failed to add component: %d\n", ret);
> + }
>
> return ret;
> }
> @@ -410,6 +415,8 @@ static int mtk_disp_ovl_remove(struct platform_device *pdev)
> {
> component_del(&pdev->dev, &mtk_disp_ovl_component_ops);
>
> + pm_runtime_disable(&pdev->dev);
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> index 0cb848d..5ea8fb6 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> @@ -9,6 +9,7 @@
> #include <linux/of_device.h>
> #include <linux/of_irq.h>
> #include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> #include <linux/soc/mediatek/mtk-cmdq.h>
>
> #include "mtk_drm_crtc.h"
> @@ -313,9 +314,13 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, priv);
>
> + pm_runtime_enable(dev);
> +
> ret = component_add(dev, &mtk_disp_rdma_component_ops);
> - if (ret)
> + if (ret) {
> + pm_runtime_disable(dev);
> dev_err(dev, "Failed to add component: %d\n", ret);
> + }
>
> return ret;
> }
> @@ -324,6 +329,8 @@ static int mtk_disp_rdma_remove(struct platform_device *pdev)
> {
> component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
>
> + pm_runtime_disable(&pdev->dev);
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index fe85e48..c9bc844 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -538,9 +538,15 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
> return;
> }
>
> + ret = pm_runtime_get_sync(comp->dev);
> + if (ret < 0)
> + DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n",
> + ret);
> +
> ret = mtk_crtc_ddp_hw_init(mtk_crtc);
> if (ret) {
> mtk_smi_larb_put(comp->larb_dev);
> + pm_runtime_put(comp->dev);
> return;
> }
>
> @@ -553,7 +559,7 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
> {
> struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
> struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0];
> - int i;
> + int i, ret;
>
> DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
> if (!mtk_crtc->enabled)
> @@ -577,6 +583,10 @@ 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",
> + ret);
>
> mtk_crtc->enabled = false;
> }
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index 57c88de..593027a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -493,6 +493,8 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
>
> comp->larb_dev = &larb_pdev->dev;
>
> + comp->dev = 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);
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> index debe363..4c063e0 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> @@ -99,6 +99,7 @@ struct mtk_ddp_comp {
> 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;
> resource_size_t regs_pa;
> --
> 1.9.1
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
Powered by blists - more mailing lists