Edit online

I2S 配置

2 Dec 2024
Read time: 2 minute(s)
I2S 包括以下配置内容:
  1. 内核配置

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

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

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

  2. DTS 配置
    • D211
      i2s0: i2s@18600000 {
          #sound-dai-cells = <0>;
          compatible = "artinchip,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 = "artinchip,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。