aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-08-18ASoC: fsl-asoc-card: Fix build warning for maybe-uninitializedShengjiu Wang1-4/+5
When build fsl-asoc-card as module, there is following error: sound/soc/fsl/fsl-asoc-card.c: In function 'fsl_asoc_card_probe': >> sound/soc/fsl/fsl-asoc-card.c:547:13: warning: 'asrc_np' may be used uninitialized in this function [-Wmaybe-uninitialized] of_node_put(asrc_np); ^ vim +/asrc_np +547 sound/soc/fsl/fsl-asoc-card.c 531 if (width == 24) 532 priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE; 533 else 534 priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE; 535 } 536 537 /* Finish card registering */ 538 platform_set_drvdata(pdev, priv); 539 snd_soc_card_set_drvdata(&priv->card, priv); 540 541 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card); 542 if (ret) 543 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); 544 545 fail: 546 of_node_put(codec_np); > 547 of_node_put(asrc_np); 548 of_node_put(cpu_np); 549 550 return ret; 551 } 552 553 static const struct of_device_id fsl_asoc_card_dt_ids[] = { 554 { .compatible = "fsl,imx-audio-cs42888", }, 555 { .compatible = "fsl,imx-audio-sgtl5000", }, Add 'asrc_fail' branch for error jump after asrc_np initialized. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-16ASoC: fsl_sai: Set SYNC bit of TCR2 to Asynchronous ModeNicolin Chen1-2/+1
There is one design rule according to SAI's reference manual: If the transmitter bit clock and frame sync are to be used by both transmitter and receiver, the transmitter must be configured for asynchronous operation and the receiver for synchronous operation. And SYNC of TCR2 is a 2-width control bit: 00 Asynchronous mode. 01 Synchronous with receiver. 10 Synchronous with another SAI transmitter. 11 Synchronous with another SAI receiver. So the driver should have set SYNC bit of TCR2 to 0x0, and meanwhile set SYNC bit of RCR2 to 0x1 (Synchronous with transmitter). Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-16Merge branch 'fix/fsl-esai' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-fsl-esaiMark Brown2-3/+0
2014-08-16ASoC: fsl: add imx-es8328 machine driverSean Cross3-0/+248
This adds an initial machine driver for the ES8328 audio codec on Freescale boards. The driver supports headphones and an audio regulator for an onboard speaker amp. Signed-off-by: Sean Cross <xobs@kosagi.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-16ASoC: fsl_sai: Make Synchronous and Asynchronous modes exclusiveNicolin Chen1-0/+7
The previous patch (ASoC: fsl_sai: Add asynchronous mode support) added new Device Tree bindings for Asynchronous and Synchronous modes support. However, these two shall not be present at the same time. So this patch just simply makes them exclusive so as to avoid incorrect Device Tree binding usage. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-16ASoC: fsl_sai: Add asynchronous mode supportNicolin Chen2-4/+30
SAI supports these operation modes: 1) asynchronous mode Both Tx and Rx are set to be asynchronous. 2) synchronous mode (Rx sync with Tx) Tx is set to be asynchronous, Rx is set to be synchronous. 3) synchronous mode (Tx sync with Rx) Rx is set to be asynchronous, Tx is set to be synchronous. 4) synchronous mode (Tx/Rx sync with another SAI's Tx) 5) synchronous mode (Tx/Rx sync with another SAI's Rx) * 4) and 5) are beyond this patch because they are related with another SAI. As the initial version of this SAI driver, it supported 2) as default while the others were totally missing. So this patch just adds supports for 1) and 3). Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-16ASoC: fsl_sai: Set SYNC bit of TCR2 to Asynchronous ModeNicolin Chen1-2/+1
There is one design rule according to SAI's reference manual: If the transmitter bit clock and frame sync are to be used by both transmitter and receiver, the transmitter must be configured for asynchronous operation and the receiver for synchronous operation. And SYNC of TCR2 is a 2-width control bit: 00 Asynchronous mode. 01 Synchronous with receiver. 10 Synchronous with another SAI transmitter. 11 Synchronous with another SAI receiver. So the driver should have set SYNC bit of TCR2 to 0x0, and meanwhile set SYNC bit of RCR2 to 0x1 (Synchronous with transmitter). Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-16ASoC: fsl_sai: Initialize with software resetNicolin Chen2-2/+8
This patch adds software reset code in dai_probe() so as to make a true init by clearing SAI's internal logic, including the bit clock generation, status flags, and FIFO pointers. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-16ASoC: fsl_esai: refine esai for TDM supportShengjiu Wang2-7/+15
Original driver didn't store the number of slots, just fix the slot number to 2, use this default number to calculate bclk and pins for TX/RX. In this patch, add one parameter for slots, and update the calculation of bclk and pins of TX/RX. Then driver will be compatible with slots > 2 in TDM mode. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-16ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC supportNicolin Chen3-0/+591
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that can be used, ideally, for all Freescale CPU DAI drivers and external CODECs. The idea of this generic sound card is a bit like ASoC Simple Card. However, for Freescale SoCs (especially those released in recent years), most of them have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And this is a specific feature that might be painstakingly controlled and merged into the Simple Card driver. So having this driver will allow all Freescale SoC users to benefit from the simplification to support a new card and the capability of wide sample rates support through ASRC. The driver is initially designed for sound card using I2S or PCM DAI formats. However, it's also possible to merge those non-I2S/PCM type sound cards, such as S/PDIF audio and HDMI audio, into this card as long as the merge will not break the original function and as long as there is something redundant that can be abstracted along with I2S type sound cards. As an initial version, it only supports three cards that I can test: imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver imx-audio-wm8962, just like the old imx-wm8962.c driver The driver is also compatible with the old Device Tree bindings of WM8962 and SGTL5000. So we may consider to remove those two drivers after this driver is totally enabled. (It needs to be added into defconfig) Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-13ASoC: fsl_esai: refine esai for TDM supportShengjiu Wang2-7/+15
Original driver didn't store the number of slots, just fix the slot number to 2, use this default number to calculate bclk and pins for TX/RX. In this patch, add one parameter for slots, and update the calculation of bclk and pins of TX/RX. Then driver will be compatible with slots > 2 in TDM mode. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-13ASoC: fsl-esai: Revert .xlate_tdm_slot_mask() supportShengjiu Wang2-3/+0
This reverts commit a603c8ee526f5ea9ad9b40710308766299ad8a69. fsl_asoc_xlate_tdm_slot_mask() is different with snd_soc_xlate_tdm_slot_mask(). fsl_asoc_xlate_tdm_slot_mask() will set the enabled bit to 0, disabled bit to 1. snd_soc_xlate_tdm_slot_mask() will set the enabled bit to 1, disabled bit to 0. For esai when the bit value is 1, the slot is enabled, when the bit value is 0, the slot is disabled. If using fsl_asoc_xlate_tdm_slot_mask(), the esai will work abnormally. So revert this patch, make the esai use default function. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-07ASoC: fsl-ssi: Support for SND_SOC_DAIFMT_CBM_CFSFabio Falzoi1-5/+28
Add SND_SOC_DAIFMT_CBM_CFS support for Freescale architecture. Successfully tested on i.MX 6Quad Wandboard and UDOO boards connected to the pcm1792a codec. In CBM_CFS mode, when using a sample size of 16 bits, we cannot use CCSR_SSI_SCR_I2S_MODE_MASTER since we get a frame sync every 16 bits. Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com> Tested-by: Angelo Adamo <adamo.a60@gmail.com> Acked-by: Timur Tabi <timur@tabi.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-04Merge remote-tracking branches 'asoc/topic/fsl', 'asoc/topic/fsl-asrc', 'asoc/topic/fsl-spdif' and 'asoc/topic/imx-audmux' into asoc-nextMark Brown11-48/+1929
2014-08-04Merge remote-tracking branch 'asoc/fix/fsl-sai' into asoc-linusMark Brown1-17/+23
2014-08-04ASoC: imx-audmux: Use uintptr_t for port numbersMark Brown1-4/+4
Since we pass the port number through file private data for debugfs we cast it to and from a pointer so use uintptr_t in order to ensure that the types are compatible, avoiding warnings on 64 bit platforms where pointers are 64 bit and unsigned integers 32 bit. Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-04ASoC: fsl_asrc: Don't access members of config before checking itNicolin Chen1-3/+6
sound/soc/fsl/fsl_asrc.c:250 fsl_asrc_config_pair() warn: variable dereferenced before check 'config' (see line 243) git remote add next git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git remote update next git checkout 3117bb3109dc223e186302f5dc8ce9ed04adca90 vim +/config +250 sound/soc/fsl/fsl_asrc.c 237 */ 238 static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair) 239 { 240 struct asrc_config *config = pair->config; 241 struct fsl_asrc *asrc_priv = pair->asrc_priv; 242 enum asrc_pair_index index = pair->index; @243 u32 inrate = config->input_sample_rate, indiv; 244 u32 outrate = config->output_sample_rate, outdiv; 245 bool ideal = config->inclk == INCLK_NONE; 246 u32 clk_index[2], div[2]; 247 int in, out, channels; 248 struct clk *clk; 249 @250 if (!config) { 251 pair_err("invalid pair config\n"); 252 return -EINVAL; 253 } Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-04ASoC: fsl_sarc_dma: Check pair before using itNicolin Chen1-2/+7
The patch 3117bb3109dc: "ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers" from Jul 29, 2014, leads to the following Smatch complaint: sound/soc/fsl/fsl_asrc_dma.c:304 fsl_asrc_dma_shutdown() warn: variable dereferenced before check 'pair' (see line 302) sound/soc/fsl/fsl_asrc_dma.c 301 struct fsl_asrc_pair *pair = runtime->private_data; 302 struct fsl_asrc *asrc_priv = pair->asrc_priv; ^^^^^^^^^^^^^^^ Dereference. 303 304 if (pair && asrc_priv->pair[pair->index] == pair) ^^^^ Check. 305 asrc_priv->pair[pair->index] = NULL; 306 So we just let the driver check pair before using it. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-31ASoC: fsl_ssi: Add stream names for DPCM usageNicolin Chen1-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 SSI driver so that we can implement ASRC via DPCM to it. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Acked-by: Timur Tabi <timur@tabi.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-31ASoC: fsl_spdif: Add stream names for DPCM usageNicolin Chen1-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>
2014-07-31ASoC: fsl_sai: Add stream names for DPCM usageNicolin Chen1-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 SAI 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>
2014-07-31ASoC: fsl_esai: Add stream names for DPCM usageNicolin Chen1-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 ESAI 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>
2014-07-31ASoC: fsl_asrc: fix an error code in fsl_asrc_probe()Dan Carpenter1-1/+1
There is a cut and paste bug so it returns success instead of the error code. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-31ASoC: fsl_asrc: Fix sparse warnings in FSL_ASRC_FORMATS due to typoNicolin Chen1-1/+1
reproduce: make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) >> sound/soc/fsl/fsl_asrc.c:563:28: sparse: restricted snd_pcm_format_t degrades to integer >> sound/soc/fsl/fsl_asrc.c:570:28: sparse: restricted snd_pcm_format_t degrades to integer vim +563 sound/soc/fsl/fsl_asrc.c 557 .probe = fsl_asrc_dai_probe, 558 .playback = { 559 .stream_name = "ASRC-Playback", 560 .channels_min = 1, 561 .channels_max = 10, 562 .rates = FSL_ASRC_RATES, > 563 .formats = FSL_ASRC_FORMATS, 564 }, 565 .capture = { 566 .stream_name = "ASRC-Capture", 567 .channels_min = 1, 568 .channels_max = 10, 569 .rates = FSL_ASRC_RATES, > 570 .formats = FSL_ASRC_FORMATS, 571 }, 572 .ops = &fsl_asrc_dai_ops, 573 }; Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-31ASoC: fsl: fsl_asrc: Select SND_SOC_GENERIC_DMAENGINE_PCMFabio Estevam1-0/+1
Building a kernel with SND_SOC_GENERIC_DMAENGINE_PCM=n leads to the following error: ERROR: "snd_dmaengine_pcm_prepare_slave_config" [sound/soc/fsl/snd-soc-fsl-asrc.ko] undefined! Let SND_SOC_FSL_ASRC select SND_SOC_GENERIC_DMAENGINE_PCM in order to fix such error. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-29ASoC: fsl_asrc: Use 'ifdef' for config optionsFabio Estevam1-2/+2
Fix the following build errors that were observed by building with make ARCH=microblaze allyesconfig: >> sound/soc/fsl/fsl_asrc.c:906:5: warning: "CONFIG_PM_RUNTIME" is not defined [-Wundef] #if CONFIG_PM_RUNTIME ^ >> sound/soc/fsl/fsl_asrc.c:934:5: warning: "CONFIG_PM_SLEEP" is not defined [-Wundef] #if CONFIG_PM_SLEEP ^ >> sound/soc/fsl/fsl_asrc.c:906:5: warning: "CONFIG_PM_RUNTIME" is not defined [-Wundef] #if CONFIG_PM_RUNTIME ^ >> sound/soc/fsl/fsl_asrc.c:934:5: warning: "CONFIG_PM_SLEEP" is not defined [-Wundef] #if CONFIG_PM_SLEEP Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-29ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform driversNicolin Chen5-0/+1850
The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a signal associated with an input clock into a signal associated with a different output clock. The driver currently works as a Front End of DPCM with other Back Ends DAI links such as ESAI<->CS42888 and SSI<->WM8962 and SAI. It converts the original sample rate to a common rate supported by Back Ends for playback while converts the common rate of Back Ends to a desired rate for capture. It has 3 pairs to support three different substreams within totally 10 channels. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Reviewed-by: Varka Bhadram <varkabhadram@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-25ASoC: fsl_sai: Improve enable flow in fsl_sai_trigger()Nicolin Chen1-2/+3
The previous enable flow: 1, Enable TE&RE (SAI starts to consume tx FIFO and feed rx FIFO) 2, Mask IRQ of Tx/Rx to enable its interrupt. 3, Enable DMA request of Tx/Rx. As this flow would enable DMA request later than TERE, the Tx FIFO would be easily emptied into underrun while Rx FIFO would be easily stuffed into overrun due to the delayed DMA transfering. This issue happened merely occational before the patch 'ASoC: fsl_sai: Reset FIFOs after disabling TE/RE' because there were useless data remaining in the FIFO for the gap. However, it manifested after FIFO reset's implemented. After this patch, the new flow: 1, Enable DMA request of Tx/Rx. 2, Enable TE&RE (SAI starts to consume tx FIFO and feed rx FIFO) 3, Mask IRQ of Tx/Rx to enable its interrupt. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-25ASoC: fsl_sai: Don't reset FIFO until TE/RE bit is unsetNicolin Chen1-5/+14
TE/RE bit of T/RCSR will remain set untill the current frame is physically finished. The FIFO reset operation should wait this bit's totally cleared rather than ignoring its status which might cause TE/RE disabling failed. This patch adds delay and timeout to wait for its completion before FIFO reset. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-25ASoC: fsl_sai: Reduce race condition during TE/RE enablingNicolin Chen1-11/+7
For trigger start, we don't need to check if it's the first time to enable TE/RE or second time. It doesn't hurt to enable them any way, which in the meantime can reduce race condition for TE/RE enabling. For trigger stop, we will definitely clear FRDE of current direction. Thus the driver only needs to read the opposite one's. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-17Merge remote-tracking branches 'asoc/fix/fsl-sai', 'asoc/fix/intel', 'asoc/fix/max98090' and 'asoc/fix/s6000' into asoc-linusMark Brown1-3/+6
2014-07-17Merge tag 'asoc-v3.16-rc1' into asoc-linusMark Brown1-2/+2
ASoC: Fixes for v3.16 Quite a few build coverage fixes in here among the usual small driver fixes includling the sigmadsp change from Lars - moving the driver to separate modules per bus (which is basically just code motion) avoids issues with some combinations of buses being enabled. # gpg: Signature made Thu 19 Jun 2014 11:57:31 BST using RSA key ID 7EA229BD # gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>" # gpg: aka "Mark Brown <broonie@debian.org>" # gpg: aka "Mark Brown <broonie@kernel.org>" # gpg: aka "Mark Brown <broonie@tardis.ed.ac.uk>" # gpg: aka "Mark Brown <broonie@linaro.org>" # gpg: aka "Mark Brown <Mark.Brown@linaro.org>"
2014-07-17ASoC: fsl_sai: Fix incorrect register writing in fsl_sai_isr()Nicolin Chen1-1/+1
In the rx irq handling part, we should clear the flags in RCSR not TCSR. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-17ASoC: fsl_sai: Reset FIFOs after disabling TE/RENicolin Chen1-2/+5
SAI will not clear their FIFOs after disabling TE/RE. Therfore, the driver should take care the task so as not to let useless data remain in the FIFO. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-01Update imx-sdma cyclic handling to report residueRussell King - ARM Linux1-1/+0
I received a report this morning from one of the Novena developers that the behaviour of the iMX6 ASoC codec driver (using imx-pcm-dma.c) was sub-optimal under high system load. While there are issues relating to system load remaining, upon reviewing the ASoC imx-pcm-dma.c driver, it was noticed that it not using the residue support, because SDMA doesn't support it. This has the effect that SDMA has to make multiple calls into the ASoC and ALSA code, one for each period. Since ALSA's snd_pcm_elapsed() does not need to be called multiple times and it is entirely sufficient to call it once to update ALSA with the current buffer position via the pointer method, we can do better here. We can also avoid stopping the DMA entirely, just like real cyclic DMA implementations behave. While this means that we replay some old samples, this is a nicer behaviour than having audio stop and restart. The changes to achieve this are relatively minor - imx-sdma.c can track where the DMA is to the nearest descriptor boundary - it does this already when deciding how many callbacks to issue. In doing this, buf_tail always points at the descriptor which will complete next. The residue is defined by the bytes remaining to the end of the buffer, when the buffer is viewed as a single block of memory [start...end]. So, when we start out, there's a full buffer worth of residue, and this counts down as we approach the end of the buffer, eventually becoming zero at the end, before returning to the full buffer worth when we wrap back to the start. Moving the walking of the descriptors into the interrupt handler means that we can update the BD_DONE flag at interrupt time, thus avoiding a delayed tasklet stopping the cyclic DMA. This means that the residue can be calculated from (total descriptors - buf_tail) * descriptor size. This is what the change below does. We update imx-pcm-dma.c to remove the NO_RESIDUE flag since we now provide the residue. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Tested-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-06-22ASoC: fsl: refine DMA/FIQ dependenciesArnd Bergmann1-2/+4
Commit 31ee2bfd724ab ("ASoC: fsl: select SND_SOC_IMX_PCM_DMA where needed") started selecting SND_SOC_IMX_PCM_DMA and SND_SOC_IMX_PCM_FIQ for two drivers when building for i.MX. This has turned out too aggressive, as FIQ is only available for i.mx2 through i.mx5, but not i.mx6 or vybrid. Further, two more drivers have become user-selectable in the meantime, and they both depend on DMA for the imx platform as well. This changes the selection of FIQ to depend on the TZIC or AVIC interrupt controllers that actually export the imx specific FIQ interfaces, and adds the missing select statements for SAI and ESAI. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-17Merge remote-tracking branches 'asoc/fix/fsl-ssi' and 'asoc/fix/pxa' into asoc-linusMark Brown1-2/+2
2014-06-17ASoC: fsl-ssi: fix do_div build warning in fsl_ssi_set_bclk()Timur Tabi1-2/+2
do_div() requires that the first parameter is a 64-bit integer, which but clkrate was defined as an unsigned long. This caused the following warnings: CC sound/soc/fsl/fsl_ssi.o sound/soc/fsl/fsl_ssi.c: In function 'fsl_ssi_set_bclk': sound/soc/fsl/fsl_ssi.c:593:3: warning: comparison of distinct pointer types lacks a cast sound/soc/fsl/fsl_ssi.c:593:3: warning: right shift count >= width of type sound/soc/fsl/fsl_ssi.c:593:3: warning: passing argument 1 of '__div64_32' from incompatible pointer type include/asm-generic/div64.h:35:17: note: expected 'uint64_t *' but argument is of type 'long unsigned int *' Signed-off-by: Timur Tabi <timur@tabi.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-17ASoC: fsl_spdif: Add support for output sample rates 96kHz and 192kHzAnssi Hannula2-5/+17
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>
2014-06-17ASoC: fsl_spdif: Improve coding styleNicolin Chen2-37/+37
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>
2014-06-16Merge remote-tracking branches 'asoc/fix/fsl-dma', 'asoc/fix/fsl-spdif', 'asoc/fix/pxa', 'asoc/fix/rcar' and 'asoc/fix/sigmadsp' into asoc-linusMark Brown2-5/+5
2014-06-12ASoC: fsl: Fix build problemGuenter Roeck1-2/+2
Commit 432481220 (ASoC: fsl-ssi: Use regmap) removed struct ccsr_ssi. Unfortunately, the structure is still used. This causes mpc85xx_smp_defconfig and mpc85xx_defconfig builds to fail with sound/soc/fsl/fsl_dma.c:926:50: error: invalid use of undefined type 'struct ccsr_ssi' dma->ssi_stx_phys = res.start + offsetof(struct ccsr_ssi, stx0); ound/soc/fsl/fsl_dma.c:927:50: error: invalid use of undefined type 'struct ccsr_ssi' dma->ssi_srx_phys = res.start + offsetof(struct ccsr_ssi, srx0); Fix by using constants, similar to original commit. Cc: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-09ASoC: fsl_spdif: Fix integer overflow when calculating divisorsAnssi Hannula1-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>
2014-06-09ASoC: fsl_spdif: Fix incorrect usage of regmap_read()Nicolin Chen1-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>
2014-06-03Merge remote-tracking branch 'asoc/topic/fsl-ssi' into asoc-nextMark Brown3-271/+363
2014-06-01Merge branch 'topic/fsl' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-fsl-ssiMark Brown5-32/+70
Conflicts: sound/soc/fsl/Kconfig
2014-06-01ASoC: fsl: Remove dependencies of boards for SND_SOC_EUKREA_TLV320Alexander Shiyan1-6/+1
Eukrea-i.MX51 board was converted to use DT, ie we no longer have a MACH_EUKREA_MBIMXSD51_BASEBOARD symbol. Transformation of other boards planned for the near future, so this patch removes all these dependencies and restricts build of this driver to ARCH_MXC. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-01ASoC: fsl-ssi: Use regmapMarkus Pargmann3-134/+158
This patch replaces the ssi specific functions write_ssi, read_ssi and write_ssi_mask by standard regmap function calls. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Tested-By: Michael Grzeschik <mgr@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-01ASoC: fsl-ssi: reorder and document fsl_ssi_privateMarkus Pargmann1-15/+43
Reorder all variables in struct fsl_ssi_private to have groups that make sense together. The patch also updates the struct documentation. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Tested-By: Michael Grzeschik <mgr@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-01ASoC: fsl-ssi: Fix baudclock handlingMarkus Pargmann1-21/+41
The baudclock may be used and set by different streams. Allow only the first stream to set the bitclock rate. Other streams have to try to get to the correct rate without modifying the bitclock rate using the SSI internal clock modifiers. The variable baudclk_streams is introduced to keep track of the active streams that are using the baudclock. This way we know if the baudclock may be set and whether we may enable/disable the clock. baudclock enable/disable is moved to hw_params()/hw_free(). This way we can keep track of the baudclock in those two functions and avoid a running clock while it is not used. As hw_params()/hw_free() may be called multiple times for the same stream, we have to use baudclk_streams variable to know whether we may enable/disable the clock. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Tested-By: Michael Grzeschik <mgr@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org>