Re: [PATCH v8 09/12] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

From: Yong Wu
Date: Wed Oct 06 2021 - 22:57:15 EST


On Thu, 2021-09-30 at 12:57 +0200, Dafna Hirschfeld wrote:
>
> On 30.09.21 05:28, Yong Wu wrote:
> > Hi Dafna,
> >
> > Thanks very much for the review.
> >
> > On Wed, 2021-09-29 at 14:13 +0200, Dafna Hirschfeld wrote:
> > >
> > > On 29.09.21 03:37, Yong Wu wrote:
> > > > MediaTek IOMMU has already added the device_link between the
> > > > consumer
> > > > and smi-larb device. If the vcodec device call the
> > > > pm_runtime_get_sync,
> > > > the smi-larb's pm_runtime_get_sync also be called
> > > > automatically.
> > > >
> > > > CC: Tiffany Lin <tiffany.lin@xxxxxxxxxxxx>
> > > > CC: Irui Wang <irui.wang@xxxxxxxxxxxx>
> > > > Signed-off-by: Yong Wu <yong.wu@xxxxxxxxxxxx>
> > > > Reviewed-by: Evan Green <evgreen@xxxxxxxxxxxx>
> > > > Acked-by: Tiffany Lin <tiffany.lin@xxxxxxxxxxxx>
> > > > Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@xxxxxxxxxxxxx>
> > > > ---
> > > > .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 37 +++----
> > > > -------
> > > > --
> > > > .../platform/mtk-vcodec/mtk_vcodec_drv.h | 3 --
> > > > .../platform/mtk-vcodec/mtk_vcodec_enc.c | 1 -
> > > > .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 44 +++----
> > > > -------

[snip]

> > > > void mtk_vcodec_release_dec_pm(struct mtk_vcodec_dev *dev)
> > > > {
> > > > pm_runtime_disable(dev->pm.dev);
> > > > - put_device(dev->pm.larbvdec);
> > > > }
> > >
> > > Now that functions only do 'pm_runtime_disable(dev->pm.dev);' so
> > > it
> > > will be more
> > > readable to remove the function mtk_vcodec_release_dec_pm
> > > and replace with pm_runtime_disable(dev->pm.dev);
> > > Same for the 'enc' equivalent.
> >
> > Make sense. But It may be not proper if using pm_runtime_disable
> > as the symmetry with mtk_vcodec_init_dec_pm in the
> > mtk_vcodec_probe.
> >
> > Maybe we should move pm_runtime_enable out from
> > mtk_vcodec_init_dec_pm
> > into mtk_vcodec_probe. I could do a new patch for this. Is this ok
> > for
> > you?
>
> yes, there is also asymettry when calling pm_runtime* in general,
> I see in the decoder it is called from mtk_vcodec_dec_pm.c
> but in the encoder it is called from mtk_vcodec_enc.c,
>
> I think all calls to pm_runtime* should be out of the *_pm.c files

OK. I will try this.

> since for example 'mtk_vcodec_dec_pw_on' also do just one call to
> pm_runtime_resume_and_get so this function can also be removed.

I guess this one should be reserved to vcodec guys. I see this function
is changed at [1]. Let's keep this patchset clean.

[1]
https://patchwork.kernel.org/project/linux-mediatek/patch/20210901083215.25984-10-yunfei.dong@xxxxxxxxxxxx/

>
> thanks,
> Dafna
>
> >
> > >
> > > Thanks,
> > > Dafna
> >
> > [snip]
> > _______________________________________________
> > Linux-mediatek mailing list
> > Linux-mediatek@xxxxxxxxxxxxxxxxxxx
> > http://lists.infradead.org/mailman/listinfo/linux-mediatek
> >