From patchwork Thu Jan 18 12:31:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 189209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp336266dyb; Thu, 18 Jan 2024 05:25:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IEU3dVcMvYDXHG2/OWzpg004ouTZkbJoyulEaJTy6Csttg2QOJHmlMyeXzjRe7fPkZlZDdx X-Received: by 2002:a17:907:7294:b0:a2c:7120:a5fd with SMTP id dt20-20020a170907729400b00a2c7120a5fdmr552094ejc.46.1705584356338; Thu, 18 Jan 2024 05:25:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705584356; cv=pass; d=google.com; s=arc-20160816; b=aCN0LHHKj/cYAs9zFcMdCR4BiyaQmZ8k6+lwIUC2pe5Fxsx1owhF2Vx74CcL8+rIj/ isBjxseAfHh6Ev4iJiMGSAiJ+DmYqhvIHYkbU9QrhyrwV3dafWh5iCv9gbSVV3vs8m1b 8VBCHcGCqPrVQz0riClyGwxzDE2mcXY3fngcWrE854vZVtlr0+dJkaql1DvyqdIMWIzj qef4myPS2/LBrz2oRCRcmzphPi1yW/MnNz+cTXRU0/ChRizmOLYRn6I0Qw1Dqzge/+9k 9zXnd2uEnFXU7Bzg70K7czJPUxVdseeiprScMaD4Pva2PVWUHNloZR53ZcRscKNbM+1N Gv5g== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30148-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l21-20020a170906231500b00a27cc992b15si6881288eja.639.2024.01.18.05.25.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 05:25:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30148-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30148-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id B22371F276AD for ; Thu, 18 Jan 2024 13:25:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5D8B28E34; Thu, 18 Jan 2024 13:24:54 +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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788434822045998967 X-GMAIL-MSGID: 1788434822045998967 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);