* [PATCH v2 1/2] ASoC: fsl_sai: Introduce a compatible string for MX6UL @ 2016-05-04 21:42 Fabio Estevam 2016-05-04 21:42 ` [PATCH v2 2/2] ASoC: fsl_sai: Allow setting the SAI MCLK direction Fabio Estevam 2016-05-04 21:51 ` [PATCH v2 1/2] ASoC: fsl_sai: Introduce a compatible string for MX6UL Nicolin Chen 0 siblings, 2 replies; 5+ messages in thread From: Fabio Estevam @ 2016-05-04 21:42 UTC (permalink / raw) To: broonie; +Cc: nicoleotsuka, Fabio Estevam, alsa-devel, shawnguo, brain From: Fabio Estevam <fabio.estevam@nxp.com> MX6UL may need to configure the General Purpose Register 1 (GPR1), so it is better to add a new compatible string to differentiate. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> --- Changes since v1: - Newly introduced in this series. sound/soc/fsl/fsl_sai.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 0754df7..d8b673f 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -797,7 +797,8 @@ static int fsl_sai_probe(struct platform_device *pdev) sai->pdev = pdev; - if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx6sx-sai")) + if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx6sx-sai") || + of_device_is_compatible(pdev->dev.of_node, "fsl,imx6ul-sai")) sai->sai_on_imx = true; sai->is_lsb_first = of_property_read_bool(np, "lsb-first"); @@ -898,6 +899,7 @@ static int fsl_sai_probe(struct platform_device *pdev) static const struct of_device_id fsl_sai_ids[] = { { .compatible = "fsl,vf610-sai", }, { .compatible = "fsl,imx6sx-sai", }, + { .compatible = "fsl,imx6ul-sai", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_sai_ids); -- 1.9.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] ASoC: fsl_sai: Allow setting the SAI MCLK direction 2016-05-04 21:42 [PATCH v2 1/2] ASoC: fsl_sai: Introduce a compatible string for MX6UL Fabio Estevam @ 2016-05-04 21:42 ` Fabio Estevam 2016-05-04 21:56 ` Nicolin Chen 2016-05-04 21:51 ` [PATCH v2 1/2] ASoC: fsl_sai: Introduce a compatible string for MX6UL Nicolin Chen 1 sibling, 1 reply; 5+ messages in thread From: Fabio Estevam @ 2016-05-04 21:42 UTC (permalink / raw) To: broonie; +Cc: nicoleotsuka, Fabio Estevam, alsa-devel, shawnguo, brain From: Fabio Estevam <fabio.estevam@nxp.com> On mx6ul the General Purpose Register 1 (GPR1) contains the following bits for configuring the direction of the SAI MCLKs: SAI1_MCLK_DIR, SAI2_MCLK_DIR, SAI3_MCLK_DIR Introduce the "fsl,sai-mclk-direction-output" optional property to allow configuring the SAI_MCLK outputs. Tested on a imx6ul-evk board. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> --- Changes since v1: - Dropped unneeded gpr node. - Change the property name to fsl,sai-mclk-direction-output. (Nicolin) - Do a runtime check against fsl,imx6ul-sai. (Nicolin) - Use macro instead of switch statement. (Nicolin) .../devicetree/bindings/sound/fsl-sai.txt | 5 +++++ include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 6 ++++++ sound/soc/fsl/fsl_sai.c | 22 ++++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/fsl-sai.txt b/Documentation/devicetree/bindings/sound/fsl-sai.txt index 044e5d7..bec3ae0 100644 --- a/Documentation/devicetree/bindings/sound/fsl-sai.txt +++ b/Documentation/devicetree/bindings/sound/fsl-sai.txt @@ -48,6 +48,11 @@ Required properties: receive data by following their own bit clocks and frame sync clocks separately. +Optional properties (for mx6ul): + + - fsl,sai-mclk-direction-output: This is a boolean property. If present, + indicates that SAI will output the SAI MCLK clock. + Note: - If both fsl,sai-asynchronous and fsl,sai-synchronous-rx are absent, the default synchronous mode (sync Rx with Tx) will be used, which means both diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h index 238c8db..6835382 100644 --- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h @@ -447,5 +447,11 @@ #define IMX6UL_GPR1_ENET2_CLK_OUTPUT (0x1 << 18) #define IMX6UL_GPR1_ENET_CLK_DIR (0x3 << 17) #define IMX6UL_GPR1_ENET_CLK_OUTPUT (0x3 << 17) +#define IMX6UL_GPR1_SAI1_MCLK_DIR (0x1 << 19) +#define IMX6UL_GPR1_SAI2_MCLK_DIR (0x1 << 20) +#define IMX6UL_GPR1_SAI3_MCLK_DIR (0x1 << 21) +#define IMX6UL_GPR1_SAI_MCLK_MASK (0x7 << 19) +#define MCLK_DIR(x) (x == 1 ? IMX6UL_GPR1_SAI1_MCLK_DIR : x == 2 ? \ + IMX6UL_GPR1_SAI2_MCLK_DIR : IMX6UL_GPR1_SAI3_MCLK_DIR) #endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index d8b673f..506a5f8 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -21,6 +21,8 @@ #include <sound/core.h> #include <sound/dmaengine_pcm.h> #include <sound/pcm_params.h> +#include <linux/mfd/syscon.h> +#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> #include "fsl_sai.h" #include "imx-pcm.h" @@ -786,10 +788,12 @@ static int fsl_sai_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct fsl_sai *sai; + struct regmap *gpr; struct resource *res; void __iomem *base; char tmp[8]; int irq, ret, i; + u32 index; sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); if (!sai) @@ -878,6 +882,24 @@ static int fsl_sai_probe(struct platform_device *pdev) fsl_sai_dai.symmetric_samplebits = 0; } + if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) && + of_device_is_compatible(pdev->dev.of_node, "fsl,imx6ul-sai")) { + gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr"); + if (IS_ERR(gpr)) { + dev_err(&pdev->dev, "cannot find iomuxc registers\n"); + return PTR_ERR(gpr); + } + + ret = of_property_read_u32(np, "sai-index", &index); + if (ret) { + dev_err(&pdev->dev, "could not read sai-index\n"); + return ret; + } + + regmap_update_bits(gpr, IOMUXC_GPR1, MCLK_DIR(index), + MCLK_DIR(index)); + } + sai->dma_params_rx.addr = res->start + FSL_SAI_RDR; sai->dma_params_tx.addr = res->start + FSL_SAI_TDR; sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX; -- 1.9.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] ASoC: fsl_sai: Allow setting the SAI MCLK direction 2016-05-04 21:42 ` [PATCH v2 2/2] ASoC: fsl_sai: Allow setting the SAI MCLK direction Fabio Estevam @ 2016-05-04 21:56 ` Nicolin Chen 2016-05-04 22:24 ` Fabio Estevam 0 siblings, 1 reply; 5+ messages in thread From: Nicolin Chen @ 2016-05-04 21:56 UTC (permalink / raw) To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel, broonie, shawnguo, brain On Wed, May 04, 2016 at 06:42:52PM -0300, Fabio Estevam wrote: > From: Fabio Estevam <fabio.estevam@nxp.com> > > On mx6ul the General Purpose Register 1 (GPR1) contains the following > bits for configuring the direction of the SAI MCLKs: > SAI1_MCLK_DIR, SAI2_MCLK_DIR, SAI3_MCLK_DIR > > Introduce the "fsl,sai-mclk-direction-output" optional property to allow > configuring the SAI_MCLK outputs. > > Tested on a imx6ul-evk board. > > Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> > --- > Changes since v1: > - Dropped unneeded gpr node. > - Change the property name to fsl,sai-mclk-direction-output. (Nicolin) > - Do a runtime check against fsl,imx6ul-sai. (Nicolin) > - Use macro instead of switch statement. (Nicolin) > > .../devicetree/bindings/sound/fsl-sai.txt | 5 +++++ > include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 6 ++++++ > sound/soc/fsl/fsl_sai.c | 22 ++++++++++++++++++++++ > 3 files changed, 33 insertions(+) > > diff --git a/Documentation/devicetree/bindings/sound/fsl-sai.txt b/Documentation/devicetree/bindings/sound/fsl-sai.txt > index 044e5d7..bec3ae0 100644 > --- a/Documentation/devicetree/bindings/sound/fsl-sai.txt > +++ b/Documentation/devicetree/bindings/sound/fsl-sai.txt > @@ -48,6 +48,11 @@ Required properties: > receive data by following their own bit clocks and > frame sync clocks separately. > > +Optional properties (for mx6ul): > + > + - fsl,sai-mclk-direction-output: This is a boolean property. If present, > + indicates that SAI will output the SAI MCLK clock. > + > Note: > - If both fsl,sai-asynchronous and fsl,sai-synchronous-rx are absent, the > default synchronous mode (sync Rx with Tx) will be used, which means both > diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h > index 238c8db..6835382 100644 > --- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h > +++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h > @@ -447,5 +447,11 @@ > #define IMX6UL_GPR1_ENET2_CLK_OUTPUT (0x1 << 18) > #define IMX6UL_GPR1_ENET_CLK_DIR (0x3 << 17) > #define IMX6UL_GPR1_ENET_CLK_OUTPUT (0x3 << 17) > +#define IMX6UL_GPR1_SAI1_MCLK_DIR (0x1 << 19) > +#define IMX6UL_GPR1_SAI2_MCLK_DIR (0x1 << 20) > +#define IMX6UL_GPR1_SAI3_MCLK_DIR (0x1 << 21) > +#define IMX6UL_GPR1_SAI_MCLK_MASK (0x7 << 19) > +#define MCLK_DIR(x) (x == 1 ? IMX6UL_GPR1_SAI1_MCLK_DIR : x == 2 ? \ > + IMX6UL_GPR1_SAI2_MCLK_DIR : IMX6UL_GPR1_SAI3_MCLK_DIR) > > #endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ > diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c > index d8b673f..506a5f8 100644 > --- a/sound/soc/fsl/fsl_sai.c > +++ b/sound/soc/fsl/fsl_sai.c > @@ -21,6 +21,8 @@ > #include <sound/core.h> > #include <sound/dmaengine_pcm.h> > #include <sound/pcm_params.h> > +#include <linux/mfd/syscon.h> > +#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> > > #include "fsl_sai.h" > #include "imx-pcm.h" > @@ -786,10 +788,12 @@ static int fsl_sai_probe(struct platform_device *pdev) > { > struct device_node *np = pdev->dev.of_node; > struct fsl_sai *sai; > + struct regmap *gpr; > struct resource *res; > void __iomem *base; > char tmp[8]; > int irq, ret, i; > + u32 index; > > sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); > if (!sai) > @@ -878,6 +882,24 @@ static int fsl_sai_probe(struct platform_device *pdev) > fsl_sai_dai.symmetric_samplebits = 0; > } > > + if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) && > + of_device_is_compatible(pdev->dev.of_node, "fsl,imx6ul-sai")) { > + gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr"); > + if (IS_ERR(gpr)) { > + dev_err(&pdev->dev, "cannot find iomuxc registers\n"); > + return PTR_ERR(gpr); > + } > + > + ret = of_property_read_u32(np, "sai-index", &index); Do we need to add this to binding doc as well? Or will it be better to use alias here? I am not sure though. Thanks Nicolin > + if (ret) { > + dev_err(&pdev->dev, "could not read sai-index\n"); > + return ret; > + } > + > + regmap_update_bits(gpr, IOMUXC_GPR1, MCLK_DIR(index), > + MCLK_DIR(index)); > + } > + > sai->dma_params_rx.addr = res->start + FSL_SAI_RDR; > sai->dma_params_tx.addr = res->start + FSL_SAI_TDR; > sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX; > -- > 1.9.1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] ASoC: fsl_sai: Allow setting the SAI MCLK direction 2016-05-04 21:56 ` Nicolin Chen @ 2016-05-04 22:24 ` Fabio Estevam 0 siblings, 0 replies; 5+ messages in thread From: Fabio Estevam @ 2016-05-04 22:24 UTC (permalink / raw) To: Nicolin Chen Cc: Fabio Estevam, alsa-devel@alsa-project.org, Mark Brown, Shawn Guo, Petr Kulhavy On Wed, May 4, 2016 at 6:56 PM, Nicolin Chen <nicoleotsuka@gmail.com> wrote: > Do we need to add this to binding doc as well? Or will it be better > to use alias here? I am not sure though. Yes, using alias is better :-) Will use it in v3, thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] ASoC: fsl_sai: Introduce a compatible string for MX6UL 2016-05-04 21:42 [PATCH v2 1/2] ASoC: fsl_sai: Introduce a compatible string for MX6UL Fabio Estevam 2016-05-04 21:42 ` [PATCH v2 2/2] ASoC: fsl_sai: Allow setting the SAI MCLK direction Fabio Estevam @ 2016-05-04 21:51 ` Nicolin Chen 1 sibling, 0 replies; 5+ messages in thread From: Nicolin Chen @ 2016-05-04 21:51 UTC (permalink / raw) To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel, broonie, shawnguo, brain On Wed, May 04, 2016 at 06:42:51PM -0300, Fabio Estevam wrote: > From: Fabio Estevam <fabio.estevam@nxp.com> > > MX6UL may need to configure the General Purpose Register 1 (GPR1), so > it is better to add a new compatible string to differentiate. > > Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> > --- > Changes since v1: > - Newly introduced in this series. > > sound/soc/fsl/fsl_sai.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c > index 0754df7..d8b673f 100644 > --- a/sound/soc/fsl/fsl_sai.c > +++ b/sound/soc/fsl/fsl_sai.c > @@ -797,7 +797,8 @@ static int fsl_sai_probe(struct platform_device *pdev) > > sai->pdev = pdev; > > - if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx6sx-sai")) > + if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx6sx-sai") || > + of_device_is_compatible(pdev->dev.of_node, "fsl,imx6ul-sai")) > sai->sai_on_imx = true; > > sai->is_lsb_first = of_property_read_bool(np, "lsb-first"); > @@ -898,6 +899,7 @@ static int fsl_sai_probe(struct platform_device *pdev) > static const struct of_device_id fsl_sai_ids[] = { > { .compatible = "fsl,vf610-sai", }, > { .compatible = "fsl,imx6sx-sai", }, > + { .compatible = "fsl,imx6ul-sai", }, We may need to update binding doc as well? > { /* sentinel */ } > }; > MODULE_DEVICE_TABLE(of, fsl_sai_ids); > -- > 1.9.1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-05-04 22:24 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-05-04 21:42 [PATCH v2 1/2] ASoC: fsl_sai: Introduce a compatible string for MX6UL Fabio Estevam 2016-05-04 21:42 ` [PATCH v2 2/2] ASoC: fsl_sai: Allow setting the SAI MCLK direction Fabio Estevam 2016-05-04 21:56 ` Nicolin Chen 2016-05-04 22:24 ` Fabio Estevam 2016-05-04 21:51 ` [PATCH v2 1/2] ASoC: fsl_sai: Introduce a compatible string for MX6UL Nicolin Chen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).