Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3713894rdb; Wed, 13 Sep 2023 23:34:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYkfOfYb301qqSuRizvzJrgED220/GTdTgJGboeFjd2Dwlg7sZ60U56XCQQlNnQcrlbVuD X-Received: by 2002:a17:902:e848:b0:1bc:25ed:374 with SMTP id t8-20020a170902e84800b001bc25ed0374mr6293246plg.49.1694673289819; Wed, 13 Sep 2023 23:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694673289; cv=none; d=google.com; s=arc-20160816; b=OFiXKzYF5ZzBedkF+zeGs3SSLCoRrDMBo+3dju9QLQkoE4Bd1QrtkXHeOTt4cmpOtR aWKZzUd9Upq5XeNexdUYVGIC0R34AUYbjpfgEfritrFfb4ahqDHdPVDU4qOMNU0Md+ab ifVduPNuyRfFpLFH10SHdHS+6tWUC4LxkcDioA1qOFLk2QIFWidzbm4Z3589J1rlUvcp pkZ6Qm2nvXl7r1EtfM24ygrfTFDyxGEkH/ZH69QF2bIRqH4qFs72VPZeN52WX6uS98mn kUOpOTzMKlV4rNGchKhDZqYg+U+n+c44UyxEdQpZNXkfsvG/C5IbUOcuo7+Q6hqtpduU i28g== 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=xg/lL1izOwfPViBEu6uN1F1cohAzJQqYUqv4NHJdz/8=; fh=ufiESpW7Hvn5oNmN0l6/qCUiQrKfLLrOwb5uR1Dftds=; b=WNNgGx1hytL4BXWThZVugLpdaZvEI5Mv+FHzmOFlCh2PdlfUf2aGxVi9zNFUuOzomG uF+6EWi+0i/BMsPJUhxbg4EaVjm7WyN2TMDVCD8pog5PGfRBxT0ibu2rPlVJSufql/q3 1LQL/yNXJRDQrm8KJR1OzqPYDGsBpjLREvTwfzOLE9IqG8jk2ssk0TRi7wuSJKdIKjOv /Yhp9l5ikguJXsH1bH+Ul4yLSSwlZ1xZQgAZMyFhhTIzs/ChrSi710Bo96EoIWNogOk3 GYoCq0h3TAnPS9AhzYT5Hf9zfWvE3dUk+TbQGpzgV7hTT/KM6Wn2JKm9WuRSEKr09vSy ZbuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id jb15-20020a170903258f00b001c3e40dfff0si1001036plb.359.2023.09.13.23.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 23:34:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3AA4D820C373; Wed, 13 Sep 2023 23:31:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235721AbjINGaz (ORCPT + 99 others); Thu, 14 Sep 2023 02:30:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235651AbjINGau (ORCPT ); Thu, 14 Sep 2023 02:30:50 -0400 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92B78CF3 for ; Wed, 13 Sep 2023 23:30:46 -0700 (PDT) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2DD081A0645; Thu, 14 Sep 2023 08:30:45 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id EA2A81A063E; Thu, 14 Sep 2023 08:30:44 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 0FF351820F59; Thu, 14 Sep 2023 14:30:42 +0800 (+08) From: Shengjiu Wang To: hverkuil@xs4all.nl, sakari.ailus@iki.fi, 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: [RFC PATCH v3 4/9] ASoC: fsl_asrc: register m2m platform device Date: Thu, 14 Sep 2023 13:54:00 +0800 Message-Id: <1694670845-17070-5-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1694670845-17070-1-git-send-email-shengjiu.wang@nxp.com> References: <1694670845-17070-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 23:31:28 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Register m2m platform device, that user can use M2M feature. Defined platform data structure and platform driver name. Signed-off-by: Shengjiu Wang --- include/sound/fsl_asrc_common.h | 12 ++++++++++++ sound/soc/fsl/fsl_asrc.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/sound/fsl_asrc_common.h b/include/sound/fsl_asrc_common.h index 7f7e725075fe..e978a2f9cd24 100644 --- a/include/sound/fsl_asrc_common.h +++ b/include/sound/fsl_asrc_common.h @@ -69,6 +69,7 @@ struct fsl_asrc_pair { * @dma_params_rx: DMA parameters for receive channel * @dma_params_tx: DMA parameters for transmit channel * @pdev: platform device pointer + * @m2m_pdev: m2m platform device pointer * @regmap: regmap handler * @paddr: physical address to the base address of registers * @mem_clk: clock source to access register @@ -104,6 +105,7 @@ struct fsl_asrc { struct snd_dmaengine_dai_dma_data dma_params_rx; struct snd_dmaengine_dai_dma_data dma_params_tx; struct platform_device *pdev; + struct platform_device *m2m_pdev; struct regmap *regmap; unsigned long paddr; struct clk *mem_clk; @@ -144,6 +146,16 @@ struct fsl_asrc { void *private; }; +/** + * struct fsl_asrc_m2m_pdata - platform data + * @asrc: pointer to struct fsl_asrc + * + */ +struct fsl_asrc_m2m_pdata { + struct fsl_asrc *asrc; +}; + +#define M2M_DRV_NAME "fsl_asrc_m2m" #define DRV_NAME "fsl-asrc-dai" extern struct snd_soc_component_driver fsl_asrc_component; diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index f9d830e0957f..7b72d6bcf281 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -1208,6 +1208,7 @@ static int fsl_asrc_runtime_suspend(struct device *dev); static int fsl_asrc_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; + struct fsl_asrc_m2m_pdata m2m_pdata; struct fsl_asrc_priv *asrc_priv; struct fsl_asrc *asrc; struct resource *res; @@ -1392,6 +1393,12 @@ static int fsl_asrc_probe(struct platform_device *pdev) goto err_pm_get_sync; } + m2m_pdata.asrc = asrc; + asrc->m2m_pdev = platform_device_register_data(&pdev->dev, + M2M_DRV_NAME, + PLATFORM_DEVID_AUTO, + &m2m_pdata, + sizeof(m2m_pdata)); return 0; err_pm_get_sync: @@ -1404,6 +1411,11 @@ static int fsl_asrc_probe(struct platform_device *pdev) static void fsl_asrc_remove(struct platform_device *pdev) { + struct fsl_asrc *asrc = dev_get_drvdata(&pdev->dev); + + if (asrc->m2m_pdev && !IS_ERR(asrc->m2m_pdev)) + platform_device_unregister(asrc->m2m_pdev); + pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) fsl_asrc_runtime_suspend(&pdev->dev); -- 2.34.1