Jump to content

FordPrfkt

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by FordPrfkt

  1. From this very helpful thread:

     

    I learned that I2S0 is disabled in the Banapi Zero M2 by default.

    I enabled it in my overlay using

    fragment@0 {
                    target-path = "/soc/i2s@1c22000";
                    __overlay__ {
                            status = "okay";
                    };
            };

     

    and with this dts:

    Spoiler

    // Definitions for G-Dis DAC
    /dts-v1/;
    /plugin/;

    / {
            compatible = "allwinner,sun8i-h3";

            fragment@0 {
                    target-path = "/soc/i2s@1c22000";
                    __overlay__ {
                            status = "okay";
                    };
            };

            fragment@1 {
                    target = <&i2c0>;
                    __overlay__ {
                            #address-cells = <0>;
                            #size-cells = <0>;
                            status = "okay";

                            wm8960: wm8960{
                                    compatible = "wlf,wm8960";
                                    reg = <0x1a>;
                                    wlf,shared-lrclk;
                                    #sound-dai-cells = <0>;
                            };
                    };
            };

            fragment@2 {
                    target-path="/";
                    __overlay__ {
                            wm8960_mclk: wm8960_mclk {
                            compatible = "fixed-clock";
                            #clock-cells = <0>;
                            clock-frequency = <12288000>;
                            };
                    };
            };


            fragment@3 {
                    target = <&i2s0>;
                    __overlay__ {
                            pinctrl-0 = <&i2s0_pins>;
                            pinctrl-names = "default";
                            sound-dai = <&wm8960>;
                            status = "okay";
                    };
            };

            fragment@4 {
                    target-path = "/";
                    __overlay__ {
                            sound_i2s {
                                    simple-audio-card,name = "2MicHAT";
                                    compatible = "simple-audio-card";
                                    simple-audio-card,format = "i2s";
                                    status = "okay";
                                    simple-audio-card,bitclock-slave = <&dailink0_slave>;
                                    simple-audio-card,frame-slave = <&dailink0_slave>;
    //                              simple-audio-card,mclk-fs = <512>;
                                     simple-audio-card,widgets =
                                            "Microphone", "Mic Jack",
                                            "Speaker", "Speaker",
                                            "Headphone", "Headphone Jack";
                                    simple-audio-card,routing =
                                            "Headphone Jack", "HP_L",
                                            "Headphone Jack", "HP_R",
                                            "Speaker", "SPK_LP",
                                            "Speaker", "SPK_LN",
                                            "LINPUT1", "Mic Jack",
                                            "LINPUT3", "Mic Jack",
                                            "RINPUT1", "Mic Jack",
                                            "RINPUT2", "Mic Jack";

                                    simple-audio-card,cpu {
                                            sound-dai = <&i2s0>;
                                    };

                                    dailink0_slave: simple-audio-card,codec {
                                            sound-dai = <&wm8960>;

                                           clocks = <&wm8960_mclk>;
                                            clock-names = "mclk";
                                    };
                            };
                    };
            };

    };

     

    i now have the sound interface!

    daniel@bananapim2zero:~$ aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: D2MicHAT [2MicHAT], device 0: 1c22000.i2s-wm8960-hifi wm8960-hifi-0 [1c22000.i2s-wm8960-hifi wm8960-hifi-0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: sun9ihdmi [sun9i-hdmi], device 0: SUN9I-HDMI PCM i2s-hifi-0 [SUN9I-HDMI PCM i2s-hifi-0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0

     

    and also some kernel error messages:

    [   53.784092] wm8960 0-001a: failed to configure clock
    [   53.784107] wm8960 0-001a: ASoC: error at snd_soc_dai_hw_params on wm8960-hifi: -22
    [   53.784124]  1c22000.i2s-wm8960-hifi: ASoC: soc_pcm_hw_params() failed (-22)
    <goes on very long>

     

    So now it seems there is something wrong with the clocking.

    Probably i did not configure the I2S correctly to take MCLK from the HAT but at the moment i got no idea

     

  2. Hi,

     

    i am trying to get the Respeaker 2 Mic Pi hat working on a Banana Pi Zero M2. The HAT uses the WM8960 codec and generates its own I2S MCLK.
    After some trouble i got the i2c interface working and i2cdetect shows a device at address 0x1a which is correct.

    But i can not get the I2S interface working.

    I have added a user overlay with the following .dts:

     

    /dts-v1/;
    /plugin/;
    
    / {
            compatible = "allwinner,sun8i-h3";
    
            fragment@0 {
                    target = <&i2c0>;
                    __overlay__ {
                            #address-cells = <0>;
                            #size-cells = <0>;
                            status = "okay";
    
                            wm8960: wm8960{
                                    compatible = "wlf,wm8960";
                                    reg = <0x1a>;
                                    #sound-dai-cells = <0>;
                            };
                    };
            };
    
            fragment@1 {
                    target = <&i2s0>;
                    __overlay__ {
                            status = "okay";
                            pinctrl-0 = <&i2s0_pins>;
                            sound-dai = <&wm8960>;
                            pinctrl-names = "default";
                    };
            };
    
            fragment@2 {
                    target-path = "/";
                    __overlay__ {
                            sound_i2s {
                                    compatible = "simple-audio-card";
                                    simple-audio-card,name = "I2S-master";
                                    simple-audio-card,format = "i2s";
                                    simple-audio-card,bitclock-master = <&codec_dai>;
                                    simple-audio-card,frame-master = <&codec_dai>;
                                    simple-audio-card,mclk-fs = <256>;
                                    status = "okay";
    
                                    simple-audio-card,widgets =
                                    "Microphone", "Mic Jack",
                                    "Speaker", "Speaker",
                                    "Headphone", "Headphone Jack";
    
                                    simple-audio-card,routing =
                                    "Headphone Jack", "HP_L",
                                    "Headphone Jack", "HP_R",
                                    "Speaker", "SPK_LP",
                                    "Speaker", "SPK_LN",
                                    "LINPUT1", "Mic Jack",
                                    "LINPUT3", "Mic Jack",
                                    "RINPUT1", "Mic Jack",
                                    "RINPUT2", "Mic Jack";
    
                                    simple-audio-card,cpu {
                                            sound-dai = <&i2s0>;
                                    };
    
                                    codec_dai,codec {
                                            sound-dai = <&wm8960>;
                                    };
                            };
                    };
            };
    };

     

    I do not see errors in dmesg but aplay -l only shows the HMDI sound interface.

    I am stuck here and have not found a good explanation how .dts files exactly work for audio or how to get some error messgae from the kernel to see what is wrong.

    Kernel Version is 5.15.62-sunxi

     

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines