From patchwork Mon Sep 14 09:32:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 11773399 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57BCF6CA for ; Mon, 14 Sep 2020 09:34:18 +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 20E2120719 for ; Mon, 14 Sep 2020 09:34:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="N0PDlfYz"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="mVA6Ve6C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20E2120719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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=MhZYfKFd7Z8DGXz9Qf9Sce1b4Wdl5fxTa8dArLnoNZI=; b=N0PDlfYzLSVr7uxhtM35b7Nix aHXxAy6f/+7LS+JMIRCCra3OMN7ddRpaiTgG5Z9hnq+FEkBPtWyEADTxYpS0YCWfud8zESjo8WDQc vWuBK6QK35WAx2RW6t5eUkj85ilZPhkcBV6hkpdYKATGxwPPZjF+4L1K1aeKycZiUnIqz57xL4iyF tnB7Y+2+YxPYE+UJPy10oaHBosg4Md0+euX/sbaWV/QUMcwhZmklWSZ+hWNHI1kJHt0E6U29IL9Oy 4F7Jn2Wnu012eIJwint1S7DGcvO8CEnrxvx+dsq4JUsOcDr1SkTOKyeaY48Kd7vnUXdI7BfTsvd0/ MS4//MJfA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHkr0-0005PS-8c; Mon, 14 Sep 2020 09:32:54 +0000 Received: from mail-eopbgr80070.outbound.protection.outlook.com ([40.107.8.70] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHkqs-0005MI-HW for linux-arm-kernel@lists.infradead.org; Mon, 14 Sep 2020 09:32:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NLFA59uV0nFOKDIMXmhXWlBifoPW+MrlISfOF2+q3NdfX/A7dwMNnjqtv/kYeH9gy+nd+vul6NAGQ1L6/aqFL+cKDiFpd4Q/ERIEZTh9O9sgpSybGL1gtNNCD615+t5j9GsYiHrBpxj3wh1MK922V25tNJVINOkbYOzA3h1vOTCM7UzHYTBO1fCF6o48kPsJvJZBbjb/DzmLLq0nzeI+2DHHkYEMP4lcpCG8lzlhJ/f57RuRHM36SnUs2wTR/u6JnC3w1iuzCsJlo9HkKa92lbm1qj+ybnlL1lghriBLFKx677+qKPfxjxNqHYJkj/3eRv40NFSehQvtdLliS8ykLg== 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=ctbrXbxWHo7a8KTPqVjF8oAJXeCzS8iEqaR1fl62DtU=; b=a5fi0x+82AiRdoxN+9SbLr6myL5cuhMuWMxVmvm0a/x2iNUZBkWs8WUZWii51z+DfYa/z85OmSZE7zrQe/vNClNeJuOhsK1S64aMIpk+DZ7bzwFNvExnKlXpo6ltsKeeqM0lIM6A1f6YI4v5omUy6oekFIEcm+vj7k5Xw76zX+kzvn8Qd0XTWUxnydDbtdh6nWE1ptKZ8feNb3lyp6PutDYbzBJJRCGeDXjtldfwyhL6+u5PYNezk8R+jeAHfVFebd3ayactIhg4gbdYANzO60Ix5myNVVIsxXQ9f9Z8Cp0TYmphRn0VawF/IuJwq1p19xUVx/QxXf5ayOrO6IMv2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ctbrXbxWHo7a8KTPqVjF8oAJXeCzS8iEqaR1fl62DtU=; b=mVA6Ve6CpNQbCAdq7HtH3WLq1zJxIds+0N1B3xa4InP6i+vsV6wFZ5wQ95eza4RVIGlwokYsFhJg2H60K0vKuhtuIwn2hXOctwWe+nqSoTjHJkavXRWmOXEPBcb2U6/HSnFoGCuRjrfFqRliI6okwLo+lUsYoodC34ZgY8Nzy10= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com (2603:10a6:800:2e::19) by VE1PR04MB6688.eurprd04.prod.outlook.com (2603:10a6:803:127::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Mon, 14 Sep 2020 09:32:44 +0000 Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::174:edc4:7d33:9c88]) by VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::174:edc4:7d33:9c88%12]) with mapi id 15.20.3370.019; Mon, 14 Sep 2020 09:32:44 +0000 From: Daniel Baluta To: shawnguo@kernel.org, o.rempel@pengutronix.de Subject: [RESEND PATCH 1/3] firmware: imx: Introduce imx_dsp_setup_channels Date: Mon, 14 Sep 2020 12:32:25 +0300 Message-Id: <20200914093227.5094-2-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200914093227.5094-1-daniel.baluta@oss.nxp.com> References: <20200914093227.5094-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR06CA0133.eurprd06.prod.outlook.com (2603:10a6:208:ab::38) 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 AM0PR06CA0133.eurprd06.prod.outlook.com (2603:10a6:208:ab::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Mon, 14 Sep 2020 09:32:43 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6219698c-9c4c-4d42-2088-08d858912245 X-MS-TrafficTypeDiagnostic: VE1PR04MB6688: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True 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: dQyVoVKj+k/uqEfysXauIzFUXtj+3zQN82ei/VkqMSBFL30Xidbd2XdisbYJiDLs16R7D+UEWa63EdBM66XXL/ORMr6n7Sp6njAhz5QOHaEnCp64jLBNpY8Oq3+59mD4XEgNqz0BvzrzayefyeenZQw4YjfS2THLUFXNDIx1whvL9duMP72LAeMQrYuOn9T9XvKVCq6QA+exOg9qtpPyX/cS/1aNtNfhG6VfTEfVM5eJ3PRubFGNgUqxOG1z3/HLqKrceFpwWBfsiB87vhVRWBbKx7erffC8ZOWDZnkPDUbedlj8xCkn0g8AOno+ReBYVqovufgwzdtqBHxXOKe2VA== 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)(346002)(39850400004)(396003)(136003)(366004)(376002)(16526019)(6512007)(186003)(6486002)(66946007)(52116002)(66556008)(66476007)(316002)(26005)(6666004)(6506007)(478600001)(956004)(2616005)(2906002)(44832011)(8936002)(5660300002)(86362001)(8676002)(1076003)(83380400001)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: tqA2KT0x0jcc+JCkeOyjhiF0ou/0cDb0Md5Gqha2lviOwHr2q0BA1fXCXxkGPkfhu/nSTSEW5Tht25oIeh34M0+8sb7tdiU9Kia8wbb0XVWNSLuy0sK5M2nuVP5Ap8yr7nFwa+AmYpSZ4rw9ej1kHyq3VkHYDZ+dgYktDvAE369uliJM4wIe+FikVwyHo+sVMnS6t7Gv7wgHrzyy/nlzfw/q9HVfn9G4iCPG6AQQTBW9V4RhOtrlfMGzDrSm/+HIb04wca1Hmr0TPVez/6JdUpMKrAeq5PaLDqGgQjpUw6seMcmzZDGfb6GhDVKr/TELI1bOG+iRlEsNHvAFfXdprBaAdr6b5XwFYoT4lldFfTsetbw17A+eypNuKW2Q3WV1J5nIEYtS/IopbT140WZNX5vzb3+6lK0raDu8c/X9GpXNU1GYFsTBNyVq8p089IcEWgikipurDJ1tvXcYqeCJzg/Q/2h50va/cP7Jd3/Vr+4w1MVF7n3t993g+nh9pb7uhZ7HsDl7ye3N7ScmF1F4BLpRTRSB5mzw5rbUL+whXGE8M4LpvNJydlSkD8f000chBVYtsvaIfQli/l5ckIACMlmKia0nQ0RpnOd0Jt7TbQ7kb5IzDp+VbcPoE7/d1qr9sLQD4b8DOxhkxLW6swqHGA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6219698c-9c4c-4d42-2088-08d858912245 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2287.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2020 09:32:44.3901 (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: Dto8XSyGotv6crwQEHOW465R3dXIPGY1taqqXnbNLFO7MPBFkJvzbk1AvKYiD9nfIPE+KQOzcGu+c0mQZx1tmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6688 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200914_053246_586618_AE4B9095 X-CRM114-Status: GOOD ( 16.08 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.8.70 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [40.107.8.70 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay 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, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Daniel Baluta 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 Mon Sep 14 09:32:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 11773395 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BC3F92C for ; Mon, 14 Sep 2020 09:33: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 6BC0720719 for ; Mon, 14 Sep 2020 09:33:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="E27uRCp7"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="JeZlEstN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BC0720719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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=WQuA7sbIgMoqrdlygDzR00+b/fN4d9U+IZfdyxrWxko=; b=E27uRCp7DC2qZV8mHqWL0m0uU lGv6j+t7LK3bpLMZK5J1td5zQC9Zxec8nQkSXLA2GdRVnNjm70vMfMb3IGihqsnW92v9PWybnJmzs FtJgdCp/DTnj9LfHq/3jB5rHIpjgHWTMGgIZcYpQ75c7tqCqLQh64MRvo+2RmkbsFdnqlynt2TfCl 8et0m7fYqCY5o9WhQKysefAoBWQ4IIjvYsssreKiPbF+hN+xdivaOikpiPBLxIH2qldCYMvt4UJHL i9ysBHDZVFQef1mOCS9VC4IXWatjdr4X4R1DC6IN8+42QMyZS7H8fySechsQAsXgVj83n3G94c4lC UWLoapx3w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHkr3-0005Q3-Bz; Mon, 14 Sep 2020 09:32:57 +0000 Received: from mail-eopbgr140055.outbound.protection.outlook.com ([40.107.14.55] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHkqu-0005NR-3S for linux-arm-kernel@lists.infradead.org; Mon, 14 Sep 2020 09:32:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZVfVvp9sJVBdAx/Dt/JkXtuwCQxBj8AZBNTCAHSZOv1wU29Rca1meONXztBlLQynvQ8jrqLBallgtJtNAERMyZyk9+Ie0dUWMmLASVYbA2Si00m9ke8M/cc62Gdbl+k4PAEDpcEzWQwhjEoPwhcWKHTq37YHVE+r3pCBgYxlaD618QfztJ136+YXs3KXksnGOd4t1TWlkVllIpuLGcml+HNTtBXfPxp0Zh0QAIrgfIivbH40bd54xuxOpbO5xr5vsu1mgJ9mhkwiE3C0L75SrDjZ9dXHuy7kgG/Sm38/wB1G8mqlULQRFVaRUbh+AgpYJ3ggeoTuzwYdPdC3YNoHMw== 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=k/tYqyR7AHVcgpgMKDqvpjZ5oCafQgTOGvuoxdkO7XA=; b=Eg52mE/5dsyPVi+4Bdtb57XW97UZOkZM1cKKzLTBlrqCLtMUEmtGPYtX+g+szqrJNGrWt+XkRuMEOD/X9oLo1YXGBmwt5Z3fxkU/wqsIseGOjsA0I+FQ3zEtowO8rINEPjDM4t6s3UFtB2SK5o9DbyM8P7gfLBMumqEWWb0dmmRIuL33xRnhfkIWkicW3B+qVXBCn4QVOtWrb70PTyuCeaPmEsEYvtGNAzbkYpSG8+x5DKVUbCqnv1ogRqKDziFZ9mPbW85ZmnRZmm9YNkWnNAOE+PLBbDryQdIjHJW63dff6K4/EM+v5PZtTm2p9vZBTcnq9DMZJ8WCkwrHNzGzkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k/tYqyR7AHVcgpgMKDqvpjZ5oCafQgTOGvuoxdkO7XA=; b=JeZlEstNfEuc5BnD4Bo3LtNBokVtT9cdZAUI7LWebtI+LqrLvVVIHDNotUC3eQtrJCM5L8/btmrhYCn9dVG8FNLMfqrLsHL+5oRZB5TTGukePqzpECoMIcNYV+JTPwgmh2i+5WNZjfe6zFsgKiHNJDJC3swa0772w2PsYbD/e6E= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com (2603:10a6:800:2e::19) by VE1PR04MB7405.eurprd04.prod.outlook.com (2603:10a6:800:1a4::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Mon, 14 Sep 2020 09:32:45 +0000 Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::174:edc4:7d33:9c88]) by VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::174:edc4:7d33:9c88%12]) with mapi id 15.20.3370.019; Mon, 14 Sep 2020 09:32:45 +0000 From: Daniel Baluta To: shawnguo@kernel.org, o.rempel@pengutronix.de Subject: [RESEND PATCH 2/3] firmware: imx: Save channel name for further use Date: Mon, 14 Sep 2020 12:32:26 +0300 Message-Id: <20200914093227.5094-3-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200914093227.5094-1-daniel.baluta@oss.nxp.com> References: <20200914093227.5094-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR06CA0133.eurprd06.prod.outlook.com (2603:10a6:208:ab::38) 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 AM0PR06CA0133.eurprd06.prod.outlook.com (2603:10a6:208:ab::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Mon, 14 Sep 2020 09:32:44 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2bddc46a-b989-4e7c-10a1-08d8589122fd X-MS-TrafficTypeDiagnostic: VE1PR04MB7405: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True 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: iq3RShwvdz0nCx/ZHKAw3vDit34hQ2xDrZGuY0oRCJyPoA0LI3SxuHSqI4a+PxWn3svzIrwOk5h3Hs79OLYpdsX9An9JDR39s7Ih3arbvq0gG7RMBqu1Lsn5YQEJPo/1jobrbfAZuLbOzn0O9E0CqO4Dvkf2UaqBFSJIOB6MvIKmXwHAAwBRgmpw2SDVFDMBpFeD67XYbhCLQOAPaqaWsNinRk4KrfhAxtb5MMoqrRxuKRrWsH+B1m8LGTYp9ojuVNjWZHV/mGxWSCT//4e4MY0oVaViCbA89lpF98573QRnn3e2ZL7DfaSHcvseXbceJ/O514X6gQ6HvKBWVaVl5g== 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)(346002)(366004)(39850400004)(376002)(136003)(396003)(6486002)(16526019)(86362001)(5660300002)(83380400001)(26005)(6666004)(66556008)(66946007)(66476007)(6512007)(1076003)(2906002)(52116002)(6506007)(316002)(8936002)(186003)(4326008)(956004)(2616005)(44832011)(478600001)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: NP46LHhP1wzU/9S93aCxXeGHJhuBrUwM83XVkYaoqYfJbz0KVkCxKgbWAp4nHoax4Gl4b30jZwO72O9F5pg34jZm/FEXVW1Jh/YvKg5FCdH2VZtjVr01jN84oGmY0CZ4MaWlNnvv+uIC6XxWDjiCrg5rO9Iw0MAGMbiA1EY5lqmBhn9ElMXOzxu1FU/Y+feYmbLJQ1PywRmA9Vk8T0LHWn8dCQtuZmxFGTyv617Z71vjSnHt0BvqJqJiQJ3HFKGSgEpMuwvx4OCq3R9f0j2PWRdOm7WzdtPFxoZF2oNWpi8BAwhPukKaFnKyoh27WeU0As3C3ca0rpvsxN8DUMDLOlt8oRdtPbls2kX7vE0F1APzdEjKc96RiMq7ndM0MlZLkf10UQd30p/BImhmPM32UyhfsYNtNeSktIc23tPKyOrX6Hhd7X6C9n1YCveG10eZalrvZJ+3JCAIvYvICyS5w1Ro7VP4PR7hi/VcjbQm26xOKbCRiuuAhUk0jNLoXYZzLZT7RFMjV2+xjioXI2JkuFHo4lSX/MOctkpmHScssuYD5yUF7vcZbDwq9IJoTPlgGcwbZ/Z1Rv2o1dgTtfDXBY5dGBr4fE5+Q2i93tsauPh48P5dgwCLBCPI0RatRBr+0sN3Gx3/xuzRKy5rp3+C5A== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2bddc46a-b989-4e7c-10a1-08d8589122fd X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2287.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2020 09:32:45.5966 (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: lcOm6V6q1UxYdCmkso5lCXn7dhrHfxZ15rHzoEFM5tlqNEvybpcQbg37Ao3RZ6HVDO8r0c9BmmA7+afQXuoGiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7405 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200914_053248_197398_82DF5C52 X-CRM114-Status: GOOD ( 12.82 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [40.107.14.55 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.14.55 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay 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, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Daniel Baluta 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 Mon Sep 14 09:32:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 11773401 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D726D92C for ; Mon, 14 Sep 2020 09:34:24 +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 A768020719 for ; Mon, 14 Sep 2020 09:34:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="c43FgyY3"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="d3cqzsXY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A768020719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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=ff0j/JMr+G4/Oup5F0JQF8OfLS+6nULnYh3UCXR9aWE=; b=c43FgyY3vBje66mwG2qqIB/Sx 0F+sWnmXjOsXkp0PuliKPa9O9Mbj9HZiS4gdV7vgZOby8hhTfLDcx5BLY6+Z4t3nRp0KOSYs2QQLw /xXkeYuyz8IPekq5OMesj2dhxqlDbCHIZtgsmIvYsB7dbza0pra8Pe8/A6AxNNMRSNRK/yXmMPj2Y G4MtDVn/PHIsFA1E8gIMk4v5087U4AA/Xe2Y8KcaGX234XvZalR2uNMQwATkam62CuZnmVSXzJ9QU FuB440UDzsdB5Tf7584RWAn6aPIvBHdQ6pjTXJIpjp9Tgg+M5cC5ma2z7YmK3zPcea7nvDq1pfOru hn0Gjy8nA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHkr7-0005RH-Kl; Mon, 14 Sep 2020 09:33:01 +0000 Received: from mail-eopbgr140055.outbound.protection.outlook.com ([40.107.14.55] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHkqw-0005NR-15 for linux-arm-kernel@lists.infradead.org; Mon, 14 Sep 2020 09:32:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c+Bb5L261vHkT2139hJMsGGh157COytZBy06aMTSZQPm5UkXia06waka9TkTpuEWWpumG4H2YANManmsX43Sm78doMvNYq6KTE/tgoEWZ9DztIrd1bfG5XCRF2O/H+epQm6hhwyZsm/NieQOHEynfz0VqCAEWDJvTVAQFTPyOICTaAwtF2ymK8p5gDRu13i3tYe2pcF28WBmIl3/HWQWW5coT0SHnz6s4h1fTovdWinDSm4N11p1zPt8ZuGuEHbSw2I2nm/U8PqzqOjYBKOW5u8WLXE6/y32ZMA7UdrnY9d0ck5GhPNOqV/zmITVHGRXNq6uruxIoddQau9axTIQzQ== 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=Qx+fvUeueNs7OsvsFQZr7T8aAABL4CCpTJI7Pg02XHA=; b=ezP6BB1aCtajGpXfWkUDGFpTOIYnnYJ/uxqh5RjXPK9MBiF7nsqR/ICofKRx/PrhMzbtyIQNHEQ1pees8ggJfoMoCAVoUfm0ZiSeG5K6+x2Y5kMPKIsqFGo/Q63uAv9o2Ia6S1owv6FnzMCS9H1WsV3kFF/+h0ndoN277ZwOz4NTNGLshV0rFfyABVkQslCxvkBbdH6j/c+WLpT8kJ+FhMpT7Xbvvn4bBbr/RV36lUhipzBLT1W8Wy3a5WZtmC4lL6S+ugDU5PPAaffhrA+TleqZx4KxxpZ0cK6k3bg5LET5R1USARcnbAIcV55Fiy/Y9scgZ7TtHNBBqA/0zmydmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qx+fvUeueNs7OsvsFQZr7T8aAABL4CCpTJI7Pg02XHA=; b=d3cqzsXY7wdNLf1PfaDKqPLx7kYP3PMflRwR2fB7p1/jTk5SyyDbEln9YZzlWm1EehoAYh/qJe0i+X3AOUfDvOhULwIxTiPSzfVfzHp5Wkm9avYQAq+8RKvkH1hD72Uk81BN51qislxLsp859qeA2ZzOAjbH5/1D5yoKvcJgNk0= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com (2603:10a6:800:2e::19) by VE1PR04MB7405.eurprd04.prod.outlook.com (2603:10a6:800:1a4::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Mon, 14 Sep 2020 09:32:46 +0000 Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::174:edc4:7d33:9c88]) by VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::174:edc4:7d33:9c88%12]) with mapi id 15.20.3370.019; Mon, 14 Sep 2020 09:32:46 +0000 From: Daniel Baluta To: shawnguo@kernel.org, o.rempel@pengutronix.de Subject: [RESEND PATCH 3/3] firmware: imx-dsp: Export functions to request/free channels Date: Mon, 14 Sep 2020 12:32:27 +0300 Message-Id: <20200914093227.5094-4-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200914093227.5094-1-daniel.baluta@oss.nxp.com> References: <20200914093227.5094-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR06CA0133.eurprd06.prod.outlook.com (2603:10a6:208:ab::38) 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 AM0PR06CA0133.eurprd06.prod.outlook.com (2603:10a6:208:ab::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Mon, 14 Sep 2020 09:32:45 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a21a4737-770c-4031-1b3c-08d8589123a9 X-MS-TrafficTypeDiagnostic: VE1PR04MB7405: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True 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: uPKlE2TTh0vHOhN6c5yGjfpia4/AR0qYmar4AWL3+l+fQwLIISo+5ds+cCOtTO04MjmNPfwKQxekiEJTOh2Okdgv5vMIhbFp5alqoAXpVunBVsYwMrHHx5b8pjn8bq66ow2Yt6OxHvYjUkg8CUH4UfXSk5jJ3I/IO7oAtdRmlxAgWSrCpOJuZcCNcAGSmEIXqZZQhVWO0KRHU6hpf6ZpIdRkrUKgmGDeBi/q5JkTdqQ5EaDAyeKebCubZBup6p2JnxZumxDCC9dirxX3skHJhRqp5ZOMc6yoRGMDfj4Bj01TbCn81zbMp8Pr2IzFSWjmEAZwcQyuOVa4HK+WBKL7EA== 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)(346002)(366004)(39850400004)(376002)(136003)(396003)(6486002)(16526019)(86362001)(5660300002)(83380400001)(26005)(6666004)(66556008)(66946007)(66476007)(6512007)(1076003)(2906002)(52116002)(6506007)(316002)(8936002)(186003)(4326008)(956004)(2616005)(44832011)(478600001)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Ly19g6qMjvS7SQXJHOs4Cya5+j/hyY7wrR+KQBcJECl4OWKC0+lkYSmGMzrIiZitEVVsgFvn+QO2XMsKIhNEZTvxXZNNamJWpZp/6h9Q/+lwieARDKBQsm1q4vgBj86LTJU1Vju1iRumT/LvAg/Um7KDRljgH7mpg0jS0gfrbWA7sPjBkaMSRXnsmZXvUsSuNNpG6AxNb9Y4/L3k5AQcATi4vNi81JfF/xyyMBr8zbaNxtiLldsGhLEz5ApMNUDoQbWeAzGGlPQxCa7IaDpi8EJZ/gC0e/Ov2GcMgrUUx1gVt/I7ZYrpfa84LmqwUyv2k31ar06lNmu9ZRJGW+Uo9BqeLMS3SbWDksflESctt+3yM1CcLnL3aktftrwRMiqRH3bLi1ZE/6NEpe1n4DdUY68rgrxcTME9vAdTY2V/X5pSiQ0ke3/OwAL6LeV3+Lf+8C6YHR+S59moYn/qdWNqdW3tOkhQREBqy9DE2SuSHgoDW/zIJfokNowlBuY9dz2PqiGybCvsDElkn54tp6SM8F2uYhsNNlSDk0+WHJHqDC6WJS2FsKEGPHKGAHXBmHGty0GqemA1W1S2xOPUBykBzcuIw8aAq1P1uuzbfnUI5TxzFDZZA9RkZrHzCDkHAATJzOy9XiSoRmaocvd9TjGviA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a21a4737-770c-4031-1b3c-08d8589123a9 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2287.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2020 09:32:46.6941 (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: RtfvVe7Y6gI7MoaqavqdWBFq3HE2jBjO/Xnx7QkcU6GKQ/kguwxvB2itsVOrPGK726JEeA8O8nL8EFnpkGFVZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7405 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200914_053250_114355_958251B0 X-CRM114-Status: GOOD ( 16.33 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.14.55 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [40.107.14.55 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay 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, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Daniel Baluta 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 */