Firefly开源社区

标题: RK3566 PDM 使用与设备树dts配置咨询 [打印本页]

作者: szzhangzhen    时间: 2022-3-31 12:52
标题: RK3566 PDM 使用与设备树dts配置咨询
本帖最后由 szzhangzhen 于 2022-3-31 12:59 编辑

RK3566平台,使用其PDM接口作为Audio input Capture通道,具体硬件结构框图如下。


参考rk3566-evb-lp4x-v10-pdm-mic-array.dts  有如下配置


/ {
  model = "Rockchip RK3566 EVB2 LP4X V10 Board PDM Mic Array";
  compatible = "rockchip,rk3566-evb2-lp4x-v10", "rockchip,rk3566";

  rk809_sound_micarray: rk809-sound-micarray {
    compatible = "simple-audio-card";
    simple-audio-card,format = "i2s";
    simple-audio-card,name = "rockchip,rk809-codec";
    simple-audio-card,mclk-fs = <256>;

    simple-audio-card,dai-link@0 {
      format = "i2s";
      cpu {
        sound-dai = <&i2s1_8ch>;
      };
      codec {
        sound-dai = <&rk809_codec 0>;
      };
    };
    simple-audio-card,dai-link@1 {
      format = "pdm";
      cpu {
        sound-dai = <&pdm>;
      };
      codec {
        sound-dai = <&rk809_codec 1>;
      };
    };
    simple-audio-card,dai-link@2 {
      format = "pdm";
      cpu {
        sound-dai = <&pdm>;
      };
      codec {
        sound-dai = <&es7202>;
      };
    };
  };
};

&i2c3 {
  status = "okay";

  es7202: es7202@30 {
    status = "okay";
    #sound-dai-cells = <0>;
    compatible = "ES7202_PDM_ADC_1";
    reg = <0x30>;
  };

  es7202_31: es7202@31 {
    status = "okay";
    #sound-dai-cells = <0>;
    compatible = "ES7202_PDM_ADC_2";
    reg = <0x31>;
  };
};

&i2s1_8ch {
  status = "okay";
  #sound-dai-cells = <0>;
  rockchip,clk-trcm = <1>;
  pinctrl-names = "default";
  pinctrl-0 = <&i2s1m0_sclktx
         &i2s1m0_lrcktx
         &i2s1m0_sdo0>;
};

&pdm {
  status = "okay";
  #sound-dai-cells = <0>;
  pinctrl-names = "default";
  pinctrl-0 = <&pdmm0_clk
      &pdmm0_clk1
      &pdmm0_sdi0
      &pdmm0_sdi1
      &pdmm0_sdi2
      &pdmm0_sdi3>;
};

&rk809_codec {
  #sound-dai-cells = <1>;
  compatible = "rockchip,rk809-codec", "rockchip,rk817-codec";
  clocks = <&cru I2S1_MCLKOUT>;
  clock-names = "mclk";
  assigned-clocks = <&cru I2S1_MCLKOUT>, <&cru I2S1_MCLK_TX_IOE>;
  assigned-clock-rates = <12288000>;
  assigned-clock-parents = <&cru I2S1_MCLKOUT_TX>, <&cru I2S1_MCLKOUT_TX>;
  pinctrl-names = "default";
  pinctrl-0 = <&i2s1m0_mclk>;
  pdmdata-out-enable;
  adc-for-loopback;
  hp-volume = <20>;
  spk-volume = <3>;
  mic-in-differential;
  status = "okay";
};

&rk809_sound {
  status = "disabled";
};


参照此dts能基本理解其含义,rk809_sound_micarray节点下
1、simple-audio-card,dai-link@0 用于配置RK809 Audio output,
2、simple-audio-card,dai-link@1 用于配置rk809使用PDM接口录音,
3、simple-audio-card,dai-link@2 用于配置es7202使用PDM接口录音,

但是从其中无法获悉,loopback如何配置。
根据参考devicetree,结合自身硬件构成,可知ES7202应如下配置
&i2c3 {
    status = "okay";
        clock-frequency = <400000>;

        es7202_30: es7202@30 {
                status = "okay";
                #sound-dai-cells = <0>;
                compatible = "ES7202_PDM_ADC_1";
                reg = <0x30>;
    };
        es7202_31: es7202@31 {
                status = "okay";
                #sound-dai-cells = <0>;
                compatible = "ES7202_PDM_ADC_2";
                reg = <0x31>;
    };

        es7202_32: es7202@32 {
                status = "okay";
                #sound-dai-cells = <0>;
                compatible = "ES7202_PDM_ADC_3";
                reg = <0x32>;
    };

};

请问,如何配置音频输入loopback、mic array?
是否应该像如下形式进行配置
sound_micarray {
  compatible = "simple-audio-card";
  simple-audio-card,format = "i2s";
  simple-audio-card,name = "rockchip,rk809-codec";
  simple-audio-card,mclk-fs = <256>;

  simple-audio-card,dai-link@0 {
    format = "i2s";
    cpu {
      sound-dai = <&i2s1_8ch>;
    };
    codec {
      sound-dai = <&rk809_codec 0>;
    };
  };


  simple-audio-card,dai-link@1 {
    format = "pdm";
    cpu {
      sound-dai = <&pdm>;
    };
    codec {
      sound-dai = <&es7202_30>;
    };
  };

  simple-audio-card,dai-link@2 {
    format = "pdm";
    cpu {
      sound-dai = <&pdm>;
    };
    codec {
      sound-dai = <&es7202_31>;
    };
  };

  simple-audio-card,dai-link@3 {
    format = "pdm";
    cpu {
      sound-dai = <&pdm>;
    };
    codec {
      sound-dai = <&es7202_32>;
    };
  };  
};





作者: firefly_zhongw    时间: 2022-3-31 14:41
1. 参考SDK的RKDocs/common/Audio/里的文档
2. es7202没有调试过,需要自己验证
3. 如果需要我司调试,请联系商务sales@t-firefly.com
作者: ocean068    时间: 2023-7-5 14:08
请问你最后怎么配置的呢,可用吗




欢迎光临 Firefly开源社区 (https://dev.t-firefly.com/) Powered by Discuz! X3.1