From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E46D9C433DF for ; Tue, 4 Aug 2020 03:52:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DBD4B206F6 for ; Tue, 4 Aug 2020 03:52:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NQCNQTie"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="Q933cNeu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBD4B206F6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IGAH0GN2PVSCU0vVYU5MccM033aSblQzm4lqZila0ZM=; b=NQCNQTieaPEstRfXRs/5rHffC NNLlf0SFRYbvT9rxSPFM2xmz0rQbBlrE1SgETKFfrp1KFbrg1bE9VeRSXQmPOzw0L2jShfZmgUf7z qDb3bwb6Djy++AOFRilzDngR6fIVTJCA0xHK8vqC13bkKuHijU+WtmixzmIa2fec4W22hZur6BRH5 0qLU0R87Ra3P+cjs0ZuXRN5bmYgaO6HlX5Ec5dFQYWxuMIQAZk7r26WDlZQ49cxeDJmqUiAZGtHTR p+++3+iNMoR7YdzkIg3dLPg1XyyTBND4aHT/ZUhz2st8Hy8U388OCnEYdAOmUZ1xRukRaqUSxev7h iEXokXSiw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2nzz-0001Ud-DD; Tue, 04 Aug 2020 03:52:23 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2nzT-0001BY-Qz; Tue, 04 Aug 2020 03:51:53 +0000 X-UUID: 4371af16acc2414c898fd3bef7a1eb47-20200803 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=FvnUhVoQnV0IbQaemgJJAeh6dN4P1LSonhmooTtqy4E=; b=Q933cNeu+hxu8mZ1Oi5ym3vMtw39O7B5LRX7wEeeJq/1aCh2NbcqifsuPykGSLwdcu8bxFhsaLLO4bICw0nexdwcaKQZAWEbuGRPNNgyrdEVhTiWWEsohoYwsyOtKnsF5KNPq+YDgZ5a2e1OzsDWFIjeSm76kOZzSBA/jj9Ec/0=; X-UUID: 4371af16acc2414c898fd3bef7a1eb47-20200803 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 78594055; Mon, 03 Aug 2020 19:51:46 -0800 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 3 Aug 2020 20:41:49 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 4 Aug 2020 11:41:47 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 4 Aug 2020 11:41:46 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , "Matthias Brugger" , Rick Chang Subject: [PATCH v11 05/28] media: platform: Improve power on and power off flow Date: Tue, 4 Aug 2020 11:40:39 +0800 Message-ID: <20200804034102.22983-6-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200804034102.22983-1-xia.jiang@mediatek.com> References: <20200804034102.22983-1-xia.jiang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200803_235152_024789_E0A4E14F X-CRM114-Status: GOOD ( 16.23 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maoguang.meng@mediatek.com, devicetree@vger.kernel.org, mojahsu@chromium.org, srv_heupstream@mediatek.com, linux-kernel@vger.kernel.org, Tomasz Figa , senozhatsky@chromium.org, drinkcat@chromium.org, linux-mediatek@lists.infradead.org, Xia Jiang , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marek Szyprowski Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Call pm_runtime_get_sync() before starting a frame and then pm_runtime_put() after completing it. This can save power for the time between processing two frames. Reviewed-by: Tomasz Figa Signed-off-by: Xia Jiang --- v11: no changes --- .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 12609ca46fd9..fb624385969e 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -710,23 +710,6 @@ static struct vb2_v4l2_buffer *mtk_jpeg_buf_remove(struct mtk_jpeg_ctx *ctx, return v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); } -static int mtk_jpeg_start_streaming(struct vb2_queue *q, unsigned int count) -{ - struct mtk_jpeg_ctx *ctx = vb2_get_drv_priv(q); - struct vb2_v4l2_buffer *vb; - int ret = 0; - - ret = pm_runtime_get_sync(ctx->jpeg->dev); - if (ret < 0) - goto err; - - return 0; -err: - while ((vb = mtk_jpeg_buf_remove(ctx, q->type))) - v4l2_m2m_buf_done(vb, VB2_BUF_STATE_QUEUED); - return ret; -} - static void mtk_jpeg_stop_streaming(struct vb2_queue *q) { struct mtk_jpeg_ctx *ctx = vb2_get_drv_priv(q); @@ -751,8 +734,6 @@ static void mtk_jpeg_stop_streaming(struct vb2_queue *q) while ((vb = mtk_jpeg_buf_remove(ctx, q->type))) v4l2_m2m_buf_done(vb, VB2_BUF_STATE_ERROR); - - pm_runtime_put_sync(ctx->jpeg->dev); } static const struct vb2_ops mtk_jpeg_qops = { @@ -761,7 +742,6 @@ static const struct vb2_ops mtk_jpeg_qops = { .buf_queue = mtk_jpeg_buf_queue, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, - .start_streaming = mtk_jpeg_start_streaming, .stop_streaming = mtk_jpeg_stop_streaming, }; @@ -812,7 +792,7 @@ static void mtk_jpeg_device_run(void *priv) struct mtk_jpeg_src_buf *jpeg_src_buf; struct mtk_jpeg_bs bs; struct mtk_jpeg_fb fb; - int i; + int i, ret; src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); @@ -832,6 +812,10 @@ static void mtk_jpeg_device_run(void *priv) return; } + ret = pm_runtime_get_sync(jpeg->dev); + if (ret < 0) + goto dec_end; + mtk_jpeg_set_dec_src(ctx, &src_buf->vb2_buf, &bs); if (mtk_jpeg_set_dec_dst(ctx, &jpeg_src_buf->dec_param, &dst_buf->vb2_buf, &fb)) goto dec_end; @@ -957,6 +941,7 @@ static irqreturn_t mtk_jpeg_dec_irq(int irq, void *priv) v4l2_m2m_buf_done(src_buf, buf_state); v4l2_m2m_buf_done(dst_buf, buf_state); v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx); + pm_runtime_put(ctx->jpeg->dev); return IRQ_HANDLED; } -- 2.18.0 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek