summaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl/fsl_spdif.c
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: Remove dev_err() usage after platform_get_irq()Stephen Boyd2019-08-021-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ASoC: fsl_spdif: fix sysclk_df typeViorel Suman2019-02-181-4/+6
| | | | | | | | 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>
* ASoC: fsl_spdif: don't print EPROBE_DEFER as errorStefan Agner2019-01-181-1/+1
| | | | | | | | | | | 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>
* ASoC: fsl_spdif: Use 64-bit arithmetic instead of 32-bitGustavo A. R. Silva2018-07-051-1/+1
| | | | | | | | | | | | | | | | 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>
* ASoC: fsl_spdif: Switch to SPDX identifierFabio Estevam2018-05-031-14/+10
| | | | | | | | 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>
* ASoC: fsl_spdif: make const arrays rate staticColin Ian King2017-09-041-2/+2
| | | | | | | | | | | | | | | | 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>
* ASoC: fsl_spdif: constify snd_soc_dai_ops structureGustavo A. R. Silva2017-07-171-1/+1
| | | | | | | | | 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>
* ASoC: fsl_spdif: use flat regmap cacheMarek Vasut2016-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | 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>
* ASoC: fsl_spdif: fix spelling mistake: "receivce" -> "receive"Colin Ian King2016-06-281-1/+1
| | | | | | | 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>
*-. Merge remote-tracking branches 'asoc/topic/fsl-spdif', 'asoc/topic/img' and ↵Mark Brown2015-12-231-0/+19
|\ \ | | | | | | | | | 'asoc/topic/intel' into asoc-next
| * | ASoC: fsl_spdif: spba clk is needed by spdif deviceShengjiu Wang2015-11-251-0/+19
| |/ | | | | | | | | | | | | | | | | | | | | 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>
* / ASoC: fsl_spdif: STL and STR registers are non volatileZidan Wang2015-11-161-8/+8
|/ | | | | | | | | 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>
* ASoC: fsl_spdif: Add driver suspend and resume to support MEGA FastZidan Wang2015-10-051-0/+73
| | | | | | | | | | | | | 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>
*-. Merge remote-tracking branches 'asoc/topic/fsl-spdif', 'asoc/topic/fsl-ssi', ↵Mark Brown2015-08-301-1/+2
|\ \ | | | | | | | | | 'asoc/topic/gtm601', 'asoc/topic/ics43432' and 'asoc/topic/ids' into asoc-next
| * | ASoC: fsl: fsl_spdif: signedness bug in fsl_spdif_startup()Dan Carpenter2015-07-141-1/+2
| |/ | | | | | | | | | | | | | | | | | | 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>
| |
| \
*-. \ Merge remote-tracking branches 'asoc/topic/fsi', 'asoc/topic/fsl', ↵Mark Brown2015-08-301-7/+15
|\ \ \ | |_|/ |/| | | | | 'asoc/topic/fsl-asrc', 'asoc/topic/fsl-card' and 'asoc/topic/fsl-sai' into asoc-next
| | * ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() errorFabio Estevam2015-07-071-3/+11
| |/ |/| | | | | | | | | | | | | | | 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>
| * ASoC: fsl: fix typos for sound/soc/fsl/*Xiubo Li2015-08-121-3/+3
| | | | | | | | | | | | | | | | 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>
| * ASoC: fsl: Add dedicated DMA buffer size for each cpu daiShengjiu Wang2015-07-071-1/+1
|/ | | | | | | | | | | | 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>
* ASoC: fsl_spdif: Don't try to round-up for clock divisor calculationNicolin Chen2015-05-251-6/+4
| | | | | | | | | | | | 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>
* ASoC: fsl_spdif: fix struct clk pointer comparingShawn Guo2015-03-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
*-. Merge remote-tracking branches 'asoc/topic/fsl-spdif', 'asoc/topic/imx', ↵Mark Brown2015-02-041-12/+3
|\ \ | | | | | | | | | 'asoc/topic/intel', 'asoc/topic/mxs-saif' and 'asoc/topic/nuc900' into asoc-next
| * | ASoC: fsl_spdif: Use dev_name() for registering the irqFabio Estevam2014-12-301-12/+3
| |/ | | | | | | | | | | | | | | | | | | | | The 'name' array is currently stored inside the fsl_spdif_priv private structure only for registering the interrupt name. This can be simplified by registering it with dev_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>
* / ASoC: fsl_spdif: Make error message conciseFabio Estevam2015-01-081-1/+1
|/ | | | | | | | | | | 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>
* ASoC: fsl: drop owner assignment from platform_driversWolfram Sang2014-10-201-1/+0
| | | | | | | A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
*-. Merge remote-tracking branches 'asoc/topic/simple', 'asoc/topic/sirf', ↵Mark Brown2014-10-061-1/+0
|\ \ | | | | | | | | | 'asoc/topic/spdif', 'asoc/topic/ssm2602' and 'asoc/topic/ssm4567' into asoc-next
| | * ASoC: fsl_spdif: Remove unused includes of linux/clk-private.hTomeu Vizoso2014-10-031-1/+0
| |/ | | | | | | | | Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* / ASoC: fsl-spdif: Convert to use regmap framework's endianness method.Xiubo Li2014-08-271-4/+1
|/ | | | | Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
*---. Merge remote-tracking branches 'asoc/topic/fsl', 'asoc/topic/fsl-asrc', ↵Mark Brown2014-08-041-40/+48
|\ \ \ | | | | | | | | | | | | 'asoc/topic/fsl-spdif' and 'asoc/topic/imx-audmux' into asoc-next
| | | * ASoC: fsl_spdif: Add support for output sample rates 96kHz and 192kHzAnssi Hannula2014-06-171-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the output sample rates 96kHz and 192kHz. Tested with a Cubox-i imx6 system and an Onkyo TX-SR607 receiver. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | * ASoC: fsl_spdif: Improve coding styleNicolin Chen2014-06-171-37/+35
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | 1) Apply better indentations 2) Drop braces for single statement. 3) Use simpler ternary to reduce code. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * / ASoC: fsl_spdif: Add stream names for DPCM usageNicolin Chen2014-07-311-0/+2
| |/ | | | | | | | | | | | | | | | | | | DPCM needs extra dapm routes in the machine driver to route audio between Front-End and Back-End. In order to differ the stream names in the route map from CODECs, we here add specific stream names to SPDIF driver so that we can implement ASRC via DPCM to it. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | ASoC: fsl_spdif: Fix integer overflow when calculating divisorsAnssi Hannula2014-06-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The calculation code does u64 = (u32 - u32) * 100000; The 64 bits are of no help here as the type is casted only after the multiplication, and therefore the result may overflow, possibly causing inoptimal or wrong clock setup in an unfortunate case (the maximum result value of the first substraction is currently 47999). Fix the code to cast before multiplication. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi> Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | ASoC: fsl_spdif: Fix incorrect usage of regmap_read()Nicolin Chen2014-06-091-1/+1
|/ | | | | | | | | We should not copy the return value into this val since it's supposed to get the value of the register not the success result of regmap_read(). Thus fix it. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
*-. Merge remote-tracking branches 'asoc/topic/devm', 'asoc/topic/fsl', ↵Mark Brown2014-05-221-50/+136
|\ \ | | | | | | | | | 'asoc/topic/fsl-esai', 'asoc/topic/fsl-sai', 'asoc/topic/fsl-spdif' and 'asoc/topic/fsl-ssi' into asoc-next
| | * ASoc: fsl_spdif: Add descriptions for fsl_spdif_privNicolin Chen2014-05-051-0/+21
| | | | | | | | | | | | | | | | | | | | | Other people would clearly understand each member and improve if they want. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * ASoC: fsl_spdif: Print actual sample rate for debugNicolin Chen2014-05-051-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | People would simply know what the driver gets the best for the current sample rate playback. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * ASoC: fsl_spdif: Add sysclk df support to derive txclk from sysclkNicolin Chen2014-05-051-30/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sysclk is one the clock sources that could be selected to derive tx clock. But the route for sysclk is a bit different that it does not only contain txclk df divider but also have an extra sysclk df. So this patch mainly adds syclk df configuration support so as to let the driver be able to get clock from sysclk. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * ASoC: fsl_spdif: Rename all _div to _dfNicolin Chen2014-05-051-21/+20
| | | | | | | | | | | | | | | | | | | | | | | | We should have used _df by following the reference manual at the beginning. So this patch just renames them. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * ASoC: fsl_spdif: Use clk_set_rate() for spdif root clock onlyNicolin Chen2014-05-051-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clock mux for the Freescale S/PDIF controller has eight clock sources while most of them are from other moudles and even system clocks that do not allow a rate-changing operation. So we here only allow the clk_set_rate() and clk_round_rate() happened to spdif root clock, the private clock for S/PDIF controller. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * ASoC: fsl_spdif: Fix clock source for rxclk rate measurementNicolin Chen2014-04-291-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | The rxclk rate actually uses sysclk, ipg clock for example, as its reference clock to calculate it. But the driver currently doesn't pass a correct clock source. So fix it. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * ASoC: fsl_spdif: Add core clock control for DMA accessNicolin Chen2014-04-241-1/+21
| |/ |/| | | | | | | | | | | | | | | | | Regmap is able to enable/disable the core clock automatically each time it's going to access the registers. But for DMA cases during playback or recording, it's totally beyong control of regmap. So we have to open the clock manually. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * ASoC: spdif: Add VF610+ compatibles support.Xiubo Li2014-04-141-0/+1
| | | | | | | | | | | | Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * ASoC: spdif: Sort the header files alphabetically.Xiubo Li2014-04-141-4/+4
|/ | | | | | Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
*-. Merge remote-tracking branches 'asoc/topic/da7213', 'asoc/topic/da732x', ↵Mark Brown2014-03-121-3/+6
|\ \ | | | | | | | | | 'asoc/topic/da9055', 'asoc/topic/davinci', 'asoc/topic/fsl', 'asoc/topic/fsl-esai', 'asoc/topic/fsl-sai' and 'asoc/topic/fsl-spdif' into asoc-next
| | * ASoC: fsl-spdif: big-endian supportXiubo Li2014-02-121-1/+4
| |/ |/| | | | | | | | | | | | | | | | | For most platforms, the CPU and SPDIF device is in the same endianess mode. While for the LS1 platform, the CPU is in LE mode and the SPDIF is in BE mode. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * ASoC: fsl: use snd_soc_dai_init_dma_data()Xiubo Li2014-02-031-2/+2
|/ | | | | | Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: fsl: Use devm_snd_dmaengine_pcm_register()Lars-Peter Clausen2013-12-021-8/+0
| | | | | | | Makes the code shorter. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
* Merge remote-tracking branch 'asoc/topic/fsl' into asoc-nextMark Brown2013-11-081-7/+2
|\
| * ASoC: fsl: fsl_spdif: No need to check the return value of ↵Fabio Estevam2013-11-041-5/+0
| | | | | | | | | | | | | | | | | | | | platform_get_resource() When using devm_ioremap_resource(), we do not need to check the return value of platform_get_resource(), so just remove it. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>