From patchwork Wed Jul 8 07:35:54 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: 11650925 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 4486713B6 for ; Wed, 8 Jul 2020 07:38:22 +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 1D7EF20656 for ; Wed, 8 Jul 2020 07:38:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mkbOpod4"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="JfI/uxRL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D7EF20656 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=mkbOpod4mXoU1SyUBQh1LuWPW FSDqLuD5pq2fdKRoCklYy8GOxr1GUsZjLbjAYuhDiZmfdLMG8lSxceUnpbgCw48VID/JOlyG2j6Ci 0JwlVNL8yiud/zKiAF5gSkIFWQ29EyOoAPnMFfAyCddHCUmnyefNwIAxkl4c+pD8lb9nbYWElJH9T Fth2rgyHRc1mOsqqabdrZHcnACdROeQSEMXV2g7u2ubfprFCgN1qzW+Pto57hyutYq4eVHzOGxWda 5mUfPWXNJlLyiGQ7CQJe8oqR9iYnqCrRsNVYAx4JVLqZuOKKl/AaaIduw2kT7PSdTMeVCiuFNqVqn qGrEUEhdQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt4dB-0008PE-0Y; Wed, 08 Jul 2020 07:36:37 +0000 Received: from mail-eopbgr80045.outbound.protection.outlook.com ([40.107.8.45] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt4d5-0008MC-NZ for linux-arm-kernel@lists.infradead.org; Wed, 08 Jul 2020 07:36:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ivMeW7U3S+Uh5wOCpf+qsZbovc+3UnXgjeS+yCIy7y3ULfp8//QjloWd/ar6/5kW7/lXGLGcJHOgv/r57iOIzcFhwSUubjL16vxLEYK3s5pI9OF5Evb4r7mkQTthlzJeFcSLHNvvctKLOdrn5ieRozE/H53ppr5vvAWy+85peSaQPk2ATy9htbsglTxPURSXIKJNQQL7uns/jKlKINTtZS/e2MmjzuP8PnTQpcbGAKWLuvmZ8BQfG51CspGbB+9aB5M1RRZpjRg84I5ByPgkZjzzG9HUsMmKT9WtRalnr7NmzS+t3NEge8KtGkZN9WDgsBtMcLJn2LILMr5pswRBbg== 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=NGyxGQGGYvsCmonZOxEbb+ZWOMRubUeBj2y8NpQX24kjH/j5rWU7E4a45Of0P2xkf6vTT/2Qw+y9+K8t2gdMEZlZb56hyGNdUmW2wM7pUrRIAl0kSD7h6oCl48cUPjOqqUPpeJOxWI/nrj+YHmDqKJT/lKmWD/btS/5BGR90BbEGn417PmbLd+jDKzhkDdTtoOx2+iXiPQDLG19q23BTFevnblokD5f9dosLHGVC6JEVt5LS2ljr7w9RMPD92V23P5M1Q9qyQuuEy64WACzKsmPxE9pJ9xhNCDvCqhtIx08ojG6v7B3e+9dBZKd0LXft0mVJxQrZlFMM/SwgDNLIYw== 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=JfI/uxRLvY1pE/lYzQb5TV4YLHPaN02DQpu5LGyELiWZySBN+Hd5O7FGrPt3jMAclibooBOpNedd8/gXXdrY2MeQqI4uv+i0Sz3+x/mYdh1YlutIz8U0xXnct6I7K1QTFQwDDhvAFE1D75nSYZQk+F619a5XmHEUt7QOzqv0Brg= 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 VE1PR04MB6734.eurprd04.prod.outlook.com (2603:10a6:803:121::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21; Wed, 8 Jul 2020 07:36:28 +0000 Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::9d5c:685e:4b51:fa60]) by VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::9d5c:685e:4b51:fa60%3]) with mapi id 15.20.3153.030; Wed, 8 Jul 2020 07:36:28 +0000 From: Daniel Baluta To: shawnguo@kernel.org, kernel@pengutronix.de Subject: [PATCH 1/3] firmware: imx: Introduce imx_dsp_setup_channels Date: Wed, 8 Jul 2020 10:35:54 +0300 Message-Id: <20200708073556.19188-2-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200708073556.19188-1-daniel.baluta@oss.nxp.com> References: <20200708073556.19188-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR10CA0067.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::20) 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 AM0PR10CA0067.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.20 via Frontend Transport; Wed, 8 Jul 2020 07:36:27 +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: 69aa9624-65fe-4919-1e7a-08d82311a051 X-MS-TrafficTypeDiagnostic: VE1PR04MB6734: 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: 95VmzV5nXcQNipPgl0M4IHAtdUFVZex39APJdK6YTKzJXIyYcYYKP8cxG6aNkA/kCbqb/4DGCxdgc4EvXMtnfkWYNt7Tg62D5gs8cwmi8WmxV9AmPQVQN7OT0iVw5ntQe9EFR4BZIp9Y8GMNYtdDZu0PPXkIyzNkyqZ/8WjbSXcZjxdoFrL2O7hB0Eak60F5Ag6CujB+q8jslUt8S4hsYdXX0RIWz0H+IsFcdRBmbmS9pnDAuqxL2buTmEQrQcdCytrDUpDfW7NRlVX+pK5wq+hiSjaBF96O8jkMLzD+dNCyF/VhEgp5LR8NnmxnIT+lqWqWDHgHwsmgGJWZsaTphw== 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; SFTY:; SFS:(4636009)(396003)(346002)(366004)(39860400002)(136003)(376002)(83380400001)(26005)(8936002)(4326008)(186003)(6512007)(16526019)(86362001)(8676002)(66476007)(66556008)(6506007)(6486002)(52116002)(478600001)(316002)(66946007)(1076003)(6666004)(44832011)(956004)(2616005)(5660300002)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: lA4f8WTRLIq1aB4/r+xKoJlFUxn0I2Nby2Hvsp3MhSx2kCgi2QQYyj1XaTIYhvOBqaRZu5Lv3PaHc8HJvh2Hr/ouHbzOhZmYP7Oo3/S22GgS8KXre9sDctaPGvVVLT2vYQGy5EoGzf3MzuASiYWfP2PWd+vltAECLEPG2nAyTfNixB0TrcwfjyU/fXpN8q00rQ+D+m6v3D4RwZwQAudrGvL6Gew95e109E19xuyPAE3Fn5ZuYAyaPFDUZciA+jjzhYhrsSrt3Oe515nOGwF2j15qMoJqzC5qNWyvlTH43WVXeCKOFYYBzkdzCiTleQD3Rx09nP5rCbqSKf2UDtp2px0DtmSNaISuoecZ8KZV4MIn2lPFJr4iZd98FR6v3Z0Tbmqs8P0Sp3tl1wISp9pmqfUUfaKrah7wudpnEQ4yxBll/dFUARZF1M+IgoUGdkUoTLi2faxv2PFfoJhaXJOoc6t4xIVSCE431PrnhkrdpTo= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69aa9624-65fe-4919-1e7a-08d82311a051 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2287.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2020 07:36:28.6630 (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: +zf1v7r1yKE9bqn4yXvYqicvOEjc6zTrePgxFFtjsE5iXJm95x5Jq/wLpppwftZlCvtbhwGKvTEotKiFKLcF4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6734 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200708_033631_775872_6100AB66 X-CRM114-Status: GOOD ( 14.86 ) 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.8.45 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.8.45 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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@rempel-privat.de, linux-imx@nxp.com, 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 Wed Jul 8 07:35:55 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: 11650923 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 BD12C14B7 for ; Wed, 8 Jul 2020 07:38:19 +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 96A942082F for ; Wed, 8 Jul 2020 07:38:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eWp371PH"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="Y25LbSlw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96A942082F 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=eWp371PHl8N1YNbT+CWeS6NzY tvZ5INJHFEcQRjgLHhW762aHvTJYUzRR/2JUu1GZcbLtR1jXZyNXxJeLL5iCMWpq4C4lUB2x8macu 7cd0ehRI3dS91kEixiLrEctR/bTvIu2qcEffZIchzA3diwGM+ekYMhUTfmsM93hx/0O2C8Za0uBXu Vd7mU0ArlaoAp3v/EyCz1Uxp74X6zLZU5WUoVj8z7xwOnJ7eefs+7gqd98+w083lsAyIryIWmKAeH +FWqxBcbdUfPXn6RTa3R9pfHK1SwNoFdeSdOLwGovRCk/fRwRqRrRDOuwTmE2ZWrXoMDm3Kiqe7Su juoBzxghw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt4dF-0008QM-1L; Wed, 08 Jul 2020 07:36:41 +0000 Received: from mail-eopbgr80045.outbound.protection.outlook.com ([40.107.8.45] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt4d6-0008MC-R7 for linux-arm-kernel@lists.infradead.org; Wed, 08 Jul 2020 07:36:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jF3jYgLK5Sywyd04cuZ3KYd6HWNPpPIL0VAN1SpsFBpak8jHaeBCHv5Yz5PXrCl6/48iuDvB5MQuQLS9icn7QW/fC5SkU8q0SWDAfgi9VXNBAJ1S13NqZ4VsLFwQ8lsee+uWp3X6QEdK7wmAglcnv403FWCzBME2+t5sIgyC5GDu7NekM+KdyWg5jMldWDglOS6rNA8pkFND84uIG9JqQHt4Twvg5TIE35HdEKlqTNWYcIPZ0EgNvmseV1NYB/Q9RvTvy+HZUrn7Pd5Mpb2LCzEu6okDRVuVMuGCO+kciOa7Vur+OyJiSHPIcqDeN018d66FR8J2MyI4f4pWpASOsA== 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=nq/X69GH0Fms8f7vCfv1GG9XjTQRVuzzImXHXk5W+H0n/jlAsJZA118Ljn4Jk+vuMPm53iveBkxutzuPXN0K4LTV3ClDe0YcpanN2zYoUC007EbJylv+f+J3hKBxlARHZCrbNsdUdSAQIhgSV2Xc6p37jHc6M+/L7+nCOJxDCvywoAjuzILRblOG1X3GunA5iYmCECeHOHWjp6qQWrhXi9aGISB7Ti2GgucWdTxAA7bYCWrwLSjeUBiDCw0zcStX+u18Zx+plUx2IaiZBeMw7y3s4YPTpsu52zQngdK3hzW0oJaEdSLJSUyNrXOutaF8Yn/kDFOPvuhexhlDflnVcw== 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=Y25LbSlwO6+MKdTUtjUtdR85T0wqcu2qLVkp3QrL0JF5YnQ5lF2/dBi2dNr/qJOAk5VmISs+S2q0PQDtJkyWTzA35IdafdeutoJiNT/pkIVOCjn+yrP584TGHwRlYRqicTU38aBEgfrNc3pL8SdzufxlLSG8EFLU/btGLxrF8P4= 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 VE1PR04MB6734.eurprd04.prod.outlook.com (2603:10a6:803:121::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21; Wed, 8 Jul 2020 07:36:29 +0000 Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::9d5c:685e:4b51:fa60]) by VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::9d5c:685e:4b51:fa60%3]) with mapi id 15.20.3153.030; Wed, 8 Jul 2020 07:36:29 +0000 From: Daniel Baluta To: shawnguo@kernel.org, kernel@pengutronix.de Subject: [PATCH 2/3] firmware: imx: Save channel name for further use Date: Wed, 8 Jul 2020 10:35:55 +0300 Message-Id: <20200708073556.19188-3-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200708073556.19188-1-daniel.baluta@oss.nxp.com> References: <20200708073556.19188-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR10CA0067.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::20) 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 AM0PR10CA0067.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.20 via Frontend Transport; Wed, 8 Jul 2020 07:36:28 +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: 871cff37-bc8b-4ef7-ec31-08d82311a106 X-MS-TrafficTypeDiagnostic: VE1PR04MB6734: 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: OEN2nt9UmYTUj3adBm1jWoX02Tq//Vvd7s7iOMRyhHa9GBVerkBHBS+8Wx/Hfyfws8FPDWVXl68i4ifFxqpOjiG6xfXd/GeAgnViazDML7XnnKXBmSOXVSoyiQxZfZ/Uvz2cWg8PgljtRXvVl6/qV+g2q7Y1kR9kozu9TV8Ae8J1d5aBpAm7ub0tPWxATNKR0x3mO3cPcn7BSkmV/DR+5u55BanFzHfhqxX1Zyw93Ga770qdOR9w3IXcY2LQTHKA15gbtT8qq7o3Eq/rMHc3jHJX12RI9D7rGL6a0PT45ArLrprgV1dqyXTrUW6atSwYtLq+8JSVGlNumDteJBLULA== 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; SFTY:; SFS:(4636009)(396003)(346002)(366004)(39860400002)(136003)(376002)(83380400001)(26005)(8936002)(4326008)(186003)(6512007)(16526019)(86362001)(8676002)(66476007)(66556008)(6506007)(6486002)(52116002)(478600001)(316002)(66946007)(1076003)(6666004)(44832011)(956004)(2616005)(5660300002)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qXymWbUgZyVX+tlI6x1t2mruIbEM9jm87eEkrAT2txSqa24QKA9lBlYz004q6E4SIpzF4DwX9NpuSdGkrHQSUen/ZfARsg5I5KOpPSXo38DpHRuUjK4tUXrsAFjyVnZXQ5mMrPqkk7N0IMqkLqSI5u8rApiSc2avh/w4WfSVFIaNU080NUQSD4nUeEZ9CRgYcqbtTBQSLWZo4/MUMLi98i7JDGz/tJRFZhHUtj3wuLkXA5j5AOB98xEXTOSsaIPLMwN6Uc8JAfZxbp9IF/GHFrxFnTd7FhBCB+wyARUMcUwftUe+95yi+SligK7E7z2of51BvPrT2lrG5Qgmol8Qe4AZ496XeMELHpLFmv1gHZwCLh8l/n+sFqqg85gmuJdaxkouxHaem53ScoScpF8QoythRZ4qnEwUPeZyspTMzmxZIwrXkrOWdfoL69Nq6RWiN5hza4FmNcH5swH1xe2+v8hZTx3FgJ8g3RLgkve+/GM= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 871cff37-bc8b-4ef7-ec31-08d82311a106 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2287.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2020 07:36:29.7895 (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: 1M6oOps3JgVy70qNaV9QH1oVRgkT4tBlBRe2VgadFyS6UF97vJ7ILqhK2SLa6OZwnJoqQqiczUQ1zgi8ctlBVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6734 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200708_033633_016436_4E8498C6 X-CRM114-Status: GOOD ( 11.40 ) 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.8.45 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.8.45 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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@rempel-privat.de, linux-imx@nxp.com, 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 Wed Jul 8 07:35:56 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: 11650927 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 B46BF13B4 for ; Wed, 8 Jul 2020 07:38: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 8CFE020656 for ; Wed, 8 Jul 2020 07:38: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="lqwMqXAn"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="EyXNAWiU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8CFE020656 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=lqwMqXAnT3Pvzj4aKNChw5MGX dubaNBZ0IkCgTK+r0KaD9N2ntpcTineZvgqYt6m0vEVtfZcZoxVL5PX8hSpqRlRlT/zpuWYGx+OyJ JnwS3YYzIC1vhwwq0R4M+ziuF3UAyilu8T5euzYVH1EluJ6nWp1utOOfBui4SWsUF2zakqW43Bq/0 0+MmAhfyMUJFfZcmZruFsUI22BwD2x4x6733Pyg9+cuHK1qLLyYRtJpooupinJKc+GjtIR0LLRUdN Lei5AZ8TgMOcLO04NzaY0oBUdtHqUEHvaa/Cx2UolyyPf//mMCeQmciaiB8PMsjn5aWbPhc8KTdxg CQTYG+1Ug==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt4dJ-0008S8-FL; Wed, 08 Jul 2020 07:36:45 +0000 Received: from mail-eopbgr80045.outbound.protection.outlook.com ([40.107.8.45] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt4d8-0008MC-1T for linux-arm-kernel@lists.infradead.org; Wed, 08 Jul 2020 07:36:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K+qpoLtFeRc8IWJ9kwp0cYCv3SDfu11u+tZGh7r4qLZTfgQu8+SvnerpG1KxWVIpUhxCA8O+07UmFU+Uc1YpfFNA2t9oqBuKlvT1ApAsyNRXXJMhzrE7I6rrprdLqlfxEvFz9OL8cPSZ+7sFlzGpF3/2bXdUZhn2AlzxCqlolCW0Lg+qFVKz4C1X1Bllhj3o8IZ30udUbjMZxyAwttStxbrLNxaq31KFcpLq4EhLE3Kc7bx6dz+9cBf1hD0DwDxeCqR2UDuBdkM4UMTSi2yiThEwnlAZW6RQe0OxzyxVbPCRfNc3MM9BEX0m43IlLGtREYl+twuQBdFGRmoCKrz2IA== 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=KiKgB/AWh/20WVfn/CTNyDV0XU2f/RD1h639/QB5n+wy/61A2hOj5Xq750/olln19JILWHjcnp17hBZZuK7L+wY44IQNAqvfYJhvgbkXMMktQI+9Rwe69vCS1peRDYE6SNt3UDNKV9bDPvyfOuIYq+0yYMTEjJrwQOcQ7XBcIoQjKj3r+F1YciXkfKWpXeEbl5tTKinzEUJqcTOgIut9arazUJ3pbvibhXTG+GNANV12zuHC7/VLS59kmVyRwyx9gyjaZIesephqe4EUhLO7iTJ8cy5JUa4eHEeb2LebOsHX9jatpQU3ZrhQxl9H2OFKKINZ9yMluDnr4oaLejFSVw== 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=EyXNAWiUubtnd9azdK/AIjhpyrCjc1U5fdPD/NDerC9frQJp6SNRy9smJbA6BATfYZX6HkrmoKKJTTXY75TUooL4KDjG2HGrUnyr4ZyiQhCCcbNoXyzsGt1C5JOxIC9J/8QAu2WEinMkwq95WLW/50HT0Vca9M/IUluslbQmuCM= 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 VE1PR04MB6734.eurprd04.prod.outlook.com (2603:10a6:803:121::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21; Wed, 8 Jul 2020 07:36:31 +0000 Received: from VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::9d5c:685e:4b51:fa60]) by VI1PR0401MB2287.eurprd04.prod.outlook.com ([fe80::9d5c:685e:4b51:fa60%3]) with mapi id 15.20.3153.030; Wed, 8 Jul 2020 07:36:31 +0000 From: Daniel Baluta To: shawnguo@kernel.org, kernel@pengutronix.de Subject: [PATCH 3/3] firmware: imx-dsp: Export functions to request/free channels Date: Wed, 8 Jul 2020 10:35:56 +0300 Message-Id: <20200708073556.19188-4-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200708073556.19188-1-daniel.baluta@oss.nxp.com> References: <20200708073556.19188-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR10CA0067.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::20) 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 AM0PR10CA0067.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.20 via Frontend Transport; Wed, 8 Jul 2020 07:36:30 +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: 83be978c-7aad-4f9a-ff30-08d82311a1c0 X-MS-TrafficTypeDiagnostic: VE1PR04MB6734: 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: 0CHu0demtKQnLWfIRI8TKRFC1yIp2v3cjs3whQTmJY3YidIUmK6gEnx8Y6F2v1mcR6asgXFjaiEdnHQS40JqBgZiBPq6JgI9u0P59TSNb5iFuk8JrJeaYTJPqgdq52qcXMXjnx8+OJigi2c67eTdWAJUnJ6D4g9WoY+PDXjoQBHonmHbBfXEoS5oMrofJDJeeaEBByQ2AGWTCGLx+1+wSHoodrsIyd7zsUhz3WwX6ZWjAUGe34eAIHpysQ/xuQoxLbSKvHXtPdnm8aZFRvrnmW5aPd1Tx4P9A+X5RMmpXZ8Z1lMjPhzO9cUmZSiJhSlqEtNV377zk7g+OGAQt3ka5w== 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; SFTY:; SFS:(4636009)(396003)(346002)(366004)(39860400002)(136003)(376002)(83380400001)(26005)(8936002)(4326008)(186003)(6512007)(16526019)(86362001)(8676002)(66476007)(66556008)(6506007)(6486002)(52116002)(478600001)(316002)(66946007)(1076003)(6666004)(44832011)(956004)(2616005)(5660300002)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 18jxE88tqGKa6ukKk65SMz37trM+A/pr+lQiX7sVmRXGewXHG8WSDgKZ/8Rdq9otcj0PCrAF3eppq90MC4MsiFWuo8jozcGPTL0cq9jXYSXpKnf7BTD9LnTqqHO0EFri/GzPPVEYYdJsOX53jyljj3InsDSZFsi7c0LWDit6lfi1hCOPmuI/og+Qn+7+OA/l6DfnP3Wk6oYm4I/G68d7araNnUIKj4pPgWggwAtLkxVvQ1QCwmWpTZlzpCv5+W4ac9N66IurZIALUdTDWD+mDqeeOMqTnfhBCKT+SQi7TvTTx9LDE2T0ZYSkSvCesB4hO6C/W9dZOXxodb1+JM7q3PO6wFpdL5FnKdtBELNmB2XSx9k0ELTMPcsHfw7kUJlAzI+bnSnbe/Obe2ssvz3TY//yLeJKuFh3IaUq8bsaHaT2yDR36qOgaWcYekBU5Ln1xVkrz/tNY29Cyal7VO2enVEkuhGMprK4I4K11vMuexQ= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83be978c-7aad-4f9a-ff30-08d82311a1c0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2287.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2020 07:36:31.1709 (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: T8MFjRQctFMtIEig/WPBv3HN1OIJbAaRzB9wX3yjnDvqrraWjTLLubqLHFTL606FLygPCQGljN6DOabST7K4mg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6734 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200708_033634_141789_E48564D5 X-CRM114-Status: GOOD ( 14.91 ) 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.8.45 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.8.45 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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@rempel-privat.de, linux-imx@nxp.com, 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 */