From patchwork Wed Apr 6 09:47:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12803048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9DE34C433F5 for ; Wed, 6 Apr 2022 09:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=g/sZbWaVzsoTRMjp2t4P6EegkpakMzN+B9Rg+Hju6Uw=; b=oI2kDDLckKcaG3 bdQ30c5sw/d/tOIoDaTH8pexlDW7UY9HhSSVXSXUPtMQSV4vQSgWbrNJZ1iwCOSgmrNXK/UsOv0wh m8OpUve/cd+KOjGwUVxUCBVRTHTyKsQ36BuQaJHvhhy7U2gJLndeKNbyiIwG3JPoOUWhXZU746RHn w7KlA6mZgzIQ4/kquWnJ237lhu/nG4GuClYa41AoYwf2wibxBOy3geu07Dw0P4DhIXQ86tbbTM8IS 7RcenNdJB+fiCDfYYfR1Xmh91KEdEConEKliGn+ukI+7JOTAk590JiDeD5hdaXb+zJVL0YlxOPfoU tubZzAvBF5hBd27dfoPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nc2Le-00594I-MK; Wed, 06 Apr 2022 09:53:12 +0000 Received: from mail-am6eur05on2060e.outbound.protection.outlook.com ([2a01:111:f400:7e1b::60e] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nc2G6-0056Oi-Uk for linux-arm-kernel@lists.infradead.org; Wed, 06 Apr 2022 09:47:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dN28yrhfYmxPO8ceskRwUbBATUzxTq+y8FgwPaaHACWSK/Tvz7tNBg/a1KTtcMJUtnwjwvOFhVL1HiAMl2GnkiV/br5c2I+HaZq9ykW8AxLOJcjD5m2VmOFBM88djBNm2uFTljyZP0HNMO6SghKwnzuUsqvGbASrGo2ccIuBAcDNfX4KYGiUnpGDmOdNX0mvoYtkzvdP/sGAmD4rmGslwMUnylbPABOF02dhclxck42UmvMcUDQIJihy2X0LTfQCXMNLAjYj9e76vytRnRT0C4h4g1caKp64fay9WvFjCSbECvlqz8zI1+Dkbh/hfeBQLtlVht+QhCzPGt+h8GuE3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kwHaDwvxASzJBr290ZaXFVJ0bE0g4TjzIARAOn7abk8=; b=RrOCRm5FXnokP4EMyJJEOBRhr5RIApSI1T/zAa22pmay4nHvb6BIneTYtTvRsFCwPltGvTveoaZzh7COHFtAn9l4CSzvtRswAcvwkR8eszaONh+gt4K/bV+nvw4JpBTCWH/A1I49v/cYjLtM/61WMzg2eCV8A3J9/diAJfUJeuembcnCTYj7E2Kt/xEV2HOlF82XX7T24zZdK2azYuNQB3kpVYr+rkKQRg3y599nqsO2eIEE81izpfiTq+A3zLEI8wTFSos680jZ4g6IjeFx5XtZ7GJhZGrDDXWu7l3gNxUMuD5KdE+GNaLQL7MLAWr+I/LwckGDdr65G5go3x4d4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kwHaDwvxASzJBr290ZaXFVJ0bE0g4TjzIARAOn7abk8=; b=IvIx0ySO5oE8pV17Gn1DQNpSx41O2F7hAy3RXdYfhEcbpsBoAOhKhe2m9xDFjvB+ZuQPQ1h1qNGw73PMr/v4S2AvkTlQWduGQEtbp+x1TSilTWNE6kQ77nj+zuwRSGsH8GOmz+/ROuaXZef+KpIKBAwz3gR6EXsg5jLLScspTC4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by DU0PR04MB9443.eurprd04.prod.outlook.com (2603:10a6:10:35b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Wed, 6 Apr 2022 09:47:23 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::6881:df46:ac23:1bc3]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::6881:df46:ac23:1bc3%7]) with mapi id 15.20.5123.031; Wed, 6 Apr 2022 09:47:22 +0000 From: Ming Qian To: mchehab@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, mirela.rabulea@oss.nxp.com Cc: hverkuil-cisco@xs4all.nl, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] media: imx-jpeg: Add pm-sleep support for imx-jpeg Date: Wed, 6 Apr 2022 17:47:03 +0800 Message-Id: <20220406094703.8229-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.33.0 X-ClientProxiedBy: SG3P274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::29) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 06296e3d-92a3-4974-de65-08da17b272ed X-MS-TrafficTypeDiagnostic: DU0PR04MB9443:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3940ob3mLrPxN/48Fkbbx+Egct9DlTUXCXxXxOEuIhaPD3RYkcrQl1R7bdcat0QySBuRDXNNjVUu2XgHP06sztWCtwBe5mSSU1+Zu1QqW5uvbycIK+YobhqfC689CPfG9frAdj7lUYIGt6d0k326VxYAYT+u9qSkrq5c9MQE/cQqMfHUDXDPphtvhMahjYSSlC0p3Yh2KHm8850GY1H948IaT/WWqHfbgxTdxCnkrkO1oislQE0Z5S6oktHDpWyDYrZQheuzecv9OAaxcAPgZvjkSwSZQIHDL8QLUB3ImEE9qlyuL5aoaHT8zDZweCpF3XsmufMdDbamctQOAiqmCN9a9ewpwMW6+4yWGbapMCLADZYEiX0m2ggfryizTQdFmbEPr5eCZyRvZqvrOTsCHSJ8KLfU1yAIWcpj0jnPE/g2SHeW89pcpI9I52WhofAlTYRN+7SYg7r4LtbDquKKMA8LIOOqeTkDYEHqxGag+WjYYcgxqAi+OPrRyof92a9xqf4v+JROaSzSkJP/Bq2AKf197gps/26Ilhbp1GvZqtIMl8fAEbncTtzm7Zqq5O4L7kV6crpw/9Hzi0GQdq84MsNaxkyUUS9y7hbuNkBzpii5SKX10yU8hvobeDms0AE3w+E3OhVUk3sszN7VJqKlwNlC2YzXFOPpY3ErwF+Cwvx4gny4+dYRFqBgDLfGRgZSh3jSU/TGoeC0GnnwsIaVrw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB6341.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(66476007)(8676002)(6486002)(6512007)(52116002)(316002)(6666004)(4326008)(6506007)(508600001)(5660300002)(186003)(83380400001)(26005)(66556008)(1076003)(36756003)(66946007)(44832011)(38100700002)(2616005)(38350700002)(86362001)(2906002)(8936002)(7416002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W8Qo9gHea7JOG2v3lPYyljEX7cOo+lXaqrb+hjjn3+RK/6IZAozzYyDBiz2K4U7Q0HN+FjIPTCxfnuG+YDrhM80Cy73atRkhVAPHU9Y5QOWufjbPnaYREL2lvkWso55K9gj8gm/v1KlSO3nFKdQZHe0eGwD6qqt99lPaWkDCrmaBMbapDye7D3HFeuer2wY4iXnYJTx91TsiPTSAkYSwJRKc1gK7lDHyL+YNpYdTx31h+H8LSFiDz3i0Q2ovp9E2GFaYcI70udLLuYXaODQdKmhoAzUO/fO+mQiE5KV85sYueO+s3t/PDEqnVK04hx8zTG8J5fBZmsu1lSFqEUfz/sv8T+3+E5/uBxH2CwP0ixNq9V6o2RPsP40t5tNPWPqO9lZ29XW0hK84CA6UdvQGzl71sVytaUEntCHPHACl4GaQXKkArVq5UetbvT3X6HNfC7OcI1KYg/uRAPXVOp/UAYssxlOT3pETz/Ru3Q7seDZjVXD3UwS1l9OCsVdYCICoOph3KBUyNHsiyBIDYtPzOGmnI0qwWJ6gvkXFIIw5UUkcTbN9pWpoN4GJBxIn9BUCZfpmNXEcvO/e3NgNYeBnULd0qF0DPL/fkPEH4MrFzpzb6KRZsJdRh8SBoU6OCddzodx3XKm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DizA50vsyC51org== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06296e3d-92a3-4974-de65-08da17b272ed X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2022 09:47:22.8811 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9JgrrJbAodady0r5QzYlK7iin7dR3bWQtWzbCQTnGMXEirLxcU/n9XJHfGBNyiqxgx1bdGdyWkOeGzMcXQg6Jw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220406_024727_065718_658E62F7 X-CRM114-Status: GOOD ( 10.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Wait finishing jpeg job before system sleep, otherwise the encoding/decoding can't be resumed after suspend. Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea --- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index ccc26372e178..3df51d866011 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -2356,9 +2356,33 @@ static int mxc_jpeg_runtime_suspend(struct device *dev) } #endif +#ifdef CONFIG_PM_SLEEP +static int mxc_jpeg_suspend(struct device *dev) +{ + struct mxc_jpeg_dev *jpeg = dev_get_drvdata(dev); + + v4l2_m2m_suspend(jpeg->m2m_dev); + return pm_runtime_force_suspend(dev); +} + +static int mxc_jpeg_resume(struct device *dev) +{ + struct mxc_jpeg_dev *jpeg = dev_get_drvdata(dev); + int ret; + + ret = pm_runtime_force_resume(dev); + if (ret < 0) + return ret; + + v4l2_m2m_resume(jpeg->m2m_dev); + return ret; +} +#endif + static const struct dev_pm_ops mxc_jpeg_pm_ops = { SET_RUNTIME_PM_OPS(mxc_jpeg_runtime_suspend, mxc_jpeg_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(mxc_jpeg_suspend, mxc_jpeg_resume) }; static int mxc_jpeg_remove(struct platform_device *pdev)