summaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci/davinci-mcasp.c
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: davinci-mcasp: Fix bit clock polarity settingsPeter Ujfalusi2014-04-081-3/+3
| | | | | | | | IB_NF, NB_IF and IB_IF configured the bc polarity incorrectly. The receive polarity was set to the same edge as the TX in these cases. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Provide correct filter_data for dmaengine for non-DT bootPeter Ujfalusi2014-03-171-5/+16
| | | | | | | | | | When we boot with non-DT mode the damengine will need the channel number and a filter function in order to get the channel. The filter_data is filled in the DAI driver while the filter_function will be provided by the edma-pcm driver. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Rename the pointer to davinci dma_params as dma_paramsPeter Ujfalusi2014-03-091-22/+22
| | | | | | | | It is quite confusing to name the pointer to davinci_pcm_dma_params as dma_data. Rename the pointer to avoid confusion. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Remove long lines from suspend/resume callbacksPeter Ujfalusi2014-02-031-24/+28
| | | | | | | | Move the context register storage behind of a struct and use a pointer to it in the suspend/resume callbacks to remove the long lines. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Rename platform data structPeter Ujfalusi2014-02-031-8/+8
| | | | | | | | | | | | Rename the struct for the platform data: snd_platform_data -> davinci_mcasp_pdata Since we have users under arch/arm/mach-davinci/ for this struct add temporary define to avoid breakage. The arch code can be updated later to use the new struct name. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Code cleanup in davinci_mcasp_hw_params()Peter Ujfalusi2014-02-031-12/+8
| | | | | | | Rearrange the code in the function for readability. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Move pm callbacks from platform device to soc_dai_driverPeter Ujfalusi2014-01-311-37/+37
| | | | | | | Handle the PM callbacks via the ASoC core instead of device core. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Return value handling cleanup for mcasp_common_hw_param()Peter Ujfalusi2014-01-311-2/+4
| | | | | | | | Take the return value from mcasp_common_hw_param() and use that in case of error. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* Merge branch 'fix/davinci' of ↵Mark Brown2014-01-311-45/+38
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into HEAD
| * ASoC: davinci-mcasp: Consolidate pm_runtime_get/put() use in the driverPeter Ujfalusi2014-01-311-14/+9
| | | | | | | | | | | | | | | | | | The use of pm_runtime in trigger() callback is not correct and it will lead to unbalanced power.usage_count. The only place which might need to call pm_runtime is the set_fmt callback. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * ASoC: davinci-mcasp: Configure xxTDM, xxFMT and xxFMCT registers synchronouslyPeter Ujfalusi2014-01-311-29/+27
| | | | | | | | | | | | | | | | | | | | | | | | These registers can be configured synchronously for playback and capture. Furthermore when McASP is in master and sync mode the capture operation needs the TX path to be configured in order to be able to provide the needed clocks for the bus. xxFMT and xxFMCT registers has been already configured for both TX and RX other places in the driver. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * ASoC: davinci-mcasp: Harmonize the sub hw_params function namesPeter Ujfalusi2014-01-311-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of davinci_hw_common_param - for common, I2S/DIT mode settings davinci_hw_dit_param - for DIT protocol configuration davinci_hw_param - for I2S (and compatible protocols) Use the following names: mcasp_common_hw_param, mcasp_dit_hw_param and mcasp_i2s_hw_param. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | ASoC: davinci-mcasp: Set BCLK divider if McASP is BCLK masterJyri Sarha2014-01-271-0/+20
|/ | | | | | | | Make BCLK divider setting implicite in hw_params call if McASP device is the bit clock master on the audio serial bus. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Support for fck reparentingPeter Ujfalusi2013-12-101-0/+44
| | | | | | | | Optional DT property to specify the desired parent clock for the McASP fck clock. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Correct am33xx snd_platform_data namePeter Ujfalusi2013-12-101-2/+2
| | | | | | | | | An earlier patch overlooked this when the compatible has been changed from omap2 -> am33x. Rename omap2_mcasp_pdata to am33xx_mcasp_pdata. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Change IO functions parameter listPeter Ujfalusi2013-12-101-175/+161
| | | | | | | | | | | Instead of passing __iomem address (mcasp->base + register_offset) pass the main mcasp structure and only access the mcasp->base in the low level IO functions. In most cases this helps with code readability and it will make it easier to switch over to regmap in the future. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Support for McASP version found in DRA7xxPeter Ujfalusi2013-12-101-7/+45
| | | | | | | | | | | | The IP in DRA7xx is similar to the IP found in TI81xxAM3xxx/AM4xxx type of SoCs but it is is integrated with sDMA instead of eDMA. The suitable pcm driver for DRA7xx is the omap-pcm driver which is using dmaengine. In the driver we can configure both dma related structures used for eDMA and sDMA. The only thing we need to make sure that we set the correct dma_data at startup with snd_soc_dai_set_dma_data() Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Fix synchronous master receive modePeter Ujfalusi2013-12-101-1/+47
| | | | | | | | | In synchronous mode both transmit and receive sections are using the TX clocks. In setup like this the TX clocks need to be enabled when capture is running. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Data source (bus) selection supportPeter Ujfalusi2013-12-101-10/+28
| | | | | | | | | | | | The audio data to/from McASP can be sent/received via two method: Via the data port (preferred) or via the configuration bus. Currently the driver assumes that all data communication will be done via the data port. This patch adds support for selecting the configuration port as data interface. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Simplify FIFO configuration codePeter Ujfalusi2013-12-101-71/+30
| | | | | | | | | | | The FIFO registers base address is different in dm646x compared to newer SoCs with McASP IP. Instead of using two paths (switch/case) to handle the difference we can simply pick the correct base address beforehand and use offsets to address the register we need to configure. With this change the indentation depth can be reduced as well. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Be consistent with the use of base in ↵Peter Ujfalusi2013-12-101-6/+6
| | | | | | | | | | davinci_mcasp_set_dai_fmt Replace mcasp->base use with plain base in the davinci_mcasp_set_dai_fmt() function since it has been already used by the remaining part of the function. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Rename private struct and it's users (dev -> mcasp)Peter Ujfalusi2013-12-101-209/+209
| | | | | | | | | | | | Rename the private struct from davinci_audio_dev to davinci_mcasp. Change the local use of the pointer to this struct from *dev to *mcasp. The aim is to have better readable code for the first look since having dev->xxxx in the code when using the local private struct is a bit surprising. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Do not inline the mcasp_set_ctl_reg functionPeter Ujfalusi2013-12-101-1/+1
| | | | | | | It brings no benefit to inline this function due to it's size and function. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Remove unused DAVINCI_MCASP_NUM_SERIALIZER definePeter Ujfalusi2013-12-101-2/+0
| | | | | | | It is not used in the code. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Move private struct definition to source filePeter Ujfalusi2013-12-101-0/+30
| | | | | | | | Since it is a private struct strictly used by the davinci-mcasp driver it can be moved from header file to the source file. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Move register definitions to header filePeter Ujfalusi2013-12-101-267/+0
| | | | | | | | It is better for readability to have the register definitions out from the source file. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Correct dai driver struct initialization for 2nd daiPeter Ujfalusi2013-12-101-1/+1
| | | | | | | Add .name when assigning the dai name. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Move DAVINCI_MCASP_RATE from header to source filePeter Ujfalusi2013-12-101-0/+2
| | | | | | | It is not used outside of the .c file. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Remove redundant num-serializer DT parameterPeter Ujfalusi2013-10-231-17/+5
| | | | | | | | | | | | The serial-dir array gives this information so there is no need to have the num-serializer property in DT description. Just ignore the property in the driver the DTS files can be updated separately without regression. Update the documentation at the same time for davinci-mcasp Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Change compatible property model to more accurateJyri Sarha2013-10-221-1/+1
| | | | | | | | Change the model omap2-mcasp-audio in compatible property to am33xx-mcasp-audio as omap2 does not have mcasp. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Extract DMA channels directly from DTJyri Sarha2013-10-221-14/+31
| | | | | | | | | Extract DMA channels directly from DT as they can not be found from platform resources anymore. This is a work-around until davinci audio driver is updated to use dmaengine. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: Add location for data port registers to DTJyri Sarha2013-10-221-20/+41
| | | | | | | | | | | | This patch adds a separate register location for data port registers to mcasp DT bindings. On am33xx SoCs the McASP registers are mapped trough L4 interconnect, but data port registers are also mapped trough L3 bus to a different memory location. Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> Signed-off-by: Darren Etheridge <detheridge@ti.com> Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: davinci-mcasp: add support for suspend and resumeDaniel Mack2013-10-031-0/+39
| | | | | | | | | | | | When the system returns from suspend, it looses its configuration. Most of it is restored by running a normal audio stream startup, but the DAI format is left unset as that's configured on the audio device creation. Hence, it suffices here to care for the registers which are touched by davinci_mcasp_set_dai_fmt() and restore them when the system is resumed. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* Merge remote-tracking branch 'asoc/topic/davinci' into asoc-nextMark Brown2013-06-171-2/+2
|\
| * ASoC: davinci: Remove redundant use of of_match_ptr macroSachin Kamat2013-06-031-2/+2
| | | | | | | | | | | | | | | | 'mcasp_dt_ids' is always compiled in. Hence of_match_ptr is not necessary. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* | ASoC: davinci: fix sample rotationDaniel Mack2013-05-211-3/+4
|/ | | | | | | | | | | | 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]
* Merge tag 'asoc-v3.10-4' of ↵Takashi Iwai2013-05-031-2/+5
|\ | | | | | | | | | | | | | | | | | | 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.
| * ASoC: McASP: Fix receive clock polarity in DAIFMT_NB_NF mode.Marek Belisko2013-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ASoC: McASP: Add pins output direction for rx clocks when configured in ↵Marek Belisko2013-04-301-1/+4
| | | | | | | | | | | | | | | | | | 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>
* | ASoC: davinci-mcasp: Add Support BCLK-to-LRCLK ratio for TDM modesMichal Bachraty2013-04-231-3/+4
| | | | | | | | | | | | | | | | | | | | 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>
* | ASoC: davinci-pcm, davinci-mcasp: Clean up active_serializersMichal Bachraty2013-04-231-3/+5
| | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'asoc/topic/davinci' into asoc-nextMark Brown2013-04-121-23/+59
|\ \
| * | ASoC: davinci-mcasp: don't overwrite DIT settingsYegor Yefremov2013-04-051-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | ASoC: davinci-mcasp: don't configure AFSX direction in DIT modeYegor Yefremov2013-04-051-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | ASoC: davinci-mcasp: clean up davinci_hw_common_param()Daniel Mack2013-03-121-23/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | ASoC: davinci-mcasp: Add support for multichannel playbackMichal Bachraty2013-03-041-8/+58
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | ASoC: switch over to use snd_soc_register_component() on davinci mcaspKuninori Morimoto2013-03-261-5/+10
|/ | | | | Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* ASoC: McASP: Fix data rotation for playback. Enables 24bit audio playbackMichal Bachraty2013-01-271-1/+1
| | | | | | | | | | | | | | 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>
* ASoC: McASP: implement a way to force BCLK/LRCLK ratiosDaniel Mack2012-12-071-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ASoC: McASP: calculate values for channel sizeDaniel Mack2012-12-071-53/+10
| | | | | | | | | | | | | 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>
OpenPOWER on IntegriCloud