Re: [PATCH v4 06/17] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
From: Rick Chang
Date: Thu Jun 18 2020 - 13:28:23 EST
Hi Yong,
On Thu, 2020-06-18 at 17:32 +0800, Yong Wu wrote:
> + Rick
>
> On Sat, 2020-05-30 at 16:10 +0800, Yong Wu wrote:
> >
> > MediaTek IOMMU has already added device_link between the consumer
> > and smi-larb device. If the jpg device call the
> > pm_runtime_get_sync,
> > the smi-larb's pm_runtime_get_sync also be called automatically.
> >
Acked-by: Rick Chang <rick.chang@xxxxxxxxxxxx>
> > CC: Rick Chang <rick.chang@xxxxxxxxxxxx>
> > Signed-off-by: Yong Wu <yong.wu@xxxxxxxxxxxx>
> > Reviewed-by: Evan Green <evgreen@xxxxxxxxxxxx>
> > ---
> > Âdrivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 22 -----------
> > -----------
> > Âdrivers/media/platform/mtk-jpeg/mtk_jpeg_core.h |ÂÂ2 --
> > Â2 files changed, 24 deletions(-)
> >
> > diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> > b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> > index f82a81a..21fba6f 100644
> > --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> > +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> > @@ -21,7 +21,6 @@
> > Â#include <media/v4l2-ioctl.h>
> > Â#include <media/videobuf2-core.h>
> > Â#include <media/videobuf2-dma-contig.h>
> > -#include <soc/mediatek/smi.h>
> > Â
> > Â#include "mtk_jpeg_hw.h"
> > Â#include "mtk_jpeg_core.h"
> > @@ -893,11 +892,6 @@ static int mtk_jpeg_queue_init(void *priv,
> > struct vb2_queue *src_vq,
> > Â
> > Âstatic void mtk_jpeg_clk_on(struct mtk_jpeg_dev *jpeg)
> > Â{
> > - int ret;
> > -
> > - ret = mtk_smi_larb_get(jpeg->larb);
> > - if (ret)
> > - dev_err(jpeg->dev, "mtk_smi_larb_get larbvdec fail
> > %d\n", ret);
> > Â clk_prepare_enable(jpeg->clk_jdec_smi);
> > Â clk_prepare_enable(jpeg->clk_jdec);
> > Â}
> > @@ -906,7 +900,6 @@ static void mtk_jpeg_clk_off(struct
> > mtk_jpeg_dev *jpeg)
> > Â{
> > Â clk_disable_unprepare(jpeg->clk_jdec);
> > Â clk_disable_unprepare(jpeg->clk_jdec_smi);
> > - mtk_smi_larb_put(jpeg->larb);
> > Â}
> > Â
> > Âstatic irqreturn_t mtk_jpeg_dec_irq(int irq, void *priv)
> > @@ -1051,21 +1044,6 @@ static int mtk_jpeg_release(struct file
> > *file)
> > Â
> > Âstatic int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg)
> > Â{
> > - struct device_node *node;
> > - struct platform_device *pdev;
> > -
> > - node = of_parse_phandle(jpeg->dev->of_node,
> > "mediatek,larb", 0);
> > - if (!node)
> > - return -EINVAL;
> > - pdev = of_find_device_by_node(node);
> > - if (WARN_ON(!pdev)) {
> > - of_node_put(node);
> > - return -EINVAL;
> > - }
> > - of_node_put(node);
> > -
> > - jpeg->larb = &pdev->dev;
> > -
> > Â jpeg->clk_jdec = devm_clk_get(jpeg->dev, "jpgdec");
> > Â if (IS_ERR(jpeg->clk_jdec))
> > Â return PTR_ERR(jpeg->clk_jdec);
> > diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
> > b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
> > index 999bd14..8579494 100644
> > --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
> > +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
> > @@ -47,7 +47,6 @@ enum mtk_jpeg_ctx_state {
> > Â * @dec_reg_base: JPEG registers mapping
> > Â * @clk_jdec: JPEG hw working clock
> > Â * @clk_jdec_smi: JPEG SMI bus clock
> > - * @larb: SMI device
> > Â */
> > Âstruct mtk_jpeg_dev {
> > Â struct mutex lock;
> > @@ -61,7 +60,6 @@ struct mtk_jpeg_dev {
> > Â void __iomem *dec_reg_base;
> > Â struct clk *clk_jdec;
> > Â struct clk *clk_jdec_smi;
> > - struct device *larb;
> > Â};
> > Â
> > Â/**
>