From patchwork Wed Nov 11 11:11:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Baluta X-Patchwork-Id: 11897395 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 0D27FC5517A for ; Wed, 11 Nov 2020 11:13:09 +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 8939820659 for ; Wed, 11 Nov 2020 11:13:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="wRLdZsmD"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="kCzkmEwo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8939820659 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=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=I6L3cG+2ywxruh7F7lCrhdBA8xYvUprLULzhNIBHRvU=; b=wRLdZsmDj6Q2QbHQ1xL2pkgYP SDY6ArcJhBAbAtDhqt8KfZgjL74WaxHX/T+nvtp43LzeBoAEotJvMNapZoyo/7oEApRfLlHGNEJXs w6K3q++ocPo7RTZXNSNioRKSYC8mQe2Y0ZN+jPyyI+wydq8jnzJEtO/9Ol99ilMJKwRjAouboXATs d/I11uHY4EP/oNDvADdfhJ7uPxNnhROB1fHxsH/kEbJJhvC633YOfUlKbt/M3MYSkeQeu8E4wX1H4 fZ/36Jx9pY89CD0RIC84S5FYQQgNXt0C4RMC836CljFBpC9T5gURi2e6K7DqpJboWPMnhGzcu4v1J nmETpgvFw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kco2g-00048J-Mj; Wed, 11 Nov 2020 11:11:58 +0000 Received: from mail-eopbgr40070.outbound.protection.outlook.com ([40.107.4.70] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kco2Z-000445-8N for linux-arm-kernel@lists.infradead.org; Wed, 11 Nov 2020 11:11:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Noc0wMKDivwlALaD/huW6gRufEZ4tQ7lDbtWywjvqd9fgx+UAShyCW2nDZ+yBB+nKImxNmxRpc2GO7uGxTAMzaUgfy1yVs2HHXFlNGfktmMWt9JKOTq98IFoPyLNHbmztZOoh9GTzHlWB/KBSzlrI2iWI50hYrUWksBqPwxM18dxuo/BvvsGKtpgegqqLPz0pF4ETxJzEFPP1MBXxaFQNEBYeqN217mPS2f54PxlNFWHgXh2Xbt7w21xmiQ2v02Ew206Kgv1zIhR/GygRzqgoZHp7vaQ/V/9vB9MEgbOl7xyVHPMUvnXHkKMu8YnUzQdGfLp2zjNCwewaYVgDVwgPQ== 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-SenderADCheck; bh=NLrOJsNnrXb+ewdPov0gxkVBIUXsJD+jA50llCrkDbs=; b=E7/GKY+qekP8GjoTMjvpu1QITTUrOxwLJ/JHdVYsqmwRuBNeqZ6PNz5H1OrhLjsZZDqbKx33m4uvEmPrwT3HUSa/BGetx8mOi/BEnkHzr2mygJ5u/qx6Yus1z2uDZDcbOam0yRMO57VEjzmyPEFK/9Sx4IUiEtvhpAwBOzF1iqAomlT58B3E2ivn8+zyjD7FfqpMcvND45MKTJpQ2Bov1Ou8ydZ8QjXlQIh59S0eYAinFU+BT/oiBaCcKV7KpVX82fXTai+l1hBYCCKNER5v5FORelXcpOw0T8Tsncs26fIF9EZtJwUhWwHpxCctQ6jV87o2O/4vIV+arcdtz8Jufg== 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=NLrOJsNnrXb+ewdPov0gxkVBIUXsJD+jA50llCrkDbs=; b=kCzkmEwo/I56m4HvTfJn9QoLho6r9R/eYhDbieYA9VUB7Syb2uX1WX9+HSjvUB8JglhriVyTHfZmY11/Y4HbpntqdGV2Qd4STtw/1ISsPzH60V67vpC7K9qySxVgDSzj1iq+BsnpbORyoLA1EN25ZEEo66e4T8tnXuuDb6UmH50= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com (2603:10a6:800:2e::19) by VI1PR04MB5774.eurprd04.prod.outlook.com (2603:10a6:803:eb::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.25; Wed, 11 Nov 2020 11:11:46 +0000 Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::a893:e288:b01d:599c]) by VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::a893:e288:b01d:599c%6]) with mapi id 15.20.3541.025; Wed, 11 Nov 2020 11:11:46 +0000 From: Daniel Baluta To: shawnguo@kernel.org Subject: [PATCH RESEND 1/3] firmware: imx: Introduce imx_dsp_setup_channels Date: Wed, 11 Nov 2020 13:11:16 +0200 Message-Id: <20201111111118.21824-2-daniel.baluta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111111118.21824-1-daniel.baluta@nxp.com> References: <20201111111118.21824-1-daniel.baluta@nxp.com> X-Originating-IP: [83.217.231.2] X-ClientProxiedBy: AM0PR10CA0005.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::15) To VI1PR0401MB2287.eurprd04.prod.outlook.com (2603:10a6:800:2e::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1864-103.ro-buh02.nxp.com (83.217.231.2) by AM0PR10CA0005.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.21 via Frontend Transport; Wed, 11 Nov 2020 11:11:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 859d3e9e-6a8c-4815-a238-08d8863293f8 X-MS-TrafficTypeDiagnostic: VI1PR04MB5774: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2331; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YRr81utzkJK0D/chSUqsVZ0aHjQNKY5DqeuQ6oMBzKueWntRaSJCHgkrko5vSMOy7TdigEM9Y/iDf7Cb8XxfLIXY8GjSCKhNCJXch7QukqMVdK+j08qDMwfdIfqdjCMislre1Q3UBHBDLLdLHRgK1e8IEJvJgLCRzbVne21v/Dt9RLVO0ZKi+MMzo0Mzp9/mQWIrFDgFY009M5ZuL4VPWKBAGXGRrBWGmbVUyO8Z6jjcj2fFTm44YIRydITvk31Koasr4RPcbUY5JPzErqiE4pTFkXORZSLFBoNf1GC6ZE5K3/UEU/6rrAp3KbMNCqXcyLbqg0sDLdvCHRmoC2WEzQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR0401MB2287.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(39860400002)(346002)(136003)(376002)(366004)(8676002)(66946007)(52116002)(8936002)(86362001)(2616005)(956004)(7696005)(478600001)(4326008)(44832011)(66556008)(6486002)(5660300002)(66476007)(186003)(26005)(6666004)(1076003)(16526019)(6916009)(36756003)(83380400001)(2906002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yIvSuo7ANsxFWtNI3oEGlvJEg6q2qqbJoA1pdy63KMNdmuK22jtuQJlAbZbIxEFUqjzsX99s58sYAYQ9kk32prClM6sTpfS12fq27KUBOBFLC/P+EMHQskifylm71wEF9dScH+hEY6o9P7uVO+lQVxfQ4G/03CNSHFUC69zo8K49WZZlsSnAP8n6mwVE/7ZEyCllHf9hxZXUtQgNSEvCdOtoWB8QPYPwkLzR/y/ejC/j/TyMJFuE1TLeLvJQkOKJ1HJqvaEAyH9c6q1zRKOFTH0mlG+sevrVrTvRMDgjrSzYbFx4zDjxR8105gq9Tic808yMsGT0cgZPfBcXTV4olRZw/EwXSzZE1IyOB3M+zBrV50Wd04ziSAiQKYrstBeV78+rMgEYj+8+aAgLYvzTMZj0ud774ZJMa3C6K8yVAe+33uBQ/KKTZu8L1s3bZu3lOE1WPfi7Mwn7BQN/b3db6xPvlYdhqToaI0rDbNj5Xq7wkBeCMwQfDjg9Lhr6zjcbijIjDMlMSKr9A0hXreT6/nv/++mEubxfzMmM+Cr6webQnjBy6ilN6xg5H/x/e496gR/bWhntuwNFRB+cpgxdWj8r5ak3nCvDevqunZmc3uCUKrBytnSpgwqkVbioxHUY+jFwHbvt+UjxQFQpmwJrlidCFixVYFS+BfR1WS2v5+JNMrXrUIq9uGf3Vac7S/fyvtxySbsOBIpoN6zbbQE1wWyvl2mVizVk8ClKks1u9K3F+kygAoV1qv/4InMowqJCSGuYDiRrHY0/pzbf9+xLsujvfXs08cs3cuAGWorgGb7IpLgMK1BIlwRmgg8vtvBHM0sNukoa/6TYI9YdoIFXZtbU4PmVO4up5T2xMFvMtT+UNB94DnH1xXqCIEPNA8GkzjP3ERl8JtOgqeSG1job4g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 859d3e9e-6a8c-4815-a238-08d8863293f8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2287.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2020 11:11:46.5310 (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: NoTeE0tRqnt4qx2fAeYwxwrb6xPzWcqhTm8xEYEHijseZBmvFKU7g7KaCW4mWurkhKS19EIBq6NtCIbUL0JtbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5774 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201111_061151_309935_FE5CE2AB X-CRM114-Status: GOOD ( 17.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, paul.olaru@nxp.com, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, shengjiu.wang@nxp.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Create a separate function that sets up DSP mailbox channels so that imx_dsp_probe function will be easier to read. Signed-off-by: Daniel Baluta --- drivers/firmware/imx/imx-dsp.c | 41 +++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c index 4265e9dbed84..a3a018c87b52 100644 --- a/drivers/firmware/imx/imx-dsp.c +++ b/drivers/firmware/imx/imx-dsp.c @@ -60,22 +60,15 @@ static void imx_dsp_handle_rx(struct mbox_client *c, void *msg) } } -static int imx_dsp_probe(struct platform_device *pdev) +static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) { - struct device *dev = &pdev->dev; - struct imx_dsp_ipc *dsp_ipc; + struct device *dev = dsp_ipc->dev; struct imx_dsp_chan *dsp_chan; struct mbox_client *cl; char *chan_name; int ret; int i, j; - device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); - - dsp_ipc = devm_kzalloc(dev, sizeof(*dsp_ipc), GFP_KERNEL); - if (!dsp_ipc) - return -ENOMEM; - for (i = 0; i < DSP_MU_CHAN_NUM; i++) { if (i < 2) chan_name = kasprintf(GFP_KERNEL, "txdb%d", i); @@ -108,12 +101,6 @@ static int imx_dsp_probe(struct platform_device *pdev) kfree(chan_name); } - dsp_ipc->dev = dev; - - dev_set_drvdata(dev, dsp_ipc); - - dev_info(dev, "NXP i.MX DSP IPC initialized\n"); - return 0; out: kfree(chan_name); @@ -125,6 +112,30 @@ static int imx_dsp_probe(struct platform_device *pdev) return ret; } +static int imx_dsp_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct imx_dsp_ipc *dsp_ipc; + int ret; + + device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); + + dsp_ipc = devm_kzalloc(dev, sizeof(*dsp_ipc), GFP_KERNEL); + if (!dsp_ipc) + return -ENOMEM; + + dsp_ipc->dev = dev; + dev_set_drvdata(dev, dsp_ipc); + + ret = imx_dsp_setup_channels(dsp_ipc); + if (ret < 0) + return ret; + + dev_info(dev, "NXP i.MX DSP IPC initialized\n"); + + return 0; +} + static int imx_dsp_remove(struct platform_device *pdev) { struct imx_dsp_chan *dsp_chan; From patchwork Wed Nov 11 11:11:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Baluta X-Patchwork-Id: 11897393 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, 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 1F202C388F9 for ; Wed, 11 Nov 2020 11:12:28 +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 930CC20756 for ; Wed, 11 Nov 2020 11:12:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fjN9CLuo"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="d2cdz8wT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 930CC20756 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=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=Uecn1JMMjYGxiGZZVVdHRPlD8+z1Z/uGlq1OlFlNC8s=; b=fjN9CLuoBBqYbgDplME45Lhwe FiecA84NNSepScGEb4Dd70sfBqGsNLBEkKk51oSOyGo/fafzzdYRiiBAR4lOQehzCf/+Y0L//+ovv 8MLVdDJOjAzHMfjUtuujIqb1sW8DKjkdEdLi142iYsYVQVUgfvi1d6pl08Do4BQNgaX+THCfThDjk 8E0Hpi4YTA6Z5ZxRNV6zJ127w43OFcyfAqCz9P3wSr6Tk19Tva0p2Bj5sMdLZg3ALmOJTei5JiHQR w2XrYliKplYj0bvOEGcXgL1E/ZKwNgM4RlsWOiEvGcEsLPgXLh96STCl2E2v5BqAG7lAwbMzv2V+o +wQFrunUw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kco2j-000492-M0; Wed, 11 Nov 2020 11:12:01 +0000 Received: from mail-eopbgr40070.outbound.protection.outlook.com ([40.107.4.70] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kco2a-000445-9t for linux-arm-kernel@lists.infradead.org; Wed, 11 Nov 2020 11:11:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NqT2ItgY6RlTDyIzbbOE/r7jrLEvPYXmB/4HZ9gd249u3FbxrRtNtfqpiIxu4F1DBWnJgUkFxeLbWisAi+nFGABp4Cp5nCgg22FsZ9wIB7VrcPr0AuQaSbZKhoM3YfGedgiQ75OYq9YYY+jyaBD664cpS/6lOXZGKZtS+UuIyw/0yLrg05WAquBgTRSh1JxhIAzFgQNRlgSEGvnUXGKYGKqqFhQ3N7uFnrUZRL+lzWdT6Z6NjQHVRUislbD/GyM9/2PmDS/lN8rqMjyC0j+e87+D9Op3JVThdzam7IDvzC0XeZT0cj/ZVF/1cdc2mml9YdHqKgWVwWC3WrklBaP+jQ== 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-SenderADCheck; bh=J0WQRLCswfFmHIwbS9PaFC7gyky0f+NMzmelxEMPkTo=; b=VAL9rkEkX3tYfo5QH3bu4H3b70MzCCMr8sbsiySfxzv/vKZtQ0PXvhNtbU9awKYOmqpTXupE4WrZBY0ytdgV2jlaSOTmOuZ0yDrehxMC3ga4y1EuGV8qOAaMcciHIfmbD7++STEtVfB2HAtWCTPfLnBD3QyQhYu2KSgo4dkHfkNSsirzziwH6tB689n8ykyXh2v5hCwJpq3YJ3xzK2fLX40mgewEPM6qgg+4A9I8S3W5RGM6FxlJcVMji2yseZt3DO4sX1HSw2ZR1NbNl2QyC3to/D3cqgvMZgocfSl7mSzmCmVH7oS3m8mzscIQvz/hXj5GAQ3jNWUyllESpyxBtg== 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=J0WQRLCswfFmHIwbS9PaFC7gyky0f+NMzmelxEMPkTo=; b=d2cdz8wTJ+YYxRcklo7ptFXPkmiSvpvnFiTko8xARyvmordr62IxFwbdNqR77maCPUTFpm8WZqk0zpi0XpIFlNpUipRPkVsyJ/1R7J5+7uwRkx6kuXCGl7oaQFd0j8H1XEoIHfhzmnaoXkCzQjS/g0oK3lweUeuduLfnQypYTek= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com (2603:10a6:800:2e::19) by VI1PR04MB5774.eurprd04.prod.outlook.com (2603:10a6:803:eb::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.25; Wed, 11 Nov 2020 11:11:48 +0000 Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::a893:e288:b01d:599c]) by VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::a893:e288:b01d:599c%6]) with mapi id 15.20.3541.025; Wed, 11 Nov 2020 11:11:48 +0000 From: Daniel Baluta To: shawnguo@kernel.org Subject: [PATCH RESEND 2/3] firmware: imx: Save channel name for further use Date: Wed, 11 Nov 2020 13:11:17 +0200 Message-Id: <20201111111118.21824-3-daniel.baluta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111111118.21824-1-daniel.baluta@nxp.com> References: <20201111111118.21824-1-daniel.baluta@nxp.com> X-Originating-IP: [83.217.231.2] X-ClientProxiedBy: AM0PR10CA0005.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::15) To VI1PR0401MB2287.eurprd04.prod.outlook.com (2603:10a6:800:2e::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1864-103.ro-buh02.nxp.com (83.217.231.2) by AM0PR10CA0005.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.21 via Frontend Transport; Wed, 11 Nov 2020 11:11:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0ae745e2-1d1e-415d-5977-08d8863294f6 X-MS-TrafficTypeDiagnostic: VI1PR04MB5774: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mmZIcUz/JN29Uz929fr2X6Q6qPtZBMGu4ovl024BlIjpJBWvhFr6pLJCeunur7Lg7cPj2jFedZzpBXACZEgzKAABs6tDKgH30fSIq50qqhSdYGwZNlv4B7t/N0d2zsyVko0sxEvLfVst/9vjunsQIlJ/oc22NK72eOf5Lf+nZzUut96MfCJEvRR7WWqVEdZOKMLVMEHIb9s/W3xP5ZgDna6xLkLT7xo/k16UC57Vit02g2N37HSC7EeaLC/yMIwNxF+GbjQ+Gs6CY7tmtvts5AWz1zHVEQCz30AVpqrBKl3YchSYTO+3OxCLP+1MeoqHkAmVgU3W/aDjFo6sjxb1JA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR0401MB2287.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(39860400002)(346002)(136003)(376002)(366004)(8676002)(66946007)(52116002)(8936002)(86362001)(2616005)(956004)(7696005)(478600001)(4326008)(44832011)(66556008)(6486002)(5660300002)(66476007)(186003)(26005)(6666004)(1076003)(16526019)(6916009)(36756003)(83380400001)(2906002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: WAs3EJ8sCm3IbzWcIs9xaoWDbCAtlvhdxEUPHvEWx/vOLBMdau4xcOFiK6tuPQf38AcUNX83uSFi9x3GmGkUQRSuzfG9PegYU6oZZmrJrbSezIDh3UQI6EHt0bwTxI3aBJRKKBOLtERwFUADUr7oVbtRq7w3mKZ7a3qYUEC5M6B96CnPk9VypETjSZmDcet9J9KQL2nUY5LEL9CajIWA2AwmG6LR+9NQj375mjIFA/M7QeEgvgL/sNntFL7NBlgF8c+b9JdYbP9dJep4ef+gnaaKG6pO9C6+TbrsRlm0sPSxv1LyPhYllV+Yv8F1AUqcJKeMSryeI/XeHPL+edsFjsnWryJ88jRtl7Vjgig7QqHoqvbeGRDiVbfEA2TDDzIIS4wj+LG/Sz5mrwrJ7+yUtExAM+K6hcx3B/OGkXSbTpQoWDZgOcr8x/MLxGuzPjipEACMPCE3upsU6wsn4GzRHJBzZYDSUavbchvS4uGDRAlnT6a3wBZwDhS6Nht6GL2cq6NftdWMGRFfP+wxy3rmr+ooSXlfROR+dsNmWFMN56aD7Qh0jXWg+1whc5sBdY8pyT8EaciKOGOrDZW7muw7h+tb6oNjMf9Rt57dY4qmVVaIAQTQ710m+zVS4dzlwDkGyEKZlX0zTSTnQxoYs3Qz28hlA4eOs3YPi0stntoE/lqV0/FBrU93gI04Ik7zDXiRm4p/gmmRwDUrgF/ZNW0GFthw1B76oDKNjDPQc2UWSry8o2lwJLg7aENVIxhJH/6P3v9E/A9Qa482U+dCEREL44hq4OsSeripNk9k6KAdSfMn7ZlGZJWj23x6/4cfgg+xdmiAOoB93w9r21+3MHER2Chv/fgPl2f+/Agma2rzHuoEPZvzspNCi4zPH+L5vjJgXswMsIgXbtHyRw6DEJ2RPw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ae745e2-1d1e-415d-5977-08d8863294f6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2287.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2020 11:11:48.0833 (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: xvWF0rDDICl4wzQfgezfNjLqeQ+mrsxi6cKqfB3+Bowh6b/VxHGryr4Po3dxNHlNkrAfamvFD1xMRkiI+lOQ1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5774 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201111_061152_425974_47D7B984 X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, paul.olaru@nxp.com, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, shengjiu.wang@nxp.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We want to request / free channels on demand later in order to save power. For this for each channel we save the name and use it to reference the channel later. Signed-off-by: Daniel Baluta --- drivers/firmware/imx/imx-dsp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c index a3a018c87b52..b6e95d6d34c0 100644 --- a/drivers/firmware/imx/imx-dsp.c +++ b/drivers/firmware/imx/imx-dsp.c @@ -79,6 +79,7 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) return -ENOMEM; dsp_chan = &dsp_ipc->chans[i]; + dsp_chan->name = chan_name; cl = &dsp_chan->cl; cl->dev = dev; cl->tx_block = false; @@ -97,16 +98,14 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) } dev_dbg(dev, "request mbox chan %s\n", chan_name); - /* chan_name is not used anymore by framework */ - kfree(chan_name); } return 0; out: - kfree(chan_name); for (j = 0; j < i; j++) { dsp_chan = &dsp_ipc->chans[j]; mbox_free_channel(dsp_chan->ch); + kfree(dsp_chan->name); } return ret; @@ -147,6 +146,7 @@ static int imx_dsp_remove(struct platform_device *pdev) for (i = 0; i < DSP_MU_CHAN_NUM; i++) { dsp_chan = &dsp_ipc->chans[i]; mbox_free_channel(dsp_chan->ch); + kfree(dsp_chan->name); } return 0; From patchwork Wed Nov 11 11:11:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Baluta X-Patchwork-Id: 11897397 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, 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 253A7C5517A for ; Wed, 11 Nov 2020 11:13:17 +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 9790F20659 for ; Wed, 11 Nov 2020 11:13:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3gHvnEkK"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="dGUcXSAg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9790F20659 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=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=7m9c0RxVjttUmdpiFjcSgASBN5l7zm6hSA4aVpvm7Oc=; b=3gHvnEkK6GOSfuhgv6sykLeLx 5Gc2ipBOySHn20z+pZ8UHlCdorTY/rd+D9Ro55H1WD5x8zlMQWcQOlXpemfm8T9jx/gSiLvoTohBP pLO0AtGb00kzB3z0+euG0ASRFJXV32GCZlt7/TIjtmkUAj1vKZmZOtaTYo5VY0y/hb8gbTl0VRZCS VW0nXay9kt2YaCJRptvA4dRAjzbbo3gmmLhOQi2gFGoKGVnkGctbytZfLFInB4NbmG+OZdM+QRO3b gZDBWiS/0vGEOtUQl0noA0DgCIgN0KmzqpQ8+k4MLGhW0mSpCzD0jsTFaGNTHNQ/ONg1E9MxcA0hC J6PEpr7hg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kco2o-0004AQ-8a; Wed, 11 Nov 2020 11:12:06 +0000 Received: from mail-eopbgr40070.outbound.protection.outlook.com ([40.107.4.70] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kco2b-000445-FD for linux-arm-kernel@lists.infradead.org; Wed, 11 Nov 2020 11:11:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XPFeYYfzFayxcgIoN+n5kg6+dIdZY+Rtr4UdUnWmBCNuCRcFA70QzGE8SOk4TXkB4NHEQBm94QybXsSxoviZDCC3sJtY7+COUbkwyDgx/cnOCkEowM7KGJJ3xpNT3gZn0cbKU07Bi0r8Wdy65QAXKICGS92O2hkDvXA87bnqmLUuyrrSikU6lN50/EkGp8aWO9g+nxIO9RhnmKvYQa82rXVBitzxfusJAAj/Qpro5PsVc7mxudGgFjHdPi6qqoqwOfi9wU5ii/dEkgiI4ifz9yWTdX8bIwTYXaShLr5vgcxXDF5xM8xO0kp+n+PGPzbBL3S6an0UB4Ce2C25AIwb0g== 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-SenderADCheck; bh=MqujLPZcdGxiqmste7of0HWz0DlohAIIIzg+XUcF/Tc=; b=BdhHIMIjc1J66OH7nAjJWo/z/4k82JN8ZrkrYAfe8QBH4xogg3lvLtNx72xXbNarp/2pgwZwpnnMKdNfrWZ2q2+Zm70+6GR9xLj5vamK5dmSRom9r//z8Lv5xmgp0lKrIHklD0SYIcJEdltRO3HoxZQvhk25DalEqhQ9bLcwTTUWAg+G0XEBNmTeLj4qwzi3YivRmVut6aAg6fp39pLqiWop3iBh+743yn4BW523YHsIahCM/ss1AOWRF7gZKeiyCV+mz2UZfnmIamBmL6OS1J+ZQsHeFxZ8VfbKIfkjXHBECPm+u9UXjGRXi5Aw0htlK+cIbj+bvVWwBWNwTzJdVQ== 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=MqujLPZcdGxiqmste7of0HWz0DlohAIIIzg+XUcF/Tc=; b=dGUcXSAgq31O/V4UgMb9VP/1kAqksf1/lGcd+b2wCZqVa7wUksS6jcnzoPHLwlBWGTaWblcHgx6sf9XifYuYqRMAdzmFnBFpO5zjMoEBgxQ7fBl4dhtw518ngKqWZF3Nd4TIyvlMtSPl+OIttAn+zMAnslIYKZWgQMZWpJ4r/sk= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com (2603:10a6:800:2e::19) by VI1PR04MB5774.eurprd04.prod.outlook.com (2603:10a6:803:eb::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.25; Wed, 11 Nov 2020 11:11:49 +0000 Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::a893:e288:b01d:599c]) by VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::a893:e288:b01d:599c%6]) with mapi id 15.20.3541.025; Wed, 11 Nov 2020 11:11:49 +0000 From: Daniel Baluta To: shawnguo@kernel.org Subject: [PATCH RESEND 3/3] firmware: imx-dsp: Export functions to request/free channels Date: Wed, 11 Nov 2020 13:11:18 +0200 Message-Id: <20201111111118.21824-4-daniel.baluta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111111118.21824-1-daniel.baluta@nxp.com> References: <20201111111118.21824-1-daniel.baluta@nxp.com> X-Originating-IP: [83.217.231.2] X-ClientProxiedBy: AM0PR10CA0005.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::15) To VI1PR0401MB2287.eurprd04.prod.outlook.com (2603:10a6:800:2e::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1864-103.ro-buh02.nxp.com (83.217.231.2) by AM0PR10CA0005.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.21 via Frontend Transport; Wed, 11 Nov 2020 11:11:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 80fbc043-7a10-46f2-4078-08d8863295bb X-MS-TrafficTypeDiagnostic: VI1PR04MB5774: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bWQFsMec6cKvEsGjfSIgz4J6USNC/1XzsyI/TfqnZPH65iXApj39KuUjviHHxczPjhcqiMRt2TXX++sjnh0DA2jWNM2F50iNmqyzacuXU49isDtBoZBOqfAot2X8aXFCGZDUd3quOFNCOtHgZNddl33c1sMWBvf4IE2t5Hn5JV5KmIbaHd7xuw1TSFbEKPV/aXXN5Yd+zUbKSdq0c5MRDn4Y6RTeZJACaT0tbONiG62sm8tl9xejrUba8E3GBKggXHSI9BG23iwhmMF8uqizcvICxYY10amsagEG+x/III7EeGGmauxLKh8hHpYLGhmUAtDmHWR9JYSAyGog9ccDnA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR0401MB2287.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(39860400002)(346002)(136003)(376002)(366004)(8676002)(66946007)(52116002)(8936002)(86362001)(2616005)(956004)(7696005)(478600001)(4326008)(44832011)(66556008)(6486002)(5660300002)(66476007)(186003)(26005)(6666004)(1076003)(16526019)(6916009)(36756003)(83380400001)(2906002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: xkLQuE2Vz57Y8u0L34AktucSFNIp8dmZVbC7QPaszJP3+n4n8R0VvCxVEJIBYBXCDTqmwqnZpIFgunS6Nzq6krIqY6hfhbQc6SH6mHW9Cko45lbEnNg7FIO9PhcaDuyM2AKSom5uYIacwMQs/kDRQR+fpgTADVwhK5rwh7Cf6PY1QUgIIc8WHh9YKT+ob8ILuSpV4KnaSF6Ul1Vu3vu6gN8WDYlXwH98dZeLx+eXdC9CmjfZUBPbprU2ZNEG1FvhEAwS34b0l+Z+c1gXFSwJ22//NQdtKag3UkBRGpPQy3LHud+Q0ShaKFD4LixoC82NlnRmV9yuE8o+tPNywrSU/pOd0uF0xHVL3REZmwltDdCNO6BAD3poucfdC2+bZFFPWOKtOWE/28wJMvjnsuF+h4nXSYgPma+brd+xF6y3LeQ6JjikuRqY8FdRKhjiw/LBd4V7Xi6Lbgu9AMVbi9UFksKbwMgFnMH/hYUxMPOElnSWTyVFWYH17PRR3qK4sc4m1KjnUg68DqLa7Njr/kfZ7ofbEfK6Gifa1DPny3p/mXBGQXhz4ixQTe3Mr4CxA/dW+4mxlZYD1GHv8Bbpzucfvx2Y+CBCCVJR/fKT+VaGgj7uZX7thqCX7MzCcvHxCA7VJsQeaXMC/3aASAGUuNpuXOFSlE6F903xDPg0QP8Ybx0SIoZDqF0KkgrGs/UbJh/LUPCNEWMmpVgAhfIwzqbyj1czaQdMj0EoYjdLhHvKMS9Lmx8+mEhbs9YYA13JQWo4A1OBG8yvCD9vLEYr0228gUyfRS0gRgd7t2dWhrg7c/129k1V1oJvOn6GUyT93dD6iWm7IICFTurQl82f4ucvNmlautZsFFRRc0A3F+o4Uqm2Xf2baf8g7ot4JpQwvHDkN3G1dEs8SQrZa9xJsyjA0w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80fbc043-7a10-46f2-4078-08d8863295bb X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2287.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2020 11:11:49.3947 (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: FU4X/Bfir6sCqbnihoy4bGcMBtW9WrIzbjX1KPK7toZXc5ErUyMFfjlIvkJ/x3L87TRKL6HbY93ytxfgTPd/cg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5774 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201111_061153_603675_0C377F56 X-CRM114-Status: GOOD ( 17.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, paul.olaru@nxp.com, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, shengjiu.wang@nxp.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to save power, we only need to request a channel when the communication with the DSP active. For this we export the following functions: - imx_dsp_request_channel, gets a channel with a given index - imx_dsp_free_channel, frees a channel with a given index Notice that we still request channels at probe to support devices that do not have PM callbacks implemented. More explanations about why requesting a channel has an effect on power savings: - requesting an mailbox channel will call mailbox's startup function. - startup function calls pm_runtime_get_sync which increments device usage count and will keep the device active. Specifically, mailbox clock will be always ON when a mailbox channel is requested. Signed-off-by: Daniel Baluta --- drivers/firmware/imx/imx-dsp.c | 25 +++++++++++++++++++++++++ include/linux/firmware/imx/dsp.h | 10 ++++++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c index b6e95d6d34c0..a6c06d7476c3 100644 --- a/drivers/firmware/imx/imx-dsp.c +++ b/drivers/firmware/imx/imx-dsp.c @@ -60,6 +60,31 @@ static void imx_dsp_handle_rx(struct mbox_client *c, void *msg) } } +struct mbox_chan *imx_dsp_request_channel(struct imx_dsp_ipc *dsp_ipc, int idx) +{ + struct imx_dsp_chan *dsp_chan; + + if (idx >= DSP_MU_CHAN_NUM) + return ERR_PTR(-EINVAL); + + dsp_chan = &dsp_ipc->chans[idx]; + dsp_chan->ch = mbox_request_channel_byname(&dsp_chan->cl, dsp_chan->name); + return dsp_chan->ch; +} +EXPORT_SYMBOL(imx_dsp_request_channel); + +void imx_dsp_free_channel(struct imx_dsp_ipc *dsp_ipc, int idx) +{ + struct imx_dsp_chan *dsp_chan; + + if (idx >= DSP_MU_CHAN_NUM) + return; + + dsp_chan = &dsp_ipc->chans[idx]; + mbox_free_channel(dsp_chan->ch); +} +EXPORT_SYMBOL(imx_dsp_free_channel); + static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) { struct device *dev = dsp_ipc->dev; diff --git a/include/linux/firmware/imx/dsp.h b/include/linux/firmware/imx/dsp.h index 7562099c9e46..4f7895a3b73c 100644 --- a/include/linux/firmware/imx/dsp.h +++ b/include/linux/firmware/imx/dsp.h @@ -55,6 +55,9 @@ static inline void *imx_dsp_get_data(struct imx_dsp_ipc *ipc) int imx_dsp_ring_doorbell(struct imx_dsp_ipc *dsp, unsigned int chan_idx); +struct mbox_chan *imx_dsp_request_channel(struct imx_dsp_ipc *ipc, int idx); +void imx_dsp_free_channel(struct imx_dsp_ipc *ipc, int idx); + #else static inline int imx_dsp_ring_doorbell(struct imx_dsp_ipc *ipc, @@ -63,5 +66,12 @@ static inline int imx_dsp_ring_doorbell(struct imx_dsp_ipc *ipc, return -ENOTSUPP; } +struct mbox_chan *imx_dsp_request_channel(struct imx_dsp_ipc *ipc, int idx) +{ + return ERR_PTR(-EOPNOTSUPP); +} + +void imx_dsp_free_channel(struct imx_dsp_ipc *ipc, int idx) { } + #endif #endif /* _IMX_DSP_IPC_H */