]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ASoC: fsl_sai: Fix buggy configurations in trigger()
authorNicolin Chen <Guangyu.Chen@freescale.com>
Tue, 1 Apr 2014 03:17:06 +0000 (11:17 +0800)
committerNitin Garg <nitin.garg@freescale.com>
Fri, 16 Jan 2015 03:16:47 +0000 (21:16 -0600)
commit7f191398306b6199cdf431272c9ddd8c7024a9bc
tree3566e6c9a8d39f6bbc6594432fdb9b027725e649
parented5e1cfbad32ccc5cd061b2fc7cb36dc1ae956e9
ASoC: fsl_sai: Fix buggy configurations in trigger()

The current trigger() has two crucial problems:
1) The DMA request enabling operations (FSL_SAI_CSR_FRDE) for Tx and Rx are
   now totally exclusive: It would fail to run simultaneous Tx-Rx cases.
2) The TERE disabling operation depends on an incorrect condition -- active
   reference count that only gets increased in snd_pcm_open() and decreased
   in snd_pcm_close(): The TERE would never get cleared.

So this patch overwrites the trigger function by following these rules:
A) We continue to support tx-async-while-rx-sync-to-tx case alone, which's
   originally limited by this fsl_sai driver, but we make the code easy to
   modify for the further support of the opposite case.
B) We enable both TE and RE for PLAYBACK stream or CAPTURE stream but only
   enabling the DMA request bit (FSL_SAI_CSR_FRDE) of the current direction
   due to the requirement of SAI -- For tx-async-while-rx-sync-to-tx case,
   the receiver is enabled only when both the transmitter and receiver are
   enabled.

Tested cases:
a) aplay test.wav -d5
b) arecord -r44100 -c2 -fS16_LE test.wav -d5
c) arecord -r44100 -c2 -fS16_LE -d5 | aplay
d) (aplay test2.wav &); sleep 1; arecord -r44100 -c2 -fS16_LE test.wav -d1
e) (arecord -r44100 -c2 -fS16_LE test.wav -d5 &); sleep 1; aplay test.wav -d1

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Acked-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e6b398465821fb8e08d208bd4ef2b5b73ce87b58)
sound/soc/fsl/fsl_sai.c
sound/soc/fsl/fsl_sai.h