Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20062279rwd; Wed, 28 Jun 2023 19:23:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlF+IMaKGrDNu5BXMf6fvcYwATX0UjmJn/GBfYDKvtq+J0GGQNON80K0qIB+VAadbSpP1V94 X-Received: by 2002:a17:902:cecd:b0:1b8:5a29:76ed with SMTP id d13-20020a170902cecd00b001b85a2976edmr253513plg.56.1688005416158; Wed, 28 Jun 2023 19:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688005416; cv=none; d=google.com; s=arc-20160816; b=aYdB58W4Ig82VbVRH9u5uk7g/JCCrWRp+8aeLp9ch14XI4ifIVTFHrZ0axrbREdPwr ORml+K7WoHOyguMzGNsPgNtHuhi0GGthYht4mp8+5rO9ea7gbrWT4vY1b4VcBLNA6+eZ DttX/LiXWqbT54Z7HsIKrX3WWo2IDgeYXRQ0Cbd3DnBdUtzJ6xK/wl0SJjL1Q9w/MIfS NcYLpVFxrkjVj6s8ga2W8a0POuF71h7qUhYk7XqId9pGUluz9plKuG5stFcED11L7Smu /s/3cMvX0/pQkspTFcWlVe+6hP11m827Noc+DhOr/f18VbGd4LXCZrrJzKYjADSVMFfW T1DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from; bh=5Qjm4ePmpv79hoT44upDcBZm1WHimuRLUQMGqj4WPds=; fh=wqCnLC59fNJLqJJs3/NMi5/oD30IP5JQsz1JrCsHxko=; b=QTVIEdt+d3hcaFZ6Y2Kz64/9ylQ+PBbEeexFQQkjyDg0+RYF180u6bYflXd2wsYaxE kgUHfz4t6vy3KowaTRFIDpGqANKR6qnO3ZFgor52JS7MdRpf7HNy/PA0KHYK35p4lI45 xT2DiZoD8tlULaZ8WhpJGtQRgF0UUPgDPt7J8+Q//V7MDvp58C8hwCOw9BVN5yOKGtR8 7UPpLbKp3V9SlsK6fgejXHIfGL+6S7cU7GA2omGBHxBPONEIi6GrETT3i/YroLx6UFnL TBOCtWOlbei595scwAjB3KRb6Q8ZQpenP2ou5eNcHjPzH8mxB2LeOlTmKSyFijD9g/bC MTzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a170902b60100b001b69ede5b79si9278951pls.470.2023.06.28.19.23.24; Wed, 28 Jun 2023 19:23:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231879AbjF2CTJ (ORCPT + 99 others); Wed, 28 Jun 2023 22:19:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230447AbjF2CS7 (ORCPT ); Wed, 28 Jun 2023 22:18:59 -0400 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 383E12134; Wed, 28 Jun 2023 19:18:57 -0700 (PDT) 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = { -- 2.34.1