summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_sai.c
AgeCommit message (Collapse)Author
2019-11-25MLK-15960-1: ASoC: fsl_sai: update fifo_depth for different platformShengjiu Wang
The fifo_depth is changed to 64 in imx8qm/imx8qxp, in imx8mq, the fifo_depth is 128. which is mentioned in their ADD. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25MLK-15927-1: ASoC: fsl_sai: Fix noise when using EDMAMihai Serban
EDMA requires the period size to be multiple of maxburst. Otherwise the remaining bytes are not transferred and thus noise is produced. We can handle this issue by adding a constraint on SNDRV_PCM_HW_PARAM_PERIOD_SIZE to be multiple of tx/rx maxburst value. This is based on a similar patch we have for ESAI: commit bd3f3eb2a37c ("MLK-15109-2: ASoC: fsl_esai: add constrain_period_size") Signed-off-by: Mihai Serban <mihai.serban@nxp.com> Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25MLK-15140-1: ASoC: fsl_sai: support latest sai moduleShengjiu Wang
The version of sai is upgrate in imx8mq, which add two register in beginning, there is VERID and PARAM. the driver need to be update Signed-off-by: Mihai Serban <mihai.serban@nxp.com> Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25MLK-14935: ASoC: fsl_sai: Fix mixing initialization data with actual audio ↵Mihai Serban
samples When starting a playback the initialization data used to reduce underruns was send to the transmit data register after the DMA requests were enabled. This patch moves the initialization phase before enabling the DMA so the data is transmitted in correct order. Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
2019-11-25MLK-14847: Revert "ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode"Mihai Serban
This reverts commit c768ed336bba ("ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode") This change was already introduced by commit 51659ca069ce ("ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode") from upstream. Manually adjust the code to match the changes introduced by subsequent commit b2936555bb38 ("MLK-13609: ASoC: fsl_sai: fix for synchronize mode") by removing updates to FSL_SAI_TMR/FSL_SAI_RMR registers. Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
2019-11-25ASoC: fsl: add imx-pcm-dma v2 platform driver (part 2)Viorel Suman
which don't request the dma channel in the probe, but request dma channel when needed. for the dma channel of cpu dai in BE can be reused by the FE. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> [ Aisheng: split PCM changes ] Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25ASoC: fsl_sai: set specific fmt for I2S XTORViorel Suman
Set specific fmt, for i2s xtor receiver is in slave mode and i2s xtor transmitter is in master mode. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25ASoC: fsl_sai: handle slave mode per TX/RX directionViorel Suman
The SAI interface can be a clock supplier or consummer as function of stream direction, ie when interacting with I2S XTOR. Removed FSL_SAI_RFR define as it is now referred as FSL_SAI_RFR0. Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25ASoC: fsl_(e)sai: introduce "shared-interrupt" DT flag (part 2)Viorel Suman
SAI & ESAI interfaces may share the same interrupt with EDMA, so that we need a flag to trigger proper shared interrupt handling. For compatibility the same DT flag, "shared-interrupt", is introduced as the one used in drivers/dma/fsl-edma-v3.c. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> [ Aisheng: split easi changes ] Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25MLK-13609: ASoC: fsl_sai: fix for synchronize modeShengjiu Wang
TX synchronous with receiver: the RMR should not be changed and the RCSR.RE should be set in playback. RX synchronous with transmitter: the TMR should not be changed and the TCSR.TE should be set in recording. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25MLK-13574-2: ASoC: fsl_sai: refine driver for ip upgradeShengjiu Wang
In imx7ulp1, the sai can support two TX channel and two RX channels, So the usage need to be updated. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25MLK-12786-2: ASoC: fsl_sai: correct the clock source for mclk0Shengjiu Wang
mclk0 is assigned through the device tree. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25MLK-12374: ASoC: fsl_sai: Change the dev_warn to dev_dbgShengjiu Wang
When audio stop, it will first stop dma, then stop cpu_dai. If there is delay between dma stop and cpu dai stop, there will be underrun error, the print will cost time, then will cause another underrun error, it is a infinite loop. Which will cause the cpu dai can't stop. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master modeZidan Wang
For SAI master mode, when Tx(Rx) sync with Rx(Tx) clock, Rx(Tx) will generate bclk and frame clock for Tx(Rx), we should set RCR4(TCR4), RCR5(TCR5) and RMR(TMR) for playback(capture), or there will be sync error sometimes. Signed-off-by: Zidan Wang <zidan.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org> (cherry picked from commit 51659ca069ce5bdf20675a7967a39ef8419e87f2)
2019-11-25MLK-11628 ASoC: fsl_sai: add initial value for is_slave_modeZidan Wang
After playback audio with sai<->wm8960 sound card, is_slave_mode will be set, but it will not be cleared. So playback audio with sai<->sii902x sound card will have no voice. Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
2019-11-25MLK-10611-1 ASoC: fsl-sai: Just one device can playback(captrue) when using ↵Zidan Wang
the same SAI Just one device can playback(captrue) when using the same SAI. Signed-off-by: Zidan Wang <zidan.wang@freescale.com> (cherry picked from commit 7981a488c4da440db21f0544b519b44636a0cabb)
2019-11-25MLK-9974: ASoC: fsl_sai: There is underrun detected in the beginning sometimesShengjiu Wang
Write initial words to SAI FIFO to reduce underrun error Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> (cherry picked from commit 7ba8ae883d84540fac5ed4147d124399537bc0b3) (cherry picked from commit f4435f35aa2a97551d2c4a12ca316c354a880f85)
2019-11-25Revert "ASoC: fsl_sai: add of_match data"Dong Aisheng
This reverts commit 89c9679f699d88986ce552738dc7c5c500c8fc67.
2019-11-25Revert "ASoC: fsl_sai: derive TX FIFO watermark from FIFO depth"Dong Aisheng
This reverts commit bd517707d85f19a7339ea8b882fcbf0fd9976bd6.
2019-11-25Revert "ASoC: fsl_sai: mark regmap as fast_io"Dong Aisheng
This reverts commit 6d19d8a3cec74a9680947ecb6abdeda38583110e.
2019-11-25Revert "ASoC: Remove dev_err() usage after platform_get_irq()"Dong Aisheng
This reverts commit cf9441adb1a35506d7606866c382b9d8614169b5.
2019-11-25Revert "ASoC: fsl_sai: Add registers definition for multiple datalines"Dong Aisheng
This reverts commit 5f0ac20ed6db1d6da2eea8b862cf3d54fdfb5830.
2019-11-25Revert "ASoC: fsl_sai: Update Tx/Rx channel enable mask"Dong Aisheng
This reverts commit b84f50b0fcb497a62068926fca793d2d213c7dbd.
2019-11-25Revert "ASoC: fsl_sai: Add support for SAI new version"Dong Aisheng
This reverts commit 4f7a0728b5305e2d865f543fbcffd617e03c7674.
2019-11-25Revert "ASoC: fsl_sai: Add support for imx7ulp/imx8mq"Dong Aisheng
This reverts commit a860fac420971c5a90d4f78959b44ead793aee4f.
2019-11-25Revert "ASoC: fsl_sai: Add support for imx8qm"Leonard Crestez
This reverts commit 6eeb60be5ebb73b2e5911e26fb1aed02940b7d09.
2019-11-25Revert "ASoC: fsl_sai: Implement set_bclk_ratio"Leonard Crestez
This reverts commit 63d1a3488ff58e094a7f517cf93c0250f0a3f6be.
2019-11-25Revert "ASoC: fsl_sai: Fix noise when using EDMA"Leonard Crestez
This reverts commit e75f4940e8ad0dd76527302a10c06b58bf7eb590.
2019-09-17ASoC: fsl_sai: Fix noise when using EDMAMihai Serban
EDMA requires the period size to be multiple of maxburst. Otherwise the remaining bytes are not transferred and thus noise is produced. We can handle this issue by adding a constraint on SNDRV_PCM_HW_PARAM_PERIOD_SIZE to be multiple of tx/rx maxburst value. Signed-off-by: Mihai Serban <mihai.serban@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Link: https://lore.kernel.org/r/20190913192807.8423-2-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-13ASoC: fsl_sai: Implement set_bclk_ratioViorel Suman
This is to allow machine drivers to set a certain bitclk rate which might not be exactly rate * frame size. Cc: NXP Linux Team <linux-imx@nxp.com> Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Link: https://lore.kernel.org/r/20190830215910.31590-1-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-21ASoC: fsl_sai: Add support for imx8qmDaniel Baluta
SAI module on imx8qm features a register map similar with imx6 series (it doesn't have VERID and PARAM registers at the beginning of address spece). Also, it has one FIFO which can help up to 64 * 32 bit samples. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20190814082911.665-2-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-07ASoC: fsl_sai: Add support for imx7ulp/imx8mqDaniel Baluta
SAI module on imx7ulp/imx8m features 2 new registers (VERID and PARAM) at the beginning of register address space. On imx7ulp FIFOs can held up to 16 x 32 bit samples. On imx8mq FIFOs can held up to 128 x 32 bit samples. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Link: https://lore.kernel.org/r/20190806151214.6783-5-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-07ASoC: fsl_sai: Add support for SAI new versionDaniel Baluta
New IP version introduces Version ID and Parameter registers and optionally added Timestamp feature. VERID and PARAM registers are placed at the top of registers address space and some registers are shifted according to the following table: Tx/Rx data registers and Tx/Rx FIFO registers keep their addresses, all other registers are shifted by 8. SAI Memory map is described in chapter 13.10.4.1.1 I2S Memory map of the Reference Manual [1]. In order to make as less changes as possible we attach an offset to each register offset to each changed register definition. The offset is read from each board private data. [1]https://cache.nxp.com/secured/assets/documents/en/reference-manual/IMX8MDQLQRM.pdf?__gda__=1563728701_38bea7f0f726472cc675cb141b91bec7&fileExt=.pdf Signed-off-by: Mihai Serban <mihai.serban@nxp.com> [initial coding in the NXP internal tree] Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> [bugfixing and cleanups] Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> [adapted to linux-next] Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Link: https://lore.kernel.org/r/20190806151214.6783-4-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-07ASoC: fsl_sai: Update Tx/Rx channel enable maskDaniel Baluta
Tx channel enable (TCE) / Rx channel enable (RCE) bits enable corresponding data channel for Tx/Rx operation. Because SAI supports up the 8 channels TCE/RCE occupy up the 8 bits inside TCR3/RCR3 registers we need to extend the mask to reflect this. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Link: https://lore.kernel.org/r/20190806151214.6783-3-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-07ASoC: fsl_sai: Add registers definition for multiple datalinesDaniel Baluta
SAI IP supports up to 8 data lines. The configuration of supported number of data lines is decided at SoC integration time. This patch adds definitions for all related data TX/RX registers: * TDR0..7, Transmit data register * TFR0..7, Transmit FIFO register * RDR0..7, Receive data register * RFR0..7, Receive FIFO register Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Link: https://lore.kernel.org/r/20190806151214.6783-2-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-02ASoC: Remove dev_err() usage after platform_get_irq()Stephen Boyd
We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: alsa-devel@alsa-project.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20190730181557.90391-50-swboyd@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-22ASoC: fsl_sai: mark regmap as fast_ioLucas Stach
The regmap is only ever used to access MMIO registers, so it's fair to say that register access is fast. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Link: https://lore.kernel.org/r/20190717105156.15721-1-l.stach@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-22ASoC: fsl_sai: derive TX FIFO watermark from FIFO depthLucas Stach
The DMA request schould be triggered as soon as the FIFO has space for another burst. As different versions of the SAI block have different FIFO sizes, the watrmark level needs to be derived from version specific data. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Angus Ainslie <angus@akkea.ca> Reviewed-by: Angus Ainslie <angus@akkea.ca> Link: https://lore.kernel.org/r/20190717105635.18514-3-l.stach@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-22ASoC: fsl_sai: add of_match dataLucas Stach
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> Tested-by: Angus Ainslie <angus@akkea.ca> Reviewed-by: Angus Ainslie <angus@akkea.ca> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20190717105635.18514-2-l.stach@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2019-05-08ASoC: fsl_sai: Move clock operation to PM runtimeShengjiu Wang
Turn off/on clocks when device enters suspend/resume. This can help saving power. As a further optimization, we turn off/on mclk only when SAI is in master mode because otherwise mclk is externally provided. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-26ASoC: fsl_sai: Add missing return 0 in remove()Nicolin Chen
Build warning being reported: sound/soc/fsl/fsl_sai.c: In function 'fsl_sai_remove': sound/soc/fsl/fsl_sai.c:921:1: warning: no return statement in function returning non-void [-Wreturn-type] So this patch just adds a "return 0" to fix it. Fixes: 812ad463e089 ("ASoC: fsl_sai: Add support for runtime pm") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-25ASoC: fsl_sai: Add support for runtime pmDaniel Baluta
Basically the same actions as for system PM, so make use of pm_runtime_force_suspend/pm_runtime_force_resume. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-25ASoC: fsl_sai: Update is_slave_mode with correct valueDaniel Baluta
is_slave_mode defaults to false because sai structure that contains it is kzalloc'ed. Anyhow, if we decide to set the following configuration SAI slave -> SAI master, is_slave_mode will remain set on true although SAI being master it should be set to false. Fix this by updating is_slave_mode for each call of fsl_sai_set_dai_fmt. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-18ASoC: fsl_sai: Remove expensive print in irq handlerShengjiu Wang
When stopping audio, ASoC will first stop DMA then CPU DAI. Sometimes there is a delay between DMA stop and CPU DAI stop, which triggers an underrun error. Now, because of the delay introduced by dev_err another underrun error will occur causing a vicious circle making impossible to stop CPU DAI. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-03ASoC: fsl_sai: Switch to SPDX identifierFabio Estevam
Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-02-13ASoC: fsl_sai: support more than 2 channelsAlexandre Belloni
The FSL SAI can support up to 32 channels using TDM. Report that value so they can actually be used. Tested using 8 channels. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-17ASoC: fsl_sai: Use 'np' variableFabio Estevam
The 'np' variable is already assigned to 'pdev->dev.of_node', so use it to improve readability. No functional change. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-05ASoC: fsl_sai: Allow setting the SAI MCLK directionFabio Estevam
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> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-05ASoC: fsl_sai: Introduce a compatible string for MX6ULFabio Estevam
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> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-03-13Merge remote-tracking branches 'asoc/topic/fsl-sai', 'asoc/topic/fsl-ssl', ↵Mark Brown
'asoc/topic/hdac' and 'asoc/topic/max9867' into asoc-next