Re: [PATCH] arm64: dts: meson: khadas-vim3l: enable audio

From: Jerome Brunet
Date: Fri Oct 18 2019 - 12:14:17 EST



On Fri 18 Oct 2019 at 12:05, Christian Hewitt <christianshewitt@xxxxxxxxx> wrote:

> Add and enable the audio nodes on the VIM3L. This is based on the recent
> submission for the SEI610 device [1] and the existing VIM3 dts.
>
> [1] https://patchwork.kernel.org/patch/11180785/
>
> Signed-off-by: Christian Hewitt <christianshewitt@xxxxxxxxx>
> ---
> .../boot/dts/amlogic/meson-sm1-khadas-vim3l.dts | 147 +++++++++++++++++++++
> 1 file changed, 147 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts
> index dbbf29a..d07f0cf 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts
> @@ -8,6 +8,7 @@
>
> #include "meson-sm1.dtsi"
> #include "meson-khadas-vim3.dtsi"
> +#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
>
> / {
> compatible = "khadas,vim3l", "amlogic,sm1";
> @@ -31,6 +32,86 @@
> regulator-boot-on;
> regulator-always-on;
> };
> +
> + sound {
> + compatible = "amlogic,axg-sound-card";
> + model = "SM1-KHADAS-VIM3L";
> + audio-aux-devs = <&tdmout_a>, <&tdmout_b>,
> + <&tdmin_a>, <&tdmin_b>;
> + audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
> + "TDMOUT_A IN 1", "FRDDR_B OUT 0",
> + "TDMOUT_A IN 2", "FRDDR_C OUT 0",
> + "TDM_A Playback", "TDMOUT_A OUT",

The route above are useless since you are not using TDM A in this card

> + "TDMOUT_B IN 0", "FRDDR_A OUT 1",
> + "TDMOUT_B IN 1", "FRDDR_B OUT 1",
> + "TDMOUT_B IN 2", "FRDDR_C OUT 1",
> + "TDM_B Playback", "TDMOUT_B OUT";
> +
> + assigned-clocks = <&clkc CLKID_MPLL2>,
> + <&clkc CLKID_MPLL0>,
> + <&clkc CLKID_MPLL1>;
> + assigned-clock-parents = <0>, <0>, <0>;
> + assigned-clock-rates = <294912000>,
> + <270950400>,
> + <393216000>;
> + status = "okay";
> +
> + dai-link-0 {
> + sound-dai = <&frddr_a>;
> + };
> +
> + dai-link-1 {
> + sound-dai = <&frddr_b>;
> + };
> +
> + dai-link-2 {
> + sound-dai = <&frddr_c>;
> + };

You have only one output, so one FRDDR is enough.
So either enable a put just one, or put them all (including FRDDR D)

> +
> + dai-link-3 {
> + sound-dai = <&toddr_a>;
> + };
> +
> + dai-link-4 {
> + sound-dai = <&toddr_b>;
> + };
> +
> + dai-link-5 {
> + sound-dai = <&toddr_c>;
> + };

There is no capture Backend, to the TODDR are useless

> +
> + /* 8ch hdmi interface */
> + dai-link-6 {
> + sound-dai = <&tdmif_b>;

Any particular reason for using TDM B interface ? What is khadas doing
in there own code ?

> + dai-format = "i2s";
> + dai-tdm-slot-tx-mask-0 = <1 1>;
> + dai-tdm-slot-tx-mask-1 = <1 1>;
> + dai-tdm-slot-tx-mask-2 = <1 1>;
> + dai-tdm-slot-tx-mask-3 = <1 1>;
> + mclk-fs = <256>;
> +
> + codec {
> + sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
> + };
> + };
> +
> + /* hdmi glue */
> + dai-link-7 {
> + sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
> +
> + codec {
> + sound-dai = <&hdmi_tx>;
> + };
> + };
> + };
> +};
> +
> +&arb {
> + status = "okay";
> +};
> +
> +&clkc_audio {
> + status = "okay";
> };
>
> &cpu0 {
> @@ -61,6 +142,24 @@
> clock-latency = <50000>;
> };
>
> +&frddr_a {
> + status = "okay";
> +};
> +
> +&frddr_b {
> + status = "okay";
> +};
> +
> +&frddr_c {
> + status = "okay";
> +};
> +
> +&pdm {
> + pinctrl-0 = <&pdm_din0_z_pins>, <&pdm_dclk_z_pins>;
> + pinctrl-names = "default";
> + status = "okay";
> +};

Why do you enable PDM ? does this board provide some digital mics ?
There is no links using PDM in your card. Please clarify

> +
> &pwm_AO_cd {
> pinctrl-0 = <&pwm_ao_d_e_pins>;
> pinctrl-names = "default";
> @@ -93,3 +192,51 @@
> phy-names = "usb2-phy0", "usb2-phy1";
> };
> */
> +
> +&tdmif_a {
> + pinctrl-0 = <&tdm_a_dout0_pins>, <&tdm_a_fs_pins>, <&tdm_a_sclk_pins>;
> + pinctrl-names = "default";
> + status = "okay";
> +
> + assigned-clocks = <&clkc_audio AUD_CLKID_TDM_SCLK_PAD0>,
> + <&clkc_audio AUD_CLKID_TDM_LRCLK_PAD0>;
> + assigned-clock-parents = <&clkc_audio AUD_CLKID_MST_A_SCLK>,
> + <&clkc_audio AUD_CLKID_MST_A_LRCLK>;
> + assigned-clock-rates = <0>, <0>;
> +};
> +
> +&tdmif_b {
> + status = "okay";
> +};
> +
> +&tdmin_a {
> + status = "okay";
> +};
> +
> +&tdmin_b {
> + status = "okay";
> +};
> +
> +&tdmout_a {
> + status = "okay";
> +};
> +
> +&tdmout_b {
> + status = "okay";
> +};
> +
> +&toddr_a {
> + status = "okay";
> +};
> +
> +&toddr_b {
> + status = "okay";
> +};
> +
> +&toddr_c {
> + status = "okay";
> +};
> +
> +&tohdmitx {
> + status = "okay";
> +};