1
0
Fork 0
Commit Graph

1610 Commits (redonkable)

Author SHA1 Message Date
Viorel Suman ae30f694da MLK-24043-2: ASoC: fsl_xcvr: do not rise M0+ SPDIF TX interrupt
At SPDIF TX interrupt the firmware running on M0+ core
overwrites TX DPATH BYPASS FEM bit which turns the
expected PHY DMAC TX PLL clock 2*bitclock instead of
expected 10*bitclock if SAI PLL is used as PHY DMAC TX
PLL.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-05-15 10:15:43 +03:00
Viorel Suman 1634635098 MLK-24043-1: ASoC: fsl_xcvr: fix shutdown for full duplex mode
The existing "shutdown" callback does not consider
full duplex mode, fix this.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-05-15 10:15:24 +03:00
Adrian Alonso 7238c03e56 MLK-23921: sound: soc: imx-pdm: update driver constrains
Update drivers constrains, limit sample rates to
[8Khz - 64Khz] and up to 8 channels.
Use SND_SOC_DAIFMT_PDM format type and remove
tdm slot settings to allow capture from multiple
SAI_RxD pins.

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Adrian Alonso <adrian.alonso@nxp.com>
2020-05-12 13:20:34 -05:00
Viorel Suman db31c447ee MLK-23991: ASoC: fsl_xcvr: drop eARC -> ARC fallback
The criteria used to drop eARC mode into ARC mode
makes eARC function to fail. Drop it for now.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-05-12 16:13:15 +03:00
Shengjiu Wang 464e926718 MLK-23975: ASoC: imx-dsp: Remove wrong dapm route
With route "Playback" -> "Playback", dapm will enable
the "Playback" widget to be power on, there is this same
widget for codec component, then codec will enter
the SND_SOC_BIAS_ON level, then mclk is enabled

When the mclk is bound with a power domain, the power
domain will be enabled always.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Peng Zhang <peng.zhang_8@nxp.com>
2020-05-11 17:44:04 +08:00
Shengjiu Wang cacd4e1389 MLK-23970: ASoC: fsl_dsp: workaround for no reset controller
On imx8mp, there is no dedicated reset controller for DSP and
there is no dedicated power domain for DSP.

The power of DSP is bound with audiomix, so we need to check
the DSP status for judging the audiomix is reset or not.

We use the PID register for status check, after reset, it will
be set to zero, when DSP is used we set it to 1.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Peng Zhang <peng.zhang_8@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-05-11 14:50:55 +08:00
Shengjiu Wang 6d730b27cc MLK-23965: ASoC: fsl_dsp: Fix the error handler in probe
Fix the error handler in probe. otherwise the resource
can't be release when error happen.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Peng Zhang <peng.zhang_8@nxp.com>
2020-05-11 10:51:16 +08:00
Viorel Suman e8bc5163ce ASoC: fsl_xcvr: use SAI PLL for SPDIF playback
Use SAI PLL for SPDIF playback in order to allow
full duplex mode.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2020-05-10 22:12:29 +03:00
Shengjiu Wang d1be673ae5 MLK-23958: ASoC: fsl_dsp: Fix the power issue with dsp
Need to use pm_runtime_get_sync & pm_runtime_put_sync in probe
to bind the attached power domain with device.

Fixes: ee1a47b87f ("MLK-23618-6: ASoC: fsl_dsp: refine handling of multi power domain")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Peng Zhang <peng.zhang_8@nxp.com>
2020-05-09 17:47:00 +08:00
Viorel Suman f801089134 ASoC: fsl_spdif: add support for 88200 and 176400 rates
Add support for 88200 Hz and 17600 Hz.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-05-08 11:58:07 +03:00
Shengjiu Wang 4316b08138 MLK-23906-4: ASoC: fsl_micfil: Don't bind clock with regmap
The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
      - clk_pm_runtime_get()

Cause the power domain of ipg clock always be enabled.
which impact the power consumption.

so we can't bind clock with regmap, but explicitly enable
clock when using.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-05-07 17:17:50 +08:00
Shengjiu Wang b35c0a202e MLK-23906-3: ASoC: fsl_easrc: Don't bind clock with regmap
The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
      - clk_pm_runtime_get()

Cause the power domain of mem clock always be enabled.
which impact the power consumption.

so we can't bind clock with regmap, but explicitly enable
clock when using.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-05-07 17:17:45 +08:00
Shengjiu Wang 7cdd916faa MLK-23906-2: ASoC: fsl_aud2htx: Switch to imx-pcm-dma-v2
With imx-pcm-dma, the dma channel is created in probe, when
there is power domain attached with dma device, the power
domain will be enabled when channel is created, then the
power of the domain will be always enabled from beginning.

So switch to imx-pcm-dma-v2, then the dma channel will be
created when playback or capture really started.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-05-07 17:17:42 +08:00
Shengjiu Wang 4ac1cd1136 MLK-23906-1: ASoC: fsl_aud2htx: Don't bind clock with regmap
The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
      - clk_pm_runtime_get()

Cause the power domain of bus clock always be enabled.
which impact the power consumption.

So we can't bind clock with regmap, then explicitly enable
clock when using.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-05-07 17:17:27 +08:00
Viorel Suman 698861f076 MLK-23618-17: fsl_sai: fix hang in probe at boot time
A power domain associated with a device may be disabled in
a separate thread by "genpd_power_off_work_fn" function in
case the device has no PM runtime enabled at that moment.
This will stop the parent clock of "bus" clk and hang
the probe in regmap read/write operation. In order to avoid
this PM runtime must be enabled before any regmap read/write
ops. Aside of this replace clk bus clocks with
pm_runtime_get/put_sync calls.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Fixes: c2641e1974 ("MLK-23618-9: ASoC: fsl_sai: Don't bind clock with regmap")
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-05-01 12:45:43 +03:00
Viorel Suman 18b2111684 MLK-23887: ASoC: fsl_xcvr: set regcache_cache_only true in probe
Set regmap to use regcache only in probe in order to avoid
issue on cat /sys/kernel/debug/regmap/30cc0000.xcvr/registers

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-05-01 12:45:43 +03:00
Zhang Peng 1a17334e71 MLK-23837 Asoc: fsl_dsp: Fix system crash when do dsp suspend test
The issue is GPU will crash when do dsp suspend test, and only
meet this issue when load GPU as module.
The reason is that dsp framework's global data set size little
than actul size. So dsp will touch the memory that not owned
dsp, then caused GPU crash.

Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>
2020-04-29 20:50:04 +08:00
Shengjiu Wang fe01a5d14b MLK-23642-3: ASoC: fsl: imx-cdnhdmi: support 6 channels
Add support 6 channels

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-04-29 18:35:51 +08:00
Viorel Suman 660bbebb9c MLK-23567-3 ASoC: fsl_xcvr: release M0+ core prior raising interrupt
M0+ core must be released prior raising any interrupt
to M0+ core, otherwise interrupt will be lost.

Fixes: b164260078 ("MLK-23567-2 ASoC: fsl_xcvr: enable SPDIF TX")
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-04-27 14:43:37 +03:00
Zhang Peng dcf3272d11 MLK-23850 soc: fsl: Correct parameters getting from DSP
Before the parameters getting from dsp is not right, now correct it.

Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-04-27 15:03:16 +08:00
Viorel Suman 5e51d73901 MLK-23840-1 ASoC: fsl_xcvr: remove fsl,xcvr-mode from DTS
XCVR driver working mode is set by "fsl,xcvr-mode" DTS
property. Being static - it does not allow changing
XCVR driver mode at runtime. Rework the driver by replacing
static DTS property with amixer control.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-04-24 13:23:15 +03:00
Viorel Suman b164260078 MLK-23567-2 ASoC: fsl_xcvr: enable SPDIF TX
Enable XCVR SPDIF TX mode.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-04-17 15:49:23 +03:00
Viorel Suman 7882f7f139 MLK-23567-1 ASoC: fsl_xcvr: add TX CS bytes control
For IEC958 kcontrol type amixer tool returns just first 4 bytes,
add a byte array control so that we'll be able to set all 24 bytes
of TX CS by using amixer.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-04-17 15:49:16 +03:00
Shengjiu Wang 02d362f8d6 MLK-23792-1: ASoC: fsl_sai: Monitor spdif rx clock in imx8mm
As we use one spare sai instance to monitor the spdif rx
clock,  there isn't belong to a sound card, we can't access
the registers by amixer controls.

So remove the amixer controls, replace them with the device
attribute.

And add an additional device attribute for enablement of
monitorring spdif. This feature only be supported on imx8mm.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-04-17 12:06:39 +08:00
Viorel Suman ded5d94919 MLK-23799 fsl_xcvr: capabilities data structure support
Add an amixer interface which allows to load
capabilities data structure.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-04-16 15:45:10 +03:00
Zhang Peng 92d77a4619 MLK-23701-3 ASoc: fsl: Fill pcm_io_frames and sampling_rate
Get samplerate and consumed data from dsp when call
snd_compr_ops.pointer.

Signed-off-by: Zhang Peng <peng_zhang_8@nxp.com>
2020-04-07 12:48:18 +08:00
Zhang Peng d235be4b28 MLK-23701-2 ASoc:fsl: Add support cplay in mp board
1. Add clk necessary in dsp driver
2. Add renderer type for select sai or esai

Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>
2020-04-07 12:48:18 +08:00
Zhang Peng 5e9570b387 MLK-23701-1 Asoc:fsl: Add to choose codec depend on dtb
Before fixed codec name cs42888, now also support wm8960 codec,
thus add to choose set codec name depend on enabled codec.

Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>
2020-04-07 12:48:18 +08:00
Viorel Suman 2513444554 MLK-23732: fsl_xcvr: implement eARC RX fallback mode
There are 2 configurable options for eARC RX fallback
to ARC mode: "ARC single ended" or "ARC common".
Add amixer control in order to allow setting it
from userspace.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-04-02 11:57:02 +03:00
Viorel Suman ca5fccb261 MLK-23734: ASoC: fsl_xcvr: remove sample bits constraint
Sample bits constraint is meaningless given that the only
supported format is SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2020-04-02 11:35:18 +03:00
Viorel Suman c336672cb0 MLK-23725-3: ASoC: fsl_xcvr: fix CS comment
Fix Channel Status comments.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-04-01 16:07:34 +03:00
Viorel Suman bbca32f615 MLK-23725-2: ASoC: fsl_xcvr: add RX CS bytes control
For IEC958 kcontrol type amixer tool returns just first 4 bytes,
add a byte array control so that we'll be able to see all 24 bytes
by using amixer.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-04-01 16:07:34 +03:00
Viorel Suman 86401d592b MLK-23725-1: ASoC: fsl_xcvr: reimplement CS read function
CS_DATA registers are supposed to be used by M0+
core, according to block guide host core must read
channel status structure from data memory.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-04-01 16:07:34 +03:00
Shengjiu Wang 3ace7799e9 MLK-23702-4: ASoC: imx-rpmsg: support rpmsg audio for i.MX8MP
in i.MX8MP, the audio codec is registered by DT, and we reserve
a memory in DT that we can allocate dma memory from the
reserved pool.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-03-31 15:04:10 +08:00
Shengjiu Wang 0bc59849c4 MLK-23702-2: ASoC: imx-pcm-rpmsg: Don't register codec driver if it is from DT
Don't register codec driver if it is from DT.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-03-31 15:04:03 +08:00
Shengjiu Wang ca2170e0fb MLK-23702-1: ASoC: fsl_rpmsg_i2s: Support rpmsg audio for i.MX8MP
in i.MX8MP, the audio codec is registered by DT. So we add
a new flag: codec_in_dt

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-03-31 15:04:00 +08:00
Viorel Suman a063fac437 MLK-23603-6: ASoC: fsl_xcvr: move clks management into suspend/resume
Move clocks prepare_enable and disable_unprepare calls
into runtime_resume and runtime_suspend respectively.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-25 10:49:09 +02:00
Viorel Suman 9c6b7f731a MLK-23603-5: ASoC: fsl_xcvr: move static IP config code into fw load
Move static XCVR IP configuration code into firmware load
method in order to avoid the need to have bus clock started
in "startup" callback.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-25 10:49:09 +02:00
Viorel Suman 6bd55541d4 MLK-23603-4: ASoC: fsl_xcvr: adjust watermark and max burst values
Set watermarks values at half FIFO size, and max burst to 1/8
of FIFO size.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-25 10:49:09 +02:00
Viorel Suman ff5a36241f MLK-23603-3: ASoC: fsl_xcvr: prepare for suspend/resume
"startup" callback is not called in a subsequent
"runtime_resume" sequence, so move IP init code
into "prepare" callback. Aside of this move
constraint check code from "prepare" to "startup"
since constraint checking is required once at stream
startup.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-25 10:49:09 +02:00
Viorel Suman 8a05c23ef2 MLK-23603-2: ASoC: fsl_xcvr: refactor constraint handling
Refactor constraint handling in order to facilitate
unimplemented cases, such as for ARC and SPDIF.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-25 10:49:09 +02:00
Viorel Suman 6a3380a43a MLK-23603-1: ASoC: fsl_xcvr: fix compliation warnings
Fix two compilation warnings.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-25 10:49:08 +02:00
Shengjiu Wang 6a895a2c4c MLK-23650-2: ASoC: fsl_asrc_m2m: Fix oops error
Don't need to add one more buffer, if the buffer
size is same as ASRC_MAX_BUFFER_SIZE.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-03-23 17:48:15 +08:00
Shengjiu Wang 091d9d8e65 MLK-23650-1: ASoC: fsl_easrc_m2m: Fix oops error
swiotlb don't allow the buffer length is zero. So
we should not add one more buffer, if the buffer
size is same as max_buf_size.

[ 1853.382383] ------------[ cut here ]------------
[ 1853.387011] kernel BUG at kernel/dma/swiotlb.c:497!
[ 1853.391889] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[ 1853.397372] Modules linked in: crct10dif_ce flexcan can_dev
[ 1853.402950] CPU: 2 PID: 17298 Comm: easrc_testapp Not tainted 5.4.3-2.0.0+gfd263a3edd95 #1
[ 1853.411210] Hardware name: FSL i.MX8MP EVK (DT)
[ 1853.415739] pstate: 80000005 (Nzcv daif -PAN -UAO)
[ 1853.420535] pc : swiotlb_tbl_map_single+0x1fc/0x310
[ 1853.425413] lr : swiotlb_map+0x60/0x148
[ 1853.429245] sp : ffff800025fdba80
[ 1853.432557] x29: ffff800025fdba80 x28: 0000000000000000
[ 1853.437867] x27: ffff000177818638 x26: ffff800011b14000
[ 1853.443176] x25: ffff800011b149f8 x24: 0000000000000000
[ 1853.448485] x23: 00000001b1e0c000 x22: 0000000000000000
[ 1853.453793] x21: ffff0001763ef410 x20: 0000000000180000
[ 1853.459102] x19: ffff0001763ef410 x18: 0000000000000000
[ 1853.464411] x17: 0000000000000000 x16: 0000000000000000
[ 1853.469720] x15: 0000000000000000 x14: 001df82f001df82f
[ 1853.475029] x13: ffff00017f34e000 x12: 0000000000000018
[ 1853.480338] x11: 00000000001fffff x10: 0001000000000000
[ 1853.485646] x9 : 0000000000000000 x8 : 0000000000000000
All test[s  1p8a5s3s.e4d90 w95i5] x7 : 0000000000000000 x6 : 0000000000000000
h success
[ 1853.497911] x5 : 0000000000200000 x4 : 0000000000000000
[ 1853.504171] x3 : 0000000000000001 x2 : 00000001b1e0c000
[ 1853.509480] x1 : 00000000c0000000 x0 : 0000000000000000
[ 1853.514789] Call trace:
[ 1853.517237]  swiotlb_tbl_map_single+0x1fc/0x310
[ 1853.521766]  swiotlb_map+0x60/0x148
[ 1853.525253]  dma_direct_map_page+0xf0/0x130
[ 1853.529434]  dma_direct_map_sg+0x78/0xe0
[ 1853.533356]  fsl_easrc_dmaconfig+0x10c/0x398
[ 1853.537624]  fsl_easrc_ioctl+0xcf4/0x1490
[ 1853.541633]  do_vfs_ioctl+0x964/0xb48
[ 1853.545293]  ksys_ioctl+0x78/0xa8
[ 1853.548607]  __arm64_sys_ioctl+0x1c/0x28
[ 1853.552530]  el0_svc_common.constprop.0+0x68/0x160
[ 1853.557320]  el0_svc_handler+0x20/0x80
[ 1853.561067]  el0_svc+0x8/0xc
[ 1853.563949] Code: 912e4021 9417b69a a94363f7 17ffffd5 (d4210000)
[ 1853.570042] ---[ end trace 5e9c94fcfabda124 ]---

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-03-23 17:44:00 +08:00
Shengjiu Wang bb6511173a MLK-23651: ASoC: fsl_spdif: Fix hang issue in reboot
In reboot, system will try to access regisers through
the dai controls, but the clock is not bind with regmap,
then system hang.

So we enable regcache_cache_only in probe to fix this
issue.

Fixes: d55d453fdf ("MLK-23618-11: ASoC: fsl_spdif: Don't bind clock with regmap")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-03-23 17:43:48 +08:00
Shengjiu Wang d55d453fdf MLK-23618-11: ASoC: fsl_spdif: Don't bind clock with regmap
The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
      - clk_pm_runtime_get()

Cause the power domain of lpcg clock always be enabled.
which impact the power consumption.

So we can't bind clock with regmap, then explicitly enable
clock when using. As we already enable all clock in
pm_runtime_resume, so only need to enable clock in probe.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-18 15:42:07 +08:00
Shengjiu Wang d91068f322 MLK-23618-10: ASoC: fsl_esai: Don't bind clock with regmap
The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
      - clk_pm_runtime_get()

Cause the power domain of lpcg clock always be enabled.
which impact the power consumption.

So we can't bind clock with regmap, then explicitly enable
clock when using. As we already enable all clock in
pm_runtime_resume, so only need to enable clock in probe.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-18 15:42:03 +08:00
Shengjiu Wang c2641e1974 MLK-23618-9: ASoC: fsl_sai: Don't bind clock with regmap
The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
      - clk_pm_runtime_get()

Cause the power domain of lpcg clock always be enabled.
which impact the power consumption.

So we can't bind clock with regmap, then explicitly enable
clock when using. As we already enable all clock in
pm_runtime_resume, so only need to enable clock in probe.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-18 15:41:58 +08:00
Shengjiu Wang 45db541836 MLK-23618-8: ASoC: fsl_audmix: Don't bind clock with regmap
The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
      - clk_pm_runtime_get()

Cause the power domain of lpcg clock always be enabled.
which impact the power consumption.

So we can't bind clock with regmap, then explicitly enable
clock when using. As we already enable all clock in
pm_runtime_resume, so only need to enable clock in probe.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-18 15:41:54 +08:00
Shengjiu Wang 1d46a32f50 MLK-23618-7: ASoC: fsl_asrc: Don't bind clock with regmap
The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
     - clk_pm_runtime_get()

Cause the power domain of lpcg clock always be enabled.
which impact the power consumption.

So we can't bind clock with regmap, then explicitly enable
clock when using. As we already enable all clock in
pm_runtime_resume, so only need to enable clock in probe.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-18 15:41:50 +08:00
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