[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1623326418.23717.18.camel@mhfsdcap03>
Date: Thu, 10 Jun 2021 20:00:18 +0800
From: Yong Wu <yong.wu@...iatek.com>
To: Dafna Hirschfeld <dafna.hirschfeld@...labora.com>
CC: Matthias Brugger <matthias.bgg@...il.com>,
Joerg Roedel <joro@...tes.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Evan Green <evgreen@...omium.org>,
Robin Murphy <robin.murphy@....com>,
Tomasz Figa <tfiga@...omium.org>,
Will Deacon <will.deacon@....com>,
<linux-mediatek@...ts.infradead.org>,
<srv_heupstream@...iatek.com>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<iommu@...ts.linux-foundation.org>, <youlin.pei@...iatek.com>,
Nicolas Boichat <drinkcat@...omium.org>,
Matthias Kaehlcke <mka@...omium.org>, <anan.sun@...iatek.com>,
<chao.hao@...iatek.com>, <ming-fan.chen@...iatek.com>,
<yi.kuo@...iatek.com>, <eizan@...omium.org>,
<acourbot@...omium.org>, CK Hu <ck.hu@...iatek.com>,
Philipp Zabel <p.zabel@...gutronix.de>
Subject: Re: [PATCH v5 11/16] drm/mediatek: Get rid of mtk_smi_larb_get/put
On Wed, 2021-05-26 at 08:41 +0300, Dafna Hirschfeld wrote:
> Hi
>
> On 10.04.21 12:11, Yong Wu wrote:
> > 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.
> >
> > CC: CK Hu <ck.hu@...iatek.com>
> > CC: Philipp Zabel <p.zabel@...gutronix.de>
> > Signed-off-by: Yong Wu <yong.wu@...iatek.com>
> > Reviewed-by: Evan Green <evgreen@...omium.org>
> > Acked-by: Chun-Kuang Hu <chunkuang.hu@...nel.org>
> > ---
> > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 9 ------
> > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 35 ---------------------
> > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 -
> > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 +--
> > 4 files changed, 1 insertion(+), 49 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > index 971ef58ac1dc..d59353af4019 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > @@ -10,7 +10,6 @@
> > #include <linux/soc/mediatek/mtk-mutex.h>
> >
> > #include <asm/barrier.h>
> > -#include <soc/mediatek/smi.h>
> >
> > #include <drm/drm_atomic.h>
> > #include <drm/drm_atomic_helper.h>
> > @@ -544,12 +543,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_resume_and_get(comp->dev);
> > if (ret < 0)
> > DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n",
> > @@ -557,7 +550,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;
> > }
> > @@ -594,7 +586,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 75bc00e17fc4..6c01492ba4df 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > @@ -449,37 +449,12 @@ unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
> > return ret;
> > }
> >
> > -static int mtk_ddp_get_larb_dev(struct device_node *node, struct mtk_ddp_comp *comp,
> > - struct device *dev)
> > -{
> > - struct device_node *larb_node;
> > - struct platform_device *larb_pdev;
> > -
> > - 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;
> > -
> > - return 0;
> > -}
> > -
> > int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
> > enum mtk_ddp_comp_id comp_id)
> > {
> > struct platform_device *comp_pdev;
> > enum mtk_ddp_comp_type type;
> > struct mtk_ddp_comp_dev *priv;
> > - int ret;
> Hi,
>
> This 'ret' is also used inside `if IS_REACHABLE(CONFIG_MTK_CMDQ)`
> so it should not be removed.
Hi Dafna,
Thanks very much for pointing out. Apparently I didn't enable this to
build. Sorry for this.
I will fix it in next version.
>
> Thanks,
> Dafna
>
> >
> > if (comp_id < 0 || comp_id >= DDP_COMPONENT_ID_MAX)
> > return -EINVAL;
> > @@ -495,16 +470,6 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
> > }
> > comp->dev = &comp_pdev->dev;
> >
> > - /* Only DMA capable components need the LARB property */
> > - if (type == MTK_DISP_OVL ||
> > - type == MTK_DISP_OVL_2L ||
> > - type == MTK_DISP_RDMA ||
> > - type == MTK_DISP_WDMA) {
> > - ret = mtk_ddp_get_larb_dev(node, comp, comp->dev);
> > - if (ret)
> > - return ret;
> > - }
> > -
> > if (type == MTK_DISP_BLS ||
> > type == MTK_DISP_CCORR ||
> > type == MTK_DISP_COLOR ||
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> > index bb914d976cf5..1b582262b682 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> > @@ -70,7 +70,6 @@ struct mtk_ddp_comp_funcs {
> > struct mtk_ddp_comp {
> > struct device *dev;
> > int irq;
> > - struct device *larb_dev;
> > enum mtk_ddp_comp_id id;
> > const struct mtk_ddp_comp_funcs *funcs;
> > };
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > index b013d56d2777..622de47239eb 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > @@ -576,11 +576,8 @@ static int mtk_drm_probe(struct platform_device *pdev)
> > pm_runtime_disable(dev);
> > err_node:
> > of_node_put(private->mutex_node);
> > - for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) {
> > + for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
> > of_node_put(private->comp_node[i]);
> > - if (private->ddp_comp[i].larb_dev)
> > - put_device(private->ddp_comp[i].larb_dev);
> > - }
> > return ret;
> > }
> >
> >
Powered by blists - more mailing lists