redchenjs / mt762x-wm8960

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

新版本的openwrt上无法使用 #5

Closed PolyLin closed 3 years ago

PolyLin commented 3 years ago

你好, 我在最新的版本的openwrt上使用这个package, 发现错误. 看过去错误是在找platform驱动的时候没有找到, 日志如下, openwrt的版本是git上的最新版本, 使用的profile是hilink的HLK-7628N. [ 13.955565] urngd: v1.0.2 started. [ 14.235018] i2c /dev entries driver [ 14.252014] ralink_gdma: module is from the staging directory, the quality is unknown, you have been warned. [ 14.321049] call snd_soc_init:3569 [ 14.327907] call snd_soc_util_init:165 [ 14.358219] i2c-mt7621 10000900.i2c: clock 100 kHz [ 14.409380] random: crng init done [ 14.416161] random: 1 urandom warning(s) missed due to ratelimiting [ 14.566627] call mt762x_wm8960_machine_probe:80 [ 14.575682] of_parse_phandle, platform_node:80854bb0, platform_node->name:i2s [ 14.589811] of_parse_phandle, codec_node:80854a6c, codec_node->name:wm8960 [ 14.603470] snd_soc_register_card, card->name:MT762X WM8960 ASoC Card [ 14.616223] card->num_links:1 [ 14.622093] for_each_card_prelinks,i:0,card->name:MT762X WM8960 ASoC Card [ 14.635535] soc_init_dai_link, name:wm8960-codec, stream_name:wm8960-hifi, num_codecs:1, num_platforms:1 [ 14.654304] found codecs ...... [ 14.660524] codec:0, name:(null), dai_name:wm8960-hifi, of_node:80854a6c [ 14.673791] snd_soc_is_matching_component...... [ 14.682759] found dlc->of_node:80854a6c, name:wm8960 [ 14.692583] found platforms ...... [ 14.699314] platform:0, name:(null), of_node:80854bb0 [ 14.709314] platform->of_node, name:i2s, full_name:i2s@a00 [ 14.720170] snd_soc_is_matching_component...... [ 14.729138] dlc->of_node:80854bb0 != component_of_node:80854a6c [ 14.740860] dlc->of_node->name:i2s, component_of_node->name:wm8960 [ 14.753093] snd_soc_is_matching_component...... [ 14.762062] dlc->of_node:80854bb0 != component_of_node:0 [ 14.772576] snd_soc_is_matching_component...... [ 14.781544] dlc->of_node:80854bb0 != component_of_node:0 [ 14.792073] mt762x-wm8960 sound: ASoC: failed to init link wm8960-codec: -517 [ 14.806213] mt762x-wm8960 sound: mt762x_wm8960_machine_probe snd_soc_register_card fail -517

redchenjs commented 3 years ago

@PolyLin 上传一下dts文件看看

PolyLin commented 3 years ago

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

include "mt7628an.dtsi"

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

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

/ { compatible = "hilink,hlk-7628n", "mediatek,mt7628an-soc"; model = "HILINK HLK-7628N";

keys {
    compatible = "gpio-keys";

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

leds {
    compatible = "gpio-leds";

    wlan {
        label = "green:wlan";
        gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
    };
};

};

&state_default { gpio { groups = "gpio"; function = "gpio"; };

refclk {
    groups = "refclk";
    function = "gpio";
};

i2s {
    groups = "i2s";
    function = "i2s";
};

};

&uart1 { 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 0x1fb0000>;
        };
    };
};

};

&wmac { status = "okay"; };

//////////// add for wm8960//////////////

&i2c { status = "okay";

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

};

&i2s { status = "okay"; };

/ {

sound {
    compatible = "mediatek,mt762x-wm8960-machine";
    mediatek,platform = <&i2s>;
    mediatek,audio-codec = <&codec>;
    audio-routing =
        "Headphone", "HP_L",
        "Headphone", "HP_R",
        "Ext Spk", "SPK_LN",
        "Ext Spk", "SPK_LP",
        "Ext Spk", "SPK_RN",
        "Ext Spk", "SPK_RP",
        "Mic", "MICB",
        "LINPUT1", "Mic",
        "RINPUT1", "Mic";
};

};

////////////////////////////////////////////////

PolyLin commented 3 years ago

我后来改用sample里的mt7628an_mediatek_linkit-smart-7688.dts的来修改mediatek_linkit-smart-7688的这个配置, 声卡就可以认到了. 但是采到的声音有问题, 录得声音电子噪声很大, 听不到需要录得东西. 我的wm8960的板子是微雪的"WM8960 Audio Board", 是不是还需要修改下dts或者是conf文件?

redchenjs commented 3 years ago

我后来改用sample里的mt7628an_mediatek_linkit-smart-7688.dts的来修改mediatek_linkit-smart-7688的这个配置, 声卡就可以认到了. 但是采到的声音有问题, 录得声音电子噪声很大, 听不到需要录得东西. 我的wm8960的板子是微雪的"WM8960 Audio Board", 是不是还需要修改下dts或者是conf文件?

  1. dts的audio-routing部分需要根据实际板子调整,特别是INPUT输入信号,每个板子的配置各不相同,需要的通道加上,不需要的删去,根据原理图配置。
  2. 如果是3.5mm接口的麦那么可能是耳机跟插座标准不同,这跟板子选用的标准有关,需要换耳机或者用国标美标转换头。
  3. 如果只有一个声道没声音或者噪音,说明电路上输入声道只接了一个,把ALC切换到单声道模式:
    amixer -D sysdefault sset "ALC Function" "Left"
    amixer -D sysdefault sset "Left Input Mixer Boost" on
    amixer -D sysdefault sset "ADC Data Output Select" 'Left Data = Left ADC;  Right Data = Left ADC'

    或者

    amixer -D sysdefault sset "ALC Function" "Right"
    amixer -D sysdefault sset "Right Input Mixer Boost" on
    amixer -D sysdefault sset "ADC Data Output Select" 'Left Data = Right ADC;  Right Data = Right ADC'
PolyLin commented 3 years ago

按照你说的方法, 去掉了多余的配置,设置了下左声道后可以录制到音频了. 谢谢指导. HLK-7628N这个配置能看出是什么地方配置错误了吗? (实际使用的是这个核心板).

redchenjs commented 3 years ago

按照你说的方法, 去掉了多余的配置,设置了下左声道后可以录制到音频了. 谢谢指导. HLK-7628N这个配置能看出是什么地方配置错误了吗? (实际使用的是这个核心板).

dts中缺少gdma使能,i2s需要gdma才能正常工作

PolyLin commented 3 years ago

谢谢你的耐心解答, 问题和疑问已经解决.