summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_xcvr.c
AgeCommit message (Collapse)AuthorFilesLines
2024-07-03ASoC: fsl_xcvr: Improve suspend/resume flow in fsl_xcvr_trigger()Chancel Liu1-20/+23
In the current flow all interrupts are disabled in runtime suspend phase. However interrupts enablement only exists in fsl_xcvr_prepare(). After resume fsl_xcvr_prepare() may not be called so it will cause all interrupts still disabled even if resume from suspend. Interrupts should be explictily enabled after resume. Also, DPATH reset setting only exists in fsl_xcvr_prepare(). After resume from suspend DPATH should be reset otherwise there'll be channel swap issue. Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Link: https://patch.msgid.link/20240628094354.780720-1-chancel.liu@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-06-03ASoC: fsl_xcvr: Add support for i.MX95 platformShengjiu Wang1-43/+85
On i.MX95, the XCVR uses a new PLL in the PHY, which is General Purpose (GP) PLL. Add GP PLL configuration support in the driver and add the 'pll_ver' flag to distinguish different PLL on different platforms. The XCVR also use PHY but limited for SPDIF only case Add 'use_phy' flag to distinguish these platforms. When there are 'pll8k' and 'pll11k' clock existing, the clock source of 'phy_clk' can be changed for different sample rate requirement. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Chancel Liu <chancel.liu@nxp.com> Link: https://msgid.link/r/1716972002-2315-3-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-27ASoC: fsl: fsl_xcvr: Switch to RUNTIME_PM_OPS()Fabio Estevam1-6/+4
Replace SET_RUNTIME_PM_OPS() with its modern alternative RUNTIME_PM_OPS(). The combined usage of pm_ptr() and RUNTIME_PM_OPS() allows the compiler to evaluate if the runtime suspend/resume() functions are used at build time or are simply dead code. This allows removing the __maybe_unused notation from the runtime suspend/resume() functions. Signed-off-by: Fabio Estevam <festevam@denx.de> Link: https://msgid.link/r/20240507173735.3456334-3-festevam@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-23ASoC: soc-card: Fix missing locking in snd_soc_card_get_kcontrol()Richard Fitzgerald1-1/+11
snd_soc_card_get_kcontrol() must be holding a read lock on card->controls_rwsem while walking the controls list. Compare with snd_ctl_find_numid(). The existing function is renamed snd_soc_card_get_kcontrol_locked() so that it can be called from contexts that are already holding card->controls_rwsem (for example, control get/put functions). There are few direct or indirect callers of snd_soc_card_get_kcontrol(), and most are safe. Three require changes, which have been included in this patch: codecs/cs35l45.c: cs35l45_activate_ctl() is called from a control put() function so is changed to call snd_soc_card_get_kcontrol_locked(). codecs/cs35l56.c: cs35l56_sync_asp1_mixer_widgets_with_firmware() is called from control get()/put() functions so is changed to call snd_soc_card_get_kcontrol_locked(). fsl/fsl_xcvr.c: fsl_xcvr_activate_ctl() is called from three places, one of which already holds card->controls_rwsem: 1. fsl_xcvr_mode_put(), a control put function, which will already be holding card->controls_rwsem. 2. fsl_xcvr_startup(), a DAI startup function. 3. fsl_xcvr_shutdown(), a DAI shutdown function. To fix this, fsl_xcvr_activate_ctl() has been changed to call snd_soc_card_get_kcontrol_locked() so that it is safe to call directly from fsl_xcvr_mode_put(). The fsl_xcvr_startup() and fsl_xcvr_shutdown() functions have been changed to take a read lock on card->controls_rsem() around calls to fsl_xcvr_activate_ctl(). While this is not very elegant, it keeps the change small, to avoid this patch creating a large collateral churn in fsl/fsl_xcvr.c. Analysis of other callers of snd_soc_card_get_kcontrol() is that they do not need any changes, they are not holding card->controls_rwsem when they call snd_soc_card_get_kcontrol(). Direct callers of snd_soc_card_get_kcontrol(): fsl/fsl_spdif.c: fsl_spdif_dai_probe() - DAI probe function fsl/fsl_micfil.c: voice_detected_fn() - IRQ handler Indirect callers via soc_component_notify_control(): codecs/cs42l43: cs42l43_mic_shutter() - IRQ handler codecs/cs42l43: cs42l43_spk_shutter() - IRQ handler codecs/ak4118.c: ak4118_irq_handler() - IRQ handler codecs/wm_adsp.c: wm_adsp_write_ctl() - not currently used Indirect callers via snd_soc_limit_volume(): qcom/sc8280xp.c: sc8280xp_snd_init() - DAIlink init function ti/rx51.c: rx51_aic34_init() - DAI init function I don't have hardware to test the fsl/*, qcom/sc828xp.c, ti/rx51.c and ak4118.c changes. Backport note: The fsl/, qcom/, cs35l45, cs35l56 and cs42l43 callers were added since the Fixes commit so won't all be present on older kernels. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Fixes: 209c6cdfd283 ("ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card") Link: https://lore.kernel.org/r/20240221123710.690224-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-23ASoC: fsl_xcvr: refine the requested phy clock frequencyShengjiu Wang1-2/+2
As the input phy clock frequency will divided by 2 by default on i.MX8MP with the implementation of clk-imx8mp-audiomix driver, So the requested frequency need to be updated. The relation of phy clock is: sai_pll_ref_sel sai_pll sai_pll_bypass sai_pll_out sai_pll_out_div2 earc_phy_cg Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com> Link: https://lore.kernel.org/r/1700702093-8008-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-22ASoC: fsl_xcvr: Enable 2 * TX bit clock for spdif only caseShengjiu Wang1-0/+10
The bit 10 in TX_DPTH_CTRL register controls the TX clock rate. If this bit is set, TX datapath clock should be = 2* TX bit rate. If this bit is not set, TX datapath clock should be 10* TX bit rate. As the spdif only case, we always use 2 * TX bit clock, so this bit need to be set. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://lore.kernel.org/r/1700617373-6472-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-14ASoC: fsl: merge DAI call back functions into opsKuninori Morimoto1-8/+8
ALSA SoC merges DAI call backs into .ops. This patch merge these into one. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87jzu5b0ue.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-20ASoC: fsl: fsl_xcvr: Convert to platform remove callback returning voidUwe Kleine-König1-3/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Takashi Iwai <tiwai@suse.de> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Link: https://lore.kernel.org/r/20230315150745.67084-76-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-09ASoC: fsl_xcvr: Add constraints of period size while using eDMAChancel Liu1-0/+12
eDMA on i.MX93 platform requires the period size to be multiple of maxburst. Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Link: https://lore.kernel.org/r/20230104023953.2973362-4-chancel.liu@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-09ASoC: fsl_xcvr: Add support for i.MX93 platformChancel Liu1-48/+95
Add compatible string and specific soc data to support XCVR on i.MX93 platform. XCVR IP on i.MX93 is cut to SPDIF only by removing external PHY. Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Link: https://lore.kernel.org/r/20230104023953.2973362-3-chancel.liu@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-28ASoC: fsl_xcvr: Add Counter registersShengjiu Wang1-0/+40
These counter registers are part of register list, add them to complete the register map - DMAC counter control registers - Data path Timestamp counter register - Data path bit counter register - Data path bit count timestamp register - Data path bit read timestamp register Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://lore.kernel.org/r/1666940627-7611-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-27ASoC: fsl: Migrate to new style legacy DAI naming flagCharles Keepax1-1/+2
Change the legacy DAI naming flag from opting in to the new scheme (non_legacy_dai_naming), to opting out of it (legacy_dai_naming). These drivers appear to be on the CPU side of the DAI link and currently uses the legacy naming, so add the new flag. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220623125250.2355471-21-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06ASoC: fsl_xcvr:Fix unbalanced pm_runtime_enable in fsl_xcvr_probezhangqilong1-0/+9
a) Add missing pm_runtime_disable() when probe error out. It could avoid pm_runtime implementation complains when removing and probing again the driver. b) Add remove for missing pm_runtime_disable(). Fix:c590fa80b3928 ("ASoC: fsl_xcvr: register platform component before registering cpu dai") Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Link: https://lore.kernel.org/r/20220602072024.33236-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-21ASoC: fsl_xcvr: Fix channel swap issue with ARCShengjiu Wang1-5/+12
With pause and resume test for ARC, there is occasionally channel swap issue. The reason is that currently driver set the DPATH out of reset first, then start the DMA, the first data got from FIFO may not be the Left channel. Moving DPATH out of reset operation after the dma enablement to fix this issue. Fixes: 28564486866f ("ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://lore.kernel.org/r/1631265510-27384-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-10ASoC: fsl_xcvr: register platform component before registering cpu daiShengjiu Wang1-5/+10
There is no defer probe when adding platform component to snd_soc_pcm_runtime(rtd), the code is in snd_soc_add_pcm_runtime() snd_soc_register_card() -> snd_soc_bind_card() -> snd_soc_add_pcm_runtime() -> adding cpu dai -> adding codec dai -> adding platform component. So if the platform component is not ready at that time, then the sound card still registered successfully, but platform component is empty, the sound card can't be used. As there is defer probe checking for cpu dai component, then register platform component before cpu dai to avoid such issue. Fixes: 28564486866f ("ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://lore.kernel.org/r/1630665006-31437-6-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-12ASoC: fsl_xcvr: Omit superfluous error message in fsl_xcvr_probe()Tang Bin1-3/+1
In the function fsl_xcvr__probe(), when get irq failed, the function platform_get_irq() logs an error message, so remove redundant message here. Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com> Link: https://lore.kernel.org/r/20210624104505.13680-1-tangbin@cmss.chinamobile.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-21Merge series "ASoC: fsl: Use devm_platform_get_and_ioremap_resource()" from ↵Mark Brown1-0/+4
Yang Yingliang <yangyingliang@huawei.com>: patch #1 ~ #8: Use devm_platform_get_and_ioremap_resource() patch #9 check return value of platform_get_resource_byname() v2: change error message in patch #9 Yang Yingliang (9): ASoC: fsl_asrc: Use devm_platform_get_and_ioremap_resource() ASoC: fsl_aud2htx: Use devm_platform_get_and_ioremap_resource() ASoC: fsl_easrc: Use devm_platform_get_and_ioremap_resource() ASoC: fsl_esai: Use devm_platform_get_and_ioremap_resource() ASoC: fsl_micfil: Use devm_platform_get_and_ioremap_resource() ASoC: fsl_sai: Use devm_platform_get_and_ioremap_resource() ASoC: fsl_spdif: Use devm_platform_get_and_ioremap_resource() ASoC: fsl_ssi: Use devm_platform_get_and_ioremap_resource() ASoC: fsl_xcvr: check return value after calling platform_get_resource_byname() sound/soc/fsl/fsl_asrc.c | 3 +-- sound/soc/fsl/fsl_aud2htx.c | 3 +-- sound/soc/fsl/fsl_easrc.c | 3 +-- sound/soc/fsl/fsl_esai.c | 3 +-- sound/soc/fsl/fsl_micfil.c | 3 +-- sound/soc/fsl/fsl_sai.c | 3 +-- sound/soc/fsl/fsl_spdif.c | 3 +-- sound/soc/fsl/fsl_ssi.c | 3 +-- sound/soc/fsl/fsl_xcvr.c | 4 ++++ 9 files changed, 12 insertions(+), 16 deletions(-) -- 2.25.1
2021-06-21ASoC: fsl_xcvr: disable all interrupts when suspend happensShengjiu Wang1-0/+10
There is an unhandled interrupt after suspend, which cause endless interrupt when system resume, so system may hang. Disable all interrupts in runtime suspend callback to avoid above issue. Fixes: 28564486866f ("ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Fabio Estevam <festevam@gmail.com> Link: https://lore.kernel.org/r/1624019913-3380-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-21ASoC: fsl_xcvr: check return value after calling platform_get_resource_byname()Yang Yingliang1-0/+4
It will cause null-ptr-deref if platform_get_resource_byname() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20210615013922.784296-10-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-10ASoC: fsl_xcvr: Remove unneeded semicolonWan Jiabing1-1/+1
Fix the following coccicheck warning: ./sound/soc/fsl/fsl_xcvr.c:739:2-3: Unneeded semicolon Signed-off-by: Wan Jiabing <wanjiabing@vivo.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Link: https://lore.kernel.org/r/20210506022452.5762-1-wanjiabing@vivo.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: fsl_xcvr: Use devm_platform_ioremap_resource_byname() to simplify codeTang Bin1-5/+3
In this function, devm_platform_ioremap_resource_byname() should be suitable to simplify code. Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com> Link: https://lore.kernel.org/r/20210302125002.23900-1-tangbin@cmss.chinamobile.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10Merge series "drop unneeded snd_soc_dai_set_drvdata" from Julia Lawall ↵Mark Brown1-1/+0
<Julia.Lawall@inria.fr>: snd_soc_dai_set_drvdata is not needed when the set data comes from snd_soc_dai_get_drvdata or dev_get_drvdata. --- sound/soc/fsl/fsl_micfil.c | 2 -- sound/soc/fsl/fsl_sai.c | 2 -- sound/soc/fsl/fsl_xcvr.c | 1 - sound/soc/mxs/mxs-saif.c | 10 ---------- sound/soc/pxa/mmp-sspa.c | 1 - sound/soc/sunxi/sun4i-i2s.c | 2 -- 6 files changed, 18 deletions(-)
2021-03-10ASoC: fsl_xcvr: move reset assert into runtime_resumeViorel Suman1-4/+6
Move reset assert into runtime_resume since we cannot rely on reset assert state when the device is put out from suspend. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://lore.kernel.org/r/1613984990-5534-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: fsl: drop unneeded snd_soc_dai_set_drvdataJulia Lawall1-1/+0
snd_soc_dai_set_drvdata is not needed when the set data comes from snd_soc_dai_get_drvdata or dev_get_drvdata. The problem was fixed usingthe following semantic patch: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x,y,e; @@ x = dev_get_drvdata(y->dev) ... when != x = e - snd_soc_dai_set_drvdata(y,x); @@ expression x,y,e; @@ x = snd_soc_dai_get_drvdata(y) ... when != x = e - snd_soc_dai_set_drvdata(y,x); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Link: https://lore.kernel.org/r/20210213101907.1318496-5-Julia.Lawall@inria.fr Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-08ASoC: fsl: constify static snd_soc_dai_ops structsRikard Falkeborn1-1/+1
The only usage of these is to assign their address to the 'ops' field in the snd_soc_dai_driver struct, which is a pointer to const. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Link: https://lore.kernel.org/r/20210206225849.51071-1-rikard.falkeborn@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20ASoC: fsl_xcvr: Remove unused of_id variableFabio Estevam1-5/+0
The of_id variable is not used, so just remove it. Signed-off-by: Fabio Estevam <festevam@gmail.com> Link: https://lore.kernel.org/r/20210118123815.1630882-3-festevam@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-25ASoC: fsl_xcvr: fix potential resource leakViorel Suman1-0/+1
"fw" variable must be relased before return. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Link: https://lore.kernel.org/r/20201124141957.20481-1-viorel.suman@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-10ASoC: fsl_xcvr: fix break conditionViorel Suman1-1/+1
The break condition copied by mistake as same as loop condition in the previous version, but must be the opposite. So fix it. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Link: https://lore.kernel.org/r/20201102161810.902464-1-viorel.suman@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-26ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driverViorel Suman1-0/+1359
XCVR (Audio Transceiver) is a on-chip functional module found on i.MX8MP. It support HDMI2.1 eARC, HDMI1.4 ARC and SPDIF. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Link: https://lore.kernel.org/r/20201013121733.83684-2-viorel.suman@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>