6.9.2. AudioCodec配置

6.9.2.1. 内核配置

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

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

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

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

6.9.2.2. DTS配置

6.9.2.2.1. m4配置

codec: codec@18610000 {
    #sound-dai-cells = <0>;
    compatible = "zx,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 = "zx,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的值。