linux/sound/soc
Alexander Sverdlin 7322ce21cd ASoC: EP93xx: fixed LRCLK rate and DMA oper. in I2S code
Changelog:
1. I2S module of EP93xx should be feed by 32bit DMA transfers. This is
hardware limitation and that's the way original Cirrus's driver worked.
This will fix distorted sound playback and make capture actually work in
present ep93xx drivers.

I've found, that author of code, on which modern ep93xx-i2s.c and
ep93xx-pcm.c are based, had faced this problem also in 2007:
http://blog.gmane.org/gmane.linux.ports.arm.cirrus/month=20070101/page=3

Now SoC code uses his developments, but not overcomes the hardware
issues. Some details from EP93xx users guide:

Both I2S transmitter and receiver have similar 16x32bit FIFO, where they
store 8 samples for both left and right channels. The FIFO is always
32bit wide and should be properly aligned if you use samples of other
width. Transmitter and receiver have configuration registers for
selection of I2S word length (16, 24, 32). They are I2STXWrdLen and
I2SRXWrdLen.

Yes, EP93xx DMA can do byte, word and quad-word transfers. The width for
transfers to and from peripherals is selected by particular module
configuration. Lucky AC97 module has such configuration: AC97RXCRx
registers, bit CM (Compact mode enable) switches between 16 and 32 bit
samples. AC97TXCRx registers have the same bits for transmitters.
ep93xx-ac97.c enables this compact mode and so has all the rights to use
S16_LE format.
No one has found such a configuration in I2S module until now in any
Cirrus manuals. I2S module always feeds it's 32bit wide FIFO with 32bit
samples consecutively for left and right channels. You cannot use 32-bit
DMA transfers to transfer two 16-bit samples.

So we can use two formats for AC97, but should remove all but S32_LE for
I2S. Always using 32 bit chunks is not a problem for I2S, the codec I
use uses less bits too (24), it's permitted by I2S standard.

In proposed patch formats list shortened to just S32_LE, this makes all
the DMA transactions right, while ALSA will do all sample format
translation for us.

2. Incorrect setting of LRCLK (2 times slower) in original ep93xx-i2s.c
masks the first problem.

DMA takes two 16 bit samples instead of one, overall sound speed seems
to be normal, but you get actually 4000 sampling rate instead of
requested 8000 and therefore some noise... This is also the reason why
the capture function not worked at all in this driver...

If we take a look into I2S specification, we will figure that LRCLK MUST
be equal to sample rate, if we are talking about stereo (in mono too,
but it's not our case at all).

In proposed patch SCLK and LRCLK rates are corrected, assuming we always
send 32 bits * 2 channels to codec.

Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-01-17 14:10:00 +00:00
..
atmel Merge branch 'for-2.6.37' into for-2.6.38 2010-11-25 11:17:24 +00:00
au1x ASoC: Do not include soc-dapm.h 2010-11-22 14:04:41 +00:00
blackfin ASoC: Do not include soc-dapm.h 2010-11-22 14:04:41 +00:00
codecs ASoC: WM8990: msleep() takes milliseconds not jiffies 2011-01-17 14:09:44 +00:00
davinci ASoC: Remove needless inclusion of tlv320aic3x.h from machine drivers 2011-01-05 11:28:50 +00:00
ep93xx ASoC: EP93xx: fixed LRCLK rate and DMA oper. in I2S code 2011-01-17 14:10:00 +00:00
fsl ASoC: Add missing dev_set_drvdata in p1022_ds_probe 2010-11-29 18:28:53 +00:00
imx Merge branch 'for-2.6.37' into for-2.6.38 2010-11-25 11:17:24 +00:00
jz4740 ASoC: Do not include soc-dapm.h 2010-11-22 14:04:41 +00:00
kirkwood ASoC: Do not include soc-dapm.h 2010-11-22 14:04:41 +00:00
nuc900 Merge branch 'for-2.6.37' into for-2.6.38 2010-11-30 11:35:43 +00:00
omap Merge branch 'for-2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/asoc-2.6 into topic/asoc 2011-01-12 07:20:30 +01:00
pxa Merge branch 'for-2.6.37' into for-2.6.38 2010-11-25 11:17:24 +00:00
s6000 ASoC: Remove needless inclusion of tlv320aic3x.h from machine drivers 2011-01-05 11:28:50 +00:00
samsung ASoC: RX1950: Enable Mic Jack during glue driver init 2011-01-10 11:47:49 +00:00
sh ASoC: fix migor audio build 2011-01-11 11:00:55 +00:00
txx9 ASoC: multi-component - ASoC Multi-Component Support 2010-08-12 14:00:00 +01:00
Kconfig ASoC: Make LZO cache compression optional 2010-12-21 23:17:18 +00:00
Makefile ASoC: Samsung: Rename from s3c24xx to samsung 2010-11-23 14:13:04 +00:00
soc-cache.c ASoC: soc-cache: Fix invalid memory access during snd_soc_lzo_cache_sync() 2011-01-11 18:27:08 +00:00
soc-core.c ASoC: Fix the device references to codec and platform drivers 2011-01-05 11:29:00 +00:00
soc-dapm.c ASoC: don't pass the string as the format arguemtn for dev_info() 2010-12-22 14:08:40 +01:00
soc-jack.c ASoC: Add trace events for jack detection 2010-12-06 14:13:42 +00:00
soc-utils.c ASoC: Add BCLK calculation utility for TDM mode too 2009-11-25 19:55:46 +00:00