6.8.2. I2S配置

6.8.2.1. 内核配置

按照ALSA的框架设计,I2S的数据传输使用DMA方式,需要DMA-engine的支持,所以在menuconfig中 需要打开DMA-engine的驱动支持。

Device Drivers--->
    [*] DMA Engine support--->
            <*> ZX SoCs DMA support

在menuconfig中打开ALSA框架的支持,使能AIC的I2S驱动

Device Drivers--->
    <*> Sound card support--->
            <*> Advanced Linux Sound Architecture--->
                    <*> ALSA for SoC audio support--->
                            <*> ZX I2S Support

6.8.2.2. DTS配置

6.8.2.2.1. M4

i2s0: i2s@18600000 {
    #sound-dai-cells = <0>;
    compatible = "zx,aic-i2s-v1.0";
    reg = <0x18600000 0x400>;
    interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&cmu CLK_I2S0>;
    resets = <&rst RESET_I2S0>;
    dmas = <&dma DMA_I2S0>, <&dma DMA_I2S0>;
    dma-names = "rx", "tx";
};

i2s1: i2s@18601000 {
    #sound-dai-cells = <0>;
    compatible = "zx,aic-i2s-v1.0";
    reg = <0x18601000 0x400>;
    interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&cmu CLK_I2S1>;
    resets = <&rst RESET_I2S1>;
    dmas = <&dma DMA_I2S1>, <&dma DMA_I2S1>;
    dma-names = "rx", "tx";
};

xxx-board.dts中的配置

&i2s0 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2s0_clk_pins>;
    status = "disabled";
};

&i2s1 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2s1_clk_pins>, <&i2s1_mclk_pins>, <&i2s1_din_pins_b>;
    status = "okay";
};

根据实际的板型配置,使能相应的I2S