Edit online

Audio Codec 配置

14 Nov 2024
Read time: 2 minute(s)
Audio Codec 包括以下配置内容:
  1. 内核配置
    按照 ALSA 的框架设计,AudioCodec 的数据传输使用 DMA 方式,需要 engine 的支持,所以在 menuconfig 中需要打开 DMA-engine 的驱动支持。
    Device Drivers--->
        [*] DMA Engine support--->
                <*> ArtInChip SoCs DMA support
    在 menuconfig 中打开 ALSA 框架的支持,使能 AIC 的 AudioCodec 驱动
    Device Drivers--->
        <*> Sound card support--->
                <*> Advanced Linux Sound Architecture--->
                        <*> ALSA for SoC audio support--->
                                <*> ArtInChip CODEC Support
  2. DTS 配置

    d211 配置

    codec: codec@18610000 {
        #sound-dai-cells = <0>;
        compatible = "artinchip,aic-codec-v1.0";
        reg = <0x18610000 0x400>;
        interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&cmu CLK_CODEC>;
        resets = <&rst RESET_CODEC>;
        dmas = <&dma DMA_CODEC>, <&dma DMA_CODEC>;
        dma-names = "rx", "tx";
    };
    
    codec-analog {
        #sound-dai-cells = <0>;
        compatible = "artinchip,codec-analog";
        dmas = <&dma 15>, <&dma DMA_CODEC>;
        dma-names = "rx", "tx";
    };

    xxx/board.dts 中的配置

    &codec {
        pinctrl-names = "default";
        pinctrl-0 = <&amic_pins>, <&dmic_pins_a>, <&spk_pins_b>;
        pa-gpios = <&gpio_f 13 GPIO_ACTIVE_LOW>;
        status = "okay";
    };

    根据实际的板级配置,设置 pinctrl-0 的值。