[alsa-devel] Fwd: enabling a20 allwinner audio codec to 24bit

Ricardo Crudo ricardo.crudo at gmail.com
Thu May 22 23:30:35 CEST 2014


I'm working with sunxi-codec of allwinner A20 device. Currently the
codec driver works only for 16bit mode, the source code can be found
here: https://github.com/linux-sunxi/linux-sunxi/tree/sunxi-3.4/sound/soc/sunxi,
 and the A20 datasheet here:

Reading the allwinner A20 datasheet and doing some modifications on
sunxi code I managed the codec to work in 24bit mode. However, it
isn't working properly. When I play a stereo wav file using the aplay
command the audio data of both channels are played mixed in only one
channel and the another channel didn't plays any sound.

For example, picture a wav stereo file with this samples:
left  right
0.5  -0.5
0.4  -0.4
0.3  -0.3
0.2  -0.2

The played sound is:
left   right
 0.5  0.0
-0.5  0.0
 0.4  0.0
-0.4  0.0
 0.3  0.0
-0.3  0.0
 0.2  0.0
-0.2  0.0

The A20 datasheet says:
"DAC TX DATA REGISTER (TXDATA): Transmitting left, right channel
sample data should be written this register one by one. The left
channel sample data is first and then the right channel sample."

I guess that this is related with the problem, despite the datasheet
didn't notify, I think that in 16bit mode the TXDATA transmits both
channels data together as the register is 32bit.

I'm not familiar writing alsa driver and other alsa working concepts.
I hope someone can help me with this.

The diff file of sunxi-codec.c is here: http://pastebin.com/raw.php?i=SvypkVU6

I appreciate any help.


More information about the Alsa-devel mailing list