VoCore2: alsa driver patch 1

Finally I recover from the fever, so happy back to work 🙂

Combine VoCore2 Ultimate firmware to latest openwrt is always one of my dream. Today I start first step.

VoCore2 ultimate has one driver is different than the single board version, it is ES8388 codec driver, but limited to my patch skill, it is so hard for me to patch it to openwrt system. After port mediatek wireless driver, I understand some of the secret now, so I can push the first version of es8388 driver to github/vonger/vocore2.


this patch has four files, 810,811 used to patch linux kernel, put it into openwrt/target/linux/ramips/patch 4.14/ then it should work. 811 is used to fix pinctrl driver, because refclk this name has used in many places, if we do not change the name, it will conflict with function named refclk. This patch I will try to submit to openwrt later, it is a bug. 🙂

rest is dts, VOCORE2.dtsi I change refclk pinmux from gpio to gpio refclk, so gpio0 pin will work as 12MHz clock.

PS: gpio0 is not real GPIO 0, it is actually GPIO 11 in register, nobody knows why ralink engineer named it gpio0, you can check its datasheet, really mess :p

How to use?

after patch everything and use the new dts then compile and flash to V2U(a lot of work), you can now try it.

But as I said, this is not a stable driver…es8388 driver is acting weird because I am a noob of alsa. I have to left some back door for hack. 🙂

in /sys/devices/platform/i2c-gpio/i2c-0/0-0010/ there are two file node named i2cread and i2cwrite, used to directly write to es8388 i2c driver and control the codec directly.

Before you use aplay xxx.wav play some sound, please run this command:

echo enable left mixer.
echo 2780 > /sys/devices/platform/i2c-gpio/i2c-0/0-0010/i2cwrite
echo enable right mixer.
echo 2a80 > /sys/devices/platform/i2c-gpio/i2c-0/0-0010/i2cwrite

echo 1a00 > /sys/devices/platform/i2c-gpio/i2c-0/0-0010/i2cwrite
echo 1b00 > /sys/devices/platform/i2c-gpio/i2c-0/0-0010/i2cwrite
echo 2e1e > /sys/devices/platform/i2c-gpio/i2c-0/0-0010/i2cwrite
echo 2f1e > /sys/devices/platform/i2c-gpio/i2c-0/0-0010/i2cwrite

first four lines are used to fix the wired bug, maybe my dts sound path setting is not correct cause this problem…(but everything looks correct for me)
second four lines are used to set the volume of left channel/right channel to max, careful your ear! 🙂

PSS: second four lines because I can not find a way to raise volume in aplay, in madplay volume works normal, if you use madplay, ignore those four lines.

My compiled firmware, just for test: http://vonger.cn/misc/vocore2/20181010-AUDIOTEST.bin

PSSS: recently github transfer speed is really fast, normally only 100KB/s, have to wait almost two hours…lol, should we thanks to Microsoft?