summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/imx-cs42888.c
AgeCommit message (Collapse)Author
2020-11-11LF-2721: ASoC: imx-cs42888: Get card name from model propertyShengjiu Wang
Get card name from model property, which is to align the name with Linux Fractory. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-09-01MLK-24612-5: ASoC: imx-cs42888: Add missed codec nodeShengjiu Wang
When there is no asrc node, there will be below error: imx-cs42888 sound-cs42888: ASoC: Neither/both codec name/of_node are set for HiFi-ASRC-BE Add codec node to fix this issue Fixes: 44dec4241b61 ("MLK-24612-3: ASoC: imx-cs42888: Support two client device") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Peng Zhang <peng.zhang_8@nxp.com>
2020-08-31MLK-24612-3: ASoC: imx-cs42888: Support two client deviceShengjiu Wang
Support two client device, each client is 2 channel 48000Hz, 16bits. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Peng Zhang <peng.zhang_8@nxp.com>
2020-06-10MLK-24290-1 ASoC: imx-cs42888: change dev_err for dev_dbg for -EPROBE_DEFER casePeter Chen
For the -EPROBE_DEFER case, it is not real error, and just resource is not ready. It needs to use debug message instead of error message for it. It could avoid unexpected console message for every device's probe, eg SD/USB devices plug in, suspend/resume process, etc. SD device plug in: mmc1: new high speed SDHC card at address aaaa mmcblk1: mmc1:aaaa SA16G 14.8 GiB imx-cs42888 sound-cs42888: failed to find codec platform device USB device plug in: usb 2-1: USB disconnect, device number 2 usb 3-1: new SuperSpeed Gen 1 USB device number 2 using cdns-usb3 usb-storage 3-1:1.0: USB Mass Storage device detected scsi host0: usb-storage 3-1:1.0 imx-cs42888 sound-cs42888: failed to find codec platform device scsi 0:0:0:0: Direct-Access SanDisk Ultra 1.00 PQ: 0 ANSI: 6 sd 0:0:0:0: [sda] 60062500 512-byte logical blocks: (30.8 GB/28.6 GiB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA sda: sda1 sd 0:0:0:0: [sda] Attached SCSI removable disk imx-cs42888 sound-cs42888: failed to find codec platform device Suspend/resume process: OOM killer disabled. Freezing remaining freezable tasks ... (elapsed 0.083 seconds) done. printk: Suspending console(s) (use no_console_suspend to debug) fec 5b040000.ethernet eth0: Link is Down PM: suspend devices took 0.684 seconds Disabling non-boot CPUs ... CPU1: shutdown psci: CPU1 killed (polled 4 ms) CPU2: shutdown psci: CPU2 killed (polled 0 ms) CPU3: shutdown psci: CPU3 killed (polled 0 ms) Enabling non-boot CPUs ... Detected VIPT I-cache on CPU1 GICv3: CPU1: found redistributor 1 region 0:0x0000000051b20000 CPU1: Booted secondary processor 0x0000000001 [0x410fd042] CPU1 is up Detected VIPT I-cache on CPU2 GICv3: CPU2: found redistributor 2 region 0:0x0000000051b40000 CPU2: Booted secondary processor 0x0000000002 [0x410fd042] CPU2 is up Detected VIPT I-cache on CPU3 GICv3: CPU3: found redistributor 3 region 0:0x0000000051b60000 CPU3: Booted secondary processor 0x0000000003 [0x410fd042] CPU3 is up imx-cs42888 sound-cs42888: failed to find codec platform device PM: resume devices took 0.240 seconds OOM killer enabled. Restarting tasks ... Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25MLK-21440-4: ASoC: imx-cs42888: remove snd_soc_find_daiShengjiu Wang
Previously we add snd_soc_find_dai to check if the codec is probed or not, but this bring kernel dump issue when CONFIG_LOCKDEP=y. [ 2.823379] WARNING: CPU: 2 PID: 1 at sound/soc/soc-core.c:1016 snd_soc_find_dai+0x144/0x150 [ 2.831827] Modules linked in: [ 2.834907] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.14.78-00007-g524e1b1f0b3f #18 [ 2.842748] Hardware name: FSL i.MX8MM EVK board (DT) [ 2.847811] task: ffff8000624f0000 task.stack: ffff000008078000 [ 2.853745] PC is at snd_soc_find_dai+0x144/0x150 [ 2.858462] LR is at snd_soc_find_dai+0x140/0x150 ... [ 3.469675] Call trace: [ 3.472135] Exception stack(0xffff00000807ba40 to 0xffff00000807bb80) [ 3.478590] ba40: 0000000000000000 00000000ffffffff 0000000000000000 0000000000000002 [ 3.4864333.596564] [<ffff00000883f2a8>] bus_add_driver+0x110/0x230 [ 3.602149] [<ffff0000088412e8>] driver_register+0x68/0x100 [ 3.607735] [<ffff0000088426dc>] __platform_driver_register+0x54/0x60 [ 3.614191] [<ffff0000097e4cc8>] imx_rpmsg_driver_init+0x20/0x28 [ 3.620213] [<ffff0000080844c4>] do_one_initcall+0x44/0x130 [ 3.625801] [<ffff000009760ef8>] kernel_init_freeable+0x1e0/0x280 [ 3.631909] [<ffff00000908c3f8>] kernel_init+0x18/0x110 [ 3.637148] [<ffff000008085a4c>] ret_from_fork+0x10/0x1c So we could't resolve the warning "snd_soc_register_card failed (-517)". Fixes: 2bf5f9704785 ("MLK-19854-1: ASoC: imx-cs42888: fix error when m4 image is not loaded") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> (cherry picked from commit 58ffdf239288cfa6904640fc8432c182cf56589b) (cherry picked from commit d1222a0e5f93d2a5d3b3b69699f79f2c62ce1d7c)
2019-11-25MLK-21985-4 ASoC: imx-cs42888: fix build for next 20190607 upgradeDong Aisheng
API change due to: adb76b5b9c47 ("ASoC: soc-core: remove legacy style dai_link") Caused below error: ../sound/soc/fsl/imx-cs42888.c:272:3: error: unknown field ‘codec_dai_name’ specified in initializer .codec_dai_name = "cs42888", ^ ../sound/soc/fsl/imx-cs42888.c:272:3: warning: initialization from incompatible pointer type ../sound/soc/fsl/imx-cs42888.c:272:3: warning: (near initialization for ‘imx_cs42888_dai[0].cpus’) ../sound/soc/fsl/imx-cs42888.c:279:3: error: unknown field ‘codec_name’ specified in initializer .codec_name = "snd-soc-dummy", ^ ../sound/soc/fsl/imx-cs42888.c:279:3: warning: initialization from incompatible pointer type ../sound/soc/fsl/imx-cs42888.c:279:3: warning: (near initialization for ‘imx_cs42888_dai[1].cpus’) ../sound/soc/fsl/imx-cs42888.c:280:3: error: unknown field ‘codec_dai_name’ specified in initializer .codec_dai_name = "snd-soc-dummy-dai", ^ ../sound/soc/fsl/imx-cs42888.c:280:3: warning: initialization makes integer from pointer without a cast ../sound/soc/fsl/imx-cs42888.c:280:3: warning: (near initialization for ‘imx_cs42888_dai[1].num_cpus’) ../sound/soc/fsl/imx-cs42888.c:280:3: error: initializer element is not computable at load time ../sound/soc/fsl/imx-cs42888.c:280:3: error: (near initialization for ‘imx_cs42888_dai[1].num_cpus’) ../sound/soc/fsl/imx-cs42888.c:290:3: error: unknown field ‘codec_dai_name’ specified in initializer .codec_dai_name = "cs42888", ^ ../sound/soc/fsl/imx-cs42888.c:290:3: warning: initialization from incompatible pointer type ../sound/soc/fsl/imx-cs42888.c:290:3: warning: (near initialization for ‘imx_cs42888_dai[2].cpus’) ../sound/soc/fsl/imx-cs42888.c:291:3: error: unknown field ‘platform_name’ specified in initializer .platform_name = "snd-soc-dummy", Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25ASoC: imx-cs42888: Use -EPROBE_DEFER instead of -EINVALShengjiu Wang
Use -EPROBE_DEFER instead of -EINVAL for the resource is not ready in time Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25MLK-20428-2: ASoC: imx-cs42xx8: The FMT should be same for tx and rxShengjiu Wang
If the FMT of tx and rx is different, there will be issue. for example tx is working at TDM mode, but rx want to work at I2S mode, this case is not supported in current ALSA driver, the best way to support this is to distinguish substream in set_fmt function. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25MLK-19854-1: ASoC: imx-cs42888: fix error when m4 image is not loadedShengjiu Wang
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>
2019-11-25MLK-19168-5: ASoC: imx-cs42888: support codec through rpmsg (part 1)Shengjiu Wang
support codec through rpmsg Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> (cherry picked from commit 8585d67e54c4c3607990a792718992de8be8fe58) [ Aisheng: split rpmsg Kconfig changes ] Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25MLK-16742-4: ASoC: imx-cs42888: fix DAPM routesViorel Suman
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>
2019-11-25MLK-16563-2: ASoC: imx-cs42888: support 12.288MHz mclk of codecShengjiu Wang
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>
2019-11-25MLK-16350-3: ASoC: imx-cs42888: fix clock rate issueShengjiu Wang
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>
2019-11-25MLK-15053: ASoC: fsl: imx-cs42888: Reject unsupported sampling ratesMihai Serban
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>
2019-11-25MLK-15043-2: ASoC: imx-cs42888: fix noise issue with FE-BE caseShengjiu Wang
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 cfe36e2e7fce578eeac9a36eac04db2584e6e92e)
2019-11-25MLK-14778: ASoC: fsl: imx-cs42888: Improve support for odd number of channelsMihai Serban
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>
2019-11-25MLK-12745-2: ASoC: fsl_esai: remove the channel swap workaround for imx6ull ↵Dong Aisheng
(part 2) 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> [ Aisheng: split ESAI DAI changes ] Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25MLK-12745-1: ASoC: imx-cs42888: add codec master mode supportShengjiu Wang
Add codec master mode support, the default is slave mode. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25MLK-12244 ASoC: fsl: Set the sound card owner fieldZidan Wang
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> [ Aisheng: hdmi change merged into hdmi branch ] Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25MLK-12165: ASoC: fsl: imx-cs42888: remove 32k and 64k supportShengjiu Wang
Revert "MLK-11623 ASoC: imx-cs42888: add 32k and 64k sample rate support" This reverts commit 314a01f40599134086480ef3c5e89a54aeedbf1f. 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>
2019-11-25MLK-12043: ASoC: fsl: imx-cs42888: Add return value checkShengjiu Wang
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>
2019-11-25MLK-11915-04 ASoC: imx-cs42888: init asrc_np to avoid wild pointer and check ↵Zidan Wang
return value of set_fmt() 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)
2019-11-25MLK-11623 ASoC: imx-cs42888: add 32k and 64k sample rate supportZidan Wang
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)
2019-11-25MLK-10055-1: ASoC: imx-cs42888: when codec probe failed, alsa return RETRY ↵Shengjiu Wang
error. 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)
2019-11-25MLK-11429-21: ASoC: imx-cs42888: port cs42888 machine driver from imx_3.10.yShengjiu Wang
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)