1
0
Fork 0
Commit Graph

1610 Commits (redonkable)

Author SHA1 Message Date
Shengjiu Wang ee1a47b87f MLK-23618-6: ASoC: fsl_dsp: refine handling of multi power domain
The attached multi power domain is enabled by device_link_add
So we need to disable them in probe, otherwise it may impact
the power consumption.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-18 15:41:46 +08:00
Shengjiu Wang 529a1cb73d MLK-23618-4: Revert "ASoC: fsl_spdif:Support multi power domains"
This reverts commit bd7b26036e.

The power domain of clock should be controlled by clock driver,
We don't need to control it in audio driver, so we don't
need to support multi power domain in audio driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-18 15:41:36 +08:00
Shengjiu Wang b1024cf8bb MLK-23618-3: Revert "ASoC: fsl_asrc: support multi power domain"
This reverts commit 442ad6fd0c.

The power domain of clock should be controlled by clock driver,
We don't need to control it in audio driver, so we don't
need to support multi power domain in audio driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-18 15:41:31 +08:00
Shengjiu Wang 6ee466819d MLK-23618-2: Revert "ASoC: fsl_esai: support multi power domain"
This reverts commit 4058ef0bb8.

The power domain of clock should be controlled by clock driver,
We don't need to control it in audio driver, so we don't
need to support multi power domain in audio driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-18 15:41:26 +08:00
Shengjiu Wang 1fe9eac911 MLK-23618-1: Revert "ASoC: fsl_sai: support multi power domain"
This reverts commit 53915e7ea9.

The power domain of clock should be controlled by clock driver,
We don't need to control it in audio driver, so we don't
need to support multi power domain in audio driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-18 15:41:20 +08:00
Shengjiu Wang 4d23edf7b3 MLK-23585-3: ASoC: imx-wm8960: support capture_only and playback_only
In imx8dxl-evk, some of wm8960s only support capture function,
So we support capture_only and playback_only in driver

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-13 16:26:02 +08:00
Shengjiu Wang 002cd44ea1 MLk-23585-2: ASoC: imx-wm8960: support multi instance
Move the golbal variables to structure, so all variables
are private for each instance.

replace the DRIVER_ATTR with DEVICE_ATTR to support
multi instance.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-13 16:26:02 +08:00
Shengjiu Wang 72b1cc1310 MLK-23585-1: ASoC: imx-wm8960: fix warning message
replace gpio_get_value with gpio_get_value_cansleep

[   35.872238] ------------[ cut here ]------------
[   35.876899] WARNING: CPU: 1 PID: 218 at drivers/gpio/gpiolib.c:3407 gpiod_get_raw_value+0x78/0x80
[   35.885774] Modules linked in:
[   35.888840] CPU: 1 PID: 218 Comm: kworker/u4:5 Tainted: G        W         5.4.24-04375-g6de4b3212b29-dirty #7367
[   35.899102] Hardware name: Freescale i.MX8DXL EVK (DT)
[   35.904247] Workqueue: events_power_efficient gpio_work
[   35.909477] pstate: 20000005 (nzCv daif -PAN -UAO)
[   35.914275] pc : gpiod_get_raw_value+0x78/0x80
[   35.918721] lr : gpiod_get_raw_value+0x20/0x80
[   35.923164] sp : ffff800012a1bd30
[   35.926476] x29: ffff800012a1bd30 x28: 0000000000000000
[   35.931791] x27: ffff00003b4152b8 x26: ffff8000119df7d0
[   35.937107] x25: 0000000000000000 x24: ffff800011ae2d48
[   35.942424] x23: ffff00001050c000 x22: ffff000010507100
[   35.947741] x21: ffff800011ae2000 x20: ffff800011ae2d10
[   35.953060] x19: ffff00003adf8640 x18: 0000000000000000
[   35.958374] x17: 0000000000000000 x16: 0000000000000000
[   35.963691] x15: 0000000000000000 x14: 0000000000000000
[   35.969008] x13: 0000000000000001 x12: 0000000000000000
[   35.974325] x11: 000000000002e708 x10: 00000000000009c0
[   35.979641] x9 : ffff800012a1b920 x8 : ffff00003a310a20
[   35.984958] x7 : ffff00003efec340 x6 : 0000000000000000
[   35.990276] x5 : 0000000000000000 x4 : ffff800011a01748
[   35.995593] x3 : ffff00003b005c00 x2 : 0000000000000001
[   36.000911] x1 : ffff00003b005c00 x0 : ffff00003b00ba18
[   36.006228] Call trace:
[   36.008684]  gpiod_get_raw_value+0x78/0x80
[   36.012790]  hp_jack_status_check+0x2c/0xf8
[   36.016977]  gpio_work+0x4c/0x70
[   36.020215]  process_one_work+0x1dc/0x370
[   36.024221]  worker_thread+0x48/0x468
[   36.027892]  kthread+0xf0/0x120
[   36.031036]  ret_from_fork+0x10/0x1c
[   36.034610] ---[ end trace b40bcf5f3cf8bd40 ]---

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-13 16:26:02 +08:00
Zhang Peng 10abba22b3 MLK-23570i fsl: fsl_dsp: Fix dsp suspend issue on imx.mp board
1. Add check pm runtime state to decide send suspend msg to dsp when
call fsl_dsp_suspend.
2. Set proxy->dsp_mu_init be zero in fsl_dsp_suspend for imx.mp.

Signed-off-by: Zhang Peng <peng_zhang_8@nxp.com>
2020-03-11 14:29:31 +01:00
Shengjiu Wang dc5a481843 LF-941: ASoC: fsl_easrc: Switch to 32 taps for resampling filter
With 128 taps of resampling filter, there is performance issue
for high sample rate and mulitchannel. For example, there is
noise issue for converting 48kHz to 768kHz, channel number
is larger than 5 channels, and p2p case.

So in order to increase performance, we reduce the taps number
to 32 in default, the quality is relatively downgraded.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-11 17:43:38 +08:00
Viorel Suman 69a1a919b9 MLK-23567-3: ASoC: fsl_xcvr: add TX CS control
TX CS control is needed for SPDIF/eARC TX function,
so add it. Aside of this separate TX controls from
RX controls so that controls can be added as function
of RX/TX flags of "fsl,xcvr-mode" DTS variable.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-10 11:08:35 +02:00
Viorel Suman e40f7a6b1a MLK-23567-2: ASoC: fsl_xcvr: use same format for both RX and TX
The only supported XCVR format is IEC958_SUBFRAME_LE, so use it
for both RX and TX.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-10 11:08:35 +02:00
Jason Liu 335d2828a9 This is the 5.4.24 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl5hHjgACgkQONu9yGCS
 aT6CSBAA0c16mnDb59jgmW/sBj/p/MrlD/WJzLriqiKN5BUsPt9++I5mNj8mG+d2
 Glm4086e8L826zv8oKiZm23xk93on+78ExhVFVZvZNaEUpiRNYCGSuDq2NrHW0z+
 kpagkAFLfCUZFoKtmWo+bpl0YtF4dd/fg7+EjyL6qT1DBs8NVMwZx7i/v0xXv7Wc
 0vsGCLYoBLzcW1FB2d9cfAUPCBuGEzL/7TdifNOXRgI9owGsZndFJgXgIzoBUt/P
 tqB8RLjIupCiMEPtsEAZ/rgEQLPFkb3yrBvgjd1wDI8bHUIQU0clqThKVNvmNSmv
 UTBSNgPAhkP8nZG7X9xCkyfEsUefejBJy66da9n4XTGGrXf9ga0BL0nNrOGwOesr
 m+tNnBSFsbFCMqFopQnt4zZSnaf67AOk2mzxbEu4E+sStyW943aDO9MoRRFgaYGH
 pfie3qOKtKta2MuNTJA+q6F0W9H+V5MtMpwbyuy1/dp2eVln2wewBBMvXYdL1YOy
 E/Z87nsQgalsDynz9m/niv32J4JAxHptyOyROkktDLBSzL5RawNn+Op8X5EtmZOe
 sPkiYicqp9CLmMj13qWXJhtuyNdD4wk6FyyAy6cX9mF44+EZGOBkyNP+n8g789Kn
 sqFJ7sfTfOnwLBFciMA5PaMTGNWROyWXNkvvUzO+9t0CyFAnT2U=
 =abGA
 -----END PGP SIGNATURE-----

Merge tag 'v5.4.24' into imx_5.4.y

Merge Linux stable release v5.4.24 into imx_5.4.y

* tag 'v5.4.24': (3306 commits)
  Linux 5.4.24
  blktrace: Protect q->blk_trace with RCU
  kvm: nVMX: VMWRITE checks unsupported field before read-only field
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>

 Conflicts:
	arch/arm/boot/dts/imx6sll-evk.dts
	arch/arm/boot/dts/imx7ulp.dtsi
	arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
	drivers/clk/imx/clk-composite-8m.c
	drivers/gpio/gpio-mxc.c
	drivers/irqchip/Kconfig
	drivers/mmc/host/sdhci-of-esdhc.c
	drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
	drivers/net/can/flexcan.c
	drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
	drivers/net/ethernet/mscc/ocelot.c
	drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
	drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
	drivers/net/phy/realtek.c
	drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
	drivers/perf/fsl_imx8_ddr_perf.c
	drivers/tee/optee/shm_pool.c
	drivers/usb/cdns3/gadget.c
	kernel/sched/cpufreq.c
	net/core/xdp.c
	sound/soc/fsl/fsl_esai.c
	sound/soc/fsl/fsl_sai.c
	sound/soc/sof/core.c
	sound/soc/sof/imx/Kconfig
	sound/soc/sof/loader.c
2020-03-08 18:57:18 +08:00
Shengjiu Wang 1d12f4912e LF-601-2: ASoC: fsl_esai: add chan_name for dma_params
The chan_name is missed, otherwise:

[   68.051062] of_dma_request_slave_channel: not enough information provided
[   68.058700] fsl-esai-dai 59010000.esai: ASoC: can't open component 59010000.esai: -6

Fixes: 6ee6ebd6efae ("LF-601-1: ASoC: fsl_esai: Switch to imx-pcm-dma-v2")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-07 11:06:28 +08:00
Shengjiu Wang 5fb9ae16b7 LF-601-2: ASoC: fsl_asrc_dma: use dma channel of ESAI for p2p
With EDMA, there is two dma channels can be used for p2p,
one is from ASRC, one is from another peripheral (ESAI or SAI)
previously we select the dma channel of ASRC, but find an issue
for ideal ratio case, there is no control for data copy
speed, the speed is faster than expected.

So we switch to dma channel of peripheral (ESAI or SAI), that
copy speed of DMA is controlled by data consumption speed
in the peripheral FIFO.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-03-05 12:19:05 +08:00
Shengjiu Wang e827b5e3f9 LF-601-1: ASoC: fsl_esai: Switch to imx-pcm-dma-v2
With the imx-pcm-dma, the dma channel will be allocated in probe,
with EDMA, the channel allocation is fixed for each peripheral.

In ASRC->ESAI->CODEC case, we have two sound card device, hw:x,0
and hw:x,1, with imx-pcm-dma, the channel for esai will be ocuppied
by hw:x,0 in boot up.  when asrc platform driver want to request
the dma channnel for esai, it will fail.

So we switch to imx-pcm-dma-v2, with imx-pcm-dma-v2, the dma
channel is allocated when running, not in probe.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-03-05 12:18:48 +08:00
Daniel Baluta f23142593e MLK-23350-14 ASoC: SOF: fsl_dai: Introduce dai-index property
With the help of dai-index we figure out the correct name for a DAI.
In topology files DAI name is formed by concatenating DAI type ("sai",
"esai", etc) with DAI index.

So, this patch removes hardcoded DAI names esai0, sai1 and figures out
the names based on DAI type/index.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-02 13:20:41 +02:00
Oleksandr Suvorov 4c585d1e98 ASoC: fsl_sai: Fix exiting path on probing failure
commit d152088978 upstream.

If the imx-sdma driver is built as a module, the fsl-sai device doesn't
disable on probing failure, which causes the warning in the next probing:

==================================================================
fsl-sai 308a0000.sai: Unbalanced pm_runtime_enable!
fsl-sai 308a0000.sai: Unbalanced pm_runtime_enable!
fsl-sai 308a0000.sai: Unbalanced pm_runtime_enable!
fsl-sai 308a0000.sai: Unbalanced pm_runtime_enable!
fsl-sai 308a0000.sai: Unbalanced pm_runtime_enable!
fsl-sai 308a0000.sai: Unbalanced pm_runtime_enable!
==================================================================

Disabling the device properly fixes the issue.

Fixes: 812ad463e0 ("ASoC: fsl_sai: Add support for runtime pm")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Link: https://lore.kernel.org/r/20200205160436.3813642-1-oleksandr.suvorov@toradex.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-28 17:22:26 +01:00
Viorel Suman 514647d585 MLK-23313-14: ASoC: fsl: imx_xcvr: remove dummy codec params adjustment hack
The hack was added to allow XCVR to record data at high FS rate,
remove it since it impacts other drivers such as MICFIL.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-02-26 10:55:43 +02:00
Viorel Suman 758605d6d4 MLK-23313-11: ASoC: fsl_xcvr: use fsl,xcvr-mode to enable TX/RX
Enable playback and capture as function of fsl,xcvr-mode.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2020-02-24 16:02:37 +02:00
Viorel Suman 61eb408955 Revert "MLK-23313-11: ASoC: fsl_xcvr: playback not yet supported"
This reverts commit 14460831d7.
2020-02-24 15:55:11 +02:00
Viorel Suman 14460831d7 MLK-23313-11: ASoC: fsl_xcvr: playback not yet supported
Disable playback as it is not supported yet.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2020-02-24 14:21:21 +02:00
Daniel Baluta e503940db4 MLK-23350-2 ASoC: fsl: Export imx_audiomix_dsp_start symbol
So that it can be used by SOF module.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-21 17:22:09 +02:00
Daniel Baluta 352ad24ecb MLK-23350-1 ASoC: sof: Skip power domain handline when num_domains = 1
This case case is already handled by the PM core.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-21 17:22:09 +02:00
Viorel Suman bf133eb854 MLK-23313-4: ASoC: fsl: Add Audio XCVR machine driver
This patch implements Audio XCVR machine driver for NXP iMX8 SOCs.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-02-20 12:58:12 +02:00
Viorel Suman c7aa3b9266 MLK-23313-3: ASoC: fsl: Add Audio XCVR CPU DAI driver.
The patch implements Audio XCVR CPU DAI driver for NXP iMX8 SOCs.
Audio XCVR is a on-chip functional module and implements
HDMI 2.1 spec eARC, ARC and SPDIF modes.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-02-20 12:57:57 +02:00
Shengjiu Wang 92601d2f59 LF-908-1: fsl_ssi: fix noise issue for master and mono mode
The driver will switch to normal mode for 1 channel, so the slot width
is not fixed to 32 bit in this mode, and even in mono mode, the slot
number is 2.
But if the bit clock calulation still use the bit width=32, and slot
number=1, then it cause the output frameclock is not correct. So there
will be noise in output sound.

This patch is to change the bit clock formula of mono mode to be
2channels * params_width * sample rate.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-02-18 19:11:36 +08:00
Daniel Baluta 79f66d8f52 MLK-23255-4: ASoC: fsl_dsp: Select SND_SOC_FSL_DSP_AUDIOMIX
This is needed by DSP driver on i.MX8MP. Need to find an elegant
way to only select it on this board.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-13 19:26:38 +08:00
Daniel Baluta d9e26ed3a5 MLK-23255-3: ASoC: fsl_dsp: Add support i.MX8MP
1. Introduce new board type and compatible string in preparation for
i.MX8MP board.

2. Add support configure and start DSP for i.MX8MP.

3. Add clocks for i.MX8MP, and do special process when suspend and
resume because dsp haven't independent power.

4. Add special handle for i.MX8MP, because in imx8mp there is audiomix
power domains, and only one power domain.

Signed-off-by: Zhang Peng <peng_zhang_8@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-13 19:26:37 +08:00
Daniel Baluta a504bca19c MLK-23255-2: ASoC: fsl_dsp: Refactor fsl_dsp to prepare support i.MX8MP
1. Factor out SCU configuration from fsl_dsp_probe because
i.MX8 MP which doesn't have an SCU.

2. Factor out DSP start function operation in a separate function
in preparation for adding support for i.MX8MP.

Signed-off-by: Zhang Peng <peng_zhang_8@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-13 19:26:37 +08:00
Daniel Baluta fb29abcd7a MLK-23255-1: ASoC: fsl_dsp: Add Audio MIX DSP helper
This is a subdevice of audiomix MFD device, exposing
access to DSP control register from AudioMIX subsystem.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-13 19:26:37 +08:00
Shengjiu Wang 7fcdf7d7e3 MLK-23287-1: ASoC: fsl_aud2htx: Add aud2htx module driver
The AUD2HTX is a digital module that provides a bridge between
the Audio Subsystem and the HDMI RTX Subsystem. This module
includes intermediate storage to queue SDMA transactions prior
to being synchronized and passed to the HDMI RTX Subsystem over
the Audio Link.

The AUD2HTX contains a DMA request routed to the SDMA module.
This DMA request is controlled based on the watermark level in
the 32-entry sample buffer.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-02-11 18:07:02 +08:00
Chuhong Yuan 68b74847c8 ASoC: fsl_audmix: add missed pm_runtime_disable
[ Upstream commit 77fffa7422 ]

The driver forgets to call pm_runtime_disable in probe failure
and remove.
Add the missed calls to fix it.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20191203111303.12933-1-hslester96@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-01 09:34:42 +00:00
Shengjiu Wang 27198be03f MLK-23242-4: ASoC: fsl_sai: Add support for imx8mp
In imx8mp there is audiomix power domains, and only
one power domain, that we don't need to call
dev_pm_domain_attach_by_id, which should return the EEXIST.

And we need to enable the MCLK output even it is in slave
mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-01-20 17:08:20 +08:00
Shengjiu Wang 1de3e8edd9 MLK-23242-2: ASoC: fsl_micfil: Add support for imx8mp
The new features are:
1. The output is 24 more significative bits in 32bit slot
2. The fifo depth is 32 entries.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-01-20 17:08:13 +08:00
Robin Gong 93a53a2f8b MLK-23242-1: ASoC: fsl_easrc: request dma channel from specific controller
Request dma channel from specific dma controller instead of generic dma
controller list, otherwise, may get the wrong dma controller if there are
multi dma controllers such as i.mx8mp.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2020-01-20 17:08:03 +08:00
Shengjiu Wang ff05848906 ASoC: fsl_esai: Add spin lock to protect reset, stop and start
commit 35dac62747 upstream.

xrun may happen at the end of stream, the
trigger->fsl_esai_trigger_stop maybe called in the middle of
fsl_esai_hw_reset, this may cause esai in wrong state
after stop, and there may be endless xrun interrupt.

This issue may also happen with trigger->fsl_esai_trigger_start.

So Add spin lock to lock those functions.

Fixes: 7ccafa2b38 ("ASoC: fsl_esai: recover the channel swap after xrun")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/52e92c4221a83e39a84a6cd92fc3d5479b44894c.1572252321.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-17 19:48:34 +01:00
Shengjiu Wang 0885728776 MLK-22620: ASoC: imx-ak5558: Force tdm mode for ASRC case
In order to support the odd channels for ASRC case, we
force to enable TDM mode. In non-tdm case, we enable
multi lane to support multi channels, but limitation
is odd multi channels can't be supported.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-29 13:26:32 +08:00
Shengjiu Wang de1a87b02a MLK-23104: ASoC: fsl_rpmsg_i2s: Add constraint for supported rate
In imx8mn, M7 image has poor quality for 8kHz ~ 22kHz sample rate
case, but M7 side don't want to fix this issue in their image, so
we remove these sample rate in supported list.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-23 14:56:08 +08:00
Shengjiu Wang a11fab7708 ASoC: fsl_audmix: Add spin lock to protect tdms
commit fe965096c9 upstream.

Audmix support two substream, When two substream start
to run, the trigger function may be called by two substream
in same time, that the priv->tdms may be updated wrongly.

The expected priv->tdms is 0x3, but sometimes the
result is 0x2, or 0x1.

Fixes: be1df61cf0 ("ASoC: fsl: Add Audio Mixer CPU DAI driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/1e706afe53fdd1fbbbc79277c48a98f8416ba873.1573458378.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 19:56:14 +01:00
Shengjiu Wang 98f77072a7 LF-215-2: ASoC: fsl_rpmsg_i2s: Fix suspend failure in free run mode
As we enabled WQ_FREEZABLE for workqueue, flush_workqueue in suspend
stage will not success, for the workqueue is freezed.

flush_workqueue in suspend is a wrong operation with WQ_FREEZABLE,
so remove it.

Fixes: 5b07f684deb1 ("LF-215: ASoC: fsl_rpmsg_i2s: Enable WQ_FREEZABLE for workqueue")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-12 19:21:31 +08:00
Viorel Suman c1a10cf6a0 LF-406: ASoC: fsl_audmix: add missing spin lock init
Add missing spin lock init.

Fixes: 9360612 ("ASoC: fsl_audmix: Add spin lock to protect tdms")
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-12-10 13:28:31 +02:00
Viorel Suman d9a6fd7eb7 MLK-21957-3: ASoC: fsl_sai: add bitcount and timestamp controls
Bitcount and timestamp support added in SAI IP recently.
Add the related controls in SAI driver.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-12-10 13:28:28 +02:00
Viorel Suman 4c4b7df6f9 MLK-22522: ASoC: fsl_sai: fix stack-out-of-bounds KASAN complain
Fix the following KASAN reported issue:
==================================================================
[   11.580278] BUG: KASAN: stack-out-of-bounds in find_next_bit+0x3c/0xc0
[   11.586815] Read of size 8 at addr ffffffc8c8d4f760 by task swapper/0/1
[   11.593440]
[   11.594943] CPU: 4 PID: 1 Comm: swapper/0 Tainted: G W 4.19.35-05042-g. #157
[   11.604259] Hardware name: Freescale i.MX8QM MEK (DT)
[   11.609323] Call trace:
[   11.611785]  dump_backtrace+0x0/0x230
[   11.615458]  show_stack+0x14/0x20
[   11.618787]  dump_stack+0xbc/0xf4
[   11.622118]  print_address_description+0x60/0x270
[   11.626830]  kasan_report+0x230/0x360
[   11.630505]  __asan_load8+0x84/0xa8
[   11.634005]  find_next_bit+0x3c/0xc0
[   11.637595]  fsl_sai_calc_dl_off+0x1c/0x50
[   11.641703]  fsl_sai_read_dlcfg+0x184/0x368
[   11.645898]  fsl_sai_probe+0x3ec/0xb48
[   11.649663]  platform_drv_probe+0x70/0xd8
[   11.653683]  really_probe+0x24c/0x370
[   11.657358]  driver_probe_device+0x70/0x138
[   11.661554]  __driver_attach+0x124/0x128
[   11.665489]  bus_for_each_dev+0xe8/0x158
[   11.669425]  driver_attach+0x30/0x40
[   11.673012]  bus_add_driver+0x290/0x308
[   11.676861]  driver_register+0xbc/0x1d0
[   11.680711]  __platform_driver_register+0x7c/0x88
[   11.685431]  fsl_sai_driver_init+0x18/0x20
[   11.689537]  do_one_initcall+0xe8/0x5a8
[   11.693387]  kernel_init_freeable+0x6b0/0x760
[   11.697759]  kernel_init+0x10/0x120
[   11.701255]  ret_from_fork+0x10/0x18
....
==================================================================
[   11.800186] Disabling lock debugging due to kernel taint

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-10 13:28:22 +02:00
Viorel Suman b02e986120 MLK-21957-2: ASoC: fsl_sai: read SAI version and params in probe
Read SAI IP version and parameters in probe function.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-12-10 13:28:18 +02:00
Viorel Suman 183d08c764 MLK-21957-1: ASoC: fsl_sai: remove reset code from dai_probe
SAI software reset is done in runtime resume,
there is no need to do it in fsl_sai_dai_probe.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-10 13:28:14 +02:00
Viorel Suman 115b39615b MLK-21484-4: ASoC: fsl_sai: ensure clk not in use prior set_mclk_rate
On recent kernels clks which are marked with CLK_SET_RATE_GATE are
"protected" against further changes at clk_prepare time, including clk
set_parent and set_rate. See commit 9461f7b33d ("clk: fix
CLK_SET_RATE_GATE with clock rate protection"). The current fsl_sai
implementation ensures the clock is not in use prior set_parent,
extend this for set_rate also by moving if (sai->mclk_streams == 0)
outside fsl_sai_set_mclk_rate(). Aside of this avoid changing rate and
parent for BUS clk.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-12-10 13:28:09 +02:00
Shengjiu Wang fe88b874f6 LF-374: ASoC: imx-pcm-dma-v2: Fix compile issue with SND_SOC_IMX_PCM_DMA=m
When build with CONFIG_SND_SOC_IMX_PCM_DMA=m, there is error:

ERROR: "snd_pcm_lib_preallocate_free" [sound/soc/fsl/imx-pcm-dma-v2.ko] undefined!

The reason is that snd_pcm_lib_preallocate_free is not declared
with EXPORT_SYMBOL.

In this patch, we use snd_dma_alloc_pages & snd_dma_free_pages to replace
the snd_pcm_lib_preallocate_pages & snd_pcm_lib_preallocate_free to fix
the build issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-10 18:35:09 +08:00
Shengjiu Wang 533604f383 MLK-21106: ASoC: imx-ak4458: Fix channel not supported in tdm & daisy chain
The channel num (9 - 15) should not be supported in tdm & daisy chain
mode for there is two dataline, this channel number can't be
symmetrically distributed on two dataline (the first one is fixed to
be 8 channel)

Fixes commit 8d29874365c3 ("MLK-17817-2: ASoC: imx-ak4458: enable 16
channels in TDM mode")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0bc47b31660efd3dbbeee7e51fca6f75e7ecb69f)
2019-12-04 12:50:54 +08:00
Daniel Baluta e00f0e9f11 ASoC: fsl_dsp: Rename reserved-region with memory-region
This aligns DSP node description with upstream. No need
to add backward compatibility for older dtbs because
FSL DSP driver is obsolete and it will be removed in the future

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 17:45:01 +02:00
Dong Aisheng 8d66f9b461 Merge remote-tracking branch 'origin/audio/ssi' into audio/next
* origin/audio/ssi:
  LF-106: ASoC: fsl_ssi: request BUS_FREQ_AUDIO
  MLK-15975-1: ASoC: fsl_ssi: support multi fifo script
2019-12-02 18:00:44 +08:00
Dong Aisheng 635de10e16 Merge remote-tracking branch 'origin/audio/spdif' into audio/next
* origin/audio/spdif: (20 commits)
  LF-106: ASoC: fsl_spdif: request BUS_FREQ_HIGH
  ASoC: fsl_spdif:Support multi power domains
  ASoC: fsl_spdif: Add pm_runtime_enable in probe
  MLK-21484-2: ASoC: fsl_spdif: ensure clk is unprepared before reparent
  MLK-19154-5: ASoC: fsl_spdif: refine PLL switch handling
  ...
2019-12-02 18:00:44 +08:00
Dong Aisheng b7f8883066 Merge remote-tracking branch 'origin/audio/sof' into audio/next
* origin/audio/sof: (21 commits)
  ASoC: SOF: Read tplg filename from board descriptor
  ASoC: SOF: Update fw_filename from board description
  ASoC: SOF: Allow probe to continue when we have an actual codec
  ASoC: SOF: Hardcode ignore_machine
  ASoC: fsl: Add generic DAI driver
  ...
2019-12-02 18:00:44 +08:00
Dong Aisheng 2a635fc846 Merge remote-tracking branch 'origin/audio/sai' into audio/next
* origin/audio/sai: (65 commits)
  LF-106: ASoC: fsl_sai: request BUS_FREQ_AUDIO
  ASoC: fsl_sai: Mark cache dirty at resume
  MLK-21876-4 ASoC: fsl: sai: fix build for next-20190524 upgrade
  ASoC: fsl: sai: fix build failture due to 5.1 RC7 upgrade
  ASoC: fsl_sai: support multi power domain
  ...
2019-12-02 18:00:43 +08:00
Dong Aisheng d7ba9dc826 Merge remote-tracking branch 'origin/audio/rpmsg' into audio/next
* origin/audio/rpmsg: (59 commits)
  LF-215: ASoC: fsl_rpmsg_i2s: Enable WQ_FREEZABLE for workqueue
  ASoC: imx-pcm-rpmsg: Remove the prtd
  ASoC: imx-pcm-rpmsg: Fix writecombine/wc build error
  ASoC: rpmsg_ak4497: ignore suspend with DAPM
  Revert "ASoC: soc-pcm: remove soc_rtdcom_ack()"
  ...
2019-12-02 18:00:43 +08:00
Dong Aisheng f543f63f55 Merge remote-tracking branch 'origin/audio/micfil' into audio/next
* origin/audio/micfil:
  MLK-22598: ASoC: fsl_micfil: Reset channel output data Flag
  ASoC: fsl_micfil: Merge the changes from imx_4.19.y
2019-12-02 18:00:42 +08:00
Dong Aisheng af11fb98c2 Merge remote-tracking branch 'origin/audio/hdmi' into audio/next
* origin/audio/hdmi: (22 commits)
  ASoC: imx-hdmi: Fix compile error
  ASoC: imx-hdmi-dma: Fix issue with dma_alloc_coherent
  ASoC: imx-hdmi-dma: replace platform to component
  ASoC: imx-cdnhdmi: Fix compile error
  MLK-20183-2: ASoC: imx-cdnhdmi: reconfigure the mclk for HDMI on imx8mq
  ...
2019-12-02 18:00:42 +08:00
Dong Aisheng 25d4beddff Merge remote-tracking branch 'origin/audio/fm' into audio/next
* origin/audio/fm: (8 commits)
  MLK-11429-21: ASoC: fsl: port si476x machine driver from imx_3.10.y
  MLK-11305 radio-si476x: support set V4L2_CID_AUDIO_MUTE CTRL
  MLK-22355: mfd: si476x: Use system_freezable_wq instead of system_wq
  MLK-10055-2: mfd: si476x-i2c: sound is registered when no FM module attached
  MLK-10038-1: mfd: si476x-i2c: Add support of si476x-rev4.0 board
  ...
2019-12-02 18:00:41 +08:00
Dong Aisheng 845f67dda2 Merge remote-tracking branch 'origin/audio/esai' into audio/next
* origin/audio/esai: (7 commits)
  LF-276: ASoC: fsl_easi: constrain period size for edma case
  ASoC: fsl_esai: Remove the tasklet
  ASoC: fsl_esai: Add spin lock to protect reset, stop and start
  ASoC: fsl_esai: Remove expensive print in irq handler
  ASoC: fsl_esai: support multi power domain
  ...
2019-12-02 18:00:40 +08:00
Dong Aisheng 5d9b52c341 Merge remote-tracking branch 'origin/audio/dsp' into audio/next
* origin/audio/dsp: (78 commits)
  MLK-22815-1: ASoC: fsl: dsp: Expand parameter msg size
  MLK-21144 ASoC: fsl: Fix crash with multiple open/close
  ASoC: fsl_dsp: Use new compatible string for FSL DSP
  ASoC: fsl: dsp: remove unused types.h
  MLK-21985-6 ASoC: imx-dsp: fix build for next 20190607 upgrade
  ...
2019-12-02 18:00:40 +08:00
Dong Aisheng d40375dbf7 Merge remote-tracking branch 'origin/audio/dma' into audio/next
* origin/audio/dma: (14 commits)
  ASoC: imx-pcm-dma-v2: Fix writecombine/wc build error
  ASoC: imx-pcm-dma-v2: Add component name
  ASoC: imx: fix build failture
  MLK-16224-2: ASoC: dmaengine_pcm: add fifo_num to snd_dmaengine_dai_dma_data
  MLK-18947: ASoC: imx-pcm-dma: alloc buffer from IRAM
  ...
2019-12-02 18:00:39 +08:00
Dong Aisheng 2e5482f337 Merge remote-tracking branch 'origin/audio/card' into audio/next
* origin/audio/card: (127 commits)
  ASoC: imx-pdm: Fix compile issue
  ASoC: imx-wm8524: remove unused audio route
  ASoC: imx-ak5558: remove unused audio route
  ASoC: imx-wm8962: change cpu-dai to audio-cpu
  ASoC: imx-sii902x: Fix compile error
  ...
2019-12-02 18:00:38 +08:00
Dong Aisheng bbeadc6b01 Merge remote-tracking branch 'origin/audio/audmix' into audio/next
* origin/audio/audmix:
  ASoC: fsl_audmix: Add spin lock to protect tdms
2019-12-02 18:00:37 +08:00
Shengjiu Wang 125bad112c LF-276: ASoC: fsl_easi: constrain period size for edma case
There is limitaion for EDMA, which can only accept the period bytes
that can be divided by maxburst with no remainder. Otherwise EDMA
will not copy the left data in the end, and it will cause noise.
so add constraint for these chips.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-02 15:33:20 +08:00
Shengjiu Wang dfb874e95e LF-215: ASoC: fsl_rpmsg_i2s: Enable WQ_FREEZABLE for workqueue
In the end of playback, when the suspend happen, there will be error
in m4 side.

RTM_SaiSdmaAdapter_SetParam: Tx in wrong state 2!
SRTM_SaiSdmaAdapter_SetBuf: Tx in wrong state 2!
SRTM_SaiSdmaAdapter_Start: Tx in wrong state 2!

The reason is that the I2S_TX_TERMINATE happen in the middle of
I2S_TX_SUSPEND and I2S_TX_RESUME, this sequence is not allowed.

So we make the rpmsg message workqueue enter freeze in suspend
to avoid such issue. that the command sequence will be
I2S_TX_SUSPEND->I2S_TX_RESUME->I2S_TX_TERMINATE

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-29 16:15:08 +08:00
Daniel Baluta 925ad97abd ASoC: fsl: Add generic DAI driver
On i.MX8 platforms that have a DSP the DAI handling is taken care
of by two entities:
	* Application Processor (AP), which runs Linux
	* DSP, which runs a firmware (typically Sound Open Firmware)

The DSP has access to DAI IP registers, but it cannot easily handle
resources like:
	* clock
	* power domain management
	* pinctrl.

For this reason we introduce a generic FSL DAI driver which will take
care of the resources above.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-28 23:16:40 +02:00
Daniel Baluta 78570725ce Revert "ASoC: fsl: Add generic DAI driver"
This reverts commit 9aca4d89de.
Reverting this because the patch suffered a lot of changes and
I don't want to do a first push. This should be squasehd
with 9aca4d89de.
2019-11-28 23:15:41 +02:00
Daniel Baluta 9aca4d89de ASoC: fsl: Add generic DAI driver
On i.MX8 platforms that have a DSP the DAI handling is taken care
of by two entities:
	* Application Processor (AP), which runs Linux
	* DSP, which runs a firmware (typically Sound Open Firmware)

The DSP has access to DAI IP registers, but it cannot easily handle
resources like:
	* clock
	* power domain management
	* pinctrl.

For this reason we introduce a generic FSL DAI driver which will take
care of the resources above.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 21:56:10 +02:00
Shengjiu Wang fcfc4be154 MLK-11429-21: ASoC: fsl: port si476x machine driver from imx_3.10.y
cherry-pick below patch from imx_3.14.y
ENGR00330403-3: ASoC: fsl: port si476x machine driver from imx_3.10.y

Port si476x machine dirver for i.MX series SoC and binding doc from imx_3.10.y

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:34 +08:00
Shengjiu Wang f25a242346 LF-106: ASoC: fsl_ssi: request BUS_FREQ_AUDIO
request BUS_FREQ_AUDIO

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:27 +08:00
Shengjiu Wang 24a3bee2e1 MLK-15975-1: ASoC: fsl_ssi: support multi fifo script
With dual fifo enabled, the case recording mono sound
in the background, playback sound twice in parallal,
the second time playback sound may distort, the possible
reason is using dual fifo to playback mono sound is not
recommended.

This patch is to provide a option to use multi fifo script,
which can be dynamically configured as one fifo or two fifo
mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 9d71068cf7d1fc1ec36e5fb34a321c1bdbaad324)
2019-11-25 15:54:27 +08:00
Shengjiu Wang c7dad700c4 LF-106: ASoC: fsl_spdif: request BUS_FREQ_HIGH
request BUS_FREQ_HIGH

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:25 +08:00
Shengjiu Wang bd7b26036e ASoC: fsl_spdif:Support multi power domains
Support multi power domains

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:24 +08:00
Shengjiu Wang 2d2076c4d0 ASoC: fsl_spdif: Add pm_runtime_enable in probe
Add pm_runtime_enable in probe

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:24 +08:00
Viorel Suman ccea8f42a7 MLK-21484-2: ASoC: fsl_spdif: ensure clk is unprepared before reparent
On recent kernels clks which are marked with CLK_SET_RATE_GATE are
"protected" against further changes at clk_prepare time, including clk
reparent. Wrap clk set_parent and set_rate operations with
disable_unprepare and prepare_enable.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:23 +08:00
Viorel Suman 8e013fb268 MLK-19154-5: ASoC: fsl_spdif: refine PLL switch handling
Allow PLL switch for playback stream only and remove
PLL switch guard with regard to capture stream as the
clock for capture stream is provided externally.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit c8213da5fbcd370acb4d764bef5df5981a517c11)
2019-11-25 15:54:22 +08:00
Viorel Suman 084c2ca345 MLK-19154-4: ASoC: imx_spdif: set SPDIF ROOT clock freq as function of rate
Set SPDIF master clock frequency as function of rate.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 407430a03994e4acff508afe8c9772680558c1c5)
2019-11-25 15:54:22 +08:00
Viorel Suman 960f3f4848 MLK-19154-3: ASoC: fsl_spdif: Add support for PLL switch at runtime.
iMX8 platforms typically have 2 AUDIO PLLs being configured to handle
8k and 11k audio rates. The patch implements the functionality to
select at runtime the appropriate AUDIO PLL as function of audio
file rate.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 3a29374cfbe0bfaf1785fa66163ffd3b9e30aca3)
2019-11-25 15:54:21 +08:00
Viorel Suman 1b48437219 MLK-19154-2: ASoC: fsl_spdif: keep all 7 TxClk sources
Use txclk array to keep all 7 TxClk sources instead of keeping clocks per
rate - need to do this in order to avoid multiple prepare_enable /
disable_unprepare of the same clock during suspend/resume.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 61bc5c83af0713a09b520486051a2efcbe852763)
2019-11-25 15:54:21 +08:00
Viorel Suman fff54ed842 MLK-19115-2: ASoC: fsl_spdif: add support for enabling raw capture mode
Since i.MX8 MQ SPDIF interface is able to capture raw data.
Add support in SPDIF driver for this functionality.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit e13a302391f56a6bb547ff89e3fac73941cee429)
2019-11-25 15:54:20 +08:00
Viorel Suman 83fbe12324 MLK-19115-1: ASoC: fsl_spdif: use snd_ctl_boolean_mono_info
Remove redundant code and use snd_ctl_boolean_mono_info
instead.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 6ae5e1bf20eeff7e5ec821d96958329170359ce8)
2019-11-25 15:54:20 +08:00
Shengjiu Wang e3e48111d9 MLK-18574: ASoC: fsl_spdif: specify the spdif in imx8mm
specify the spdif in imx8mm for the ipg clock is higher that
it can support 192kHz

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:19 +08:00
Shengjiu Wang 590ec64bb5 MLK-18574: ASoC: fsl_spdif: support 192kHz for rx in imx8
The ipg clock is higher enough to support 192kHz in imx8

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:18 +08:00
Shengjiu Wang 70e9a07d29 MLK-17089-4: ASoC: fsl_spdif: support suspend & resume for imx8
Base on latest power management design in MLK-17074, every driver
need to enter runtime suspend state in suspend, so the driver should
call the pm_runtime_force_suspend in suspend. with this implementation
the suspend function almost same as runtime suspend function. so remove
the suspend function, just use pm_runtime_force_suspend instead.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:18 +08:00
Shengjiu Wang c4f6be48fd MLK-17034-6: ASoC: fsl_spdif: Move clock operation to pm runtime function
In imx8 when systerm enter suspend state, the power of subsystem will be
off, the clock enable state will be lost after resume, but the runtime
resume function will be called after resume by pm, so need to move clock
enablement to runtime resume and clock disablement to runtime suspend.
Then after resume the clock enable state can be recovered.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:17 +08:00
Shengjiu Wang c84933c819 MLK-15960-3: ASoC: fsl_spdif: refine pm runtime function
In imx8qm/imx8qxp, the power domain of IP is enabled when
pm_runtime_get_sync() is called, and disabled when pm_runtime
_put_sync() is called. when power domain is disabled, the value
of registers will lost, so we need to use the regcache_sync()
to restore the registers in fsl_spdif_runtime_resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:54:17 +08:00
Shengjiu Wang 38f89d3ce1 MLK-13947: ASoC: fsl_spdif: introduce SoC specific data
Introduce a SoC data struct which contains the differences between
the different SoCs this driver supports. This makes it easy to support
more differences without having to introduce a new switch/case each
time.
And in imx8qm, the spdif has two interrupt numbers and the burst size
should be 2 for EDMA limitation to support dual FIFO.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:54:16 +08:00
Shengjiu Wang 610e75569e MLK-12722: ASoC: fsl_spdif: clear the validity bit for TX
Validity bit is set in default, which means the data is not reliable,
The receive device may drop this data. So clear it in default, and
provide a mixer interface for user to control this bit.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:54:15 +08:00
Shengjiu Wang 54cf07dcaf MLK-10903-2: ASoC: imx_spdif: add snd_soc_pm_ops
Add snd_soc_pm_ops in machine driver to make the trigger suspend/resume
be called in suspend/resume. Remove platform_set_drvdata for redundance,
When register card, it has been called.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit fe21119eed18804b2bc7c47216b6f4478de0268d)
2019-11-25 15:54:15 +08:00
Shengjiu Wang f675fa3778 MLK-10903-1: ASoC: fsl_spdif: remove cache only in suspend/resume
In imx6qp, there is no mega fast. After suspend, but before resume,
there will be spdif interrupt, if set cache only in suspend, then we
can't clear the interrupt, because regmap_write only write to cache.
So the system will hang for the interrupt can't be cleared.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 2a6a522c86d6c0fe80023c4327ca7ce4792035c8)
2019-11-25 15:54:14 +08:00
Shengjiu Wang 15bbc61393 MLK-11429-1: ASoC: fsl_spdif: don't change the root clock rate of spdif in driver
cherry-pick below patch from imx_3.14.y
ENGR00331799-2 ASoC: fsl_spdif: don't change the root clock rate of spdif in driver

The spdif root clock may be used by other module or defined with
CLK_SET_RATE_GATE, so we can't change the clock rate in driver.
In this patch remove the clk_set_rate and clk_round_rate to protect the
clock.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit c77170b2c9a9737f6fd61a5ea85a43b90e8ef02b)
[ Aisheng: fix incorrectly removing u64 rate_actual ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:14 +08:00
Shengjiu Wang 801e2a74c5 LF-106: ASoC: fsl_sai: request BUS_FREQ_AUDIO
request BUS_FREQ_AUDIO

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:12 +08:00
Daniel Baluta 61e5cc7288 ASoC: fsl_sai: Mark cache dirty at resume
This is needed so that at resume will restore the
correct SAI registers.

Looks like the call to regcache_mark_dirty was missed when
porting commit 760bd6187413e37c8 ("MLK-15960-2: ASoC: fsl_sai: refine
the pm runtime function")

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:54:12 +08:00
Dong Aisheng 21ab6ea993 MLK-21876-4 ASoC: fsl: sai: fix build for next-20190524 upgrade
In file included from ../sound/soc/fsl/fsl_sai.c:15:0:
../sound/soc/fsl/fsl_sai.c: In function ‘fsl_sai_startup’:
../sound/soc/fsl/fsl_sai.c:957:51: error: ‘offset’ undeclared (first use in this function)
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),
                                                   ^
../include/linux/regmap.h:77:31: note: in definition of macro ‘regmap_update_bits’
  regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
                               ^
../sound/soc/fsl/fsl_sai.h:84:37: note: in expansion of macro ‘FSL_SAI_TCR3’
 #define FSL_SAI_xCR3(tx, off) (tx ? FSL_SAI_TCR3(off) : FSL_SAI_RCR3(off))
                                     ^
../sound/soc/fsl/fsl_sai.c:957:34: note: in expansion of macro ‘FSL_SAI_xCR3’
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),
                                  ^
../sound/soc/fsl/fsl_sai.c:957:51: note: each undeclared identifier is reported only once for each function it appears in
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),
                                                   ^
../include/linux/regmap.h:77:31: note: in definition of macro ‘regmap_update_bits’
  regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
                               ^
../sound/soc/fsl/fsl_sai.h:84:37: note: in expansion of macro ‘FSL_SAI_TCR3’
 #define FSL_SAI_xCR3(tx, off) (tx ? FSL_SAI_TCR3(off) : FSL_SAI_RCR3(off))
                                     ^
../sound/soc/fsl/fsl_sai.c:957:34: note: in expansion of macro ‘FSL_SAI_xCR3’
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:11 +08:00
Dong Aisheng 63de0c0232 ASoC: fsl: sai: fix build failture due to 5.1 RC7 upgrade
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:11 +08:00
Shengjiu Wang 53915e7ea9 ASoC: fsl_sai: support multi power domain
support multi power domain

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:10 +08:00
Shengjiu Wang c43c341752 ASoC: fsl_sai: Support -EPROBE_DEFER
Support -EPROBE_DEFER for the resource is not ready in time

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:09 +08:00
Viorel Suman e138a5378b MLK-20328-1: ASoC: fsl_sai: map number of pins to dataline masks
The patch enable mapping the number of pins required to play or record
a specific number of channels to a specific dataline mask.

Three consequent elements in "fsl,dataline" and "fsl,dataline,dsd" defines a
particular mapping, for instance for: fsl,dataline = "0 0xff 0xff 2 0x11 0x11"
there are two mappings defined:

default (0 pins) "rx" and "tx" dataline masks: 0 0xff 0xff
         2 pins  "rx" and "tx" dataline masks: 2 0x11 0x11

In case if property is missing, then default value "0 0x1 0x1" is considered.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:09 +08:00
Viorel Suman 34ef089c73 MLK-20189-8: ASoC: fsl_sai: use signed offset variable
Both dataline_off and dataline_off_dsd fields are unsigned,
thus checking negative values make no sense. Use a signed
variable to calculate offset instead.

This fixes Coverity issue: CID1899299

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:08 +08:00
Shengjiu Wang f2fa8b69e5 MLK-15975-3: ASoC: fsl_sai: The offset of fifo_off is changed
Commit 786c8bd56324 ("MLK-19734-3: dmaengine: imx-sdma: change
fifo offset of fifo_num") change the offset of fifo_off, so
the sai driver need to be updated.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit c94ce8776e01f1f40a866d4da89603ab042dde0f)
2019-11-25 15:54:06 +08:00
Viorel Suman a9534c8c98 MLK-19573-1: ASoC: fsl: dsd: make fsl_get_pins_state inline
Make fsl_get_pins_state function inline.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit badcb97ebd8c0aae89f76e979bcc801be35c7400)
2019-11-25 15:54:05 +08:00
Viorel Suman f3d96d45f6 MLK-18898-1: ASoC: fsl_sai: select pinctrl state as function of bitclock rate
Similar to DSD512 case we need a PCM pinctrl state option to map SAI BCLK
to codec MCLK pin. Given that bitclock rate is function of slots number and
slot width - pass bclk rate as parameter value from SAI driver.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 826caeae32713cff7ad50de8ebc9915de975edd9)
2019-11-25 15:54:02 +08:00
Shengjiu Wang ddf3ffebf9 MLK-18947: ASoC: fsl_sai: fix volatile function
The FSL_SAI_VERID and FSL_SAI_PARAM only available
when reg_offset is 8

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0a0695672dc7ecf07a7642ff6f99f0b9d3a26b32)
2019-11-25 15:54:01 +08:00
Viorel Suman 244757cda2 MLK-18682-2: ASoC: fsl: sai: allow dynamic pll switching
Currently SAI master clock derives from an audio pll that cannot be
changed at runtime. iMX8 SoC has 2 audio plls usually configured to support
either 8000Hz (8k,16k,32k,48k,etc) or 11025Hz (11k,22k,44.1k,88.2k,etc)
ranges of rates - thus at runtime a SAI interface is able to play only one
range of rates. The patch allows dynamic SAI master clock reparenting to
the appropriate audio pll as function of the audio stream rate to be
played/recorded.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:01 +08:00
Viorel Suman 4bc2390d93 MLK-18682-1: ASoC: fsl: sai: use set_bclk_ratio to calculate BCLK freq (part 1)
ALSA API has a standard way to configure DAI BCLK by calling
"snd_soc_dai_set_bclk_ratio" function. So use it to set BCLK ratio
and calculate SAI BCLK frequency.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
[ Aisheng: split machine imx-pdm changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:00 +08:00
Viorel Suman 06131f164d MLK-18534-1: ASoC: fsl: sai: introduce 1:1 bclk:mclk ratio support
Since IP version 3.01 (845s) SAI has support for 1:1
bclk:mclk ratio.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:00 +08:00
Viorel Suman f228945168 MLK-17531-1: ASoC: fsl: sai: add support for SAI v3.01
a) Add support for new SAI (VERID, PARAM, MCTL, MDIV) registers
   available in i.MX 850d (SAI v3.00) and i.MX 845s (SAI v3.01).
b) Handle SAI MCLK register as function of SAI IP version.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:59 +08:00
Viorel Suman cf1d61356c MLK-17580: ASoC: fsl: sai: check for pinctrl status
For some cases (like AMIX) pinctrl may be null - this
breaks SAI functionality. Enforce pinctrl null pointer
checking prior calling any function which involves
pins state changes.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:58 +08:00
Viorel Suman 0e084ed83d MLK-17580: ASoC: fsl: sai: Use DSD helper
Replace DSD related code with calls to DSD helper functions.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com
2019-11-25 15:53:58 +08:00
Viorel Suman 6e286195f6 MLK-17580: ASoC: fsl: dsd: Add DSD utilities helper
Add DSD utilities helper.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com
2019-11-25 15:53:57 +08:00
Cosmin-Gabriel Samoila 8f88f5a166 Sound: Soc: fsl: Set SAI Channel Mode to Output Mode
Transmit data pins will output zero when slots are masked or channels
are disabled. In CHMOD TDM mode, transmit data pins are tri-stated when
slots are masked or channels are disabled. When data pins are tri-stated,
there is noise on some channels when FS clock value is high and data is
read while fsclk is transitioning from high to low.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:56 +08:00
Shengjiu Wang 24e96cb548 MLK-17156-1: ASoC: fsl_sai: update register offset for ULP B0
ULP B0 integrate the latest SAI IP, there is version id and
parameter id register in the beginning, so update the offset
for ULP B0

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:55 +08:00
Viorel Suman 868ead7e7e MLK-17528-3: ASoC: fsl_sai: Set clock rate in "set_sysclk" API
Set the requested clock rate in "set_sysclk" for specified clock id.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:55 +08:00
Viorel Suman c5f603a927 MLK-17528-1: ASoC: fsl_sai: Introduce FSL_SAI_CLK_BIT clock id
Introduce FSL_SAI_CLK_BIT clock id in order to distinguish
the bit clock and master clocks in "set_sysclk" API.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:54 +08:00
Shengjiu Wang af5446166b MLK-17566: ASoC: fsl_sai: fix register definition
The register definition is not completed for SAI support
8 transmit data register and 8 receive data register.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:53 +08:00
Daniel Baluta 7713dcdb9f MLK-17485: ASoC: fsl_sai: Specify supported rate_min and rate_max
Because fsl_sai_dai rates doesn't have a specific set of
rate values (.rates = SNDRV_PCM_RATE_KNOT) we need to provide
rate_min and rate_max otherwise functions trying to get
supported parameters will get confused and return an error.

Fixes:  1b6f0496e013 ("MLK-17428-8: ASoC: fsl_sai: support 768KHz sample rate")
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:53 +08:00
Shengjiu Wang c31b8ab22e MLK-17428-8: ASoC: fsl_sai: support 768KHz sample rate
support 768Hz sample rate and 2.8MHz for DSD

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:52 +08:00
Viorel Suman 086dcbc6a9 MLK-16224-6: ASoC: fsl_sai: fix DSD suspend/resume
With the existing implementation the SAI pinctrl state is restored to
default after resume - this breaks DSD playback after resume.
Restore DSD pinctrl state in snd_soc_dai_driver resume callback.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:52 +08:00
Shengjiu Wang 27fdb7856d MLK-17467: ASoC: fsl_sai: fix typo for fsl_sai
Fix build warning

sound/soc/fsl/fsl_sai.c: In function ‘fsl_sai_trigger’:
sound/soc/fsl/fsl_sai.c:736:3: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
   while (tx && i < channels)
   ^~~~~
sound/soc/fsl/fsl_sai.c:742:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘while’
    j++;
    ^
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:52 +08:00
Shengjiu Wang 15e50be363 MLK-16224-4: ASoC: fsl_sai: support multi fifo and DSD
The codec always mux the LRCLK pin to DSD data line, so when
we want to support DSD, the pinmux is different. For two channel
DSD, the DSDL is mapped to TX0, but the DSDR is mapped to TX4,
there is address offset for the fifo address of TX0 and TX4, TX4's
fifo is not adjacent to TX0's.

Usually, if mapping is TX0 and TX1, that will be easy for SAI
and SDMA to handle, that SAI can use the FIFO combine mode, SDMA
can use the normal script.

so for DSD:
1. The SDMA should use the multi-fifo script, and SAI can't
use the FIFO combine mode.
2. driver should to check the dts configuration(fsl,dataline) for
which dataline is used corrently
3. maxburst is the multiply of datalines
4. each channel of DSD occupy one data lane
5. according to data lane, set TRCE bits

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:50 +08:00
Shengjiu Wang 82a7f067a1 MLK-17442: ASoC: fsl: fix wrong usage of filter_data (part 1)
The filter_data should be used for dma_filter_fn function,
but we used the filter_data wrongly for dma channel name.
This patch is to fix the issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviwed-by: Daniel Baluta <daniel.baluta@nxp.com>
[ Aisheng: split out esai and pcm changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:49 +08:00
Shengjiu Wang c49d1d073a MLK-16929-1: ASoC: fsl_sai: add bitclk_freq
Allow set SAI bit clock frequency trough snd_soc_dai_set_sysclk
function call on machine sound drivers.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Adrian Alonso <adrian.alonso@nxp.com>
2019-11-25 15:53:49 +08:00
Viorel Suman 300eef7d06 MLK-13946-8: ASoC: fsl_sai: use min(channels,slots) for xMR setting
xMR setting must be set as min(channels,slots) since
both "channels < slots" and "channels > slots" scenarios
are possible.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:49 +08:00
Shengjiu Wang 0da2560aff MLK-13946-3: ASoC: fsl_sai: fix the xMR setting
When there is multi data line enabled, the xMR setting is
wrong if according to the channel number. which should
according to the slot number

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:48 +08:00
Shengjiu Wang 4b73b084ba MLK-16130-1: ASoC: fsl_sai: enable TCE/RCE according to input channels
If there is only two channels input and slots is 2, then enable one
port is enough for data transfer. so enable the TCE/RCE according to
the input channels and slots configuration.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:48 +08:00
Viorel Suman be7bf0faa8 MLK-13975: ASoC: fsl_sai: Refine master flag handling
The patch introduces the master flag handling
as function of direction and the option to provide
the flag value from DTS.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:47 +08:00
Shengjiu Wang c709ebd035 MLK-15960-2: ASoC: fsl_sai: refine the pm runtime function
In imx8qm/imx8qxp, the power domain of IP is enabled when
pm_runtime_get_sync() is called, and disabled when pm_runtime
_put_sync() is called. when power domain is disabled, the value
of registers will lost, so we need to use the regcache_sync()
to restore the registers in fsl_sai_runtime_resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:47 +08:00
Shengjiu Wang f4a5a72887 MLK-15960-1: ASoC: fsl_sai: update fifo_depth for different platform
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-25 15:53:46 +08:00
Mihai Serban 90efe83b6e MLK-15927-1: ASoC: fsl_sai: Fix noise when using EDMA
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-25 15:53:45 +08:00
Shengjiu Wang 62bd14531e MLK-15140-1: ASoC: fsl_sai: support latest sai module
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-25 15:53:45 +08:00
Mihai Serban f3f09671c6 MLK-14935: ASoC: fsl_sai: Fix mixing initialization data with actual audio 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-25 15:53:44 +08:00
Daniel Baluta 35c3e9f7fe MLK-14870: ASoC: fsl_sai: Remove support for S20_3LE
With current clock configuration we cannot derive bitclk for S20_3LE
format in SAI master mode. There was an attempt to fix this in commit
65e6b5f1b4a7 ("MLK-14536: ASoC: wm8960: Fix playback in CPU DAI master mode")
but this broke codec-master mode, thus the patch was partially reverted in
96f0d36e420 ("MLK-14798: arm: dts: imx6ul: Fix wm8960 codec master mode")

So, remove S20_3LE support for SAI master mode. Clients using this
feature should use codec master mode, which is the default one in the
dts anyway.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:44 +08:00
Mihai Serban 3d1fa75a96 MLK-14847: Revert "ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode"
This reverts commit c768ed336bba ("ASoC: fsl-sai: set xCR4/xCR5/xMR for
SAI master mode")

This change was already introduced by commit 51659ca069 ("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-25 15:53:42 +08:00
Viorel Suman 56507d35db ASoC: fsl: add imx-pcm-dma v2 platform driver (part 2)
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-25 15:53:42 +08:00
Viorel Suman cbd9903c62 ASoC: fsl_sai: set specific fmt for I2S XTOR
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-25 15:53:42 +08:00
Viorel Suman cd3f08ca64 ASoC: fsl_sai: handle slave mode per TX/RX direction
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-25 15:53:40 +08:00
Viorel Suman 606e962127 ASoC: fsl_(e)sai: introduce "shared-interrupt" DT flag (part 2)
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-25 15:53:39 +08:00
Shengjiu Wang e03d9fa698 MLK-13609: ASoC: fsl_sai: fix for synchronize mode
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-25 15:53:39 +08:00
Shengjiu Wang da84851398 MLK-13574-2: ASoC: fsl_sai: refine driver for ip upgrade
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-25 15:53:39 +08:00
Shengjiu Wang 2bb7f96ef1 MLK-12786-2: ASoC: fsl_sai: correct the clock source for mclk0
mclk0 is assigned through the device tree.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:38 +08:00
Shengjiu Wang 6099503aa3 MLK-12374: ASoC: fsl_sai: Change the dev_warn to dev_dbg
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-25 15:53:37 +08:00
Zidan Wang 583b9f7b09 ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode
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 51659ca069)
2019-11-25 15:53:37 +08:00
Zidan Wang bf40b0c9ad MLK-11628 ASoC: fsl_sai: add initial value for is_slave_mode
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-25 15:53:36 +08:00
Zidan Wang 90248ae954 MLK-10611-1 ASoC: fsl-sai: Just one device can playback(captrue) when using 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-25 15:53:35 +08:00
Shengjiu Wang 9401ad6c72 MLK-9974: ASoC: fsl_sai: There is underrun detected in the beginning sometimes
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-25 15:53:35 +08:00
Dong Aisheng a7e3a722ed Revert "ASoC: fsl_sai: add of_match data"
This reverts commit 89c9679f69.
2019-11-25 15:53:34 +08:00
Dong Aisheng 252b2a0d9e Revert "ASoC: fsl_sai: derive TX FIFO watermark from FIFO depth"
This reverts commit bd517707d8.
2019-11-25 15:53:34 +08:00
Dong Aisheng 0df4d8e7c7 Revert "ASoC: fsl_sai: mark regmap as fast_io"
This reverts commit 6d19d8a3ce.
2019-11-25 15:53:33 +08:00
Dong Aisheng f337340c23 Revert "ASoC: Remove dev_err() usage after platform_get_irq()"
This reverts commit cf9441adb1.
2019-11-25 15:53:33 +08:00
Dong Aisheng ab150b3f7c Revert "ASoC: fsl_sai: Add registers definition for multiple datalines"
This reverts commit 5f0ac20ed6.
2019-11-25 15:53:32 +08:00