VoCore: Audio Driver

Special thanks to Guangqian Luo. When I am debugging my linux audio driver, he notified me there already exists source code in linux kernel/ALSA and it really works. He is using the right way doing the work but I am not 😀 I am reinventing the wheel…ALSA exists code is much better than mine.

To make WM8960 work, we need five necessary parts:
1. I2C interface, used to transfer command to WM8960.
2. I2S interface, used to transfer data to WM8960.
3. WM8960 driver, used to call I2S, I2C driver.
4. ALSA middle layer driver, used to connect user and kernel.
5. DMA interface, used to smooth data transfer between software and hardware.

1. I2C part, that is easy, we use i2c-gpio, based on gpio 11,14.
add these lines to VOCORE.dts, root part.

        i2c-gpio {
                compatible = "i2c-gpio";
                gpios = <&gpio0 11 0 &gpio0 14 0>;
                i2c-gpio,delay-us = <2>; /* around 400KHz */

                #address-cells = <1>;
                #size-cells = <0>;

                wm8960: wm8960@1a {
                        compatible = "wm8960";
                        reg = <0x1a>;
                };
        };

2. I2S interface, source code already there, in [kernel]/sound/soc/ralink/mt7620-i2s.c
This is for MT7620, but I checked datasheet, the register of MT7620 and RT5350 are 99% same, only one bit is not same but nothing matter.

3. WM8960 driver.
[kernel]/sound/soc/codecs/wm8960.c

4. ALSA driver.
[kernel]/sound/soc/ralink/mt7620-wm8960.c

5. DMA driver.
[kernel]/drivers/dma/ralink-gdma.c

Haha, the codes are clean and stable(OpenWRT 14.07, Linux 3.10.49), looks like my code is useless now, maybe later it can be used to help starter learn kernel driver.

I will base on the exists source make a new firmware soon.