From patchwork Tue May 17 08:01:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 574085 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 365FAC433EF for ; Tue, 17 May 2022 08:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241906AbiEQIBo (ORCPT ); Tue, 17 May 2022 04:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242616AbiEQIBg (ORCPT ); Tue, 17 May 2022 04:01:36 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80040.outbound.protection.outlook.com [40.107.8.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59C583615A; Tue, 17 May 2022 01:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UiWayjE1cJHmbgY/Tbb01/ysGdYGSrOT3MY/JsMkLygu5V/cjlykKPvVltXS67KZaPhnqDsM+O+0JshBC6dqB/wyU9wuWtNSmm0OBGPPLiFPTlh4unrmnXcAx8a1ZVPWkEDhveOwtzvq0Ht3GzzcSgouanp2l3NOtCgsTKtU6qZguby4Q+99Hn56Gw/sSeVuhrsPcyImRC8zduWsMp0kmqhynPCbcPHTBfXxq3RNq9r8lmNZHxfAwTcEsukm95AymQxxZghD38KKiroIRk1YGcbfsRCZLQp2Jr5SnDBaJbP5D6Z9Z6NteMAE+YmADR237QG7Z/njIHjFJLN9jxOK2A== 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=7cO5pQ+IU70ujZNtLnHCk+xOHdhbIIMynapQyg6Vnkw=; b=WUiOXOMuNOTFkEhn+T57r4r8OccnrbwZCqGLo3+SA6jx6cgLZe8DLjhIscKd21/MtzJnPU9YebyoRj8VaF25qkc7txaUHGjcq5675OD02Ijgs+8BhxqgYhQlwdiX0masmCXFYtkO1P8S55k/IjgkQWNKYzzFsJ38pQMjuk7znHlEVupBA/p7BBQne428GaMGo9LXCHk6kMLU6q2aTJqsGVT+lHVFTK9M/Ogpq4lXlqaH36+i3iZ2oKT7iFrVHGY2DgScFkLZUCj+f8iJPFKezLUtGOiTfXTM32ukKXfuFaMfBcpopLGqUp71VtabbSP6YBdfbpbCNk7kyDw3gro+cQ== 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=7cO5pQ+IU70ujZNtLnHCk+xOHdhbIIMynapQyg6Vnkw=; b=ece+lKfNe2SBWY3CM0SGWSEKNNw/uhXjQLO0IOllkvsmmj1tgmXIo16UjVRhlrxyyLGtAqOyVQgD81IxiRH5jix1zi8x+2I0OuaJ3cQ0a1nVSgb1lhkTwY/8PdqXXROeSN7vQ5T0p5EdeePBlbNfoFRxwDKsK7bm+Q323KodQxU= 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 AM0PR04MB5924.eurprd04.prod.outlook.com (2603:10a6:208:124::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Tue, 17 May 2022 08:01:31 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::bc48:7565:c619:62c3]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::bc48:7565:c619:62c3%7]) with mapi id 15.20.5250.018; Tue, 17 May 2022 08:01:31 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] media: amphion: support for reloading module Date: Tue, 17 May 2022 16:01:16 +0800 Message-Id: <20220517080116.24502-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.36.1 X-ClientProxiedBy: HK2PR02CA0168.apcprd02.prod.outlook.com (2603:1096:201:1f::28) 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: dd57076e-5a4f-44d0-cf56-08da37db742f X-MS-TrafficTypeDiagnostic: AM0PR04MB5924: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: 9P9HrzKSxBneltSZQCCN+0USAoGyQyrqQ28rJwCf0bb/zbfjrZU8Kcyj13qWcD/QUYWvCfb56TcSACLDf3wSkoka18EGvIcsgJ+y/fy6NNNnkBbOoD0JBvVo2TrUCfvrD++kKM/ZR5O+Anizgb2of2U34JKlQgNByG4m4aoVJZbI4aaW8d6Udzc76S8v8X9uN27XvftNcumh4ker1CtAiK18GwEip4BnhE3+EoJLOTbnfc63YoBFibxrdWsi1Mc8f7HIvpQV/Yl3ueUggf+5IOdgQQfk8g4IWXlrtwmwbGz1R3CcDU77pI2l82LqNDTUweD+VwaO8i4n+I50VRLw4XNxn/2NFZVCCPq31VMTo2j7fkEtYsd6PrKz2anUB/TbIpJ94LoqzsbXxJFiGK63QZVpwJJYCRxtMNsmhT1LQVwLYquDAQJsdtRvQLb7LFPpdYgjpEkNGJsxfZga3hdDF8XqAhJMcIgdAh4Xv39A5JpxGSH1yc8/u/QmTPdo5o5TvQ+Te8J1nIGhA1l5U7PbKAh8WFQ8CxXxA6pdO1u54KC6gOG5DSC+vVcKWUWxu7ko7CsGHOv/XhEzFZre2WgHHNi7hPwghpgnL5gkbDn2g9HtFtDEuxH15Kat30SwGhwR9XHAJCH3cTEzGWlv1mmuK2aD/u6WK4+TsgGUbyQnK0NXQ0/p8AcnbWwNBIlk6BfwGOd0TzEIw8n2rdt8BtQ0SQ== 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)(186003)(52116002)(6666004)(2906002)(26005)(7416002)(6512007)(8676002)(1076003)(44832011)(6486002)(8936002)(508600001)(316002)(66476007)(2616005)(83380400001)(4326008)(36756003)(66556008)(86362001)(66946007)(38350700002)(6506007)(38100700002)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IvO57ftuMJXrLrZ8M1Tu4netf2BaoOY2eJ8lSbja977BD29vrx2TZSXFyymaI5j44Jj0uJE+NvX6QPRLbmYouQMmVazSt8fW3Cei96wMAbZ5LO4IhI124ZEdX44w5fH9S0f+nqBKnpBgPRPE5e1mH3HC2bZ36Rsw/V1SwPfAftv7TjcypCS4/cv1o323rhbPlusvRF1BTlJYg1rcnthU2XprDpYb3b+6ZPjAq9kfIzeAKE6IGvX7US2LP+29BvQN+/E0vIsYS2Sb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psuycE1UFBwA+QmN/QEOciOlkNqIodT0OC8YAZLewTMCgA8NXh6J3oA76pQ05mpU1Ujj0sr/5kSK/ibdIpxWzuXQyArSgJlFKjHx0svE6PoQmgrdTOn7aB7B8J/PHDOdq+fkkgmsiZmwzWROVABq/ExEernF+N2eQwW2nhU9jkE0xyueLqXYuDjpmjst9EL2/EQ8ChEurSjU1F6Rkvbof6g+F9FhDu9WzosZqEIgM9tWDLZGNRKEFEjcE3G4or0mfmqnudtYLXoCPk8wuLLw4uDCKTd+uQocvlhM60572UjK5c3N0x/1byFifAplXSIvA0YkJ3VMbgqUxU0tHQgJaZNy7rEl26EQ7UthuxTXJsvm3bOM8f6gbjsE1Xy4XwmSLMTWscKkqS7jiVQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd57076e-5a4f-44d0-cf56-08da37db742f X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 08:01:31.6595 (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: QOwDkhhMZWOfGTQcfsW4bmh69kRKbdRFIchIsxJ1kDNWtotpAzNSJuBJZ8bl4wiwA5xkhIwWTIyr1pzsc5niYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5924 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As there is no interface to power off vpu core. So it need to boot from cold on first load. but on the second load, driver need to restore the status instead of booting. Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vpu_core.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c index 68ad183925fd..3cca7ae2355d 100644 --- a/drivers/media/platform/amphion/vpu_core.c +++ b/drivers/media/platform/amphion/vpu_core.c @@ -257,14 +257,8 @@ static int vpu_core_register(struct device *dev, struct vpu_core *core) } list_add_tail(&core->list, &vpu->cores); - vpu_core_get_vpu(core); - if (vpu_iface_get_power_state(core)) - ret = vpu_core_restore(core); - if (ret) - goto error; - return 0; error: if (core->msg_buffer) { @@ -362,7 +356,10 @@ struct vpu_core *vpu_request_core(struct vpu_dev *vpu, enum vpu_core_type type) pm_runtime_resume_and_get(core->dev); if (core->state == VPU_CORE_DEINIT) { - ret = vpu_core_boot(core, true); + if (vpu_iface_get_power_state(core)) + ret = vpu_core_restore(core); + else + ret = vpu_core_boot(core, true); if (ret) { pm_runtime_put_sync(core->dev); mutex_unlock(&core->lock);