summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_spdif.c
AgeCommit message (Collapse)Author
2021-01-28sound: soc: fsl-spdif: Fix runtime PM imbalance on errorOleksandr Suvorov
In case of any error occurs after enabling the PM runtime framework for the fsl-spdif-dai device, the next probing generates the warning: "fsl-spdif-dai 2004000.spdif: Unbalanced pm_runtime_enable!" Add the error handling path to keep the PM runtime usage counter balanced. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2021-01-27mxc_spdif.c: set the validity bit to 'valid'Max Krummenacher
Each spdif sample is qualified by the validity bit. The bit shall be logic '0' if the audio sample is valid. This commit configures the transmitter to always send '0' rather than always send '1'. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry picked from commit 0bef909d061cd800da3f553d24129fc48bf3af01) (cherry picked from commit 6ff91330b3dee51b14cde4442f78a07e87d21d68) (cherry picked from commit 3295861e36076e7bdd72f5c1a60233ef7ead20e6)
2020-05-15MLK-23146-1: ASoC: fsl_spdif: add intermediate RX rates for iMX8MM.Viorel Suman
Add intermediate RX rates for iMX8MM. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-05-08ASoC: fsl_spdif: add support for 88200 and 176400 ratesViorel Suman
Add support for 88200 Hz and 17600 Hz. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-03-23MLK-23651: ASoC: fsl_spdif: Fix hang issue in rebootShengjiu Wang
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: d55d453fdfe1 ("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-18MLK-23618-11: ASoC: fsl_spdif: Don't bind clock with regmapShengjiu Wang
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-18MLK-23618-4: Revert "ASoC: fsl_spdif:Support multi power domains"Shengjiu Wang
This reverts commit bd7b26036e8793d7fb915da6206706e3e6620ffa. 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>
2019-12-02Merge remote-tracking branch 'origin/audio/spdif' into audio/nextDong Aisheng
* 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-11-25LF-106: ASoC: fsl_spdif: request BUS_FREQ_HIGHShengjiu Wang
request BUS_FREQ_HIGH Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25ASoC: fsl_spdif:Support multi power domainsShengjiu Wang
Support multi power domains Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25ASoC: fsl_spdif: Add pm_runtime_enable in probeShengjiu Wang
Add pm_runtime_enable in probe Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25MLK-21484-2: ASoC: fsl_spdif: ensure clk is unprepared before reparentViorel Suman
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-25MLK-19154-5: ASoC: fsl_spdif: refine PLL switch handlingViorel Suman
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-25MLK-19154-3: ASoC: fsl_spdif: Add support for PLL switch at runtime.Viorel Suman
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-25MLK-19154-2: ASoC: fsl_spdif: keep all 7 TxClk sourcesViorel Suman
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-25MLK-19115-2: ASoC: fsl_spdif: add support for enabling raw capture modeViorel Suman
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-25MLK-19115-1: ASoC: fsl_spdif: use snd_ctl_boolean_mono_infoViorel Suman
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-25MLK-18574: ASoC: fsl_spdif: specify the spdif in imx8mmShengjiu Wang
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-25MLK-18574: ASoC: fsl_spdif: support 192kHz for rx in imx8Shengjiu Wang
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-25MLK-17089-4: ASoC: fsl_spdif: support suspend & resume for imx8Shengjiu Wang
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-25MLK-17034-6: ASoC: fsl_spdif: Move clock operation to pm runtime functionShengjiu Wang
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-25MLK-15960-3: ASoC: fsl_spdif: refine pm runtime functionShengjiu Wang
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-25MLK-13947: ASoC: fsl_spdif: introduce SoC specific dataShengjiu Wang
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-25MLK-12722: ASoC: fsl_spdif: clear the validity bit for TXShengjiu Wang
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-25MLK-10903-1: ASoC: fsl_spdif: remove cache only in suspend/resumeShengjiu Wang
In imx6qp, there is no mega fast. After suspend, but before resume, there will be spdif interrupt, if set cache only in suspend, then we can't clear the interrupt, because regmap_write only write to cache. So the system will hang for the interrupt can't be cleared. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> (cherry picked from commit 2a6a522c86d6c0fe80023c4327ca7ce4792035c8)
2019-11-25MLK-11429-1: ASoC: fsl_spdif: don't change the root clock rate of spdif in ↵Shengjiu Wang
driver cherry-pick below patch from imx_3.14.y ENGR00331799-2 ASoC: fsl_spdif: don't change the root clock rate of spdif in driver The spdif root clock may be used by other module or defined with CLK_SET_RATE_GATE, so we can't change the clock rate in driver. In this patch remove the clk_set_rate and clk_round_rate to protect the clock. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> (cherry picked from commit c77170b2c9a9737f6fd61a5ea85a43b90e8ef02b) [ Aisheng: fix incorrectly removing u64 rate_actual ] Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25Revert "ASoC: Remove dev_err() usage after platform_get_irq()"Dong Aisheng
This reverts commit cf9441adb1a35506d7606866c382b9d8614169b5.
2019-08-02ASoC: Remove dev_err() usage after platform_get_irq()Stephen Boyd
We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: alsa-devel@alsa-project.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20190730181557.90391-50-swboyd@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-18ASoC: fsl_spdif: fix sysclk_df typeViorel Suman
According to RM SPDIF STC SYSCLK_DF field is 9-bit wide, values being in 0..511 range. Use a proper type to handle sysclk_df. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-18ASoC: fsl_spdif: don't print EPROBE_DEFER as errorStefan Agner
Probe deferral is to be expected during normal operation, so avoid printing an error when it is encountered. Signed-off-by: Stefan Agner <stefan@agner.ch> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Reviewed-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-05ASoC: fsl_spdif: Use 64-bit arithmetic instead of 32-bitGustavo A. R. Silva
Add suffix ULL to constant 64 in order to give the compiler complete information about the proper arithmetic to use. Notice that such constant is used in a context that expects an expression of type u64 (64 bits, unsigned) and the following expression is currently being evaluated using 32-bit arithmetic: rate[index] * txclk_df * 64 Addresses-Coverity-ID: 1222129 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-03ASoC: fsl_spdif: Switch to SPDX identifierFabio Estevam
Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-04ASoC: fsl_spdif: make const arrays rate staticColin Ian King
Don't populate the const arrays rate on the stack, instead make them static. Makes the object code smaller by 220 bytes: Before: text data bss dec hex filename 24385 9776 128 34289 85f1 sound/soc/fsl/fsl_spdif.o After: text data bss dec hex filename 24005 9936 128 34069 8515 sound/soc/fsl/fsl_spdif.o Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-17ASoC: fsl_spdif: constify snd_soc_dai_ops structureGustavo A. R. Silva
This structure is only stored in the ops field of a snd_soc_dai_driver structure. That field is declared const, so snd_soc_dai_ops structures that have this property can be declared as const also. Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-20ASoC: fsl_spdif: use flat regmap cacheMarek Vasut
Same as commit ce492b3b8f99cf9d2f807ec22d8805c996a09503 Subject: drm/fsl-dcu: use flat regmap cache Using flat regmap cache instead of RB-tree to avoid the following lockdep warning on driver load: WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:2871 lockdep_trace_alloc+0x104/0x128 DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) The RB-tree regmap cache needs to allocate new space on first writes. However, allocations in an atomic context (e.g. when a spinlock is held) are not allowed. The function regmap_write calls map->lock, which acquires a spinlock in the fast_io case. Since the driver uses MMIO, the regmap bus of type regmap_mmio is being used which has fast_io set to true. Signed-off-by: Marek Vasut <marex@denx.de> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-28ASoC: fsl_spdif: fix spelling mistake: "receivce" -> "receive"Colin Ian King
trivial fix to spelling mistake in dev_err message Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-23Merge remote-tracking branches 'asoc/topic/fsl-spdif', 'asoc/topic/img' and ↵Mark Brown
'asoc/topic/intel' into asoc-next
2015-11-25ASoC: fsl_spdif: spba clk is needed by spdif deviceShengjiu Wang
SPDIF need to enable the spba clock, when sdma is using share peripheral script. In this case, there is two spba master port is used, if don't enable the clock, the spba bus will have arbitration issue, which may cause read/write wrong data from/to SPDIF registers. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-16ASoC: fsl_spdif: STL and STR registers are non volatileZidan Wang
STL and STR registers are writable and not readable. So they are non volatile. Remove them from volatile list, and add default register value for them. Signed-off-by: Zidan Wang <zidan.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-05ASoC: fsl_spdif: Add driver suspend and resume to support MEGA FastZidan Wang
For i.MX6 SoloX, there is a mode of the SoC to shutdown all power source of modules during system suspend and resume procedure. Thus, SPDIF needs to save all the values of registers before the system suspend and restore them after the system resume. The SRPC register should be volatile, LOCK bit is set by the hardware. Signed-off-by: Zidan Wang <zidan.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-30Merge remote-tracking branches 'asoc/topic/fsl-spdif', 'asoc/topic/fsl-ssi', ↵Mark Brown
'asoc/topic/gtm601', 'asoc/topic/ics43432' and 'asoc/topic/ids' into asoc-next
2015-08-30Merge remote-tracking branches 'asoc/topic/fsi', 'asoc/topic/fsl', ↵Mark Brown
'asoc/topic/fsl-asrc', 'asoc/topic/fsl-card' and 'asoc/topic/fsl-sai' into asoc-next
2015-08-12ASoC: fsl: fix typos for sound/soc/fsl/*Xiubo Li
There are too much noise about the typos for fsl's drivers. So I fix all the typos here in this patch in almost every file I touched. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-14ASoC: fsl: fsl_spdif: signedness bug in fsl_spdif_startup()Dan Carpenter
We need "i" to be signed or it leads to a forever loop in the error handling. Fixes: fa3be9208dcb ('ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() errorFabio Estevam
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07ASoC: fsl: Add dedicated DMA buffer size for each cpu daiShengjiu Wang
As the ssi is not the only cpu dai, there are esai, spdif, sai. and imx_pcm_dma can be used by all of them. Especially ESAI need a larger DMA buffer size. So Add dedicated DMA buffer for each cpu dai. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Acked-by: Timur Tabi <timur@tabi.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-25ASoC: fsl_spdif: Don't try to round-up for clock divisor calculationNicolin Chen
As commit 6c8ca30eec7b ("ASoC: fsl_ssi: Don't try to round-up for PM divisor calculation") mentioned that there's no more need to use a round up work around to get a better divisor since the clk-divider driver has been refined a lot. So this patch applies the same modification to fsl_spdif driver. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-11ASoC: fsl_spdif: fix struct clk pointer comparingShawn Guo
Since commit 035a61c314eb ("clk: Make clk API return per-user struct clk instances"), clk API users can no longer check if two struct clk pointers are pointing to the same hardware clock, i.e. struct clk_hw, by simply comparing two pointers. That's because with the per-user clk change, a brand new struct clk is created whenever clients try to look up the clock by calling clk_get() or sister functions like clk_get_sys() and of_clk_get(). This changes the original behavior where the struct clk is only created for once when clock driver registers the clock to CCF in the first place. The net change here is before commit 035a61c314eb the struct clk pointer is unique for given hardware clock, while after the commit the pointers returned by clk lookup calls become different for the same hardware clock. That said, the struct clk pointer comparing in the code doesn't work any more. Call helper function clk_is_match() instead to fix the problem. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Michael Turquette <mturquette@linaro.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-02-04Merge remote-tracking branches 'asoc/topic/fsl-spdif', 'asoc/topic/imx', ↵Mark Brown
'asoc/topic/intel', 'asoc/topic/mxs-saif' and 'asoc/topic/nuc900' into asoc-next
2015-01-08ASoC: fsl_spdif: Make error message conciseFabio Estevam
Currently the error message uses 'np->full_name' which leads to a very verbose log that contains the full path of the node. We can have a concise log by using pdev->name instead. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>