summaryrefslogtreecommitdiff
path: root/sound/soc/davinci/davinci-mcasp.c
AgeCommit message (Collapse)Author
2014-10-05ASoC: davinci-mcasp: Correct rx format unit configurationPeter Ujfalusi
commit fe0a29e163a5d045c73faab682a8dac71c2f8012 upstream. In case of capture we should not use rotation. The reverse and mask is enough to get the data align correctly from the bus to MCU: Format data from bus after reverse (XRBUF) S16_LE: |LSB|MSB|xxx|xxx| |xxx|xxx|MSB|LSB| S24_3LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB| S24_LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB| S32_LE: |LSB|DAT|DAT|MSB| |MSB|DAT|DAT|LSB| With this patch all supported formats will work for playback and capture. Reported-by: Jyri Sarha <jsarha@ti.com> (broken S24_3LE capture) Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-21ASoC: davinci: fix sample rotationDaniel Mack
McASP serial audio engine needs different rotation values on TX and RX channels. Commit dde109fb462 ("ASoC: McASP: Fix data rotation for playback. Enables 24bit audio playback") changed the calculation to fix the playback format, but broke the capture stream by doing it for both TXFMT and RXFMT. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org [3.9 only]
2013-05-03Merge tag 'asoc-v3.10-4' of ↵Takashi Iwai
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next ASoC: Updates for v3.10 A few more bug fixes, the DAPM clock fix is actually a driver specific one since currently there's only one user of the clock support due to the problems relying on the clock API.
2013-05-03ASoC: McASP: Fix receive clock polarity in DAIFMT_NB_NF mode.Marek Belisko
According documentation bit ACLKRPOL is set to 0 (receiver samples data on falling edge) and when set to 1 (receiver samples data on rising edge). I2S data are always sampled on falling edge and valid during rising edge of bit clock. So in case of capture data transmitter sample data on falling edge and macsp must read then on rising edge. Signed-off-by: Marek Belisko <marek.belisko@streamunlimited.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-30ASoC: McASP: Add pins output direction for rx clocks when configured in ↵Marek Belisko
CBS_CFS format When McASP is bit clock and frame clock master enable pin output for rx clocks. Signed-off-by: Marek Belisko <marek.belisko@streamunlimited.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23ASoC: davinci-mcasp: Add Support BCLK-to-LRCLK ratio for TDM modesMichal Bachraty
For TDM mode, BCLK-to-LCLK ratio is computed as (tdm_slots) x (word_length). I2S mode is only subset of TDM mode with specific tdm_slots = 2 channels. Also bclk_lrclk_ratio can be greater than 255, therefore u16 need to be used. Signed-off-by: Michal Bachraty <michal.bachraty@streamunlimited.com> Acked-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23ASoC: davinci-pcm, davinci-mcasp: Clean up active_serializersMichal Bachraty
As pointed of by Vaibhav, commit message: "ASoC: davinci-mcasp: Add support for multichannel playback" number of active serializers can be hidden into fifo_level variable, which is set in davimci-mcasp. Signed-off-by: Michal Bachraty <michal.bachraty@streamunlimited.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-12Merge remote-tracking branch 'asoc/topic/davinci' into asoc-nextMark Brown
2013-04-05ASoC: davinci-mcasp: don't overwrite DIT settingsYegor Yefremov
Channel size settings will be made at the end of davinci_mcasp_hw_params() routine and thus overwrite frame format settings made for DIT mode. This patch fixes this issue by taking op_mode into account. Tested with official PSP 3.2 kernel and sii9022a HDMI transmitter. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Tested-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-05ASoC: davinci-mcasp: don't configure AFSX direction in DIT modeYegor Yefremov
AFSX won't be used in DIT mode. The related pins are AHCLKX and the data pins. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Acked-by: Vaibhav Bedia <vaibhav.bedia@ti.com> Tested-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-26ASoC: switch over to use snd_soc_register_component() on davinci mcaspKuninori Morimoto
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-12ASoC: davinci-mcasp: clean up davinci_hw_common_param()Daniel Mack
As pointed of by Vaibhav, commit 2952b27e2 ("ASoC: davinci-mcasp: Add support for multichannel playback") duplicated the logic of counting the active serializers. That can be avoided by shifting the code around a bit. Also, drop two unused defines introduced by the same commit. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Vaibhav Bedia <vaibhav.bedia@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04ASoC: davinci-mcasp: Add support for multichannel playbackMichal Bachraty
Davinci McASP has support for I2S multichannel playback. For I2S playback/receive, each serializer is capable to play 2 channels (L/R) audio data.Serializer function (Playback-receive-none) is configured in DT, depending on hardware specification. It is possible to play less channels than configured in DT. For that purpose,only specific number of active serializers are enabled. McASP FIFO need to have DMA transfer Bcnt set to number of enabled serializers, otherwise no data are transfered to McASP and Alsa generates "DMA/IRQ playback write error (DMA or IRQ trouble?)" error. For TDM mode, McASP is capable to play or receive 32 channels for one serializer. McAsp has support for max 16 serializer, therefore max channels is 32 * 8. Signed-off-by: Michal Bachraty <michal.bachraty@streamunlimited.com> Tested-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-27ASoC: McASP: Fix data rotation for playback. Enables 24bit audio playbackMichal Bachraty
u32 rotate = (32 - word_length) / 4; This implementation is wrong, but it works only for 16, or 32 bit audio data. (rotation for 16 or 32 bit is same as in code I present) Mcasp rotated data in 4 bits (max value 0x7)and then masks them . That data are sended to i2s bus. For 24 bit or 20 bit or other data formats, this code rotates data badly and you hear somethink like noise. You need to use u32 rotate = (word_length / 4) & 0x7; to proper data rotation. Signed-off-by: Michal Bachraty <michal.bachraty@streamunlimited.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-07ASoC: McASP: implement a way to force BCLK/LRCLK ratiosDaniel Mack
Depending on the Codec, the the BCLK/LRCLK ratio might not be freely chosen by the CPU DAI. For example, some Codec might want to be supplied with 32-bit samples for both its channels regardless of the actual audio word size the CPU sends. In such cases, the rest of the bits on the data lines must be padded with zeros: _______________________________ LRCLK / \ --' `---------- ..... BCLK ||||||||||||||||||||||||||||||||||||||||||||||| ..... DATA ____||||||||||||||||_________________|||||||||| ..... |<-- data -->|<-- pads --> | This patch adds a new clock divider to configure the BCLK/LRCLK ratio. If the machine code uses that divider, the driver uses the specified value, instead of deriving that information from the audio word size. Otherwise, the original behaviour is retained. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-07ASoC: McASP: calculate values for channel sizeDaniel Mack
Change davinci_config_channel_size() to derive the values for XSSZ and XROT in DAVINCI_MCASP_[RT]XFMT_REG from the configured word length rather than hard-coding them in a switch/case block. Also, by directly passing the word length to davinci_config_channel_size(), we can get rid of the DAVINCI_AUDIO_WORD_* enum. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-07ASoC: McASP: remove unused variablesDaniel Mack
codec_fmt and sample_rate variables are unused in both snd_platform_data and davinci_audio_dev, so drop them. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-10-22ASoC: davinci: replace private sram api with genallocMatt Porter
Removes the DaVinci private SRAM API and replaces it with the genalloc API. The SRAM gen_pool is passed in pdata since DaVinci is in the early stages of DT conversion. [zonque@gmail.com: stub out gen_pool functions for !CONFIG_GENERIC_ALLOCATOR] Signed-off-by: Matt Porter <mporter@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-10-15ASoC: McASP: treat SNDRV_PCM_FORMAT_U24_* as 32 bit wordsDaniel Mack
Signed-off-by: Daniel Mack <zonque@gmail.com> Reported-by: Mike Looijmans <mike.looijmans@topic.nl> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-10-15ASoC: McASP: add support for 24 bit samplesDaniel Mack
Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-10-15ASoC: McASP: set format parameters in dependence of the DAI formatDaniel Mack
The FSDUR flag configures whether the frame clock uses a high phase of only one bit or a full word. This has to be set depending on the DAI format. For other modes than DSP_B, the FSXDLY/FSRDLY fields have to be set to 1. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-10-15ASoC: McASP: make AHCLK direction configurableDaniel Mack
Add a .set_sysclk function to pass the direction of the clock down to the driver. Only enable AHCLKX in the PDIR register when the CPU is driving the clock. This also removes the modification of the AHCLKXE/AHCLKRE bits in the hw_params callback, and users must set the desired configuration using snd_soc_dai_set_sysclk(), which this patch also does for the only user in mainline (davinci-evm). Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-10-15ASoC: McASP: add support for clock dividersDaniel Mack
Add support for the internal clock dividers of the McASP driver. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-06ASoC: Davinci: McASP: add support new McASP IP VariantHebbar, Gururaja
The OMAP2+ variant of McASP is different from Davinci variant w.r.to some register offset. Changes - Add new MCASP_VERSION_3 to identify new variant. New DT compatible "ti,omap2-mcasp-audio" to identify version 3 controller. - The register offsets are handled depending on the version. Note: DMA parameters (dma fifo offset) are not updated and will be done later. Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-05Merge branch 'asoc-omap' into for-3.7Mark Brown
2012-08-27ASoC: Davinci: McASP: add device tree support for McASPHebbar, Gururaja
Add device tree probe for McASP driver. Note: DMA parameters are not populated from DT and will be done later. Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-27ASoC: davinci: davinci-pcm does not need to be a plaform_driverHebbar, Gururaja
Same as the commit 518de86 (ASoC: tegra: register 'platform' from DAIs, get rid of pdev). It makes davinci-pcm not a platform_driver but helper to register "platform", so that the platform_device for davinci-pcm can be saved completely. Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-09ASoC: McASP: Convert driver to use Runtime PM APIHebbar, Gururaja
* Add Runtime PM support to McASP host controller. * Use Runtime PM API to enable/disable McASP clock. This was tested on AM18x Board using suspend/resume Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-09ASoC: Davinci: McASP: Flush the FIFO before enablingVaibhav Bedia
FIFO should be flushed before it is enabled for the first time. This fixes the I/O errors reported by the ASoC core on a fresh boot Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com> Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-02ASoC: davinci-mcasp.c: use devm_ functionsJulia Lawall
The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_mem_region and devm_ioremap for data that is allocated in the probe function of a platform device and is only freed in the remove function. In this case, the original code did not contain a call to iounmap, nor does one appear anywhere else in the file. I have assumed that it is safe to use devm_ioremap for the allocation in any case. Signed-off-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-25ASoC: Convert davinci directory to module_platform_driverAxel Lin
Factor out some boilerplate code. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23ASoC: Constify snd_soc_dai_ops structsLars-Peter Clausen
Commit 1ee46ebd("ASoC: Make the DAI ops constant in the DAI structure") introduced the possibility to have constant DAI ops structures, yet this is barley used in both existing drivers and also new drivers being submitted, although none of them modifies its DAI ops structure. The later is not surprising since existing drivers are often used as templates for new drivers. So this patch just constifies all existing snd_soc_dai_ops structs to eliminate the issue altogether. The patch was generated with the following coccinelle semantic patch: // <smpl> @@ identifier ops; @@ -struct snd_soc_dai_ops ops = +const struct snd_soc_dai_ops ops = { ... }; // </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-29ASoC: davinci-mcasp: add support for unsigned PCM formatsBen Gardiner
Although the McASP supports sign-extending samples in RX or TX [1]; the davinci-mcasp driver does not touch the {R,X}PBIT or {R,X}PAD field of the {R,X}FMT registers meaning that the McASP will serialize the bytes it is given regardless of their signedness. So supporting unsigned formats is as simple as adding them to the metadata of the davinci-mcasp driver. Update the FMTBITs reported in the snd_soc_dai_driver and also update the case statements in davinci-mcasp's hw_params() function so that the McASP can be connected to CODECs that use unsigned values. [1] http://www.ti.com/lit/ug/sprufm1/sprufm1.pdf Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-05-19ASoC: davinci-mcasp: enable ping-pong SRAM buffersBen Gardiner
The davinci-i2s driver copies the platform data for playback and capture sram sizes which is in turn used by davinci-pcm to allocate ping-pong buffers. Copy also the platform data in davinci-mcasp probe. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-04-26davinci-mcasp: fix _CBM_CFS pin directionsBen Gardiner
The current davinci_mcasp_set_dai_fmt() sets bits ACLKX and ACLKR in the PDIR register for the codec clock-master/frame-slave mode; however, this results in the ACLKX and ACLKR pins being outputs according to SPRUFM1 [1] which conflicts with "codec is clock master." Similarly to the previous patch in this series, "fix _CBM_CFS hw_params" -- For codec clock-master/frame-slave mode (_CMB_CFS), clear bits ACLKX and ACLKR in the PDIR register to set the pins as inputs and hence allow externally sourced bit-clocks. [1] http://www.ti.com/litv/pdf/sprufm1 Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Reviewed-by: James Nuss <jamesnuss@nanometrics.ca> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-04-26davinci-mcasp: fix _CBM_CFS hw_paramsBen Gardiner
The current davinci_mcasp_set_dai_fmt() sets bits ACLKXE and ACLKRE (CLKXM and CLKRM as they are reffered to in SPRUFM1 [1]) for codec clock-slave/ frame-slave mode (_CBS_CFS) which selects internally generated bit-clock and frame-sync signals; however, it does the same thing again for codec clock-master/frame-slave mode (_CBM_CFS) in the very next case statement which is incorrectly selecting internally generated bit-clocks in this mode. For codec clock-master/frame-slave mode (_CBM_CFS), clear bits ACLKXE and ACLKRE to select externally-generated bit-clocks. [1] http://www.ti.com/litv/pdf/sprufm1 Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Reviewed-by: James Nuss <jamesnuss@nanometrics.ca> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-04-26davinci-mcasp: use bitfield definitions for PDIRBen Gardiner
The current driver creates value for set/clr of PDIR using (x<<26) instead of the #defines that are convieniently made available. Update the driver to use the bitfield definitions of PDIR. There is no functional change introduced by this patch. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Reviewed-by: James Nuss <jamesnuss@nanometrics.ca> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-04-26ASoC: davinci-mcasp: correct tdm_slots limitBen Gardiner
The current check for the number of tdm-slots specified by platform data is always true (x >= 2 || x <= 32); therefore the else branch that warns of an incorrect number of slots can never be taken. Check that the number of tdm slots specified by platform data is between 2 and 32, inclusive. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Reviewed-by: James Nuss <jamesnuss@nanometrics.ca> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-02-09ASoC: Davinci: Replace usage of IO_ADDRESS with ioremap()Vaibhav Bedia
This patch modifies the Davinci i2s and mcasp drivers to make use of ioremap() instead of IO_ADDRESS() Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-02-09ASoC: Davinci: Call clk_disable() and clk_put() in case of errorVaibhav Bedia
In case of any error in probe() function, clk_disable() and clk_put() should be called if clk_enable() and clk_get() went through. Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-02-09ASoC: Davinci: Use resource_size() helper functionVaibhav Bedia
This patch modifies the Davinci i2s and mcasp drivers to make use of the resource_size() helper function for readability. Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-11-17ASoC: davinci: fixes for multi-componentChris Paulson-Ellis
Multi-component commit f0fba2ad broke a few things which this patch should fix. Tested on the DM355 EVM. I've been as careful as I can, but it would be good if those with access to other Davinci boards could test. -- The multi-component commit put the initialisation of snd_soc_dai.[capture|playback]_dma_data into snd_soc_dai_ops.hw_params of the McBSP, McASP & VCIF drivers (davinci-i2s.c, davinci-mcasp.c & davinci-vcif.c). The initialisation had to be moved from the probe function in these drivers because davinci_*_dai changed from snd_soc_dai to snd_soc_dai_driver. Unfortunately, the DMA params pointer is needed by davinci_pcm_open (in davinci-pcm.c) before hw_params is called. I have moved the initialisation to a new snd_soc_dai_ops.startup function in each of these drivers. This fix indicates that all platforms that use davinci-pcm must have been broken and need to test with this fix. -- The multi-component commit also changed the McBSP driver name from "davinci-asp" to "davinci-i2s" in davinci-i2s.c without updating the board level references to the driver name. This change is understandable, as there is a similarly named "davinci-mcasp" driver in davinci-mcasp.c. There is probably no 'correct' name for this driver. The DM6446 datasheet calls it the "ASP" and describes it as a "specialised McBSP". The DM355 datasheet calls it the "ASP" and describes it as a "specialised ASP". The DM365 datasheet calls it the "McBSP". Rather than fix this problem by reverting to "davinci-asp", I've elected to avoid future confusion with the "davinci-mcasp" driver by changing it to "davinci-mcbsp", which is also consistent with the names of the functions in the driver. There are other fixes required, so it was never going to be as simple as a revert anyway. -- The DM365 only has one McBSP port (of the McBSP platforms, only the DM355 has 2 ports), so I've changed the the id of the platform_device from 0 to -1. -- In davinci-evm.c, the DM6446 EVM can no longer share a snd_soc_dai_link structure with the DM355 EVM as they use different cpu DAI names (the DM355 has 2 ports and the EVM uses the second port, but the DM6446 only has 1 port). This also means that the 2 boards need different snd_soc_card structures. -- The codec_name entries in davinci-evm.c didn't match the i2c ids in the board files. I have only checked and fixed the details of the names used for the McBSP based platforms. Someone with a McASP based platform (eg DA8xx) should check the others. Signed-off-by: Chris Paulson-Ellis <chris@edesix.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-10-18ASoC: davinci-mcasp.c: Return error code in failureJulia Lawall
In this code, 0 is returned on failure, even though other failures return -ENOMEM or other similar values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @a@ identifier alloc; identifier ret; constant C; expression x; @@ x = alloc(...); if (x == NULL) { <+... \(ret = -C; \| return -C; \) ...+> } @@ identifier f, a.alloc; expression ret; expression x,e1,e2,e3; @@ ret = 0 ... when != ret = e1 *x = alloc(...) ... when != ret = e2 if (x == NULL) { ... when != ret = e3 return ret; } // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-08-12ASoC: multi-component - ASoC Multi-Component SupportLiam Girdwood
This patch extends the ASoC API to allow sound cards to have more than one CODEC and more than one platform DMA controller. This is achieved by dividing some current ASoC structures that contain both driver data and device data into structures that only either contain device data or driver data. i.e. struct snd_soc_codec ---> struct snd_soc_codec (device data) +-> struct snd_soc_codec_driver (driver data) struct snd_soc_platform ---> struct snd_soc_platform (device data) +-> struct snd_soc_platform_driver (driver data) struct snd_soc_dai ---> struct snd_soc_dai (device data) +-> struct snd_soc_dai_driver (driver data) struct snd_soc_device ---> deleted This now allows ASoC to be more tightly aligned with the Linux driver model and also means that every ASoC codec, platform and (platform) DAI is a kernel device. ASoC component private data is now stored as device private data. The ASoC sound card struct snd_soc_card has also been updated to store lists of it's components rather than a pointer to a codec and platform. The PCM runtime struct soc_pcm_runtime now has pointers to all its components. This patch adds DAPM support for ASoC multi-component and removes struct snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec or runtime PCM level basis rather than using snd_soc_socdev. Other notable multi-component changes:- * Stream operations now de-reference less structures. * close_delayed work() now runs on a DAI basis rather than looping all DAIs in a card. * PM suspend()/resume() operations can now handle N CODECs and Platforms per sound card. * Added soc_bind_dai_link() to bind the component devices to the sound card. * Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove DAI link components. * sysfs entries can now be registered per component per card. * snd_soc_new_pcms() functionailty rolled into dai_link_probe(). * snd_soc_register_codec() now does all the codec list and mutex init. This patch changes the probe() and remove() of the CODEC drivers as follows:- o Make CODEC driver a platform driver o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core. o Removed all static codec pointers (drivers now support > 1 codec dev) o snd_soc_register_pcms() now done by core. o snd_soc_register_dai() folded into snd_soc_register_codec(). CS4270 portions: Acked-by: Timur Tabi <timur@freescale.com> Some TLV320aic23 and Cirrus platform fixes. Signed-off-by: Ryan Mallon <ryan@bluewatersys.com> TI CODEC and OMAP fixes Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Samsung platform and misc fixes :- Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Jassi Brar <jassi.brar@samsung.com> Signed-off-by: Seungwhan Youn <sw.youn@samsung.com> MPC8610 and PPC fixes. Signed-off-by: Timur Tabi <timur@freescale.com> i.MX fixes and some core fixes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> J4740 platform fixes:- Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> CC: Tony Lindgren <tony@atomide.com> CC: Nicolas Ferre <nicolas.ferre@atmel.com> CC: Kevin Hilman <khilman@deeprootsystems.com> CC: Sascha Hauer <s.hauer@pengutronix.de> CC: Atsushi Nemoto <anemo@mba.ocn.ne.jp> CC: Kuninori Morimoto <morimoto.kuninori@renesas.com> CC: Daniel Gloeckner <dg@emlix.com> CC: Manuel Lauss <mano@roarinelk.homelinux.net> CC: Mike Frysinger <vapier.adi@gmail.com> CC: Arnaud Patard <apatard@mandriva.com> CC: Wan ZongShun <mcuos.com@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-07-20ASoC: davinci: let platform data define edma queue numbersSekhar Nori
Currently the EDMA queue to be used by for servicing ASP through internal RAM is fixed to EDMAQ_0 and that to service internal RAM from external RAM is fixed to EDMAQ_1. This may not be the desirable configuration on all platforms. For example, on DM365, queue 0 has large fifo size and is more suitable for video transfers. Having audio and video transfers on the same queue may lead to starvation on audio side. platform data as defined currently passes a queue number to the driver but that remains unused inside the driver. Fix this by defining one queue each for ASP and RAM transfers in the platform data and using it inside the driver. Since EDMAQ_0 maps to 0, thats the queue that will be used if the asp queue number is not initialized. None of the platforms currently utilize ping-pong transfers through internal RAM so that functionality remains unchanged too. This patch has been tested on DM644x and OMAP-L138 EVMs. Signed-off-by: Sekhar Nori <nsekhar@ti.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-06-15ASoC: DaVinci: Fix McASP hardware FIFO configurationSudhakar Rajashekhara
On DA830/OMAP-L137 and DA850/OMAP-L138 SoCs, the McASP peripheral has FIFO support. This FIFO provides additional data buffering. It also provides tolerance to variation in host/DMA controller response times. More details of the FIFO operation can be found at http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=sprufm1&fileType=pdf Existing sequence of steps for audio playback/capture are: a. DMA configuration b. McASP configuration (configures and enables FIFO) c. Start DMA d. Start McASP (enables FIFO) During McASP configuration, while FIFO was being configured, FIFO was being enabled in davinci_hw_common_param() function of sound/soc/davinci/davinci-mcasp.c file. This generated a transmit DMA event, which gets serviced when DMA is started. https://patchwork.kernel.org/patch/84611/ patch clears the DMA events before starting DMA, which is the right thing to do. But this resulted in a state where DMA was waiting for an event from McASP (after step c above), but the event which was already there, has got cleared (because of step b above). The fix is not to enable the FIFO during McASP configuration as FIFO was being enabled as part of McASP start. Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-04-07Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: ALSA: mixart: range checking proc file ALSA: hda - Fix a wrong array range check in patch_realtek.c ALSA: ASoC: move dma_data from snd_soc_dai to snd_soc_pcm_stream ALSA: hda - Enable amplifiers on Acer Inspire 6530G ASoC: Only do WM8994 bias off transition from standby ASoC: Don't use DCS_DATAPATH_BUSY for WM hubs devices ASoC: Don't do runtime wm_hubs DC servo updates if using offset correction ASoC: Support second DC servo readback method for wm_hubs ASoC: Avoid wraparound in wm_hubs DC servo correction ALSA: echoaudio - Eliminate use after free ALSA: i2c: cleanup: change parameter to pointer ALSA: hda - Add MSI blacklist for Aopen MZ915-M ASoC: OMAP: Fix capture pointer handling for OMAP1510 to work correctly with recent ALSA PCM code ALSA: hda - Update document about MSI and interrupts ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981 ALSA: hda - Add missing printk argument in previous patch ASoC: Fix passing platform_data to ac97 bus users and fix a leak ALSA: hda - Fix ADC/MUX assignment of ALC269 codec ALSA: hda - Fix invalid bit values passed to snd_hda_codec_amp_stereo() ASoC: wm8994: playback => capture
2010-04-05ALSA: ASoC: move dma_data from snd_soc_dai to snd_soc_pcm_streamDaniel Mack
This fixes a memory corruption when ASoC devices are used in full-duplex mode. Specifically for pxa-ssp code, where this pointer is dynamically allocated for each direction and destroyed upon each stream start. All other platforms are fixed blindly, I couldn't even compile-test them. Sorry for any breakage I may have caused. [Note that this is a backported version for 2.6.34. Upstream commit is fd23b7dee] Signed-off-by: Daniel Mack <daniel@caiaq.de> Reported-by: Sven Neumann <s.neumann@raumfeld.com> Reported-by: Michael Hirsch <m.hirsch@raumfeld.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo
implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-01-26ASoC: DaVinci: Fix stream restart errorChaithrika U S
Sometimes after a suspend-resume cycle, the ALSA application restarts the stream when resume fails and McASP fails to work as the clock is not enabled. This patch corrects this bug. Testes on TI DA850/OMAP-L138 EVM. Signed-off-by: Chaithrika U S <chaithrika@ti.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>