博通wifi芯片的坑
小爱同学用的wifi芯片和树莓派zero的差不太多,不难解决
&mmc1 {
pinctrl-names = "default";
pinctrl-0 = <&mmc1_pg_pins>;
vmmc-supply = <®_aldo1>;
mmc-pwrseq = <&wifi_pwrseq>;
bus-width = <4>;
non-removable;
status = "okay";
};
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pg_pins>, <&uart1_cts_rts_pg_pins>;
uart-has-rtscts;
status = "okay";
bluetooth {
compatible = "brcm,bcm43438-bt";
clocks = <&rtc 1>;
clock-names = "lpo";
vbat-supply = <®_dldo1>;
vddio-supply = <®_aldo3>;
device-wakeup-gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
host-wakeup-gpios = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */
shutdown-gpios = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
};
};
®_dldo1 {
regulator-always-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc-wifi0";
};
®_dldo2 {
regulator-always-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc-wifi1";
};
wifi_pwrseq: wifi_pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL06 */
clocks = <&rtc 1>;
clock-names = "ext_clock";
};
全志 sun8i 声音的坑
一开始在内核里勾选 sun8i-codec 发现在启动时alsa根本认不出系统的声卡。研究设备树发现sun8i的codec是通过i2s连接,并依赖simple-card和sun4i-i2s这两个内核模块,勾选以下的内核模块问题得到解决
CONFIG_SND_SUN8I_CODEC
CONFIG_SND_SUN8I_ADDA_PR_REGMAP=y
CONFIG_SND_SOC_XTFPGA_I2S=y
CONFIG_ZX_TDM=y
CONFIG_SND_SIMPLE_CARD=y
CONFIG_SND_SOC_I2C_AND_SPI=y
CONFIG_SND_SUN8I_CODEC_ANALOG
同时要在设备树里开启codec
&sound {
/* Board level jack widgets */
simple-audio-card,widgets = "Microphone", "Microphone Jack",
"Headphone", "Headphone Jack";
/* Board level routing. First 2 routes copied from SoC level */
simple-audio-card,routing =
"Left DAC", "AIF1 Slot 0 Left",
"Right DAC", "AIF1 Slot 0 Right",
"HP", "HPCOM",
"Headphone Jack", "HP",
"MIC1", "Microphone Jack",
"Microphone Jack", "MBIAS";
status = "okay";
};
&dai {
status = "okay";
};
&codec {
status = "okay";
};
编译后内核是认出来声卡了,但是没有声音,分析了下电路发现是要使能功放(PH05),不太会设备树,就暂且把它写成一颗led
leds {
compatible = "gpio-leds";
codecd {
label = "love:codecd:power";
gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>;
default-state = "on";
};
};
把一个喇叭接到后面的接口上小爱就有声音了!!
可以用gmediarender推送dlna了
尚未解决的坑 : AC108 CODEC
小爱同学mini有两个版本,一种是有两颗ac108,一种是只有一颗ac108,在全志tina的4.9内核里有这个驱动,还有树莓派的seeed 麦克风HAT用了这个芯片。然而个人水平有限,还没有解决问题。主要是tina的驱动过不了编译,改了许多地方仍然出错。而树莓派HAT的驱动虽然支持主线但是它是基于simple-card重新造了一套轮子,导致和simple-card不能通用,也就是说声音和录音只能选一个。。。。。
一些尝试
sun4i-i2s 在主线中并不支持dsp_a模式,所以5.4内核要想用dsp_a需要使用5.7内核中的驱动,并且重新写一个sound设备树节点和定义a33的i2s节点。
别问我是怎么知道的。。。
定义A33的i2s
i2s0: i2s@1c22000 {
#sound-dai-cells = <0>;
compatible = "allwinner,sun6i-a31-i2s";
reg = <0x01c22000 0x400>;
interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_I2S0>, <&ccu CLK_I2S0>;
clock-names = "apb", "mod";
resets = <&ccu RST_BUS_I2S0>;
dmas = <&dma 3>, <&dma 3>;
dma-names = "rx", "tx";
status = "disabled";
};
i2s1: i2s@1c22400 {
#sound-dai-cells = <0>;
compatible = "allwinner,sun6i-a31-i2s";
reg = <0x01c22400 0x400>;
interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_I2S1>, <&ccu CLK_I2S1>;
clock-names = "apb", "mod";
resets = <&ccu RST_BUS_I2S1>;
dmas = <&dma 4>, <&dma 4>;
dma-names = "rx", "tx";
status = "disabled";
};
在pinctrl里加入i2s占用的引脚
/*i2s0 pins*/
i2s0_pins_bclk: i2s0@0 {
pins = "PB5";
function = "i2s0";
};
i2s0_pins_lrck: i2s0@1 {
pins = "PB4";
function = "i2s0";
};
i2s0_pins_do0: i2s0@2 {
pins = "PB6";
function = "i2s0";
};
i2s0_pins_di: i2s0@3 {
pins = "PB7";
function = "i2s0";
};
/*i2s1 pins*/
i2s1_pins_bclk: i2s1@0 {
pins = "PG11";
function = "i2s1";
};
i2s1_pins_lrck: i2s1@1 {
pins = "PG10";
function = "i2s1";
};
i2s1_pins_do0: i2s1@2 {
pins = "PG12";
function = "i2s1";
};
i2s1_pins_di: i2s1@3 {
pins = "PG13";
function = "i2s1";
};
小爱设备树中加入sound1节点
写了两个版本,用hat驱动的就只是替换一下simple-card字段就不放了
sound1: sound@1 {
compatible = "simple-audio-card";
simple-audio-card,format = "dsp_a";
simple-audio-card,name = "ac108-4mic-voicecard";
status = "disabled";
simple-audio-card,bitclock-master = <&codec_dai>;
simple-audio-card,frame-master = <&codec_dai>;
simple-audio-card,channels-playback-override = <4>;
simple-audio-card,channels-capture-override = <4>;
cpu_dai: simple-audio-card,cpu {
sound-dai = <&i2s0>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
dai-tdm-slot-tx-mask = <1 1 0 0>;
dai-tdm-slot-rx-mask = <1 1 0 0>;
};
codec_dai: simple-audio-card,codec {
sound-dai = <&ac108_a>;
clocks = <&ac108_mclk>;
};
};
使能i2s0 和 i2c1
&i2s0 {
#sound-dai-cells = <0>;
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&i2s0_pins_bclk &i2s0_pins_lrck &i2s0_pins_do0 &i2s0_pins_di>;
pinctrl-names = "default";
status = "okay";
};
&i2c1 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
ac108_a: ac108@3b{
compatible = "x-power,ac108_0";
reg = <0x3b>;
#sound-dai-cells = <0>;
data-protocol = <0>;
};
};
使用seeed-voice-card的驱动虽然可以认到声卡,但是录音时会出现问题
arecord也可以认出设备
头疼。。。
希望有大神可以帮忙指点一下。。。。。
相关的我已经放到一个仓库里了。。。。
白嫖