From patchwork Thu Jun 29 01:37:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 697710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1067DEB64D7 for ; Thu, 29 Jun 2023 02:12:52 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BF928857; Thu, 29 Jun 2023 04:11:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BF928857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688004769; bh=BTIrQapvZplHTIrW1e9ro3Mnysru2+GDmsjUZqG7m+Q=; h=From:To:Subject:Date:In-Reply-To:References:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From; b=UWtCAlk41bW+PUmAZFKVJiFMKy7is2Uu6vGm8kSRIIKKjRPzkIcOwhVoob07qGb2Q vde8Z72QO/5P/6hWe+YvT8ObAbnrkVOGrkrZdx1f6v88FCcwvXG4zI8Hk/lWXMv2m+ aQJ+AWTwZpV5iMyyeve9dvyxP2eg4fYjsgfEHvG8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1510DF800E3; Thu, 29 Jun 2023 04:11:19 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id B0AC4F80431; Thu, 29 Jun 2023 04:11:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AAD27F8057C; Thu, 29 Jun 2023 04:11:14 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3EEEDF80246 for ; Thu, 29 Jun 2023 04:10:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3EEEDF80246 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id D340B200D46; Thu, 29 Jun 2023 04:10:38 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 9C585200D3F; Thu, 29 Jun 2023 04:10:38 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id D7DBF181D0E3; Thu, 29 Jun 2023 10:10:36 +0800 (+08) From: Shengjiu Wang To: tfiga@chromium.org, m.szyprowski@samsung.com, mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 5/6] ASoC: fsl_asrc: enable memory to memory function Date: Thu, 29 Jun 2023 09:37:52 +0800 Message-Id: <1688002673-28493-6-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1688002673-28493-1-git-send-email-shengjiu.wang@nxp.com> References: <1688002673-28493-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Message-ID-Hash: 4IJNXXIFY5XLMK6WGNULCQU3K2PM75S5 X-Message-ID-Hash: 4IJNXXIFY5XLMK6WGNULCQU3K2PM75S5 X-MailFrom: shengjiu.wang@nxp.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Intergrate memory to memory feature to ASRC driver, call m2m probe(), remove(), suspend() and resume() in different callback. Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_asrc.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 30190ccb74e7..bd5f134e3473 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -17,6 +17,7 @@ #include #include "fsl_asrc.h" +#include "fsl_asrc_m2m.h" #define IDEAL_RATIO_DECIMAL_DEPTH 26 #define DIVIDER_NUM 64 @@ -1380,6 +1381,13 @@ static int fsl_asrc_probe(struct platform_device *pdev) goto err_pm_get_sync; } + /* probe m2m feature */ + ret = fsl_asrc_m2m_probe(asrc); + if (ret) { + dev_err(&pdev->dev, "failed to init m2m device %d\n", ret); + goto err_pm_get_sync; + } + return 0; err_pm_get_sync: @@ -1392,6 +1400,9 @@ static int fsl_asrc_probe(struct platform_device *pdev) static void fsl_asrc_remove(struct platform_device *pdev) { + /* remove m2m feature */ + fsl_asrc_m2m_remove(pdev); + pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) fsl_asrc_runtime_suspend(&pdev->dev); @@ -1493,10 +1504,32 @@ static int fsl_asrc_runtime_suspend(struct device *dev) return 0; } +static int __maybe_unused fsl_asrc_suspend(struct device *dev) +{ + struct fsl_asrc *asrc = dev_get_drvdata(dev); + + /* suspend asrc m2m */ + fsl_asrc_m2m_suspend(asrc); + + return pm_runtime_force_suspend(dev); +} + +static int __maybe_unused fsl_asrc_resume(struct device *dev) +{ + struct fsl_asrc *asrc = dev_get_drvdata(dev); + int ret; + + ret = pm_runtime_force_resume(dev); + + /* resume asrc m2m */ + fsl_asrc_m2m_resume(asrc); + + return ret; +} + static const struct dev_pm_ops fsl_asrc_pm = { SET_RUNTIME_PM_OPS(fsl_asrc_runtime_suspend, fsl_asrc_runtime_resume, NULL) - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) + SET_SYSTEM_SLEEP_PM_OPS(fsl_asrc_suspend, fsl_asrc_resume) }; static const struct fsl_asrc_soc_data fsl_asrc_imx35_data = {