Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp342893rdb; Thu, 18 Jan 2024 05:26:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHH0KM17U/1P1Kx7Y+FxOikLF6oR4bFBmSlnX33HWKIxxWqMxh2+TLB8hGOn/0Vl7cjMZFR X-Received: by 2002:a17:902:ec06:b0:1d5:7524:6d21 with SMTP id l6-20020a170902ec0600b001d575246d21mr3562273pld.42.1705584382301; Thu, 18 Jan 2024 05:26:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705584382; cv=pass; d=google.com; s=arc-20160816; b=p+xMDGqfL5YFzbeGmEO1VWKgGUFd+1LADvefoLMfjRxMg91uRpFtAQJqOZzvRbI0Uw EcAUQQ8nVYtjCm7s1eWCDQMF8lUX1hrFaPDhmNFpTUfknYI1gBAxifafx+MP343XkJWT 6gTDqILC8FtGdCujmraauf2SeIXPKO/hqQKaLqWouvrkSxE+wJ+XNolEVhLL6AdSllcC C9JixDG3BWp57ClfqhtdeQNUvChFo053KUoGMEU03Bwis5/3jtH2UL1NHbYCmpl0EgN1 gA/WML1QyTCtcSr8aFAPuvel8eVFURpv7FImzXwh1t09BPvwKfoSkAvvrgcyrdfodepG nPJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:to:from; bh=oW6Td+yZdBcswzs4YbvV1IwkuphzT6dkcHAjG42TM4c=; fh=ufiESpW7Hvn5oNmN0l6/qCUiQrKfLLrOwb5uR1Dftds=; b=Ktpem7cETROWOIvSBuR5hMhvWFMghShum4h5QD0ykcbniGmLaxnc93hdreHV4i2jeb uyYt7HN5Eos5ezLMj5R93f3k5tpppnO8SbhtD+rhfUWSGkQ3qUok5tNbD9whFD5OyJNQ CB58+CCAoiVznL9X4E6+QsITTir8RCn7FCwvqbgc8A1hGYmxcjMwC7oH/VizvWiGMCus XK4mEEWr2jgpfSTWf3cFbsU8dG7szxZO52VUHqODMgK2UK4/LTvVgaXGtO/Mwpdz6+fn Lc3bgpa9MEE8eAnHKuZzh5ihNBci1EkwwoIOSlDL1SON0sq3ChpwYLDuRzDxZcl4w+gE pnww== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel+bounces-30148-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30148-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id cd23-20020a056a02079700b005c69bfbde6dsi1475560pgb.202.2024.01.18.05.26.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 05:26:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30148-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel+bounces-30148-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30148-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E55B9B2281C for ; Thu, 18 Jan 2024 13:25:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A143B25750; Thu, 18 Jan 2024 13:24:53 +0000 (UTC) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82D5C241FB; Thu, 18 Jan 2024 13:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=92.121.34.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705584293; cv=none; b=FezkHwEBBWsbEZk7JAefzFz2XIIJCA8EiZzGmyzpkvha8fC2hW8RR2sjgNnICgDCXQ6qbO2kFD9cqMAZ0FMOTqyQSkRjfG7FeZh+b17FY0WBW3MjoBCl/8Ts1wXeVmPQbri4BQJT3D/idpAs0szgM9j80Iip302YXrYzFyC8az8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705584293; c=relaxed/simple; bh=ImzNxqs0xkj2U6J7gTa9sJdI5GGIwkLF3v5xPj/nHYQ=; h=Received:Received:Received:From:To:Subject:Date:Message-Id: X-Mailer:In-Reply-To:References:X-Virus-Scanned; b=Pn710p+LQtVLD5BOwNluwFyMJWGDdkZTvwIyvGBVPnwWjdI/sAAmExANdYq+2kY6EzuzZxO3Y1ObkHakbdZ5TxzNpTaoew1fCs/AyJMtmMokV2VlTGOWoqhCQB4kPU8fYYrLZ7WWw4xYxZHTo0xzvzjmXgAFq41vQ6ugaVspZkY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; arc=none smtp.client-ip=92.121.34.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id DEBD41A1241; Thu, 18 Jan 2024 14:14:55 +0100 (CET) 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 7D75A1A0762; Thu, 18 Jan 2024 14:14:55 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 784DA183AC0A; Thu, 18 Jan 2024 21:14:53 +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: [PATCH v12 04/15] ASoC: fsl_asrc: register m2m platform device Date: Thu, 18 Jan 2024 20:31:57 +0800 Message-Id: <1705581128-4604-5-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1705581128-4604-1-git-send-email-shengjiu.wang@nxp.com> References: <1705581128-4604-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Register m2m platform device, that user can use M2M feature. Defined platform data structure and platform driver name. Signed-off-by: Shengjiu Wang Acked-by: Mark Brown --- include/sound/fsl_asrc_common.h | 23 +++++++++++++++++++++++ sound/soc/fsl/fsl_asrc.c | 18 ++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/sound/fsl_asrc_common.h b/include/sound/fsl_asrc_common.h index 3b53d366182f..c709b8906929 100644 --- a/include/sound/fsl_asrc_common.h +++ b/include/sound/fsl_asrc_common.h @@ -71,6 +71,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 @@ -103,6 +104,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; @@ -139,6 +141,27 @@ struct fsl_asrc { void *private; }; +/** + * struct fsl_asrc_m2m_pdata - platform data + * @asrc: pointer to struct fsl_asrc + * @fmt_in: input sample format + * @fmt_out: output sample format + * @chan_min: minimum channel number + * @chan_max: maximum channel number + * @rate_min: minimum rate + * @rate_max: maximum rete + */ +struct fsl_asrc_m2m_pdata { + struct fsl_asrc *asrc; + u64 fmt_in; + u64 fmt_out; + int chan_min; + int chan_max; + int rate_min; + int rate_max; +}; + +#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 7d8643ee0ba0..5ecb5d869607 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -1187,6 +1187,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; @@ -1368,6 +1369,18 @@ static int fsl_asrc_probe(struct platform_device *pdev) goto err_pm_get_sync; } + m2m_pdata.asrc = asrc; + m2m_pdata.fmt_in = FSL_ASRC_FORMATS; + m2m_pdata.fmt_out = FSL_ASRC_FORMATS | SNDRV_PCM_FMTBIT_S8; + m2m_pdata.rate_min = 5512; + m2m_pdata.rate_max = 192000; + m2m_pdata.chan_min = 1; + m2m_pdata.chan_max = 10; + 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: @@ -1380,6 +1393,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