Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp189487pxv; Wed, 14 Jul 2021 01:29:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwRnYUZYsHbXCgHBcCjMIP2+NGsOi3AnkL2ZjhurdjIMAcCKW2q59dkCd0NZTuwoI8vops X-Received: by 2002:a92:cf05:: with SMTP id c5mr5644182ilo.196.1626251399834; Wed, 14 Jul 2021 01:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626251399; cv=none; d=google.com; s=arc-20160816; b=CFOtqfObdbDMCuOCwutFSd2dPzj7WkrP1AFW+iApV/tID2N2pvLrLLhJiYpeoBHlk1 /0wv7n/bPNdf9g/P5MyWyw/Om3gR5tDByKxQL4B/8Qvyxy0JMkJgMkq18C0/dL3sIUSH FsIMaA6WW8/oBfBnIs8UNLYSe4L4UymVwUu55doidXBhsfRJBzE6ja6P4a8vJpYjJIdS 97OdtU+p7kspWC9N7Tgn8hDCSk5X/ODhRpoE858DG7Zf4giznyIZqqpTHT06p1iEpwgz KLNZD5oZC8JqVZv2A6lytaA0aU7uYPTOe4YuV/X96MgV4lQtzbbhpXO8CpFYNlXFUnC5 sXFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=YqIHlNoHyQ+ugeEa2loYAR3HtyMHzHzxKpcagUgSUDs=; b=OZYV45IQYUiD2Rp7SdcB60QtTcKu7lZpxE2QASMdkI73//ugzZ8GBI4as5VPaogzlM OakNCtpVvLPjKDzd6c7YVWnyKTXwAqWxohaHBmeW1Qpov9T2y2Z3zf9esbgXbX91GkQ/ ucExga5LNGZAl0tijwjJdvvO6dIanD4TXeuov1c74eatcCHQBWsmD74oyXGQF1IUz+XW EtDwcqPeOZbLYZkoBYKDKG6rNx5BBewOxsj0CfXK3scLSr3pHSipQytk3DFyLM3FDK79 7tGbQXRN0sqxjZLxTNBoKOJAKq7HnSuaCKPZ2k+4cD/OZsw39I8c85qVSzwdOFAogwZ4 Z6HQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si1770900ioh.29.2021.07.14.01.29.47; Wed, 14 Jul 2021 01:29:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238516AbhGNIbo (ORCPT + 99 others); Wed, 14 Jul 2021 04:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbhGNIbo (ORCPT ); Wed, 14 Jul 2021 04:31:44 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAD3FC06175F; Wed, 14 Jul 2021 01:28:52 -0700 (PDT) Received: from [IPv6:2a02:810a:880:f54:e49e:3ed0:1a77:5623] (unknown [IPv6:2a02:810a:880:f54:e49e:3ed0:1a77:5623]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dafna) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id C8B601F42822; Wed, 14 Jul 2021 09:28:48 +0100 (BST) Subject: Re: [PATCH v6 04/11] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put To: Yong Wu , Matthias Brugger , Joerg Roedel , Rob Herring , Krzysztof Kozlowski , David Airlie , Mauro Carvalho Chehab Cc: Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, Nicolas Boichat , Matthias Kaehlcke , anan.sun@mediatek.com, ming-fan.chen@mediatek.com, yi.kuo@mediatek.com, acourbot@chromium.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, Daniel Vetter , Chun-Kuang Hu , Philipp Zabel , Xia Jiang , Tiffany Lin , Hsin-Yi Wang , Eizan Miyamoto , anthony.huang@mediatek.com, Rick Chang References: <20210714025626.5528-1-yong.wu@mediatek.com> <20210714025626.5528-5-yong.wu@mediatek.com> From: Dafna Hirschfeld Message-ID: <2753c4b1-76e7-9acd-ca1c-62e6017ed971@collabora.com> Date: Wed, 14 Jul 2021 10:28:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210714025626.5528-5-yong.wu@mediatek.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14.07.21 04:56, 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. > > After removing the larb_get operations, then mtk_jpeg_clk_init is > also unnecessary. Remove it too. > > CC: Rick Chang > CC: Xia Jiang > Signed-off-by: Yong Wu > Reviewed-by: Evan Green > Acked-by: Rick Chang Reviewed-by: Dafna Hirschfeld > --- > .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 45 +------------------ > .../media/platform/mtk-jpeg/mtk_jpeg_core.h | 2 - > 2 files changed, 2 insertions(+), 45 deletions(-) > > diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c > index a89c7b206eef..4fea2c512434 100644 > --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c > +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c > @@ -22,7 +22,6 @@ > #include > #include > #include > -#include > > #include "mtk_jpeg_enc_hw.h" > #include "mtk_jpeg_dec_hw.h" > @@ -1055,10 +1054,6 @@ 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); > - > ret = clk_bulk_prepare_enable(jpeg->variant->num_clks, > jpeg->variant->clks); > if (ret) > @@ -1069,7 +1064,6 @@ static void mtk_jpeg_clk_off(struct mtk_jpeg_dev *jpeg) > { > clk_bulk_disable_unprepare(jpeg->variant->num_clks, > jpeg->variant->clks); > - mtk_smi_larb_put(jpeg->larb); > } > > static irqreturn_t mtk_jpeg_enc_done(struct mtk_jpeg_dev *jpeg) > @@ -1284,35 +1278,6 @@ static struct clk_bulk_data mtk_jpeg_clocks[] = { > { .id = "jpgenc" }, > }; > > -static int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg) > -{ > - struct device_node *node; > - struct platform_device *pdev; > - int ret; > - > - 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; > - > - ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks, > - jpeg->variant->clks); > - if (ret) { > - dev_err(&pdev->dev, "failed to get jpeg clock:%d\n", ret); > - put_device(&pdev->dev); > - return ret; > - } > - > - return 0; > -} > - > static void mtk_jpeg_job_timeout_work(struct work_struct *work) > { > struct mtk_jpeg_dev *jpeg = container_of(work, struct mtk_jpeg_dev, > @@ -1333,11 +1298,6 @@ static void mtk_jpeg_job_timeout_work(struct work_struct *work) > v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx); > } > > -static inline void mtk_jpeg_clk_release(struct mtk_jpeg_dev *jpeg) > -{ > - put_device(jpeg->larb); > -} > - > static int mtk_jpeg_probe(struct platform_device *pdev) > { > struct mtk_jpeg_dev *jpeg; > @@ -1376,7 +1336,8 @@ static int mtk_jpeg_probe(struct platform_device *pdev) > goto err_req_irq; > } > > - ret = mtk_jpeg_clk_init(jpeg); > + ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks, > + jpeg->variant->clks); > if (ret) { > dev_err(&pdev->dev, "Failed to init clk, err %d\n", ret); > goto err_clk_init; > @@ -1442,7 +1403,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev) > v4l2_device_unregister(&jpeg->v4l2_dev); > > err_dev_register: > - mtk_jpeg_clk_release(jpeg); > > err_clk_init: > > @@ -1460,7 +1420,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev) > video_device_release(jpeg->vdev); > v4l2_m2m_release(jpeg->m2m_dev); > v4l2_device_unregister(&jpeg->v4l2_dev); > - mtk_jpeg_clk_release(jpeg); > > return 0; > } > diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h > index 595f7f10c9fd..3e4811a41ba2 100644 > --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h > +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h > @@ -85,7 +85,6 @@ struct mtk_jpeg_variant { > * @alloc_ctx: videobuf2 memory allocator's context > * @vdev: video device node for jpeg mem2mem mode > * @reg_base: JPEG registers mapping > - * @larb: SMI device > * @job_timeout_work: IRQ timeout structure > * @variant: driver variant to be used > */ > @@ -99,7 +98,6 @@ struct mtk_jpeg_dev { > void *alloc_ctx; > struct video_device *vdev; > void __iomem *reg_base; > - struct device *larb; > struct delayed_work job_timeout_work; > const struct mtk_jpeg_variant *variant; > }; >