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>
McASP serial audio engine needs different rotation values on TX and RX
channels. Commit dde109fb46 ("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]
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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJRg3/MAAoJELSic+t+oim9W+cP/3NERwICTNvllNOrZXii7akJ
DnzzIaw0fEJ2+hIXJzU/lEI/KjqIT7SADQRWg+eid8ZrjaUB6LXUPPuv67V4TseD
1+8ClQp1cDg1KepBcD2S1liVjPKvW64IpXwZNgLGigW6PP21yK8+DoQvVKPVB+sP
q72jntTzy9qWenmjygpPEYDeOfe5EM7hAaa2tFuYIPEL+EkMOXXvjx8ojylwQV6V
5xFQ+CBSS8WHz7CKlawF3JH8TkcFGZNT9Hibhv1fpGM+iJDCsh/+MNiBwOpO+1wk
eCJSiCWWTGgVK+3AvlSIQr8ml0EDEbS8Aq6bbJb9w4wgV65oFt2hOxOpkcK/8NcP
qnKNYc3nRQsb3H+dObMdQNPWDjOfwsolKUOjetxosRIq4Pzm8afY96gu06EqTnw9
XYXqoSAVpCuPDpmlu87Lajoj4T5XNq3G7ONAMpsAfMrl/xxmV11Wrs4/7S0o3Csb
tNhO5XjLbFNTw9nVT6qZQViH7Bm1ItDM2B/tLb1yqnlgBAjNW/WlUyFg4bE4Qeyr
hUg7DwvYPSVnr25t8RmPMmB2MdD4N+PfRy+aIEIuE9KMeYUTPVr5kFdDP7uA7Yw2
Dn7lmAdDEq33zfTGYhGWs87IdxhD3VyEWveR6alrtBW0LS7ArtsPlWKhA074XuJj
AmAU6RS3+75nymA9ucY+
=WQzu
-----END PGP SIGNATURE-----
Merge tag 'asoc-v3.10-4' of 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.
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>
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>
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>
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>
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>
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>
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>
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>
Convert MicBias widgets to supply widget.
On tlv320aic3x, Mic bias power on/off shares the same register bits
with output mic bias voltage. So, when power on mic bias, we need
reclaim it to voltage value.
Provide a new platform data so that the micbias voltage can be sent
according to board requirement. Now since tlv320aic3x codec driver
is DT aware, update dt files and functions to handle this new
"micbias-vg" platform data.
Because of sharing of bits, when enabling the micbias, voltage also
needs to be updated. So use SND_SOC_DAPM_POST_PMU & SND_SOC_DAPM_PRE_PMD
macro to create an event to handle this.
Since micbias is converted to supply widget, updated machine drivers as
well.
This change is runtime tested on da850-evm with audio loopback
(arecord|aplay) for confirmation.
Signed-off-by: Hebbar Gururaja <gururaja.hebbar@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Fix typo caused by recent commit (cf53756 - ASoC: davinci: davinci-pcm
does not need to be a plaform_driver)
Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
Davinci McASP header & driver are shared by few OMAP platforms (like
TI81xx, AM335x). Splitting asp header into Davinci platform specific
header and Audio specific header helps to share them across platforms.
Audio specific defines is moved to to common
<linux/platform_data/davinci_asp.h> so that the header can be
accessed by all related platforms.
While here, correct the header usage (remove multiple header
re-definitions and unused headers) and remove platform names from
structures comments and enum. Also some some coding style errors.
Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Acked-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
* 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>
Defines or parameters from <mach/mux.h> isn't used anywhere. Hence
remove the header include.
Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
This is a follow up on 53dea36c70 which fixes the other affected
pcm engines.
Description from 53dea36c70:
Don't rely on the codec's channels_min information to decide wheter or
not allocate a substream's DMA buffer. Rather check if the substream
itself was allocated previously.
Without this patch I was seeing null-pointer dereferenc in atmel-pcm.
Signed-off-by: Joachim Eastwood <joachim.eastwood@jotron.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
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>
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.
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Missed .owner of struct snd_soc_card will prevent the module from being
removed from underneath its users.
Reported-by: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (549 commits)
ALSA: hda - Fix ADC input-amp handling for Cx20549 codec
ALSA: hda - Keep EAPD turned on for old Conexant chips
ALSA: hda/realtek - Fix missing volume controls with ALC260
ASoC: wm8940: Properly set codec->dapm.bias_level
ALSA: hda - Fix pin-config for ASUS W90V
ALSA: hda - Fix surround/CLFE headphone and speaker pins order
ALSA: hda - Fix typo
ALSA: Update the sound git tree URL
ALSA: HDA: Add new revision for ALC662
ASoC: max98095: Convert codec->hw_write to snd_soc_write
ASoC: keep pointer to resource so it can be freed
ASoC: sgtl5000: Fix wrong mask in some snd_soc_update_bits calls
ASoC: wm8996: Fix wrong mask for setting WM8996_AIF_CLOCKING_2
ASoC: da7210: Add support for line out and DAC
ASoC: da7210: Add support for DAPM
ALSA: hda/realtek - Fix DAC assignments of multiple speakers
ASoC: Use SGTL5000_LINREG_VDDD_MASK instead of hardcoded mask value
ASoC: Set sgtl5000->ldo in ldo_regulator_register
ASoC: wm8996: Use SND_SOC_DAPM_AIF_OUT for AIF2 Capture
ASoC: wm8994: Use SND_SOC_DAPM_AIF_OUT for AIF3 Capture
...
SND_DM365_EXTERNAL_CODEC does not exist, so it's a useless default.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The core will sync DAPM as part of the card initialization, there is no
need for machine drivers to do so during their setup.
OMAP drivers are omitted as I know Peter already has patches for them.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Commit 75d9ac4 ("ASoC: Allow DAI formats to be specified in the dai_link")
changed DAI format flag values and we cannot simply invert anymore e.g.
frame-sync with ^= SND_SOC_DAIFMT_NB_IF (which was anyway misuse) as there
is no anymore fixed bit position for bit-clock or frame-sync inversion.
Fix this by relying only on DAI format flag values passed to us and by not
making any assumption on individual bit positions
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Cc: Vaibhav Bedia <vaibhav.bedia@ti.com>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
The ambiguously named variable 'link' is used as a temporary throughout
davinci-pcm -- its presence makes grepping (and groking) the code
difficult.
Replace link with the value of link in almost all sites. The exception
is a couple places where the last-assigned link/chan needs to be
returned by a function -- in these cases, rename to last_link.
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>