All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shengjiu Wang <shengjiu.wang@nxp.com>
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	[thread overview]
Message-ID: <1705581128-4604-5-git-send-email-shengjiu.wang@nxp.com> (raw)
In-Reply-To: <1705581128-4604-1-git-send-email-shengjiu.wang@nxp.com>

Register m2m platform device, that user can
use M2M feature.

Defined platform data structure and platform
driver name.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Mark Brown <broonie@kernel.org>
---
 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


  parent reply	other threads:[~2024-01-18 13:24 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 12:31 [PATCH v12 00/15] Add audio support in v4l2 framework Shengjiu Wang
2024-01-18 12:31 ` [PATCH v12 01/15] ASoC: fsl_asrc: define functions for memory to memory usage Shengjiu Wang
2024-01-18 12:31 ` [PATCH v12 02/15] ASoC: fsl_easrc: " Shengjiu Wang
2024-01-18 12:31 ` [PATCH v12 03/15] ASoC: fsl_asrc: move fsl_asrc_common.h to include/sound Shengjiu Wang
2024-01-18 12:31 ` Shengjiu Wang [this message]
2024-01-18 12:31 ` [PATCH v12 05/15] ASoC: fsl_easrc: register m2m platform device Shengjiu Wang
2024-01-18 12:31 ` [PATCH v12 06/15] media: uapi: Add V4L2_CAP_AUDIO_M2M capability flag Shengjiu Wang
2024-01-18 12:32 ` [PATCH v12 07/15] media: v4l2: Add audio capture and output support Shengjiu Wang
2024-02-17  9:42   ` Mauro Carvalho Chehab
2024-02-17  9:42     ` Mauro Carvalho Chehab
2024-02-19  6:35     ` Shengjiu Wang
2024-02-19  6:35       ` Shengjiu Wang
2024-02-21  4:30     ` Tomasz Figa
2024-02-21  4:30       ` Tomasz Figa
2024-02-21 10:11       ` Shengjiu Wang
2024-02-21 10:11         ` Shengjiu Wang
2024-02-21 11:16         ` Hans Verkuil
2024-02-21 11:16           ` Hans Verkuil
2024-02-21 11:13     ` Hans Verkuil
2024-02-21 11:13       ` Hans Verkuil
2024-02-21  4:32   ` Tomasz Figa
2024-02-21  4:32     ` Tomasz Figa
2024-01-18 12:32 ` [PATCH v12 08/15] media: uapi: Define audio sample format fourcc type Shengjiu Wang
2024-02-17  9:19   ` Mauro Carvalho Chehab
2024-02-17  9:19     ` Mauro Carvalho Chehab
2024-02-19  4:05     ` Shengjiu Wang
2024-02-19  4:05       ` Shengjiu Wang
2024-02-19 12:56       ` Mauro Carvalho Chehab
2024-02-19 12:56         ` Mauro Carvalho Chehab
2024-02-21 11:10         ` Hans Verkuil
2024-02-21 11:10           ` Hans Verkuil
2024-02-22  3:50           ` Shengjiu Wang
2024-02-22  3:50             ` Shengjiu Wang
2024-02-23 14:50             ` Hans Verkuil
2024-02-23 14:50               ` Hans Verkuil
2024-01-18 12:32 ` [PATCH v12 09/15] media: uapi: Add V4L2_CTRL_CLASS_M2M_AUDIO Shengjiu Wang
2024-01-18 12:32 ` [PATCH v12 10/15] media: uapi: Add audio rate controls support Shengjiu Wang
2024-02-17  9:57   ` Mauro Carvalho Chehab
2024-02-17  9:57     ` Mauro Carvalho Chehab
2024-02-19  6:03     ` Shengjiu Wang
2024-02-19  6:03       ` Shengjiu Wang
2024-02-19 12:16       ` Mauro Carvalho Chehab
2024-02-19 12:16         ` Mauro Carvalho Chehab
2024-01-18 12:32 ` [PATCH v12 11/15] media: uapi: Declare interface types for Audio Shengjiu Wang
2024-01-18 12:32 ` [PATCH v12 12/15] media: uapi: Add an entity type for audio resampler Shengjiu Wang
2024-01-18 12:32 ` [PATCH v12 13/15] media: vivid: add fixed point test controls Shengjiu Wang
2024-01-20  4:30   ` kernel test robot
2024-01-20 13:47   ` kernel test robot
2024-01-18 12:32 ` [PATCH v12 14/15] media: imx-asrc: Add memory to memory driver Shengjiu Wang
2024-01-20 18:17   ` kernel test robot
2024-01-18 12:32 ` [PATCH v12 15/15] media: vim2m-audio: add virtual driver for audio memory to memory Shengjiu Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1705581128-4604-5-git-send-email-shengjiu.wang@nxp.com \
    --to=shengjiu.wang@nxp.com \
    --cc=Xiubo.Lee@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=festevam@gmail.com \
    --cc=hverkuil@xs4all.nl \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=nicoleotsuka@gmail.com \
    --cc=perex@perex.cz \
    --cc=sakari.ailus@iki.fi \
    --cc=shengjiu.wang@gmail.com \
    --cc=tfiga@chromium.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.