From patchwork Thu Jun 4 09:05:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209619 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, 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 C6EE9C433E1 for ; Thu, 4 Jun 2020 09:08:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0C9B2075B for ; Thu, 4 Jun 2020 09:08:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="JR1U77e7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728500AbgFDJIR (ORCPT ); Thu, 4 Jun 2020 05:08:17 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:6741 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728231AbgFDJIQ (ORCPT ); Thu, 4 Jun 2020 05:08:16 -0400 X-UUID: fa45243a44f24b0297a11d29e8a5bb97-20200604 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=ZTXG1swxMq+6u0sp84wMTHDYveVRdbBvoRAsf7UsS68=; b=JR1U77e7/lQeLd5dX2tkjqYduKi+E8JlPn05KOQIY3zGeXCjwBO6vVLdML3S6Qs3HIH6Maxa0vxydx7+u9EKqNZVNkODaY+a/s33hi7/q0cc4KPyn4qdSZQyb32LWCGuEJpxBWzN1VcoJp1gIgRfbB8RvXw2Zvoga5MpoE8+d+o=; X-UUID: fa45243a44f24b0297a11d29e8a5bb97-20200604 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 658534586; Thu, 04 Jun 2020 17:08:11 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 17:08:09 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 4 Jun 2020 17:08:07 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Rick Chang CC: , , , , , Marek Szyprowski , Tomasz Figa , , , , , , , Xia Jiang Subject: [PATCH RESEND v9 07/18] media: platform: Improve the implementation of the system PM ops Date: Thu, 4 Jun 2020 17:05:42 +0800 Message-ID: <20200604090553.10861-9-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604090553.10861-1-xia.jiang@mediatek.com> References: <20200604090553.10861-1-xia.jiang@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add v4l2_m2m_suspend() function call in mtk_jpeg_suspend() to make sure that the current frame is processed completely before suspend. Add v4l2_m2m_resume() function call in mtk_jpeg_resume() to unblock the driver from scheduling next frame. Signed-off-by: Xia Jiang --- v9: use v4l2_m2m_suspend() and v4l2_m2m_resume() to improve the implemention of the system PM ops --- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.18.0 diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 7f74597262fc..49bdbf1c435f 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -1208,10 +1208,13 @@ static __maybe_unused int mtk_jpeg_pm_resume(struct device *dev) static __maybe_unused int mtk_jpeg_suspend(struct device *dev) { int ret; + struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev); if (pm_runtime_suspended(dev)) return 0; + v4l2_m2m_suspend(jpeg->m2m_dev); + ret = mtk_jpeg_pm_suspend(dev); return ret; } @@ -1219,12 +1222,15 @@ static __maybe_unused int mtk_jpeg_suspend(struct device *dev) static __maybe_unused int mtk_jpeg_resume(struct device *dev) { int ret; + struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev); if (pm_runtime_suspended(dev)) return 0; ret = mtk_jpeg_pm_resume(dev); + v4l2_m2m_resume(jpeg->m2m_dev); + return ret; }