redchenjs / mt762x-wm8960

MT762X WM8960 ALSA SoC machine driver
GNU General Public License v2.0
27 stars 22 forks source link

aplay -l命令找不到声卡 #11

Closed guoai2015 closed 2 years ago

guoai2015 commented 2 years ago

按照文档配置编译镜像刷机后输入 aplay -l 命令提示:no soundcards found... 求大神帮忙看看dts文件是否配置有问题。

#include "mt7620a.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
    compatible = "egb,egb-v20", "ralink,mt7620a-soc";
    model = "EGB-V20";

    aliases {
        led-boot = &led_sys;
        led-failsafe = &led_sys;
        led-running = &led_sys;
        led-upgrade = &led_sys;
        label-mac-device = &ethernet;
    };

    chosen {
        /* bootargs = "console=disable"; */
        bootargs = "console=ttyS1,57600";
    };

    leds {
        compatible = "gpio-leds";

        led_sys: sys {
            label = "egbv20:blue:sys";
            gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
        };

        4g {
            label = "egbv20:blue:4g";
            gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
        };

        ac220-1 {
            label = "egbv20:blue:ac220-1";
            gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
        };

        ac220-2 {
            label = "egbv20:blue:ac220-2";
            gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
        };
    };

    keys {
        compatible = "gpio-keys";

        reset {
            label = "reset";
            gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
            linux,code = <KEY_RESTART>;
        };
    };

    gpio_export {
        compatible = "gpio-export";
        #size-cells = <0>;

        kr_ch0 {
            gpio-export,name = "kr_ch0";
            gpio-export,output = <1>;
            gpios = <&gpio2 22 GPIO_ACTIVE_LOW>;
        };
        kr_ch1 {
            gpio-export,name = "kr_ch1";
            gpio-export,output = <1>;
            gpios = <&gpio2 23 GPIO_ACTIVE_LOW>;
        };
    };

    sound {
        compatible = "mediatek,mt762x-wm8960-machine";
        mediatek,platform = <&i2s>;
        mediatek,audio-codec = <&codec>;
        audio-routing =
            "Ext Spk", "SPK_RN",
            "Ext Spk", "SPK_RP",
            "Mic", "MICB",
            "LINPUT1", "Mic",
            "LINPUT2", "Line In",
            "RINPUT1", "Line In";
    };
};

&uart {
    pinctrl-names = "default";
    pinctrl-0 = <&i2s_uartf_pins>;

    status = "okay";
};

&gpio1 {
    status = "okay";
};

&gpio2 {
    status = "okay";
};

&gpio3 {
    status = "okay";
};

&i2c {
    status = "okay";

    codec: wm8960@1a {
        compatible = "wlf,wm8960";
        reg = <0x1a>;
        wlf,shared-lrclk;
    };
};

&i2s {
    #sound-dai-cells = <0>;
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&i2s_uartf_pins>;
};

&gdma {
    status = "okay";
};

&spi0 {
    status = "okay";

    flash@0 {
        compatible = "jedec,spi-nor";
        reg = <0>;
        spi-max-frequency = <10000000>;

        partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;

            partition@0 {
                label = "u-boot";
                reg = <0x0 0x30000>;
                read-only;
            };

            partition@30000 {
                label = "u-boot-env";
                reg = <0x30000 0x10000>;
                read-only;
            };

            factory: partition@40000 {
                label = "factory";
                reg = <0x40000 0x10000>;
                read-only;
            };

            partition@50000 {
                compatible = "denx,uimage";
                label = "firmware";
                reg = <0x50000 0xfb0000>;
            };
        };
    };
};

&spi1 {
    status = "okay";
};

&ehci {
    status = "okay";
};

&ohci {
    status = "okay";
};

&sdhci {
    status = "okay";
};

&pcie {
    status = "okay";
};

&ethernet {
    pinctrl-names = "default";
    pinctrl-0 = <&ephy_pins>;

    mtd-mac-address = <&factory 0x4>;

    mediatek,portmap = "wllll";
};

&gsw {
    ralink,port4 = "ephy";
};

&wmac {
    ralink,mtd-eeprom = <&factory 0x0>;
};

&state_default {
    gpio {
        groups = "mdio", "rgmii1", "rgmii2", "wdt";
        function = "gpio";
    };
    wled {
        groups = "wled";
        function = "wled";
    };
};

&pinctrl {
    i2s_uartf_pins: uartf_i2s {
        uartf_i2s {
            groups = "uartf";
            function = "i2s uartf";
        };
    };
};

原理图

redchenjs commented 2 years ago

@guoai2015 dmesglsmod 的输出贴一下

guoai2015 commented 2 years ago

十分感谢大佬回复,我把设备树的i2s配置改了一下,然后加上PulseAudio的配置,现在可以找到声卡了。 改成了这样:

&i2s {
    status = "okay";
};

有个疑问就是,如原理图里,使用的是外部12Mhz的振荡器,没有用主芯片的时钟信号,是不是就不用管,默认配置就行?

redchenjs commented 2 years ago

对的,用外部晶振不需要配置refclk部分,但原理图中ADCLRC引脚是浮空的,需要对照README修改一下才能使用录音功能

guoai2015 commented 2 years ago

好的,再次感谢!