2021-07-17 23:33:31

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH v2 0/2] Meson8/Meson8b: sound card support

This series adds the AIU audio controller for Meson8 and Meson8b. The
AIU audio controller has been found to work fine with out-of-tree
patches for HDMI audio (over I2S). SPDIF output also works (tested with
a scope).
Endless Mini (EC-100) has an RT5640 audio codec. The driver for this
codec can be selected since commit 08c56cab302a05 ("ASoC: rt5640: Make
codec selectable"), which is part of Linux 5.14-rc1. While support is
not perfect (due to us lacking proper support for configuring
GPIO_BSD_EN) audio output still works fine.

This series is based on my bugfix patch "ARM: dts: meson8: Use a
higher default GPU clock frequency" from [0]

Changes since v1 at [1]:
- added sound-name-prefix = "AIU"; to the first patch to make it
identical to what we have in meson-gx.dtsi
- drop audio-routing property from the sound card in the second patch
as it doesn't appear to be needed


[0] https://patchwork.kernel.org/project/linux-amlogic/patch/[email protected]/
[1] https://patchwork.kernel.org/project/linux-amlogic/cover/[email protected]/


Martin Blumenstingl (2):
ARM: dts: meson: Add the AIU audio controller
ARM: dts: meson8b: ec100: wire up the RT5640 audio codec

arch/arm/boot/dts/meson.dtsi | 12 ++++++
arch/arm/boot/dts/meson8.dtsi | 63 +++++++++++++++++++++++++++++
arch/arm/boot/dts/meson8b-ec100.dts | 44 ++++++++++++++++++++
arch/arm/boot/dts/meson8b.dtsi | 63 +++++++++++++++++++++++++++++
4 files changed, 182 insertions(+)

--
2.32.0


2021-07-17 23:34:16

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH v2 2/2] ARM: dts: meson8b: ec100: wire up the RT5640 audio codec

The Realtek RT5640 codec is connected to the SoC's I2S interface.
Describe this in the .dts together with the codec's LDO1 enable GPIO so
audio can be played on the Endless Mini.
While here, add a note about the realtek,ldo1-en-gpios for which the
EC100 uses GPIO_BSD_EN. Due to driver limitations this pin cannot be
used currently.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
arch/arm/boot/dts/meson8b-ec100.dts | 44 +++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)

diff --git a/arch/arm/boot/dts/meson8b-ec100.dts b/arch/arm/boot/dts/meson8b-ec100.dts
index 8e48ccc6b634..e404bdccdab9 100644
--- a/arch/arm/boot/dts/meson8b-ec100.dts
+++ b/arch/arm/boot/dts/meson8b-ec100.dts
@@ -96,6 +96,32 @@ rtc32k_xtal: rtc32k-xtal-clk {
#clock-cells = <0>;
};

+ sound {
+ compatible = "amlogic,gx-sound-card";
+ model = "M8B-EC100";
+
+ assigned-clocks = <&clkc CLKID_MPLL0>,
+ <&clkc CLKID_MPLL1>,
+ <&clkc CLKID_MPLL2>;
+ assigned-clock-rates = <270950400>,
+ <294912000>,
+ <393216000>;
+
+ dai-link-0 {
+ sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
+ };
+
+ dai-link-1 {
+ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
+ dai-format = "i2s";
+ mclk-fs = <256>;
+
+ codec-0 {
+ sound-dai = <&rt5640>;
+ };
+ };
+ };
+
usb_vbus: regulator-usb-vbus {
/*
* Silergy SY6288CCAC-GP 2A Power Distribution Switch.
@@ -242,6 +268,14 @@ vddee: regulator-vddee {
};
};

+&aiu {
+ status = "okay";
+
+ pinctrl-0 = <&i2s_am_clk_pins>, <&i2s_out_ao_clk_pins>,
+ <&i2s_out_lr_clk_pins>, <&i2s_out_ch01_ao_pins>;
+ pinctrl-names = "default";
+};
+
&cpu0 {
cpu-supply = <&vcck>;
};
@@ -283,9 +317,19 @@ &i2c_A {

rt5640: codec@1c {
compatible = "realtek,rt5640";
+
reg = <0x1c>;
+
+ #sound-dai-cells = <0>;
+
interrupt-parent = <&gpio_intc>;
interrupts = <13 IRQ_TYPE_EDGE_BOTH>; /* GPIOAO_13 */
+
+ /*
+ * TODO: realtek,ldo1-en-gpios is connected to GPIO_BSD_EN.
+ * We currently cannot configure this pin correctly.
+ * Luckily for us it's in the "right" state by default.
+ */
realtek,in1-differential;
};
};
--
2.32.0

2021-07-26 08:01:57

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] ARM: dts: meson8b: ec100: wire up the RT5640 audio codec

On 18/07/2021 01:30, Martin Blumenstingl wrote:
> The Realtek RT5640 codec is connected to the SoC's I2S interface.
> Describe this in the .dts together with the codec's LDO1 enable GPIO so
> audio can be played on the Endless Mini.
> While here, add a note about the realtek,ldo1-en-gpios for which the
> EC100 uses GPIO_BSD_EN. Due to driver limitations this pin cannot be
> used currently.
>
> Signed-off-by: Martin Blumenstingl <[email protected]>
> ---
> arch/arm/boot/dts/meson8b-ec100.dts | 44 +++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/arch/arm/boot/dts/meson8b-ec100.dts b/arch/arm/boot/dts/meson8b-ec100.dts
> index 8e48ccc6b634..e404bdccdab9 100644
> --- a/arch/arm/boot/dts/meson8b-ec100.dts
> +++ b/arch/arm/boot/dts/meson8b-ec100.dts
> @@ -96,6 +96,32 @@ rtc32k_xtal: rtc32k-xtal-clk {
> #clock-cells = <0>;
> };
>
> + sound {
> + compatible = "amlogic,gx-sound-card";
> + model = "M8B-EC100";
> +
> + assigned-clocks = <&clkc CLKID_MPLL0>,
> + <&clkc CLKID_MPLL1>,
> + <&clkc CLKID_MPLL2>;
> + assigned-clock-rates = <270950400>,
> + <294912000>,
> + <393216000>;
> +
> + dai-link-0 {
> + sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
> + };
> +
> + dai-link-1 {
> + sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
> + dai-format = "i2s";
> + mclk-fs = <256>;
> +
> + codec-0 {
> + sound-dai = <&rt5640>;
> + };
> + };
> + };
> +
> usb_vbus: regulator-usb-vbus {
> /*
> * Silergy SY6288CCAC-GP 2A Power Distribution Switch.
> @@ -242,6 +268,14 @@ vddee: regulator-vddee {
> };
> };
>
> +&aiu {
> + status = "okay";
> +
> + pinctrl-0 = <&i2s_am_clk_pins>, <&i2s_out_ao_clk_pins>,
> + <&i2s_out_lr_clk_pins>, <&i2s_out_ch01_ao_pins>;
> + pinctrl-names = "default";
> +};
> +
> &cpu0 {
> cpu-supply = <&vcck>;
> };
> @@ -283,9 +317,19 @@ &i2c_A {
>
> rt5640: codec@1c {
> compatible = "realtek,rt5640";
> +
> reg = <0x1c>;
> +
> + #sound-dai-cells = <0>;
> +
> interrupt-parent = <&gpio_intc>;
> interrupts = <13 IRQ_TYPE_EDGE_BOTH>; /* GPIOAO_13 */
> +
> + /*
> + * TODO: realtek,ldo1-en-gpios is connected to GPIO_BSD_EN.
> + * We currently cannot configure this pin correctly.
> + * Luckily for us it's in the "right" state by default.
> + */
> realtek,in1-differential;
> };
> };
>

Reviewed-by: Neil Armstrong <[email protected]>

2021-07-26 08:15:48

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] Meson8/Meson8b: sound card support

Hi,

On Sun, 18 Jul 2021 01:30:28 +0200, Martin Blumenstingl wrote:
> This series adds the AIU audio controller for Meson8 and Meson8b. The
> AIU audio controller has been found to work fine with out-of-tree
> patches for HDMI audio (over I2S). SPDIF output also works (tested with
> a scope).
> Endless Mini (EC-100) has an RT5640 audio codec. The driver for this
> codec can be selected since commit 08c56cab302a05 ("ASoC: rt5640: Make
> codec selectable"), which is part of Linux 5.14-rc1. While support is
> not perfect (due to us lacking proper support for configuring
> GPIO_BSD_EN) audio output still works fine.
>
> [...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (for-next)

[1/2] ARM: dts: meson: Add the AIU audio controller
https://git.kernel.org/amlogic/c/4f8ca13df1d5ff1c09e06acbd1bc7d4d8510dfc0
[2/2] ARM: dts: meson8b: ec100: wire up the RT5640 audio codec
https://git.kernel.org/amlogic/c/0bd475db1a5d0cd89b435ff6bfee083aca5d104a

--
Neil