From: Daniel Baluta <daniel.baluta@nxp.com> To: broonie@kernel.org Cc: festevam@gmail.com, perex@perex.cz, tiwai@suse.com, Xiubo.Lee@gmail.com, nicoleotsuka@gmail.com, timur@kernel.org, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, shengjiu.wang@nxp.com, angus@akkea.ca, kernel@pengutronix.de, l.stach@pengutronix.de, viorel.suman@nxp.com Subject: [PATCH 01/10] ASoC: fsl_sai: add of_match data Date: Mon, 22 Jul 2019 15:48:24 +0300 [thread overview] Message-ID: <20190722124833.28757-2-daniel.baluta@nxp.com> (raw) In-Reply-To: <20190722124833.28757-1-daniel.baluta@nxp.com> From: Lucas Stach <l.stach@pengutronix.de> New revisions of the SAI IP block have even more differences that need be taken into account by the driver. To avoid sprinking compatible checks all over the driver move the current differences into of_match_data. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> --- sound/soc/fsl/fsl_sai.c | 22 ++++++++++++++-------- sound/soc/fsl/fsl_sai.h | 6 +++++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index d58cc3ae90d8..ed0432e7327a 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -9,6 +9,7 @@ #include <linux/dmaengine.h> #include <linux/module.h> #include <linux/of_address.h> +#include <linux/of_device.h> #include <linux/pm_runtime.h> #include <linux/regmap.h> #include <linux/slab.h> @@ -788,10 +789,7 @@ static int fsl_sai_probe(struct platform_device *pdev) return -ENOMEM; sai->pdev = pdev; - - if (of_device_is_compatible(np, "fsl,imx6sx-sai") || - of_device_is_compatible(np, "fsl,imx6ul-sai")) - sai->sai_on_imx = true; + sai->soc_data = of_device_get_match_data(&pdev->dev); sai->is_lsb_first = of_property_read_bool(np, "lsb-first"); @@ -900,7 +898,7 @@ static int fsl_sai_probe(struct platform_device *pdev) if (ret) return ret; - if (sai->sai_on_imx) + if (sai->soc_data->use_imx_pcm) return imx_pcm_dma_init(pdev, IMX_SAI_DMABUF_SIZE); else return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); @@ -913,10 +911,18 @@ static int fsl_sai_remove(struct platform_device *pdev) return 0; } +static const struct fsl_sai_soc_data fsl_sai_vf610_data = { + .use_imx_pcm = false, +}; + +static const struct fsl_sai_soc_data fsl_sai_imx6sx_data = { + .use_imx_pcm = true, +}; + static const struct of_device_id fsl_sai_ids[] = { - { .compatible = "fsl,vf610-sai", }, - { .compatible = "fsl,imx6sx-sai", }, - { .compatible = "fsl,imx6ul-sai", }, + { .compatible = "fsl,vf610-sai", .data = &fsl_sai_vf610_data }, + { .compatible = "fsl,imx6sx-sai", .data = &fsl_sai_imx6sx_data }, + { .compatible = "fsl,imx6ul-sai", .data = &fsl_sai_imx6sx_data }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_sai_ids); diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h index 24cb156bf995..83e2bfe05b1b 100644 --- a/sound/soc/fsl/fsl_sai.h +++ b/sound/soc/fsl/fsl_sai.h @@ -126,6 +126,10 @@ #define FSL_SAI_MAXBURST_TX 6 #define FSL_SAI_MAXBURST_RX 6 +struct fsl_sai_soc_data { + bool use_imx_pcm; +}; + struct fsl_sai { struct platform_device *pdev; struct regmap *regmap; @@ -135,7 +139,6 @@ struct fsl_sai { bool is_slave_mode; bool is_lsb_first; bool is_dsp_mode; - bool sai_on_imx; bool synchronous[2]; unsigned int mclk_id[2]; @@ -143,6 +146,7 @@ struct fsl_sai { unsigned int slots; unsigned int slot_width; + const struct fsl_sai_soc_data *soc_data; struct snd_dmaengine_dai_dma_data dma_params_rx; struct snd_dmaengine_dai_dma_data dma_params_tx; }; -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Baluta <daniel.baluta@nxp.com> To: broonie@kernel.org Cc: alsa-devel@alsa-project.org, viorel.suman@nxp.com, timur@kernel.org, Xiubo.Lee@gmail.com, linuxppc-dev@lists.ozlabs.org, shengjiu.wang@nxp.com, angus@akkea.ca, tiwai@suse.com, perex@perex.cz, nicoleotsuka@gmail.com, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-kernel@vger.kernel.org, l.stach@pengutronix.de Subject: [PATCH 01/10] ASoC: fsl_sai: add of_match data Date: Mon, 22 Jul 2019 15:48:24 +0300 [thread overview] Message-ID: <20190722124833.28757-2-daniel.baluta@nxp.com> (raw) In-Reply-To: <20190722124833.28757-1-daniel.baluta@nxp.com> From: Lucas Stach <l.stach@pengutronix.de> New revisions of the SAI IP block have even more differences that need be taken into account by the driver. To avoid sprinking compatible checks all over the driver move the current differences into of_match_data. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> --- sound/soc/fsl/fsl_sai.c | 22 ++++++++++++++-------- sound/soc/fsl/fsl_sai.h | 6 +++++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index d58cc3ae90d8..ed0432e7327a 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -9,6 +9,7 @@ #include <linux/dmaengine.h> #include <linux/module.h> #include <linux/of_address.h> +#include <linux/of_device.h> #include <linux/pm_runtime.h> #include <linux/regmap.h> #include <linux/slab.h> @@ -788,10 +789,7 @@ static int fsl_sai_probe(struct platform_device *pdev) return -ENOMEM; sai->pdev = pdev; - - if (of_device_is_compatible(np, "fsl,imx6sx-sai") || - of_device_is_compatible(np, "fsl,imx6ul-sai")) - sai->sai_on_imx = true; + sai->soc_data = of_device_get_match_data(&pdev->dev); sai->is_lsb_first = of_property_read_bool(np, "lsb-first"); @@ -900,7 +898,7 @@ static int fsl_sai_probe(struct platform_device *pdev) if (ret) return ret; - if (sai->sai_on_imx) + if (sai->soc_data->use_imx_pcm) return imx_pcm_dma_init(pdev, IMX_SAI_DMABUF_SIZE); else return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); @@ -913,10 +911,18 @@ static int fsl_sai_remove(struct platform_device *pdev) return 0; } +static const struct fsl_sai_soc_data fsl_sai_vf610_data = { + .use_imx_pcm = false, +}; + +static const struct fsl_sai_soc_data fsl_sai_imx6sx_data = { + .use_imx_pcm = true, +}; + static const struct of_device_id fsl_sai_ids[] = { - { .compatible = "fsl,vf610-sai", }, - { .compatible = "fsl,imx6sx-sai", }, - { .compatible = "fsl,imx6ul-sai", }, + { .compatible = "fsl,vf610-sai", .data = &fsl_sai_vf610_data }, + { .compatible = "fsl,imx6sx-sai", .data = &fsl_sai_imx6sx_data }, + { .compatible = "fsl,imx6ul-sai", .data = &fsl_sai_imx6sx_data }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_sai_ids); diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h index 24cb156bf995..83e2bfe05b1b 100644 --- a/sound/soc/fsl/fsl_sai.h +++ b/sound/soc/fsl/fsl_sai.h @@ -126,6 +126,10 @@ #define FSL_SAI_MAXBURST_TX 6 #define FSL_SAI_MAXBURST_RX 6 +struct fsl_sai_soc_data { + bool use_imx_pcm; +}; + struct fsl_sai { struct platform_device *pdev; struct regmap *regmap; @@ -135,7 +139,6 @@ struct fsl_sai { bool is_slave_mode; bool is_lsb_first; bool is_dsp_mode; - bool sai_on_imx; bool synchronous[2]; unsigned int mclk_id[2]; @@ -143,6 +146,7 @@ struct fsl_sai { unsigned int slots; unsigned int slot_width; + const struct fsl_sai_soc_data *soc_data; struct snd_dmaengine_dai_dma_data dma_params_rx; struct snd_dmaengine_dai_dma_data dma_params_tx; }; -- 2.17.1
next prev parent reply other threads:[~2019-07-22 12:49 UTC|newest] Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-07-22 12:48 [PATCH 00/10] Add support for new SAI IP version Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta [this message] 2019-07-22 12:48 ` [PATCH 01/10] ASoC: fsl_sai: add of_match data Daniel Baluta 2019-07-23 17:00 ` Mark Brown 2019-07-23 17:00 ` Mark Brown 2019-07-24 6:42 ` [alsa-devel] " Daniel Baluta 2019-07-24 6:42 ` Daniel Baluta 2019-07-24 22:34 ` Nicolin Chen 2019-07-24 22:34 ` Nicolin Chen 2019-07-25 6:00 ` [alsa-devel] " Daniel Baluta 2019-07-25 6:00 ` Daniel Baluta 2019-07-25 6:00 ` Daniel Baluta 2019-07-22 12:48 ` [PATCH 02/10] ASoC: fsl_sai: derive TX FIFO watermark from FIFO depth Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta 2019-07-22 12:48 ` [PATCH 03/10] ASoC: fsl_sai: Add registers definition for multiple datalines Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta 2019-07-22 12:48 ` [PATCH 04/10] ASoC: fsl_sai: Update Tx/Rx channel enable mask Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta 2019-07-22 12:48 ` [PATCH 05/10] ASoC: fsl_sai: Add support to enable multiple data lines Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta 2019-07-22 12:55 ` Lucas Stach 2019-07-22 12:55 ` Lucas Stach 2019-07-24 8:58 ` [alsa-devel] " Daniel Baluta 2019-07-24 8:58 ` Daniel Baluta 2019-07-22 12:48 ` [PATCH 06/10] ASoC: dt-bindings: Document dl_mask property Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta 2019-07-22 12:56 ` Lucas Stach 2019-07-22 12:56 ` Lucas Stach 2019-07-24 23:13 ` Nicolin Chen 2019-07-24 23:13 ` Nicolin Chen 2019-07-24 23:13 ` Nicolin Chen 2019-07-25 6:08 ` [alsa-devel] " Daniel Baluta 2019-07-25 6:08 ` Daniel Baluta 2019-07-25 6:08 ` Daniel Baluta 2019-07-22 12:48 ` [PATCH 07/10] ASoC: fsl_sai: Add support for FIFO combine mode Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta 2019-07-22 13:01 ` Lucas Stach 2019-07-22 13:01 ` Lucas Stach 2019-07-22 12:48 ` [PATCH 08/10] ASoC: dt-bindings: Document fcomb_mode property Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta 2019-07-24 23:22 ` Nicolin Chen 2019-07-24 23:22 ` Nicolin Chen 2019-07-25 6:02 ` [alsa-devel] " Daniel Baluta 2019-07-25 6:02 ` Daniel Baluta 2019-07-25 17:39 ` Nicolin Chen 2019-07-25 17:39 ` Nicolin Chen 2019-07-25 17:39 ` Nicolin Chen 2019-07-22 12:48 ` [PATCH 09/10] ASoC: fsl_sai: Add support for SAI new version Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta 2019-07-24 23:32 ` Nicolin Chen 2019-07-24 23:32 ` Nicolin Chen 2019-07-25 6:06 ` [alsa-devel] " Daniel Baluta 2019-07-25 6:06 ` Daniel Baluta 2019-07-22 12:48 ` [PATCH 10/10] ASoC: fsl_sai: Add support for imx7ulp/imx8mq Daniel Baluta 2019-07-22 12:48 ` Daniel Baluta 2019-07-22 13:04 ` Lucas Stach 2019-07-22 13:04 ` Lucas Stach
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=20190722124833.28757-2-daniel.baluta@nxp.com \ --to=daniel.baluta@nxp.com \ --cc=Xiubo.Lee@gmail.com \ --cc=alsa-devel@alsa-project.org \ --cc=angus@akkea.ca \ --cc=broonie@kernel.org \ --cc=festevam@gmail.com \ --cc=kernel@pengutronix.de \ --cc=l.stach@pengutronix.de \ --cc=linux-imx@nxp.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=nicoleotsuka@gmail.com \ --cc=perex@perex.cz \ --cc=shengjiu.wang@nxp.com \ --cc=timur@kernel.org \ --cc=tiwai@suse.com \ --cc=viorel.suman@nxp.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: linkBe 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.