With rpmsg sound, when the m4 image is not loaded. There is error log
[ 46.257647] imx-cs42888 sound-rpmsg-cs42888: ASoC: CODEC DAI cs42888 not registered
[ 46.265413] imx-cs42888 sound-rpmsg-cs42888: snd_soc_register_card failed (-517)
The issue is that codec is not register, the sound registeration will fail
So add check in probe function for codec dai ready or not.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
ASRC DAPM routes not needed when ASRC node is not specified.
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
The esai and cs42888 can use different mclk, which has different
frequency. But machine driver thought they are same frequency, which
may cause issue in some case.
Base on above conclusion, the codec can support 12.288MHz mclk.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
The rate returned by clk_get_rate in probe function is not correct,
for the power domain in that time may be closed, kernel get 0 rate
from scfw, so move the clk_get_rate to hw_params, in that time, the
power domain should be enabled
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Dynamic constraints for supported sampling rates cannot prevent aplay to
play audio files with higher rates. So we remove the constraints and hard
reject the unsupported samples.
Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
The case is "aplay -Dhw:0,1 -d 5 -r 8000 -f S16_LE -c 9 audio8k16b9c.wav",
which is to playback 9 channel bitstream. But the maximum supported channel
of codec is 8, ALSA didn't return error for this case, but continue to
playback.
The reason is that in FE-BE case, ASLA only get the FE's hw parameter for
constraint list, omit the BE's parameter. This patch is to merge BE's
parameter to FE. in this situation with the 9 channel case, ASLA will
return error "aplay: set_params:1303: Channels count non available"
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit cfe36e2e7f)
For samples with more than 2 and odd number of channels the I2S mode
does not work correctly. In I2S mode we are required to activate an even
number of channels (possibly on multiple datalines) and thus configure
the BCLK for even channels. In this case samples with odd (smaller) number
of channels are played faster and the sound is distorted.
To fix this behavior we can enable TDM mode for the special cases of
samples with 3, 5 or 7 channels. But even TDM has some restrictions that
prevent us from having full support for the special cases:
1. TDM is not supported by codec in master mode so 3, 5 and 7 channels
usage is denied.
2. In codec slave mode TDM works only with 8 slots and slot width of 32
bits. For an often used MCLK frequency of 24MHz and the above restrictions
the maximum sample rate is limited to 48KHz = 24576000/(2*8*32).
The 2 denominator is required by ESAI BCLK divisors.
Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
In imx6ull, the esai errata ERR008000 for imx6q/dl is fixed, so remove the
workaround from imx6ull.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
When load sound card, the pulseaudio will using the sound card to
playback and record. It may be cause a kernel crash when the sound
card is unloaded while the playback/record is active
After setting the sound card owner field, when pulseaudio is running,
the sound card module ref-count will not be 0 and the sound card will
not be unloaded. So you should stop the pulseaudio when you want to
unload the sound card.
Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Revert "MLK-11623 ASoC: imx-cs42888: add 32k and 64k sample rate support"
This reverts commit 314a01f405.
In Async mode, record and playback use different samplerate, one is 32k,
another is 48kHz, there will be issue "unsupported sysclk ratio".
example case is
arecord -Dhw:0,1 -f S16_LE -r 32000 -c 2 | aplay -f S16_LE -r 32000 -c 2
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Report by coverity (CID 18428). The return value need be checked
for snd_soc_dai_set_sysclk().
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
init asrc_np to avoid wild pointer and check return value of
set_fmt(). Reported by Coverity.
Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 4ccc87a93e180e09b6494fd6c6d81b07dc054e9b)
When codec sysclk is 24576000, the sample rate ratio can be 128, 192,
256, 384, 512, 768, 1024. So 32k, 48k, 64k, 96k, 192k can be support.
Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit b436254cd55dc0d2ebb6d2ca7ce5f58520ea5dbc)
If there is no codec device, the machine driver will not register the
card. then alsa will not return RETRY error. update the error handling
for machine driver.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 01ffd8e5e828d20214a196e64b981c9fd94c913e)
cherry-pick below patch from imx_3.14.y
ENGR00330403-1: ASoC: imx-cs42888: port cs42888 machine driver from imx_3.10.y
Port the cs42888 machine driver from imx_3.10.y and do update according to
new esai driver and asrc driver.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 7ed3aac83630a38eb397ed92f815a28e07198748)