1
0
Fork 0
Commit Graph

20230 Commits (redonkable)

Author SHA1 Message Date
Daniel Baluta 1cfb99c40e MLK-23854-1 ASoC: SOF: Remove unneeded header files
Unnecessary header files may slow down build performance.
Issue reported by coverity (CID9607920).

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-04-27 18:16:17 +03:00
Daniel Baluta cbe43f15a4 MLK-23350-11 ASoC: SOF: Add sdma3/sai3 clocks for DSP
In order to be able to access SAI3/SDMA3 registers
we need to enable SAI3_IPG and SDMA3_ROOT clocks.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-04-27 18:16:16 +03:00
Daniel Baluta b923181a17 MLK-23350-9: ASoC: SOF: define INFO_ flags in dsp_ops
Currently the INFO_ flags such as PAUSE/NO_PERIOD_WAKEUP are defined
in the SOF PCM core, which doesn't scale. To account for platform
variations, these flags need to be set in DSP ops.

This patch only moves the definitions and does not change any
functionality.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-04-27 18:16:16 +03:00
Dan Carpenter c9b4bd73c2 ASoC: SOF: Fix snd_sof_ipc_stream_posn()
We're passing "&posn" instead of "posn" so it ends up corrupting
memory instead of doing something useful.

Fixes: 53e0c72d98 ("ASoC: SOF: Add support for IPC IO between DSP and Host")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200303101858.ytehbrivocyp3cnf@kili.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-27 18:16:16 +03:00
Jaska Uimonen 3a316348aa ASoC: SOF: ipc: check ipc return value before data copy
In tx_wait_done the ipc payload is copied before the DSP transaction
error code is checked. This might lead to corrupted data in kernel side
even though the error would be handled later. It is also pointless to
copy the data in case of error. So change the order of error check and
copy.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Link: https://lore.kernel.org/r/20200228231850.9226-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-27 18:16:16 +03: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
Colin Ian King 549a48900d ASoC: Intel: mrfld: return error codes when an error occurs
commit 3025571edd upstream.

Currently function sst_platform_get_resources always returns zero and
error return codes set by the function are never returned. Fix this
by returning the error return code in variable ret rather than the
hard coded zero.

Addresses-Coverity: ("Unused value")
Fixes: f533a035e4 ("ASoC: Intel: mrfld - create separate module for pci part")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200208220720.36657-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-21 09:04:56 +02:00
Colin Ian King 86ec55651f ASoC: Intel: mrfld: fix incorrect check on p->sink
commit f5e056e1e4 upstream.

The check on p->sink looks bogus, I believe it should be p->source
since the following code blocks are related to p->source. Fix
this by replacing p->sink with p->source.

Fixes: 24c8d14192 ("ASoC: Intel: mrfld: add DSP core controls")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Copy-paste error")
Link: https://lore.kernel.org/r/20191119113640.166940-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-21 09:04:55 +02: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
Julia Lawall 8dead2c275 ASoC: stm32: sai: Add missing cleanup
[ Upstream commit 7506baeed8 ]

The commit 0d6defc7e0 ("ASoC: stm32: sai: manage rebind issue")
converts some function calls to their non-devm equivalents.  The
appropriate cleanup code was added to the remove function, but not
to the probe function.  Add a call to snd_dmaengine_pcm_unregister
to compensate for the call to snd_dmaengine_pcm_register in case
of subsequent failure.

Fixes: commit 0d6defc7e0 ("ASoC: stm32: sai: manage rebind issue")
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Acked-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/1586099028-5104-1-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-17 10:50:25 +02:00
이경택 9a8b1ba9d4 ASoC: topology: use name_prefix for new kcontrol
commit abca9e4a04 upstream.

Current topology doesn't add prefix of component to new kcontrol.

Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
Link: https://lore.kernel.org/r/009b01d60804$ae25c2d0$0a714870$@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-17 10:50:06 +02:00
이경택 f467e054c0 ASoC: dpcm: allow start or stop during pause for backend
commit 21fca8bdbb upstream.

soc_compr_trigger_fe() allows start or stop after pause_push.
In dpcm_be_dai_trigger(), however, only pause_release is allowed
command after pause_push.
So, start or stop after pause in compress offload is always
returned as error if the compress offload is used with dpcm.
To fix the problem, SND_SOC_DPCM_STATE_PAUSED should be allowed
for start or stop command.

Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/004d01d607c1$7a3d5250$6eb7f6f0$@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-17 10:50:06 +02:00
이경택 af0b76f9f6 ASoC: dapm: connect virtual mux with default value
commit 3bbbb7728f upstream.

Since a virtual mixer has no backing registers
to decide which path to connect,
it will try to match with initial state.
This is to ensure that the default mixer choice will be
correctly powered up during initialization.
Invert flag is used to select initial state of the virtual switch.
Since actual hardware can't be disconnected by virtual switch,
connected is better choice as initial state in many cases.

Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
Link: https://lore.kernel.org/r/01a301d60731$b724ea10$256ebe30$@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-17 10:50:06 +02:00
이경택 803db8a078 ASoC: fix regwmask
commit 0ab070917a upstream.

If regwshift is 32 and the selected architecture compiles '<<' operator
for signed int literal into rotating shift, '1<<regwshift' became 1 and
it makes regwmask to 0x0.
The literal is set to unsigned long to get intended regwmask.

Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
Link: https://lore.kernel.org/r/001001d60665$db7af3e0$9270dba0$@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-17 10:50:06 +02: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
Paul Cercueil 9351dee1cc ASoC: jz4740-i2s: Fix divider written at incorrect offset in register
commit 9401d5aa32 upstream.

The 4-bit divider value was written at offset 8, while the jz4740
programming manual locates it at offset 0.

Fixes: 26b0aad80a ("ASoC: jz4740: Add dynamic sampling rate support to jz4740-i2s")
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200306222931.39664-2-paul@crapouillou.net
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13 10:48:09 +02: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 ccb83f789e MLK-23702-3: ASoC: rpmsg_wm8960: Add i2c interface
rpmsg wm8960 also can be registered as an i2c device.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-03-31 15:04:07 +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
Olivier Moysan af7dd05d7c ASoC: stm32: sai: manage rebind issue
[ Upstream commit 0d6defc7e0 ]

The commit e894efef9a ("ASoC: core: add support to card rebind")
allows to rebind the sound card after a rebind of one of its component.
With this commit, the sound card is actually rebound,
but may be no more functional. The following problems have been seen
with STM32 SAI driver.

1) DMA channel is not requested:

With the sound card rebind the simplified call sequence is:
stm32_sai_sub_probe
	snd_soc_register_component
		snd_soc_try_rebind_card
			snd_soc_instantiate_card
	devm_snd_dmaengine_pcm_register

The problem occurs because the pcm must be registered,
before snd_soc_instantiate_card() is called.

Modify SAI driver, to change the call sequence as follows:
stm32_sai_sub_probe
	devm_snd_dmaengine_pcm_register
	snd_soc_register_component
		snd_soc_try_rebind_card

2) DMA channel is not released:

dma_release_channel() is not called when
devm_dmaengine_pcm_release() is executed.
This occurs because SND_DMAENGINE_PCM_DRV_NAME component,
has already been released through devm_component_release().

devm_dmaengine_pcm_release() should be called before
devm_component_release() to avoid this problem.

Call snd_dmaengine_pcm_unregister() and snd_soc_unregister_component()
explicitly from SAI driver, to have the right sequence.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Message-Id: <20200304102406.8093-1-olivier.moysan@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-25 08:25:48 +01: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 c43a9a158c MLK-23618-5: Revert "ASoC: cs42xx8: support multi power domain"
This reverts commit 62e2861cf0.

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:41 +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
Daniel Baluta ec19a7176f MLK-23560-4 ASoC: SOF: Fix maybe used unitialized warning
This fixes the following compilation warning:

sound/soc/sof/imx/imx8.c: In function ‘imx8_probe’:
sound/soc/sof/imx/imx8.c:210:6: warning: ‘i’ may be used uninitialized
in this function [-Wmaybe-uninitiali

Warning introduce with commit commit 352ad24ec
("MLK-23350-1 ASoC: sof: Skip power domain handline when num_domains")

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-13 16:58:57 +02:00
Pierre-Louis Bossart 236ee9e163 MLK-23560-3 ASoC: SOF: define INFO_ flags in dsp_ops
Currently the INFO_ flags such as PAUSE/NO_PERIOD_WAKEUP are defined
in the SOF PCM core, which doesn't scale. To account for platform
variations, these flags need to be set in DSP ops.

This patch only moves the definitions and does not change any
functionality.

Reviewed-by: Jaska Uimonen <jaska.uimonen@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191024210318.30068-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-13 16:58:45 +02:00
Daniel Baluta e5e991a741 MLK-23560-2: ASoC: SOF: Enable PM support
We need to provide PM macros in order for the SOF core
to suspend/resume the DSP.

PM support on the DSP side is quite limited and we are mostly
doing PM for ARM core.

Without this patch DSP won't be restarted after a resume causing
SOF driver calls to time out.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-03-13 15:34:16 +02: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
Charles Keepax 2780251199 ASoC: dapm: Correct DAPM handling of active widgets during shutdown
commit 9b3193089e upstream.

commit c2caa4da46 ("ASoC: Fix widget powerdown on shutdown") added a
set of the power state during snd_soc_dapm_shutdown to ensure the
widgets powered off. However, when commit 39eb5fd13d
("ASoC: dapm: Delay w->power update until the changes are written")
added the new_power member of the widget structure, to differentiate
between the current power state and the target power state, it did not
update the shutdown to use the new_power member.

As new_power has not updated it will be left in the state set by the
last DAPM sequence, ie. 1 for active widgets. So as the DAPM sequence
for the shutdown proceeds it will turn the widgets on (despite them
already being on) rather than turning them off.

Fixes: 39eb5fd13d ("ASoC: dapm: Delay w->power update until the changes are written")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200228153145.21013-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12 13:00:26 +01:00
Amadeusz Sławiński a87fe1f24f ASoC: Intel: Skylake: Fix available clock counter incrementation
commit 8308a09e87 upstream.

Incrementation of avail_clk_cnt was incorrectly moved to error path. Put
it back to success path.

Fixes: 6ee927f2f0 ('ASoC: Intel: Skylake: Fix NULL ptr dereference when unloading clk dev')
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200224125202.13784-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12 13:00:26 +01:00
Matthias Reichl 94c472e7b4 ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path
commit ac0a689979 upstream.

When we get a clock error during probe we have to call
regulator_bulk_disable before bailing out, otherwise we trigger
a warning in regulator_put.

Fix this by using "goto err" like in the error cases above.

Fixes: 5a3af12931 ("ASoC: pcm512x: Add PCM512x driver")
Signed-off-by: Matthias Reichl <hias@horus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200220202956.29233-1-hias@horus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12 13:00:26 +01:00
Takashi Iwai 757ed44a19 ASoC: pcm: Fix possible buffer overflow in dpcm state sysfs output
commit 6c89ffea60 upstream.

dpcm_show_state() invokes multiple snprintf() calls to concatenate
formatted strings on the fixed size buffer.  The usage of snprintf()
is supposed for avoiding the buffer overflow, but it doesn't work as
expected because snprintf() doesn't return the actual output size but
the size to be written.

Fix this bug by replacing all snprintf() calls with scnprintf()
calls.

Fixes: f86dcef87b ("ASoC: dpcm: Add debugFS support for DPCM")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200218111737.14193-4-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12 13:00:25 +01:00
Takashi Iwai bbc02b018d ASoC: intel: skl: Fix possible buffer overflow in debug outputs
commit 549cd0ba04 upstream.

The debugfs output of intel skl driver writes strings with multiple
snprintf() calls with the fixed size.  This was supposed to avoid the
buffer overflow but actually it still would, because snprintf()
returns the expected size to be output, not the actual output size.

Fix it by replacing snprintf() calls with scnprintf().

Fixes: d14700a01f ("ASoC: Intel: Skylake: Debugfs facility to dump module config")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200218111737.14193-3-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12 13:00:25 +01:00
Takashi Iwai 1dd4d68f19 ASoC: intel: skl: Fix pin debug prints
commit 64bbacc5f0 upstream.

skl_print_pins() loops over all given pins but it overwrites the text
at the very same position while increasing the returned length.
Fix this to show the all pin contents properly.

Fixes: d14700a01f ("ASoC: Intel: Skylake: Debugfs facility to dump module config")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200218111737.14193-2-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12 13:00:25 +01:00
Dan Carpenter 488c6c340d ASoC: SOF: Fix snd_sof_ipc_stream_posn()
commit 613cea5935 upstream.

We're passing "&posn" instead of "posn" so it ends up corrupting
memory instead of doing something useful.

Fixes: 53e0c72d98 ("ASoC: SOF: Add support for IPC IO between DSP and Host")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200303101858.ytehbrivocyp3cnf@kili.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12 13:00:25 +01:00
Dragos Tarcatu e259388d69 ASoC: topology: Fix memleak in soc_tplg_manifest_load()
commit 242c46c023 upstream.

In case of ABI version mismatch, _manifest needs to be freed as
it is just a copy of the original topology manifest. However, if
a driver manifest handler is defined, that would get executed and
the cleanup is never reached. Fix that by getting the return status
of manifest() instead of returning directly.

Fixes: 583958fa2e ("ASoC: topology: Make manifest backward compatible from ABI v4")
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Link: https://lore.kernel.org/r/20200207185325.22320-3-dragos_tarcatu@mentor.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12 13:00:25 +01:00
Dragos Tarcatu a6e3b2aedf ASoC: topology: Fix memleak in soc_tplg_link_elems_load()
commit 2b2d5c4db7 upstream.

If soc_tplg_link_config() fails, _link needs to be freed in case of
topology ABI version mismatch. However the current code is returning
directly and ends up leaking memory in this case.
This patch fixes that.

Fixes: 593d9e52f9 ("ASoC: topology: Add support to configure existing physical DAI links")
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Link: https://lore.kernel.org/r/20200207185325.22320-2-dragos_tarcatu@mentor.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12 13:00:25 +01: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
Sathyanarayana Nujella bb7ffcbec2 ASoC: SOF: Intel: hda: Add iDisp4 DAI
commit e68d669657 upstream.

TGL supports more than three iDisp DAI's.
Add support for iDisp4 CPU DAI.

Without this patch, we saw the below error on our TGL DUT:
   sof_rt5682 tgl_max98357a_rt5682: ASoC: CPU DAI iDisp4 Pin not registered

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191220171037.10689-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-28 17:22:29 +01: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
Arnd Bergmann 59c723344a ASoC: atmel: fix atmel_ssc_set_audio link failure
commit 9437bfda00 upstream.

The ssc audio driver can call into both pdc and dma backends.  With the
latest rework, the logic to do this in a safe way avoiding link errors
was removed, bringing back link errors that were fixed long ago in commit
061981ff8c ("ASoC: atmel: properly select dma driver state") such as

sound/soc/atmel/atmel_ssc_dai.o: In function `atmel_ssc_set_audio':
atmel_ssc_dai.c:(.text+0xac): undefined reference to `atmel_pcm_pdc_platform_register'

Fix it this time using Makefile hacks and a comment to prevent this
from accidentally getting removed again rather than Kconfig hacks.

Fixes: 1829141055 ("ASoC: atmel: enable SOC_SSC_PDC and SOC_SSC_DMA in Kconfig")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20200130130545.31148-1-codrin.ciubotariu@microchip.com
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
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
Samuel Holland 9f83363875 ASoC: sun8i-codec: Fix setting DAI data format
commit 96781fd941 upstream.

Use the correct mask for this two-bit field. This fixes setting the DAI
data format to RIGHT_J or DSP_A.

Fixes: 36c684936f ("ASoC: Add sun8i digital audio codec")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20200217064250.15516-7-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-28 17:22:13 +01:00
Samuel Holland 3de0bbe213 ASoC: codec2codec: avoid invalid/double-free of pcm runtime
commit b6570fdb96 upstream.

The PCM runtime was freed during PMU in the case that the event hook
encountered an error. However, it is also unconditionally freed during
PMD. Avoid a double-free by dropping the call to kfree in the PMU hook.

Fixes: a72706ed82 ("ASoC: codec2codec: remove ephemeral variables")
Cc: stable@vger.kernel.org
Signed-off-by: Samuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20200213061147.29386-2-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-28 17:22:13 +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
Daniel Baluta 2f9fda1072 MLK-23350-12: ASoC: SOF: Kconfig: Fix typo in config symbols name
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-25 17:20:57 +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
Cezary Rojewski bf754c8886 ASoC: SOF: Intel: hda: Fix SKL dai count
[ Upstream commit a6947c9d86 ]

With fourth pin added for iDisp for skl_dai, update SOF_SKL_DAI_NUM to
account for the change. Without this, dais from the bottom of the list
are skipped. In current state that's the case for 'Alt Analog CPU DAI'.

Fixes: ac42b142cd76 ("ASoC: SOF: Intel: hda: Add iDisp4 DAI")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200113114054.9716-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:52 +01:00
Pierre-Louis Bossart be1113b4b4 ASoC: SOF: Intel: hda-dai: fix compilation warning in pcm_prepare
[ Upstream commit d873997192 ]

Fix GCC warning with W=1, previous cleanup did not remove unnecessary
variable.

sound/soc/sof/intel/hda-dai.c: In function ‘hda_link_pcm_prepare’:

sound/soc/sof/intel/hda-dai.c:265:31: warning: variable ‘hda_stream’
set but not used [-Wunused-but-set-variable]
  265 |  struct sof_intel_hda_stream *hda_stream;
      |                               ^~~~~~~~~~

Fixes: a3ebccb52e ("ASoC: SOF: Intel: hda: reset link DMA state in prepare")
Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200113205620.27285-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:48 +01:00
Chen Zhou 6cfe307b5b ASoC: atmel: fix build error with CONFIG_SND_ATMEL_SOC_DMA=m
[ Upstream commit 8fea78029f ]

If CONFIG_SND_ATMEL_SOC_DMA=m, build error:

sound/soc/atmel/atmel_ssc_dai.o: In function `atmel_ssc_set_audio':
(.text+0x7cd): undefined reference to `atmel_pcm_dma_platform_register'

Function atmel_pcm_dma_platform_register is defined under
CONFIG SND_ATMEL_SOC_DMA, so select SND_ATMEL_SOC_DMA in
CONFIG SND_ATMEL_SOC_SSC, same to CONFIG_SND_ATMEL_SOC_PDC.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Link: https://lore.kernel.org/r/20200113133242.144550-1-chenzhou10@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:46 +01:00
Sam McNally e9e24f2ca9 ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isn't one.
[ Upstream commit d4b74e218a ]

Some members of the Google_Hatch family include a rt5682 jack codec, but
no speaker amplifier. This uses the same driver (sof_rt5682) as a
combination of rt5682 jack codec and max98357a speaker amplifier. Within
the sof_rt5682 driver, these cases are not currently distinguishable,
relying on a DMI quirk to decide the configuration. This causes an
incorrect configuration when only the rt5682 is present on a
Google_Hatch device.

For CML, the jack codec is used as the primary key when matching,
with a possible speaker amplifier described in quirk_data. The two cases
of interest are the second and third 10EC5682 entries in
snd_soc_acpi_intel_cml_machines[]. The second entry matches the
combination of rt5682 and max98357a, resulting in the quirk_data field
in the snd_soc_acpi_mach being non-null, pointing at
max98357a_spk_codecs, the snd_soc_acpi_codecs for the matched speaker
amplifier. The third entry matches just the rt5682, resulting in a null
quirk_data.

The sof_rt5682 driver's DMI data matching identifies that a speaker
amplifier is present for all Google_Hatch family devices. Detect cases
where there is no speaker amplifier by checking for a null quirk_data in
the snd_soc_acpi_mach and remove the speaker amplifier bit in that case.

Signed-off-by: Sam McNally <sammc@chromium.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200103124921.v3.1.Ib87c4a7fbb3fc818ea12198e291b87dc2d5bc8c2@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:43 +01:00
Pierre-Louis Bossart 67ca691658 ASoC: soc-topology: fix endianness issues
[ Upstream commit 72bbeda022 ]

Sparse complains about a series of easy warnings, fix.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200102195952.9465-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:41 +01:00
Sathyanarayana Nujella bae02d239a ASoC: intel: sof_rt5682: Add support for tgl-max98357a-rt5682
[ Upstream commit 6605f0ca3a ]

This patch adds the driver data and updates quirk info
for tgl with max98357a speaker amp and ALC5682 headset codec.

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191126143205.21987-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:33 +01:00
Sathyanarayana Nujella fa54ae038c ASoC: intel: sof_rt5682: Add quirk for number of HDMI DAI's
[ Upstream commit c68e07970e ]

TGL supports one more HDMI DAI than previous models.
So add quirk support for number of HDMI DAI's.

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191126143205.21987-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:33 +01:00
Daniel Baluta 7ce1ff3ee2 MLK-23350-10 ASoC: SOF: Allow SOF IMX8 support to be build as a module
This is necessary for several reasons:
	- SOF FW is not available at boot time so compiling the modules
	as built in will complicate FW booting.
	- decrease Image size

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-21 17:22:10 +02:00
Pierre-Louis Bossart 1750be151e MLK-23350-9 ASoC: SOF: imx: fix undefined reference issue
make.cross ARCH=mips allyesconfig fails with the following error:

sound/soc/sof/sof-of-dev.o:(.data.sof_of_imx8mp_desc+0x40): undefined
reference to `sof_imx8m_ops'

This seems to be a Makefile order issue, solve by using the same
structure as for Intel platforms.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-02-21 17:22:10 +02:00
Pierre-Louis Bossart 452aee67ca MLK-23350-8 ASoC: SOF: imx: fix compilation with allyesconfig
make ARCH=mips allyesconfig generates this error:

sound/soc/sof/imx/imx8m.o:(.data.dsp_ops+0x0): multiple definition of
`dsp_ops'
sound/soc/sof/imx/imx8.o:(.data.dsp_ops+0x0): first defined here

Fix by making the definitions static

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2020-02-21 17:22:10 +02:00
Daniel Baluta efb390e6c7 MLK-23350-6 ASoC: SOF: Add i.MX8MP device descriptor
Add SOF device and DT descriptor for i.MX8MP platform.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-21 17:22:09 +02:00
Daniel Baluta 3f23312c74 MLK-23350-5 ASoC: SOF: imx: Add i.MX8M HW support
There is one notable difference between i.MX8M and i.MX8, which
doesn't allow us to reuse HW support from imx8.c file designed for i.MX8.

On i.MX8M resources (clocks, power, pinctrl, etc) are managed by the
Linux kernel while on i.MX8 resources are managed by a separate
System Controller Firmware. This makes the interface to those
resources completely different.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-21 17:22:09 +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
Viorel Suman b48e28774a MLK-23314-1: ASoC: ak5558: add support for ak5552
AK5552 is a 32-bit 2ch ADC and has the same register
map as AK5558.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-02-20 12:57:19 +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
Ranjani Sridharan f7775193b6 ASoC: pcm: update FE/BE trigger order based on the command
[ Upstream commit acbf27746e ]

Currently, the trigger orders SND_SOC_DPCM_TRIGGER_PRE/POST
determine the order in which FE DAI and BE DAI are triggered.
In the case of SND_SOC_DPCM_TRIGGER_PRE, the FE DAI is
triggered before the BE DAI and in the case of
SND_SOC_DPCM_TRIGGER_POST, the BE DAI is triggered before
the FE DAI. And this order remains the same irrespective of the
trigger command.

In the case of the SOF driver, during playback, the FW
expects the BE DAI to be triggered before the FE DAI during
the START trigger. The BE DAI trigger handles the starting of
Link DMA and so it must be started before the FE DAI is started
to prevent xruns during pause/release. This can be addressed
by setting the trigger order for the FE dai link to
SND_SOC_DPCM_TRIGGER_POST. But during the STOP trigger,
the FW expects the FE DAI to be triggered before the BE DAI.
Retaining the same order during the START and STOP commands,
results in FW error as the DAI component in the FW is still
active.

The issue can be fixed by mirroring the trigger order of
FE and BE DAI's during the START and STOP trigger. So, with the
trigger order set to SND_SOC_DPCM_TRIGGER_PRE, the FE DAI will be
trigger first during SNDRV_PCM_TRIGGER_START/STOP/RESUME
and the BE DAI will be triggered first during the
STOP/SUSPEND/PAUSE commands. Conversely, with the trigger order
set to SND_SOC_DPCM_TRIGGER_POST, the BE DAI will be triggered
first during the SNDRV_PCM_TRIGGER_START/STOP/RESUME commands
and the FE DAI will be triggered first during the
SNDRV_PCM_TRIGGER_STOP/SUSPEND/PAUSE commands.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191104224812.3393-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-14 16:34:07 -05: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
Cezary Rojewski 9af68afd83 ASoC: Intel: skl_hda_dsp_common: Fix global-out-of-bounds bug
commit 15adb20f64 upstream.

Definitions for idisp snd_soc_dai_links within skl_hda_dsp_common are
missing platform component. Add it to address following bug reported by
KASAN:

[   10.538502] BUG: KASAN: global-out-of-bounds in skl_hda_audio_probe+0x13a/0x2b0 [snd_soc_skl_hda_dsp]
[   10.538509] Write of size 8 at addr ffffffffc0606840 by task systemd-udevd/299
(...)
[   10.538519] Call Trace:
[   10.538524]  dump_stack+0x62/0x95
[   10.538528]  print_address_description+0x2f5/0x3b0
[   10.538532]  ? skl_hda_audio_probe+0x13a/0x2b0 [snd_soc_skl_hda_dsp]
[   10.538535]  __kasan_report+0x134/0x191
[   10.538538]  ? skl_hda_audio_probe+0x13a/0x2b0 [snd_soc_skl_hda_dsp]
[   10.538542]  ? skl_hda_audio_probe+0x13a/0x2b0 [snd_soc_skl_hda_dsp]
[   10.538544]  kasan_report+0x12/0x20
[   10.538546]  __asan_store8+0x57/0x90
[   10.538550]  skl_hda_audio_probe+0x13a/0x2b0 [snd_soc_skl_hda_dsp]
[   10.538553]  platform_drv_probe+0x51/0xb0
[   10.538556]  really_probe+0x311/0x600
[   10.538559]  driver_probe_device+0x87/0x1b0
[   10.538562]  device_driver_attach+0x8f/0xa0
[   10.538565]  ? device_driver_attach+0xa0/0xa0
[   10.538567]  __driver_attach+0x102/0x1a0
[   10.538569]  ? device_driver_attach+0xa0/0xa0
[   10.538572]  bus_for_each_dev+0xe8/0x160
[   10.538574]  ? subsys_dev_iter_exit+0x10/0x10
[   10.538577]  ? preempt_count_sub+0x18/0xc0
[   10.538580]  ? _raw_write_unlock+0x1f/0x40
[   10.538582]  driver_attach+0x2b/0x30
[   10.538585]  bus_add_driver+0x251/0x340
[   10.538588]  driver_register+0xd3/0x1c0
[   10.538590]  __platform_driver_register+0x6c/0x80
[   10.538592]  ? 0xffffffffc03e8000
[   10.538595]  skl_hda_audio_init+0x1c/0x1000 [snd_soc_skl_hda_dsp]
[   10.538598]  do_one_initcall+0xd0/0x36a
[   10.538600]  ? trace_event_raw_event_initcall_finish+0x160/0x160
[   10.538602]  ? kasan_unpoison_shadow+0x36/0x50
[   10.538605]  ? __kasan_kmalloc+0xcc/0xe0
[   10.538607]  ? kasan_unpoison_shadow+0x36/0x50
[   10.538609]  ? kasan_poison_shadow+0x2f/0x40
[   10.538612]  ? __asan_register_globals+0x65/0x80
[   10.538615]  do_init_module+0xf9/0x36f
[   10.538619]  load_module+0x398e/0x4590
[   10.538625]  ? module_frob_arch_sections+0x20/0x20
[   10.538628]  ? __kasan_check_write+0x14/0x20
[   10.538630]  ? kernel_read+0x9a/0xc0
[   10.538632]  ? __kasan_check_write+0x14/0x20
[   10.538634]  ? kernel_read_file+0x1d3/0x3c0
[   10.538638]  ? cap_capable+0xca/0x110
[   10.538642]  __do_sys_finit_module+0x190/0x1d0
[   10.538644]  ? __do_sys_finit_module+0x190/0x1d0
[   10.538646]  ? __x64_sys_init_module+0x50/0x50
[   10.538649]  ? expand_files+0x380/0x380
[   10.538652]  ? __kasan_check_write+0x14/0x20
[   10.538654]  ? fput_many+0x20/0xc0
[   10.538658]  __x64_sys_finit_module+0x43/0x50
[   10.538660]  do_syscall_64+0xce/0x700
[   10.538662]  ? syscall_return_slowpath+0x230/0x230
[   10.538665]  ? __do_page_fault+0x51e/0x640
[   10.538668]  ? __kasan_check_read+0x11/0x20
[   10.538670]  ? prepare_exit_to_usermode+0xc7/0x200
[   10.538673]  entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fixes: a78959f407 ("ASoC: Intel: skl_hda_dsp_common: use modern dai_link style")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200122181254.22801-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-11 04:35:52 -08:00
Marek Vasut 0a56a2e162 ASoC: sgtl5000: Fix VDDA and VDDIO comparison
commit e19ecbf105 upstream.

Comparing the voltage of VDDA and VDDIO to determine whether or not to
enable VDDC manual override is insufficient. This is a problem in case
the VDDA is supplied from different regulator than VDDIO, while both
report the same voltage to the regulator framework. In that case where
VDDA and VDDIO is supplied by different regulators, the VDDC manual
override must not be applied.

Fixes: b6319b061b ("ASoC: sgtl5000: Fix charge pump source assignment")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Igor Opaniuk <igor.opaniuk@toradex.com>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Link: https://lore.kernel.org/r/20191220164450.1395038-2-marex@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-11 04:35:48 -08:00
Jerome Brunet 05dceb5a62 ASoC: meson: axg-fifo: fix fifo threshold setup
commit 864cee90d4 upstream.

On TODDR sm1, the fifo threshold register field is slightly different
compared to the other SoCs. This leads to the fifo A being flushed to
memory every 8kB. If the period is smaller than that, several periods
are pushed to memory and notified at once. This is not ideal.

Fix the register field update. With this, the fifos are flushed every
128B. We could still do better, like adapt the threshold depending on
the period size, but at least it consistent across the different
SoC/fifos

Fixes: 5ac825c3d8 ("ASoC: meson: axg-toddr: add sm1 support")
Reported-by: Alden DSouza <aldend@google.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20191218172420.1199117-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-11 04:35:44 -08:00
Pierre-Louis Bossart df57920d6e ASoC: SOF: core: release resources on errors in probe_continue
[ Upstream commit 410e5e55c9 ]

The initial intent of releasing resources in the .remove does not work
well with HDaudio codecs. If the probe_continue() fails in a work
queue, e.g. due to missing firmware or authentication issues, we don't
release any resources, and as a result the kernel oopses during
suspend operations.

The suggested fix is to release all resources during errors in
probe_continue(), and use fw_state to track resource allocation
state, so that .remove does not attempt to release the same
hardware resources twice. PM operations are also modified so that
no action is done if DSP resources have been freed due to
an error at probe.

Reported-by: Takashi Iwai <tiwai@suse.de>
Co-developed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Bugzilla:  http://bugzilla.suse.com/show_bug.cgi?id=1161246
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200124213625.30186-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-11 04:35:27 -08:00
Ranjani Sridharan 3145862d8f ASoC: SOF: Introduce state machine for FW boot
[ Upstream commit 6ca5cecbd1 ]

Add a state machine for FW boot to track the
different stages of FW boot and replace the boot_complete
field with fw_state field in struct snd_sof_dev.
This will be used to determine the actions to be performed
during system suspend.

One of the main motivations for adding this change is the
fact that errors during the top-level SOF device probe cannot
be propagated and therefore suspending the SOF device normally
during system suspend could potentially run into errors.
For example, with the current flow, if the FW boot failed
for some reason and the system suspends, the SOF device
suspend could fail because the CTX_SAVE IPC would be attempted
even though the FW never really booted successfully causing it
to time out. Another scenario that the state machine fixes
is when the runtime suspend for the SOF device fails and
the DSP is powered down nevertheless, the CTX_SAVE IPC during
system suspend would timeout because the DSP is already
powered down.

Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191218002616.7652-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-11 04:35:27 -08:00
Pierre-Louis Bossart 570a29b1f7 ASoC: SOF: core: free trace on errors
commit 37e97e6fae upstream.

free_trace() is not called on probe errors, fix

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200124213625.30186-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-11 04:35:21 -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
Pierre-Louis Bossart 1722478144 ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
updated solution to the problem reported with randconfig:

CONFIG_SND_SOC_SOF_IMX depends on CONFIG_SND_SOC_SOF, but is in
turn referenced by the sof-of-dev driver. This creates a reverse
dependency that manifests in a link error when CONFIG_SND_SOC_SOF_OF
is built-in but CONFIG_SND_SOC_SOF_IMX=m:

sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'

use def_trisate to propagate the right settings without select.

Fixes: f4df4e4042 ("ASoC: SOF: imx8: Fix COMPILE_TEST error")
Fixes: 202acc565a ("ASoC: SOF: imx: Add i.MX8 HW support")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191101173045.27099-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-10 17:01:58 +02:00
Daniel Baluta a6f61fb451 LF-537-15: ASoC: core: Don't override platform name is of_node is set
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-02-10 17:01:57 +02:00
Paul Olaru b7ecbc7149 LF-537-13: sound: soc: sof: imx: Add i.MX8QM device descriptor
Add SOF device and DT descriptors for i.MX8QM platform.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2020-02-10 17:01:57 +02:00
Paul Olaru 7364defe42 LF-537-12 sound: soc: sof: Add ops for i.MX8QM
i.MX8QM and i.MX8QXP are mostly identical platforms with minor hardware
differences. One of these differences affects the firmware boot process,
requiring the run operation to differ. All other ops are reused.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2020-02-10 17:01:57 +02:00
Paul Olaru 4299ac03ce LF-537-11 sound: soc: sof: Rename i.MX8 platform to i.MX8X
i.MX8 and i.MX8X platforms are very similar and were treated the same.
Anyhow, we need to account for the differences somehow.

Current supported platform is i.MX8QXP which is from i.MX8X family.
Rename i.MX8 platform to i.MX8X to prepare for future i.MX8 platforms.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2020-02-10 17:01:56 +02:00
Jaroslav Kysela 09d4a9c83c ASoC: topology: fix soc_tplg_fe_link_create() - link->dobj initialization order
[ Upstream commit 8ce1cbd6ce ]

The code which checks the return value for snd_soc_add_dai_link() call
in soc_tplg_fe_link_create() moved the snd_soc_add_dai_link() call before
link->dobj members initialization.

While it does not affect the latest kernels, the old soc-core.c code
in the stable kernels is affected. The snd_soc_add_dai_link() function uses
the link->dobj.type member to check, if the link structure is valid.

Reorder the link->dobj initialization to make things work again.
It's harmless for the recent code (and the structure should be properly
initialized before other calls anyway).

The problem is in stable linux-5.4.y since version 5.4.11 when the
upstream commit 76d2703649 was applied.

Fixes: 76d2703649 ("ASoC: topology: Check return value for snd_soc_add_dai_link()")
Cc: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20200122190752.3081016-1-perex@perex.cz
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-05 21:22:53 +00:00
Arnaud Pouliquen 422566f37e ASoC: sti: fix possible sleep-in-atomic
[ Upstream commit ce780a47c3 ]

Change mutex and spinlock management to avoid sleep
in atomic issue.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Link: https://lore.kernel.org/r/20200113100400.30472-1-arnaud.pouliquen@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-05 21:22:46 +00:00
Kai Vehmanen 99ced2ecfe ASoC: hdac_hda: Fix error in driver removal after failed probe
[ Upstream commit 552b1a85da ]

In case system has multiple HDA codecs, and codec probe fails for
at least one but not all codecs, driver will end up cancelling
a non-initialized timer context upon driver removal.

Call trace of typical case:

[   60.593646] WARNING: CPU: 1 PID: 1147 at kernel/workqueue.c:3032
__flush_work+0x18b/0x1a0
[...]
[   60.593670]  __cancel_work_timer+0x11f/0x1a0
[   60.593673]  hdac_hda_dev_remove+0x25/0x30 [snd_soc_hdac_hda]
[   60.593674]  device_release_driver_internal+0xe0/0x1c0
[   60.593675]  bus_remove_device+0xd6/0x140
[   60.593677]  device_del+0x175/0x3e0
[   60.593679]  ? widget_tree_free.isra.7+0x90/0xb0 [snd_hda_core]
[   60.593680]  snd_hdac_device_unregister+0x34/0x50 [snd_hda_core]
[   60.593682]  snd_hdac_ext_bus_device_remove+0x2a/0x60 [snd_hda_ext_core]
[   60.593684]  hda_dsp_remove+0x26/0x100 [snd_sof_intel_hda_common]
[   60.593686]  snd_sof_device_remove+0x84/0xa0 [snd_sof]
[   60.593687]  sof_pci_remove+0x10/0x30 [snd_sof_pci]
[   60.593689]  pci_device_remove+0x36/0xb0

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110235751.3404-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-05 21:22:45 +00:00
Kai Vehmanen e43ab59fb1 ASoC: SOF: Intel: fix HDA codec driver probe with multiple controllers
[ Upstream commit 2c63bea714 ]

In case system has multiple HDA controllers, it can happen that
same HDA codec driver is used for codecs of multiple controllers.
In this case, SOF may fail to probe the HDA driver and SOF
initialization fails.

SOF HDA code currently relies that a call to request_module() will
also run device matching logic to attach driver to the codec instance.
However if driver for another HDA controller was already loaded and it
already loaded the HDA codec driver, this breaks current logic in SOF.
In this case the request_module() SOF does becomes a no-op and HDA
Codec driver is not attached to the codec instance sitting on the HDA
bus SOF is controlling. Typical scenario would be a system with both
external and internal GPUs, with driver of the external GPU loaded
first.

Fix this by adding similar logic as is used in legacy HDA driver
where an explicit device_attach() call is done after request_module().

Also add logic to propagate errors reported by device_attach() back
to caller. This also works in the case where drivers are not built
as modules.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110235751.3404-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-05 21:22:45 +00:00
Dmitry Osipenko 1a18f3a7db ASoC: rt5640: Fix NULL dereference on module unload
[ Upstream commit 89b71b3f02 ]

The rt5640->jack is NULL if jack is already disabled at the time of
driver's module unloading.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20200106014707.11378-1-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-05 21:22:44 +00:00
Sam McNally 791e3ec642 ASoC: Intel: cht_bsw_rt5645: Add quirk for boards using pmc_plt_clk_0
[ Upstream commit adebb11139 ]

As of commit 648e921888 ("clk: x86: Stop marking clocks as
CLK_IS_CRITICAL"), the cht_bsw_rt5645 driver needs to enable the clock
it's using for the codec's mclk. It does this from commit 7735bce05a
("ASoC: Intel: boards: use devm_clk_get() unconditionally"), enabling
pmc_plt_clk_3. However, Strago family Chromebooks use pmc_plt_clk_0 for
the codec mclk, resulting in white noise with some digital microphones.
Add a DMI-based quirk for Strago family Chromebooks to use pmc_plt_clk_0
instead - mirroring the changes made to cht_bsw_max98090_ti in
commit a182ecd380 ("ASoC: intel: cht_bsw_max98090_ti: Add quirk for
boards using pmc_plt_clk_0") and making use of the existing
dmi_check_system() call and related infrastructure added in
commit 22af29114e ("ASoC: Intel: cht-bsw-rt5645: add quirks for
SSP0/AIF1/AIF2 routing").

Signed-off-by: Sam McNally <sammc@chromium.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190917054933.209335-1-sammc@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-01 09:34:46 +00:00
Dragos Tarcatu 98aedb8935 ASoC: topology: Prevent use-after-free in snd_soc_get_pcm_runtime()
[ Upstream commit dd836ddf4e ]

remove_link() is currently calling snd_soc_remove_dai_link() after
it has already freed the memory for the link name. But this is later
read from snd_soc_get_pcm_runtime() causing a KASAN use-after-free
warning. Reorder the cleanups to fix this issue.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20191204210447.11701-4-pierre-louis.bossart@linux.intel.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
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
Pierre-Louis Bossart 32a369776b ASoC: SOF: Intel: hda: hda-dai: fix oops on hda_link .hw_free
[ Upstream commit 921162c81a ]

When the PCM_PARAM IPC fails while configuring the FE, the kernel
oopses in the HDaudio link DMA .hw_free operation. The root cause is a
NULL dma_data since the BE .hw_params was never called by the SOC
core.

This error can also happen if the HDaudio link DMA configuration IPC
fails in the BE .hw_params.

This patches makes sure the dma_data is properly saved in .hw_params,
and tested before being use in hw_free.

GitHub issue: https://github.com/thesofproject/linux/issues/1417

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191218000518.5830-3-pierre-louis.bossart@linux.intel.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
Kai Vehmanen eedf205f02 ASoC: SOF: fix fault at driver unload after failed probe
[ Upstream commit b06e46427f ]

If sof_machine_check() fails during driver probe, the IPC
state is not initialized and this will lead to a NULL
dereference at driver unload. Example log is as follows:

[ 1535.980630] sof-audio-pci 0000:00:1f.3: error: no matching ASoC machine driver found - aborting probe
[ 1535.980631] sof-audio-pci 0000:00:1f.3: error: failed to get machine info -19
[ 1535.980632] sof-audio-pci 0000:00:1f.3: error: sof_probe_work failed err: -19
[ 1550.798373] BUG: kernel NULL pointer dereference, address: 0000000000000008
...
[ 1550.798393] Call Trace:
[ 1550.798397]  snd_sof_ipc_free+0x15/0x30 [snd_sof]
[ 1550.798399]  snd_sof_device_remove+0x29/0xa0 [snd_sof]
[ 1550.798400]  sof_pci_remove+0x10/0x30 [snd_sof_pci]

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191218000518.5830-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-01 09:34:41 +00:00
Hans de Goede b2a04901f3 ASoC: Intel: bytcht_es8316: Fix Irbis NB41 netbook quirk
commit 869bced7a0 upstream.

When a quirk for the Irbis NB41 netbook was added, to override the defaults
for this device, I forgot to add/keep the BYT_CHT_ES8316_SSP0 part of the
defaults, completely breaking audio on this netbook.

This commit adds the BYT_CHT_ES8316_SSP0 flag to the Irbis NB41 netbook
quirk, making audio work again.

Cc: stable@vger.kernel.org
Cc: russianneuromancer@ya.ru
Fixes: aa2ba991c4 ("ASoC: Intel: bytcht_es8316: Add quirk for Irbis NB41 netbook")
Reported-and-tested-by: russianneuromancer@ya.ru
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200106113903.279394-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-23 08:22:30 +01:00
Stephan Gerhold bcd68cdc69 ASoC: msm8916-wcd-analog: Fix MIC BIAS Internal1
commit 057efcf9fa upstream.

MIC BIAS Internal1 is broken at the moment because we always
enable the internal rbias resistor to the TX2 line (connected to
the headset microphone), rather than enabling the resistor connected
to TX1.

Move the RBIAS code to pm8916_wcd_analog_enable_micbias_int1/2()
to fix this.

Fixes: 585e881e5b ("ASoC: codecs: Add msm8916-wcd analog codec")
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20200111164006.43074-3-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-23 08:22:30 +01:00
Stephan Gerhold b87225508c ASoC: msm8916-wcd-analog: Fix selected events for MIC BIAS External1
commit e0beec8839 upstream.

MIC BIAS External1 sets pm8916_wcd_analog_enable_micbias_ext1()
as event handler, which ends up in pm8916_wcd_analog_enable_micbias_ext().

But pm8916_wcd_analog_enable_micbias_ext() only handles the POST_PMU
event, which is not specified in the event flags for MIC BIAS External1.
This means that the code in the event handler is never actually run.

Set SND_SOC_DAPM_POST_PMU as the only event for the handler to fix this.

Fixes: 585e881e5b ("ASoC: codecs: Add msm8916-wcd analog codec")
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20200111164006.43074-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-23 08:22:29 +01:00
Olivier Moysan 065f819dfa ASoC: stm32: dfsdm: fix 16 bits record
commit 8e55ea1912 upstream.

In stm32_afsdm_pcm_cb function, the transfer size is provided in bytes.
However, samples are copied as 16 bits words from iio buffer.
Divide by two the transfer size, to copy the right number of samples.

Fixes: 1e7f6e1c69 ("ASoC: stm32: dfsdm: add 16 bits audio record support")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20200110131131.3191-1-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-23 08:22:29 +01:00
Olivier Moysan 24e9094d06 ASoC: stm32: sai: fix possible circular locking
commit a14bf98c04 upstream.

In current driver, locks can be taken as follows:
- Register access: take a lock on regmap config and then on clock.
- Master clock provider: take a lock on clock and then on regmap config.
This can lead to the circular locking summarized below.

Remove peripheral clock management through regmap framework, and manage
peripheral clock in driver instead. On register access, lock on clock
is taken first, which allows to avoid possible locking issue.

[ 6696.561513] ======================================================
[ 6696.567670] WARNING: possible circular locking dependency detected
[ 6696.573842] 4.19.49 #866 Not tainted
[ 6696.577397] ------------------------------------------------------
[ 6696.583566] pulseaudio/6439 is trying to acquire lock:
[ 6696.588697] 87b0a25b (enable_lock){..-.}, at: clk_enable_lock+0x64/0x128
[ 6696.595377]
[ 6696.595377] but task is already holding lock:
[ 6696.601197] d858f825 (stm32_sai_sub:1342:(sai->regmap_config)->lock){....}
...
[ 6696.812513]  Possible unsafe locking scenario:
[ 6696.812513]
[ 6696.818418]        CPU0                    CPU1
[ 6696.822935]        ----                    ----
[ 6696.827451]   lock(stm32_sai_sub:1342:(sai->regmap_config)->lock);
[ 6696.833618]                                lock(enable_lock);
[ 6696.839350]                                lock(stm32_sai_sub:1342:
                                              (sai->regmap_config)->lock);
[ 6696.848035]   lock(enable_lock);

Fixes: 03e78a242a ("ASoC: stm32: sai: add h7 support")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20200109083254.478-1-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-23 08:22:29 +01:00
Stephan Gerhold 80c59b8a8a ASoC: msm8916-wcd-digital: Reset RX interpolation path after use
commit 85578bbd64 upstream.

For some reason, attempting to route audio through QDSP6 on MSM8916
causes the RX interpolation path to get "stuck" after playing audio
a few times. In this situation, the analog codec part is still working,
but the RX path in the digital codec stops working, so you only hear
the analog parts powering up. After a reboot everything works again.

So far I was not able to reproduce the problem when using lpass-cpu.

The downstream kernel driver avoids this by resetting the RX
interpolation path after use. In mainline we do something similar
for the TX decimator (LPASS_CDC_CLK_TX_RESET_B1_CTL), but the
interpolator reset (LPASS_CDC_CLK_RX_RESET_CTL) got lost when the
msm8916-wcd driver was split into analog and digital.

Fix this problem by adding the reset to
msm8916_wcd_digital_enable_interpolator().

Fixes: 150db8c5af ("ASoC: codecs: Add msm8916-wcd digital codec")
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20200105102753.83108-1-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-23 08:22:29 +01: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
Nilkanth Ahirrao 9677ee5800 ASoC: rsnd: fix DALIGN register for SSIU
commit ef8e147943 upstream.

The current driver only sets 0x76543210 and 0x67452301 for DALIGN.
This doesn’t work well for TDM split and ex-split mode for all SSIU.
This patch programs the DALIGN registers based on the SSIU number.

Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Jiada Wang <jiada_wang@mentor.com>
Cc: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Fixes: a914e44693 ("ASoC: rsnd: more clear rsnd_get_dalign() for DALIGN")
Signed-off-by: Nilkanth Ahirrao <anilkanth@jp.adit-jv.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20191121111023.10976-1-erosca@de.adit-jv.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-17 19:48:35 +01:00
Takashi Iwai 906ed10bc6 ASoC: core: Fix compile warning with CONFIG_DEBUG_FS=n
commit bd0b609e0c upstream.

Paper over a compile warning:
  sound/soc/soc-pcm.c:1185:8: warning: unused variable ‘name’

Fixes: 0632fa0425 ("ASoC: core: Fix pcm code debugfs error")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191107134833.1502-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-17 19:48:35 +01:00
Pierre-Louis Bossart 74de9e7ba7 ASoC: SOF: Intel: Broadwell: clarify mutual exclusion with legacy driver
commit a6955fe0e2 upstream.

Some distros select all options blindly, which leads to confusion and
bug reports. SOF does not fully support Broadwell due to firmware
dependencies, the machine drivers can only support one option, and
UCM/topology files are still being propagated to downstream distros,
so make SOF on Broadwell an opt-in option that first require distros
to opt-out of existing defaults.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204237
Fixes: f35bf70f61 ('ASoC: Intel: Make sure BDW based machine drivers build for SOF')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191101173045.27099-3-pierre-louis.bossart@linux.intel.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 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
Daniel Baluta ac1d5c147f ASoC: SOF: imx8: Fix dsp_box offset
commit dcf08d0f8f upstream.

dsp_box is used to keep DSP initiated messages. The value of dsp_offset
is set by the DSP with the first message, so we need a way to bootstrap
it in order to get the first message.

We do this by setting the correct default dsp_box offset which on i.MX8
is not zero.

Very interesting is why it has worked until now.

On i.MX8, DSP communicates with ARM core using a shared SDRAM memory
area. Actually, there are two shared areas:
	* SDRAM0 - starting at 0x92400000, size 0x800000
	* SDRAM1 - starting at 0x92C00000, size 0x800000

SDRAM0 keeps the data sections, starting with .rodata. By chance
fw_ready structure was placed at the beginning of .rodata.

dsp_box_base is defined as SDRAM0 + dsp_box_offset and it is placed
at the beginning of SDRAM1 (dsp_box_offset should be 0x800000). But
because it is zero initialized by default it points to SDRAM0 where
by chance the fw_ready was placed in the SOF firmware.

Anyhow, SOF commit 7466bee378dd811b ("clk: make freq arrays constant")
fw_ready is no longer at the beginning of SDRAM0 and everything shows
how lucky we were until now.

Fix this by properly setting the default dsp_box offset.

Fixes: 202acc565a ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191220170531.10423-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-17 19:48:19 +01:00
Olivier Moysan 8c475efd6c ASoC: stm32: spdifrx: fix input pin state management
commit 3b7658679d upstream.

Changing input state in iec capture control is not safe,
as the pin state may be changed concurrently by ASoC
framework.
Remove pin state handling in iec capture control.

Note: This introduces a restriction on capture control,
when pin sleep state is defined in device tree. In this case
channel status can be captured only when an audio stream
capture is active.

Fixes: f68c2a682d ("ASoC: stm32: spdifrx: add power management")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20191204154333.7152-4-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-17 19:48:18 +01:00
Olivier Moysan 06e929ccb9 ASoC: stm32: spdifrx: fix race condition in irq handler
commit 86e1956af4 upstream.

When snd_pcm_stop() is called in interrupt routine,
substream context may have already been released.
Add protection on substream context.

Fixes: 03e4d5d56f ("ASoC: stm32: Add SPDIFRX support")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20191204154333.7152-3-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-17 19:48:18 +01:00
Olivier Moysan af3fb3ea16 ASoC: stm32: spdifrx: fix inconsistent lock state
commit 2859b17840 upstream.

In current spdifrx driver locks may be requested as follows:
- request lock on iec capture control, when starting synchronization.
- request lock in interrupt context, when spdifrx stop is called
from IRQ handler.

Take lock with IRQs disabled, to avoid the possible deadlock.

Lockdep report:
[   74.278059] ================================
[   74.282306] WARNING: inconsistent lock state
[   74.290120] --------------------------------
...
[   74.314373]        CPU0
[   74.314377]        ----
[   74.314381]   lock(&(&spdifrx->lock)->rlock);
[   74.314396]   <Interrupt>
[   74.314400]     lock(&(&spdifrx->lock)->rlock);

Fixes: 03e4d5d56f ("ASoC: stm32: Add SPDIFRX support")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20191204154333.7152-2-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-17 19:48:18 +01:00
Daniel Baluta 5585d2a989 ASoC: soc-core: Set dpcm_playback / dpcm_capture
commit 218fe9b7ec upstream.

When converting a normal link to a DPCM link we need
to set dpcm_playback / dpcm_capture otherwise playback/capture
streams will not be created resulting in errors like this:

[   36.039111]  sai1-wm8960-hifi: ASoC: no backend playback stream

Fixes: a655de808c ("ASoC: core: Allow topology to override machine driver FE DAI link config")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20191204151333.26625-1-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-17 19:48:17 +01:00
Colin Ian King d918aacabc ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev
commit 98910e1d61 upstream.

The memory allocation failure check for priv->pd_dev is incorrectly
pointer checking priv instead of priv->pd_dev. Fix this.

Addresses-Coverity: ("Logically dead code")
Fixes: 202acc565a ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191204124816.1415359-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-17 19:48:17 +01:00
Shengjiu Wang f684cc7c13 ASoC: wm8962: fix lambda value
[ Upstream commit 556672d75f ]

According to user manual, it is required that FLL_LAMBDA > 0
in all cases (Integer and Franctional modes).

Fixes: 9a76f1ff6e ("ASoC: Add initial WM8962 CODEC driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/1576065442-19763-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:34 +01:00
Curtis Malainey 78935af228 ASoC: SOF: Intel: split cht and byt debug window sizes
[ Upstream commit f84337c3fb ]

Turns out SSP 3-5 are only available on cht, to avoid dumping on
undefined registers let's split the definition.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191210004854.16845-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:22 +01:00
Karol Trzcinski 9d71c76a16 ASoC: SOF: loader: snd_sof_fw_parse_ext_data log warning on unknown header
[ Upstream commit 8edc956676 ]

Added warning log when found some unknown FW boot ext header,
to improve debuggability.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191210004854.16845-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:22 +01:00
Dragos Tarcatu c75fe29eb1 ASoC: topology: Check return value for soc_tplg_pcm_create()
[ Upstream commit a3039aef52 ]

The return value of soc_tplg_pcm_create() is currently not checked
in soc_tplg_pcm_elems_load(). If an error is to occur there, the
topology ignores it and continues loading.

Fix that by checking the status and rejecting the topology on error.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191210003939.15752-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:21 +01:00
Dragos Tarcatu 805afc15c6 ASoC: topology: Check return value for snd_soc_add_dai_link()
[ Upstream commit 76d2703649 ]

snd_soc_add_dai_link() might fail. This situation occurs for
instance in a very specific use case where a PCM device and a
Back End DAI link are given identical names in the topology.
When this happens, soc_new_pcm_runtime() fails and then
snd_soc_add_dai_link() returns -ENOMEM when called from
soc_tplg_fe_link_create(). Because of that, the link will not
get added into the card list, so any attempt to remove it later
ends up in a panic.

Fix that by checking the return status and free the memory in case
of an error.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191210003939.15752-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:21 +01:00
Hans de Goede 89b5e38e70 ASoC: Intel: bytcr_rt5640: Update quirk for Teclast X89
[ Upstream commit 7eccc05c71 ]

When the Teclast X89 quirk was added we did not have jack-detection
support yet.

Note the over-current detection limit is set to 2mA instead of the usual
1.5mA because this tablet tends to give false-positive button-presses
when it is set to 1.5mA.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191203221442.2657-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:15 +01:00
Tzung-Bi Shih efd10b1171 ASoC: max98090: fix possible race conditions
[ Upstream commit 45dfbf5697 ]

max98090_interrupt() and max98090_pll_work() run in 2 different threads.
There are 2 possible races:

Note: M98090_REG_DEVICE_STATUS = 0x01.
Note: ULK == 0, PLL is locked; ULK == 1, PLL is unlocked.

max98090_interrupt      max98090_pll_work
----------------------------------------------
schedule max98090_pll_work
                        restart max98090 codec
receive ULK INT
                        assert ULK == 0
schedule max98090_pll_work (1).

In the case (1), the PLL is locked but max98090_interrupt unnecessarily
schedules another max98090_pll_work.

max98090_interrupt      max98090_pll_work      max98090 codec
----------------------------------------------------------------------
                                               ULK = 1
receive ULK INT
read 0x01
                                               ULK = 0 (clear on read)
schedule max98090_pll_work
                        restart max98090 codec
                                               ULK = 1
receive ULK INT
read 0x01
                                               ULK = 0 (clear on read)
                        read 0x01
                        assert ULK == 0 (2).

In the case (2), both max98090_interrupt and max98090_pll_work read
the same clear-on-read register.  max98090_pll_work would falsely
thought PLL is locked.
Note: the case (2) race is introduced by the previous commit ("ASoC:
max98090: exit workaround earlier if PLL is locked") to check the status
and exit the loop earlier in max98090_pll_work.

There are 2 possible solution options:
A. turn off ULK interrupt before scheduling max98090_pll_work; and turn
on again before exiting max98090_pll_work.
B. remove the second thread of execution.

Option A cannot fix the case (2) race because it still has 2 threads
access the same clear-on-read register simultaneously.  Although we
could suppose the register is volatile and read the status via I2C could
be much slower than the hardware raises the bits.

Option B introduces a maximum 10~12 msec penalty delay in the interrupt
handler.  However, it could only punish the jack detection by extra
10~12 msec.

Adopts option B which is the better solution overall.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20191122073114.219945-4-tzungbi@google.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:12 +01:00
Shuming Fan 42ba2aded4 ASoC: rt5682: fix i2c arbitration lost issue
[ Upstream commit bc094709de ]

This patch modified the HW initial setting to fix i2c arbitration lost issue.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191125091940.11953-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:11 +01:00
Shengjiu Wang bc155e25a0 ASoC: soc-pcm: check symmetry before hw_params
[ Upstream commit 5cca59516d ]

This reverts commit 957ce0c6b8 (ASoC: soc-pcm: check symmetry after
hw_params).

That commit cause soc_pcm_params_symmetry can't take effect.
cpu_dai->rate, cpu_dai->channels and cpu_dai->sample_bits
are updated in the middle of soc_pcm_hw_params, so move
soc_pcm_params_symmetry to the end of soc_pcm_hw_params is
not a good solution, for judgement of symmetry in the function
is always true.

FIXME:
According to the comments of that commit, I think the case
described in the commit should disable symmetric_rates
in Back-End, rather than changing the position of
soc_pcm_params_symmetry.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1573555602-5403-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:45:42 +01:00
Hans de Goede cfadd487ae ASoC: Intel: bytcr_rt5640: Update quirk for Acer Switch 10 SW5-012 2-in-1
[ Upstream commit 0bb887709e ]

When the Acer Switch 10 SW5-012 quirk was added we did not have
jack-detection support yet; and the builtin microphone selection of
the original quirk is wrong too.

Fix the microphone-input quirk and add jack-detection info so that the
internal-microphone and headphone/set jack on the Switch 10 work properly.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191119145138.59162-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:45:39 +01:00
Chuhong Yuan 13215269ed ASoC: wm5100: add missed pm_runtime_disable
[ Upstream commit b1176bbb70 ]

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

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20191118073707.28298-1-hslester96@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:45:38 +01:00
Chuhong Yuan dc7a825622 ASoC: wm2200: add missed operations in remove and probe failure
[ Upstream commit 2dab09be49 ]

This driver misses calls to pm_runtime_disable and regulator_bulk_disable
in remove and a call to free_irq in probe failure.
Add the calls to fix it.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Link: https://lore.kernel.org/r/20191118073633.28237-1-hslester96@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:45:37 +01:00
Michael Walle 1abc16758b ASoC: wm8904: fix regcache handling
[ Upstream commit e9149b8c00 ]

The current code assumes that the power is turned off in
SND_SOC_BIAS_OFF. If there are no actual regulator the codec isn't
turned off and the registers are not reset to their default values but
the regcache is still marked as dirty. Thus a value might not be written
to the hardware if it is set to the default value. Do a software reset
before turning off the power to make sure the registers are always reset
to their default states.

Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20191112223629.21867-1-michael@walle.cc
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:45:31 +01:00
Yu-Hsuan Hsu 187fb0e947 ASoC: Intel: kbl_rt5663_rt5514_max98927: Add dmic format constraint
[ Upstream commit e2db787bdc ]

On KBL platform, the microphone is attached to external codec(rt5514)
instead of PCH. However, TDM slot between PCH and codec is 16 bits only.
In order to avoid setting wrong format, we should add a constraint to
force to use 16 bits format forever.

Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190923162940.199580-1-yuhsuan@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:45:21 +01:00
Ben Zhang 5e0775af48 ASoC: rt5677: Mark reg RT5677_PWR_ANLG2 as volatile
[ Upstream commit eabf424f7b ]

The codec dies when RT5677_PWR_ANLG2(MX-64h) is set to 0xACE1
while it's streaming audio over SPI. The DSP firmware turns
on PLL2 (MX-64 bit 8) when SPI streaming starts.  However regmap
does not believe that register can change by itself. When
BST1 (bit 15) is turned on with regmap_update_bits(), it doesn't
read the register first before write, so PLL2 power bit is
cleared by accident.

Marking MX-64h as volatile in regmap solved the issue.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-6-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:45:18 +01:00
Ranjani Sridharan fc766aec02 ASoC: SOF: topology: set trigger order for FE DAI link
[ Upstream commit 5eee2b3f60 ]

Set trigger order for FE DAI links to SND_SOC_DPCM_TRIGGER_POST
to trigger the BE DAI's before the FE DAI's. This prevents the
xruns seen on playback pipelines using the link DMA.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191104224812.3393-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:44:44 +01:00
Pierre-Louis Bossart d98020a3fd ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
[ Upstream commit f9ad754684 ]

updated solution to the problem reported with randconfig:

CONFIG_SND_SOC_SOF_IMX depends on CONFIG_SND_SOC_SOF, but is in
turn referenced by the sof-of-dev driver. This creates a reverse
dependency that manifests in a link error when CONFIG_SND_SOC_SOF_OF
is built-in but CONFIG_SND_SOC_SOF_IMX=m:

sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'

use def_trisate to propagate the right settings without select.

Fixes: f4df4e4042 ("ASoC: SOF: imx8: Fix COMPILE_TEST error")
Fixes: 202acc565a ("ASoC: SOF: imx: Add i.MX8 HW support")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191101173045.27099-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:44:34 +01:00
Kuninori Morimoto 0e8be3f402 ASoC: soc-pcm: fixup dpcm_prune_paths() loop continue
[ Upstream commit bed646dc3f ]

dpcm_prune_paths() is checking widget at 2 parts.
(A) is for CPU, (B) is for Codec.
If we focus to (A) part, continue at (a) is for (1) loop. But,
if we focus to (B) part, continue at (b) is for (2) loop, not for (1).
This is bug.
This patch fixup this issue.

	static int dpcm_prune_paths(...)
	{
		...
   (1)		for_each_dpcm_be(fe, stream, dpcm) {
			...

 ^			widget = dai_get_widget(...);
 |
(A)			if (widget && widget_in_list(...))
 | (a)				continue;
 v
 ^ (2)			for_each_rtd_codec_dai(...) {
 |				widget = dai_get_widget(...);
(B)
 |				if (widget && widget_in_list(...))
 v (b)					continue;
			}
			...

Fixes: 2e5894d737 ("ASoC: pcm: Add support for DAI multicodec")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blui64mf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:44:13 +01:00
Kai Vehmanen 8be87bf063 ASoC: SOF: enable sync_write in hdac_bus
[ Upstream commit f3416e7144 ]

Align SOF HDA implementation with snd-hda-intel driver and enable
sync_write flag for all supported Intel platforms in SOF. When set,
a sync is issued after each verb write.

Sync after write has helped to overcome intermittent delays in
system resume flow on Intel Coffee Lake systems, and most recently
probe errors related to the HDMI codec on Ice Lake systems.

Matches the snd-hda-intel driver change done in commit 2756d9143a
("ALSA: hda - Fix intermittent CORB/RIRB stall on Intel chips").

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191008164443.1358-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:43:58 +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
Daniel Baluta 77255cbb70 LF-537-10: ASoC: SOF Fix unused variable ‘mach’ warning
mach is only used now in nocodec usecase, so properly
guard it to avoid compiler warning.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-18 23:17:33 +02:00
Daniel Baluta da85e842dc LF-537-10 ASoC: simple-card: Don't create separate link when platform is present
In normal sound case all DAIs are detected as CPU-Codec.
simple_dai_link_of supports the presence of a platform but it counts
it as a CPU DAI resulting in the creation of an extra link.

Adding a platform property to a link description like:

simple-audio-card,dai-link {
	cpu {
		sound-dai = <&sai1>;
	};
	plat {
		sound-dai = <&dsp>;
	};
	codec {
		sound-dai = <&wm8960>;
	}

will result in the creation of two links:
	* sai1 <-> wm8960
	* dsp  <-> wm8960

which is obviously not what we want. We just want one single link
with:
	* sai1 <-> wm8960 (and platform set to dsp).

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20191209135353.17427-1-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-18 11:39:24 +02:00
Daniel Baluta 4fe325ff10 LF-537-6 ASoC: SOF: imx8: Fix dsp_box offset
dsp_box is used to keep DSP initiated messages. The value of dsp_offset
is set by the DSP with the first message, so we need a way to boostrap
it in order to get the first message.

We do this by setting the correct default dsp_box offset which on i.MX8
is not zero.

Very interesting is why it has worked until now.

On i.MX8, DSP communicates with ARM core using a shared SDRAM memory
area. Actually, there are two shared areas:
	* SDRAM0 - starting at 0x92400000, size 0x800000
	* SDRAM1 - starting at 0x92C00000, size 0x800000

SDRAM0 keeps the data sections, starting with .rodata. By chance
fw_ready structure was placed at the beginning of .rodata.

dsp_box_base is defined as SDRAM0 + dsp_box_offset and it is placed
at the begining of SDRAM1 (dsp_box_offset should be 0x800000). But
because it is zero initialized by default it points to SDRAM0 where
by chance the fw_ready was placed in the SOF firmware.

Anyhow, SOF commit 7466bee378dd811b ("clk: make freq arrays constant")
fw_ready is no longer at the beginning of SDRAM0 and everything shows
how lucky we were until now.

Fix this by properly setting the default dsp_box offset.

Fixes 202acc565a ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-18 11:38:50 +02:00
Karol Trzcinski c1364b5b4a LF-537-5 ASoC: SOF: log compiler name and version information
Log information about used compilator and optimization level
in sof firmware to host system.
It will be helful to catch some compiler dependent bugs.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-12-18 11:38:39 +02:00
Karol Trzcinski 4109d0ed20 LF-537-3 ASoC: SOF: fix snd_sof_fw_parse_ext_data
An error occurs during parsing more than one ext_data from the mailbox, because
of invalid data offset handling. Fix by removing the incorrect duplicate
increment of the offset.

The return value is also reset in the switch case. This does not change the
behavior but improves readability - there is no longer a need to check what the
return value of get_ext_windows is.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-12-18 11:38:28 +02:00
Karol Trzcinski 8e260d958e LF-537-2 ASoC: SOF: snd_sof_fw_parse_ext_data log warning on unknown header
Added warning log when found some unknown FW boot ext header,
to improve debuggability.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-12-18 11:38:23 +02:00
Daniel Baluta 0b4813a18e LF-537-1 ASoC: SOF: Introduce machine driver name
ACPI creates tables with information about the machine driver.
With DT there is no need for such tables because we can directly
get all the information needed from DT file.

This patch introduces machine driver property inside dsp node.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-18 11:38:03 +02: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
Pawel Harlozinski 9ae0611f0c ASoC: Jack: Fix NULL pointer dereference in snd_soc_jack_report
commit 8f157d4ff0 upstream.

Check for existance of jack before tracing.
NULL pointer dereference has been reported by KASAN while unloading
machine driver (snd_soc_cnl_rt274).

Signed-off-by: Pawel Harlozinski <pawel.harlozinski@linux.intel.com>
Link: https://lore.kernel.org/r/20191112130237.10141-1-pawel.harlozinski@linux.intel.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
Jacob Rasmussen 560025a0b5 ASoC: rt5645: Fixed typo for buddy jack support.
commit fe23be2d85 upstream.

Had a typo in e7cfd867fd that resulted in buddy jack support not being
fixed.

Fixes: e7cfd867fd ("ASoC: rt5645: Fixed buddy jack support.")
Signed-off-by: Jacob Rasmussen <jacobraz@google.com>
Reviewed-by: Ross Zwisler <zwisler@google.com>
Cc: <jacobraz@google.com>
CC: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20191114232011.165762-1-jacobraz@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 19:56:13 +01:00
Jacob Rasmussen bb949b530c ASoC: rt5645: Fixed buddy jack support.
commit e7cfd867fd upstream.

The headphone jack on buddy was broken with the following commit:
commit 6b5da66322 ("ASoC: rt5645: read jd1_1 status for jd
detection").
This changes the jd_mode for buddy to 4 so buddy can read from the same
register that was used in the working version of this driver without
affecting any other devices that might use this, since no other device uses
jd_mode = 4. To test this I plugged and uplugged the headphone jack, verifying
audio works.

Signed-off-by: Jacob Rasmussen <jacobraz@google.com>
Reviewed-by: Ross Zwisler <zwisler@google.com>
Link: https://lore.kernel.org/r/20191111185957.217244-1-jacobraz@google.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:13 +01:00
Shengjiu Wang 57ec9315e6 ASoC: soc-pcm: check symmetry before hw_params
This reverts commit 957ce0c6b8 (ASoC: soc-pcm: check symmetry after
hw_params).

That commit cause soc_pcm_params_symmetry can't take effect.
cpu_dai->rate, cpu_dai->channels and cpu_dai->sample_bits
are updated in the middle of soc_pcm_hw_params, so move
soc_pcm_params_symmetry to the end of soc_pcm_hw_params is
not a good solution, for judgement of symmetry in the function
is always true.

FIXME:
According to the comments of that commit, I think the case
described in the commit should disable symmetric_rates
in Back-End, rather than changing the position of
soc_pcm_params_symmetry.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1573555602-5403-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-17 17:58:21 +08: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
Daniel Baluta 8511427845 ASoC: SOF: Parse fw/tplg filename from DT
Introduce two DT properties in dsp node:
	* fw-filename, optional property giving the firmware filename
	(if this is missing fw filename is read from board description)
	* tplg-filename, mandatory giving the topology filename.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 17:44: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 dfc1c26529 Merge remote-tracking branch 'origin/audio/codec' into audio/next
* origin/audio/codec: (34 commits)
  LF-102: ASoC: ak4458: Support DSD512 when codec is ak4497
  ASoC: AK4458: Enable DSD for AK4497
  MLK-17817-1: ASoC: ak4458: enable daisy chain
  MLK-20189-7: ASoC: ak4458: check reset control status
  MLK-19573-2: ASoC: ak4458: enable DSD playback
  ...
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 9c3a087b1d ASoC: SOF: Read tplg filename from board descriptor
We use the nocodec tplg_filename for now. Proper name
should be read from device tree file.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-29 00:51:41 +02:00
Daniel Baluta 9ce84c863a ASoC: SOF: Update fw_filename from board description
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-29 00:32:36 +02:00
Daniel Baluta 95ab2f59ea ASoC: SOF: Allow probe to continue when we have an actual codec
For now the machine driver taking care of the codec is hard-coded.
In the future we will need to read the name from DT.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-28 23:24:35 +02:00
Daniel Baluta 1b9618b96c ASoC: SOF: Hardcode ignore_machine
We need to find a way to pass the machine driver name to SOF core. So
far just hard code it.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-28 23:21:46 +02: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 ceebeb986a ASoC: soc-core: Set dpcm_playback / dpcm_capture
When converting a normal link to a DPCM link we need
to set dpcm_playback / dpcm_capture otherwise playback/capture
streams will not be created resulting in aplay/arecord not working.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 22:01:55 +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
Daniel Baluta 37ade25a58 ASoC: SOF: nocodec: Amend arguments for sof_nocodec_setup()
Set the drv_name and tplg_filename for nocodec
machine driver in sof_machine_check().
This means the sof_nocodec_setup() does not
need the mach, plat_data or desc arguments any longer.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 21:50:22 +02:00
Daniel Baluta 19fa41a7ab ASoC: Make creation of machine device from SOF core optional
Currently, SOF probes machine drivers by creating a platform device
and passing the machine description as private data.

This is driven by the ACPI restrictions. Ideally, ACPI tables
should contain the description for the machine driver. This is
not possible because ACPI tables are frozen and used on multiple
OS-es (e.g Windows).

In the case, of Device Tree we don't have this restrictions, so we
choose to probe the machine drivers by creating a DT node as is
the standard ALSA way.

This patch makes the probing of machine drivers from SOF core optional
allowing for arm platforms to decouple the SOF core from machine
driver probing.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 21:49:11 +02:00
Daniel Baluta 3d9382581a ASoC: SOF: Remove unused drv_name in sof_pdata
This field is only set but never used. Let's remove
it to make code cleaner.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2019-11-27 21:48:18 +02:00
Ranjani Sridharan 0d4340c272 ASoC: SOF: core: move check for runtime callbacks to core
For some platforms, the refcount is explicitly incremented
to prevent it from entering runtime suspend. This
should be be done during probe in the core instead
of being done in the PCM driver.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2019-11-27 21:31:48 +02:00
Ranjani Sridharan ed4e044776 ASoC: SOF: core: modify the signature for snd_sof_create_page_table
Modify the signature for snd_sof_create_page_table to
take struct device pointer as an argument instead of
struct snd_sof_dev as this will be used by both the SOF
core device and its clients. Also, move the definition
out of core.c to utils.c.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2019-11-27 17:12:16 +02:00
Ranjani Sridharan 9e39858592 ASoC: SOF: Introduce default_fw_filename member in sof_dev_desc
Currently the FW filename is obtained from the ACPI matching
table when determining which machine driver to use. In
preparation for making the machine driver ACPI match optional
for Device Tree platforms and moving the machine driver selection
out of the SOF core, this patch introduces the default_fw_filename
member in struct sof_dev_desc.

Once the machine driver selection is moved out of SOF core,
the nocodec_fw_filename will become obsolete and will be removed.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 17:11:42 +02:00
Liam Girdwood 0e821afb94 ASoC: SOF: Intel: Fix CFL and CML FW nocodec binary names.
The manifest information is different between CNL, CML and CFL platforms
hence we need to load different files.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2019-11-27 17:11:24 +02:00
Ranjani Sridharan 67c1304cd5 ASoC: SOF: topology: remove snd_sof_init_topology()
Remove snd_sof_init_topology() as it is never used.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2019-11-27 17:10:06 +02:00
Daniel Baluta 62a6c4c769 ASoC: SOF: topology: Fix unload for SAI/ESAI
Link unload now fails for ESAI/SAI DAIs with:

"error: invalid DAI type 6" because DAI type is not
properly handled.

Fix this by correctly handling cases where type is ESAI or SAI.

Fixes: a4eff5f86c ("ASoC: SOF: imx: Read ESAI parameters and send them to DSP")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 17:09:46 +02:00
Guido Roncarolo 48744b1600 ASoC: SOF: imx: Read SAI parameters and send them to DSP
Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-11-27 17:08:23 +02:00
Daniel Baluta 592b8ba3b6 ASoC: SOF: imx: Read ESAI parameters and send them to DSP
ESAI parameters are read for topology file, packed into
sof_ipc_dai_esai_parms struct and then sent to DSP.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 17:08:23 +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