2018-11-08 06:44:03

by Vasily Khoruzhick

[permalink] [raw]
Subject: [PATCH v6 0/3] Add support for audiocodec in Allwinner A64

This series enables sound on Pine64, SoPine boards and Pinebook.

v2: - Use simple-amplifier for speaker amp on Pinebook
- Rename sun50i-a64-i2s to sun50i-a64-codec-i2s to preserve compatible
string for other 3 I2S modules in A64 in case if there's any
incompatibility with H3
v3: - renamed sunxi-adda-pr-regmap to sun8i-adda-pr-regmap
- use ilog2() to calculate reg value for LRCK div instead of using a
table
v4: - dts: don't use 'Mic' and 'Headset Mic' widgets from sun8i-codec,
define our board-level widgets instead.
v5: - collect all the tags
v6: - driver patches has been merged through ASoC tree
- rebase onto 4.20-rc1
- Drop 'Speaker' from routes on sopine and pine64, they don't have
speaker.

Vasily Khoruzhick (3):
arm64: dts: allwinner: a64: add nodes necessary for analog sound
support
arm64: dts: allwinner: a64: enable sound on Pine64 and SoPine
arm64: dts: allwinner: a64: enable sound on Pinebook

.../boot/dts/allwinner/sun50i-a64-pine64.dts | 28 +++++++++
.../dts/allwinner/sun50i-a64-pinebook.dts | 42 ++++++++++++++
.../allwinner/sun50i-a64-sopine-baseboard.dts | 28 +++++++++
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 58 +++++++++++++++++++
4 files changed, 156 insertions(+)

--
2.19.1



2018-11-08 06:42:48

by Vasily Khoruzhick

[permalink] [raw]
Subject: [PATCH v6 3/3] arm64: dts: allwinner: a64: enable sound on Pinebook

This commit enables I2S, digital and analog parts of audiocodec on
Pinebook

Signed-off-by: Vasily Khoruzhick <[email protected]>
---
.../dts/allwinner/sun50i-a64-pinebook.dts | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
index 77fac84797e9..73f171f4ba9b 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
@@ -64,6 +64,23 @@
compatible = "mmc-pwrseq-simple";
reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
};
+
+ speaker_amp: speaker_amp {
+ compatible = "simple-audio-amplifier";
+ enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
+ };
+};
+
+&codec {
+ status = "okay";
+};
+
+&codec_analog {
+ status = "okay";
+};
+
+&dai {
+ status = "okay";
};

&ehci0 {
@@ -267,6 +284,31 @@
vcc-hdmi-supply = <&reg_dldo1>;
};

+&sound {
+ status = "okay";
+ simple-audio-card,widgets = "Microphone", "Internal Microphone Left",
+ "Microphone", "Internal Microphone Right",
+ "Headphone", "Headphone Jack",
+ "Speaker", "Internal Speaker";
+ simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
+ simple-audio-card,routing =
+ "Left DAC", "AIF1 Slot 0 Left",
+ "Right DAC", "AIF1 Slot 0 Right",
+ "INL", "LINEOUT",
+ "INR", "LINEOUT",
+ "Internal Speaker", "OUTL",
+ "Internal Speaker", "OUTR",
+ "Headphone Jack", "HP",
+ "AIF1 Slot 0 Left ADC", "Left ADC",
+ "AIF1 Slot 0 Right ADC", "Right ADC",
+ "Left ADC", "ADC",
+ "Right ADC", "ADC",
+ "Internal Microphone Left", "MBIAS",
+ "MIC1", "Internal Microphone Left",
+ "Internal Microphone Right", "HBIAS",
+ "MIC2", "Internal Microphone Right";
+};
+
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pb_pins>;
--
2.19.1


2018-11-08 06:42:49

by Vasily Khoruzhick

[permalink] [raw]
Subject: [PATCH v6 1/3] arm64: dts: allwinner: a64: add nodes necessary for analog sound support

Add nodes for i2s, digital and analog parts of audiocodec on A64

Signed-off-by: Vasily Khoruzhick <[email protected]>
---
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 58 +++++++++++++++++++
1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index f3a66f888205..53796a3e6bf3 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -173,6 +173,34 @@
compatible = "linux,spdif-dit";
};

+ sound: sound {
+ compatible = "simple-audio-card";
+ simple-audio-card,name = "sun50i-a64-audio";
+ simple-audio-card,format = "i2s";
+ simple-audio-card,frame-master = <&cpudai>;
+ simple-audio-card,bitclock-master = <&cpudai>;
+ simple-audio-card,mclk-fs = <512>;
+ simple-audio-card,aux-devs = <&codec_analog>;
+ simple-audio-card,routing =
+ "Left DAC", "AIF1 Slot 0 Left",
+ "Right DAC", "AIF1 Slot 0 Right",
+ "AIF1 Slot 0 Left ADC", "Left ADC",
+ "AIF1 Slot 0 Right ADC", "Right ADC",
+ "Left ADC", "ADC",
+ "Right ADC", "ADC",
+ "MIC1", "Mic",
+ "MIC2", "Headset Mic";
+ status = "disabled";
+
+ cpudai: simple-audio-card,cpu {
+ sound-dai = <&dai>;
+ };
+
+ link_codec: simple-audio-card,codec {
+ sound-dai = <&codec>;
+ };
+ };
+
timer {
compatible = "arm,armv8-timer";
interrupts = <GIC_PPI 13
@@ -665,6 +693,30 @@
status = "disabled";
};

+ dai: dai@1c22c00 {
+ #sound-dai-cells = <0>;
+ compatible = "allwinner,sun50i-a64-codec-i2s";
+ reg = <0x01c22c00 0x200>;
+ interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
+ clock-names = "apb", "mod";
+ resets = <&ccu RST_BUS_CODEC>;
+ reset-names = "rst";
+ dmas = <&dma 15>, <&dma 15>;
+ dma-names = "rx", "tx";
+ status = "disabled";
+ };
+
+ codec: codec@1c22e00 {
+ #sound-dai-cells = <0>;
+ compatible = "allwinner,sun8i-a33-codec";
+ reg = <0x01c22e00 0x600>;
+ interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
+ clock-names = "bus", "mod";
+ status = "disabled";
+ };
+
uart0: serial@1c28000 {
compatible = "snps,dw-apb-uart";
reg = <0x01c28000 0x400>;
@@ -902,6 +954,12 @@
#reset-cells = <1>;
};

+ codec_analog: codec-analog@1f015c0 {
+ compatible = "allwinner,sun50i-a64-codec-analog";
+ reg = <0x01f015c0 0x4>;
+ status = "disabled";
+ };
+
r_i2c: i2c@1f02400 {
compatible = "allwinner,sun50i-a64-i2c",
"allwinner,sun6i-a31-i2c";
--
2.19.1


2018-11-08 06:43:01

by Vasily Khoruzhick

[permalink] [raw]
Subject: [PATCH v6 2/3] arm64: dts: allwinner: a64: enable sound on Pine64 and SoPine

This commit enables I2S, digital and analog parts of audiocodec on
Pine64 and SoPine boards.

Signed-off-by: Vasily Khoruzhick <[email protected]>
---
.../boot/dts/allwinner/sun50i-a64-pine64.dts | 28 +++++++++++++++++++
.../allwinner/sun50i-a64-sopine-baseboard.dts | 28 +++++++++++++++++++
2 files changed, 56 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index c077b6c1f458..ff352bdfbb93 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -75,6 +75,18 @@
};
};

+&codec {
+ status = "okay";
+};
+
+&codec_analog {
+ status = "okay";
+};
+
+&dai {
+ status = "okay";
+};
+
&de {
status = "okay";
};
@@ -264,6 +276,22 @@
status = "disabled";
};

+&sound {
+ status = "okay";
+ simple-audio-card,widgets = "Microphone", "Microphone Jack",
+ "Headphone", "Headphone Jack";
+ simple-audio-card,routing =
+ "Left DAC", "AIF1 Slot 0 Left",
+ "Right DAC", "AIF1 Slot 0 Right",
+ "Headphone Jack", "HP",
+ "AIF1 Slot 0 Left ADC", "Left ADC",
+ "AIF1 Slot 0 Right ADC", "Right ADC",
+ "Left ADC", "ADC",
+ "Right ADC", "ADC",
+ "Microphone Jack", "HBIAS",
+ "MIC2", "Microphone Jack";
+};
+
/* On Exp and Euler connectors */
&uart0 {
pinctrl-names = "default";
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
index 53fcc9098df3..25d732df37c4 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
@@ -80,6 +80,18 @@
};
};

+&codec {
+ status = "okay";
+};
+
+&codec_analog {
+ status = "okay";
+};
+
+&dai {
+ status = "okay";
+};
+
&de {
status = "okay";
};
@@ -164,6 +176,22 @@
vcc-hdmi-supply = <&reg_dldo1>;
};

+&sound {
+ status = "okay";
+ simple-audio-card,widgets = "Microphone", "Microphone Jack",
+ "Headphone", "Headphone Jack";
+ simple-audio-card,routing =
+ "Left DAC", "AIF1 Slot 0 Left",
+ "Right DAC", "AIF1 Slot 0 Right",
+ "Headphone Jack", "HP",
+ "AIF1 Slot 0 Left ADC", "Left ADC",
+ "AIF1 Slot 0 Right ADC", "Right ADC",
+ "Left ADC", "ADC",
+ "Right ADC", "ADC",
+ "Microphone Jack", "HBIAS",
+ "MIC2", "Microphone Jack";
+};
+
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pb_pins>;
--
2.19.1


2018-11-08 06:53:19

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v6 1/3] arm64: dts: allwinner: a64: add nodes necessary for analog sound support

On Thu, Nov 8, 2018 at 2:42 PM Vasily Khoruzhick <[email protected]> wrote:
>
> Add nodes for i2s, digital and analog parts of audiocodec on A64
>
> Signed-off-by: Vasily Khoruzhick <[email protected]>
> ---
> arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 58 +++++++++++++++++++
> 1 file changed, 58 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
> index f3a66f888205..53796a3e6bf3 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
> @@ -173,6 +173,34 @@
> compatible = "linux,spdif-dit";
> };
>
> + sound: sound {
> + compatible = "simple-audio-card";
> + simple-audio-card,name = "sun50i-a64-audio";
> + simple-audio-card,format = "i2s";
> + simple-audio-card,frame-master = <&cpudai>;
> + simple-audio-card,bitclock-master = <&cpudai>;
> + simple-audio-card,mclk-fs = <512>;
> + simple-audio-card,aux-devs = <&codec_analog>;
> + simple-audio-card,routing =
> + "Left DAC", "AIF1 Slot 0 Left",
> + "Right DAC", "AIF1 Slot 0 Right",
> + "AIF1 Slot 0 Left ADC", "Left ADC",
> + "AIF1 Slot 0 Right ADC", "Right ADC",
> + "Left ADC", "ADC",
> + "Right ADC", "ADC",

The ADC widget is an overall enable control for the digital part of
the codec's ADC.
It is modeled as a supply widget in sun8i-codec. The routing should be internal
to sun8i-codec. See the following for the DAC routing:

https://elixir.bootlin.com/linux/v4.20-rc1/source/sound/soc/sunxi/sun8i-codec.c#L474

> + "MIC1", "Mic",
> + "MIC2", "Headset Mic";

Drop the last two. These belong at the board level. And as previously mentioned,
these two widgets from the sun8i-codec driver are bogus.

> + status = "disabled";
> +
> + cpudai: simple-audio-card,cpu {
> + sound-dai = <&dai>;
> + };
> +
> + link_codec: simple-audio-card,codec {
> + sound-dai = <&codec>;
> + };
> + };
> +
> timer {
> compatible = "arm,armv8-timer";
> interrupts = <GIC_PPI 13
> @@ -665,6 +693,30 @@
> status = "disabled";
> };
>
> + dai: dai@1c22c00 {
> + #sound-dai-cells = <0>;
> + compatible = "allwinner,sun50i-a64-codec-i2s";
> + reg = <0x01c22c00 0x200>;
> + interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
> + clock-names = "apb", "mod";
> + resets = <&ccu RST_BUS_CODEC>;
> + reset-names = "rst";
> + dmas = <&dma 15>, <&dma 15>;
> + dma-names = "rx", "tx";
> + status = "disabled";
> + };
> +
> + codec: codec@1c22e00 {
> + #sound-dai-cells = <0>;
> + compatible = "allwinner,sun8i-a33-codec";
> + reg = <0x01c22e00 0x600>;
> + interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
> + clock-names = "bus", "mod";
> + status = "disabled";
> + };
> +
> uart0: serial@1c28000 {
> compatible = "snps,dw-apb-uart";
> reg = <0x01c28000 0x400>;
> @@ -902,6 +954,12 @@
> #reset-cells = <1>;
> };
>
> + codec_analog: codec-analog@1f015c0 {
> + compatible = "allwinner,sun50i-a64-codec-analog";
> + reg = <0x01f015c0 0x4>;
> + status = "disabled";
> + };
> +
> r_i2c: i2c@1f02400 {
> compatible = "allwinner,sun50i-a64-i2c",
> "allwinner,sun6i-a31-i2c";
> --
> 2.19.1
>

2018-11-08 07:12:33

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v6 2/3] arm64: dts: allwinner: a64: enable sound on Pine64 and SoPine

On Thu, Nov 8, 2018 at 2:42 PM Vasily Khoruzhick <[email protected]> wrote:
>
> This commit enables I2S, digital and analog parts of audiocodec on
> Pine64 and SoPine boards.
>
> Signed-off-by: Vasily Khoruzhick <[email protected]>
> ---
> .../boot/dts/allwinner/sun50i-a64-pine64.dts | 28 +++++++++++++++++++
> .../allwinner/sun50i-a64-sopine-baseboard.dts | 28 +++++++++++++++++++
> 2 files changed, 56 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> index c077b6c1f458..ff352bdfbb93 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> @@ -75,6 +75,18 @@
> };
> };
>
> +&codec {
> + status = "okay";
> +};
> +
> +&codec_analog {
> + status = "okay";
> +};
> +
> +&dai {
> + status = "okay";
> +};
> +
> &de {
> status = "okay";
> };
> @@ -264,6 +276,22 @@
> status = "disabled";
> };
>
> +&sound {
> + status = "okay";
> + simple-audio-card,widgets = "Microphone", "Microphone Jack",
> + "Headphone", "Headphone Jack";
> + simple-audio-card,routing =
> + "Left DAC", "AIF1 Slot 0 Left",
> + "Right DAC", "AIF1 Slot 0 Right",
> + "Headphone Jack", "HP",
> + "AIF1 Slot 0 Left ADC", "Left ADC",
> + "AIF1 Slot 0 Right ADC", "Right ADC",
> + "Left ADC", "ADC",
> + "Right ADC", "ADC",

As mentioned the above two don't belong in the device tree.

> + "Microphone Jack", "HBIAS",

Schematics says this is NC or not connected by default.
You may want to ask Pine64 about this?

Same comments for SoPine.

> + "MIC2", "Microphone Jack";
> +};
> +
> /* On Exp and Euler connectors */
> &uart0 {
> pinctrl-names = "default";
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
> index 53fcc9098df3..25d732df37c4 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
> @@ -80,6 +80,18 @@
> };
> };
>
> +&codec {
> + status = "okay";
> +};
> +
> +&codec_analog {
> + status = "okay";
> +};
> +
> +&dai {
> + status = "okay";
> +};
> +
> &de {
> status = "okay";
> };
> @@ -164,6 +176,22 @@
> vcc-hdmi-supply = <&reg_dldo1>;
> };
>
> +&sound {
> + status = "okay";
> + simple-audio-card,widgets = "Microphone", "Microphone Jack",
> + "Headphone", "Headphone Jack";
> + simple-audio-card,routing =
> + "Left DAC", "AIF1 Slot 0 Left",
> + "Right DAC", "AIF1 Slot 0 Right",
> + "Headphone Jack", "HP",
> + "AIF1 Slot 0 Left ADC", "Left ADC",
> + "AIF1 Slot 0 Right ADC", "Right ADC",
> + "Left ADC", "ADC",
> + "Right ADC", "ADC",
> + "Microphone Jack", "HBIAS",
> + "MIC2", "Microphone Jack";
> +};
> +
> &uart0 {
> pinctrl-names = "default";
> pinctrl-0 = <&uart0_pb_pins>;
> --
> 2.19.1
>

2018-11-08 07:28:33

by Vasily Khoruzhick

[permalink] [raw]
Subject: Re: [PATCH v6 2/3] arm64: dts: allwinner: a64: enable sound on Pine64 and SoPine

On Wed, Nov 7, 2018 at 11:11 PM Chen-Yu Tsai <[email protected]> wrote:
>
> On Thu, Nov 8, 2018 at 2:42 PM Vasily Khoruzhick <[email protected]> wrote:
> >
> > This commit enables I2S, digital and analog parts of audiocodec on
> > Pine64 and SoPine boards.
> >
> > Signed-off-by: Vasily Khoruzhick <[email protected]>
> > ---
> > .../boot/dts/allwinner/sun50i-a64-pine64.dts | 28 +++++++++++++++++++
> > .../allwinner/sun50i-a64-sopine-baseboard.dts | 28 +++++++++++++++++++
> > 2 files changed, 56 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > index c077b6c1f458..ff352bdfbb93 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > @@ -75,6 +75,18 @@
> > };
> > };
> >
> > +&codec {
> > + status = "okay";
> > +};
> > +
> > +&codec_analog {
> > + status = "okay";
> > +};
> > +
> > +&dai {
> > + status = "okay";
> > +};
> > +
> > &de {
> > status = "okay";
> > };
> > @@ -264,6 +276,22 @@
> > status = "disabled";
> > };
> >
> > +&sound {
> > + status = "okay";
> > + simple-audio-card,widgets = "Microphone", "Microphone Jack",
> > + "Headphone", "Headphone Jack";
> > + simple-audio-card,routing =
> > + "Left DAC", "AIF1 Slot 0 Left",
> > + "Right DAC", "AIF1 Slot 0 Right",
> > + "Headphone Jack", "HP",
> > + "AIF1 Slot 0 Left ADC", "Left ADC",
> > + "AIF1 Slot 0 Right ADC", "Right ADC",
> > + "Left ADC", "ADC",
> > + "Right ADC", "ADC",
>
> As mentioned the above two don't belong in the device tree.
>
> > + "Microphone Jack", "HBIAS",
>
> Schematics says this is NC or not connected by default.
> You may want to ask Pine64 about this?
>
> Same comments for SoPine.

I'll just drop it. Not connected on schematics - we don't put it in dts.

>
> > + "MIC2", "Microphone Jack";
> > +};
> > +
> > /* On Exp and Euler connectors */
> > &uart0 {
> > pinctrl-names = "default";
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
> > index 53fcc9098df3..25d732df37c4 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
> > @@ -80,6 +80,18 @@
> > };
> > };
> >
> > +&codec {
> > + status = "okay";
> > +};
> > +
> > +&codec_analog {
> > + status = "okay";
> > +};
> > +
> > +&dai {
> > + status = "okay";
> > +};
> > +
> > &de {
> > status = "okay";
> > };
> > @@ -164,6 +176,22 @@
> > vcc-hdmi-supply = <&reg_dldo1>;
> > };
> >
> > +&sound {
> > + status = "okay";
> > + simple-audio-card,widgets = "Microphone", "Microphone Jack",
> > + "Headphone", "Headphone Jack";
> > + simple-audio-card,routing =
> > + "Left DAC", "AIF1 Slot 0 Left",
> > + "Right DAC", "AIF1 Slot 0 Right",
> > + "Headphone Jack", "HP",
> > + "AIF1 Slot 0 Left ADC", "Left ADC",
> > + "AIF1 Slot 0 Right ADC", "Right ADC",
> > + "Left ADC", "ADC",
> > + "Right ADC", "ADC",
> > + "Microphone Jack", "HBIAS",
> > + "MIC2", "Microphone Jack";
> > +};
> > +
> > &uart0 {
> > pinctrl-names = "default";
> > pinctrl-0 = <&uart0_pb_pins>;
> > --
> > 2.19.1
> >

2018-11-08 07:32:14

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v6 3/3] arm64: dts: allwinner: a64: enable sound on Pinebook

On Thu, Nov 8, 2018 at 2:42 PM Vasily Khoruzhick <[email protected]> wrote:
>
> This commit enables I2S, digital and analog parts of audiocodec on
> Pinebook
>
> Signed-off-by: Vasily Khoruzhick <[email protected]>
> ---
> .../dts/allwinner/sun50i-a64-pinebook.dts | 42 +++++++++++++++++++
> 1 file changed, 42 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> index 77fac84797e9..73f171f4ba9b 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> @@ -64,6 +64,23 @@
> compatible = "mmc-pwrseq-simple";
> reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
> };
> +
> + speaker_amp: speaker_amp {
> + compatible = "simple-audio-amplifier";
> + enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */

You might want to add a sound-name-prefix property. See

Documentation/devicetree/bindings/sound/name-prefix.txt

Also this should have a reference to its power supply regulator.

> + };
> +};
> +
> +&codec {
> + status = "okay";
> +};
> +
> +&codec_analog {
> + status = "okay";
> +};
> +
> +&dai {
> + status = "okay";
> };
>
> &ehci0 {
> @@ -267,6 +284,31 @@
> vcc-hdmi-supply = <&reg_dldo1>;
> };
>
> +&sound {
> + status = "okay";
> + simple-audio-card,widgets = "Microphone", "Internal Microphone Left",
> + "Microphone", "Internal Microphone Right",
> + "Headphone", "Headphone Jack",
> + "Speaker", "Internal Speaker";
> + simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
> + simple-audio-card,routing =
> + "Left DAC", "AIF1 Slot 0 Left",
> + "Right DAC", "AIF1 Slot 0 Right",
> + "INL", "LINEOUT",
> + "INR", "LINEOUT",
> + "Internal Speaker", "OUTL",
> + "Internal Speaker", "OUTR",
> + "Headphone Jack", "HP",
> + "AIF1 Slot 0 Left ADC", "Left ADC",
> + "AIF1 Slot 0 Right ADC", "Right ADC",
> + "Left ADC", "ADC",
> + "Right ADC", "ADC",
> + "Internal Microphone Left", "MBIAS",
> + "MIC1", "Internal Microphone Left",
> + "Internal Microphone Right", "HBIAS",
> + "MIC2", "Internal Microphone Right";

The schematics is missing the actual jack, but this looks to be correct.

ChenYu

> +};
> +
> &uart0 {
> pinctrl-names = "default";
> pinctrl-0 = <&uart0_pb_pins>;
> --
> 2.19.1
>

2018-11-08 16:29:13

by Vasily Khoruzhick

[permalink] [raw]
Subject: Re: [PATCH v6 3/3] arm64: dts: allwinner: a64: enable sound on Pinebook

On Wed, Nov 7, 2018 at 11:30 PM Chen-Yu Tsai <[email protected]> wrote:
>
> On Thu, Nov 8, 2018 at 2:42 PM Vasily Khoruzhick <[email protected]> wrote:
> >
> > This commit enables I2S, digital and analog parts of audiocodec on
> > Pinebook
> >
> > Signed-off-by: Vasily Khoruzhick <[email protected]>
> > ---
> > .../dts/allwinner/sun50i-a64-pinebook.dts | 42 +++++++++++++++++++
> > 1 file changed, 42 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> > index 77fac84797e9..73f171f4ba9b 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> > @@ -64,6 +64,23 @@
> > compatible = "mmc-pwrseq-simple";
> > reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
> > };
> > +
> > + speaker_amp: speaker_amp {
> > + compatible = "simple-audio-amplifier";
> > + enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
>
> You might want to add a sound-name-prefix property. See

No need, there's only speaker amplifier in Pinebook.

>
> Documentation/devicetree/bindings/sound/name-prefix.txt
>
> Also this should have a reference to its power supply regulator.

It's powered from V5P0_USB according to schematics, which comes out of
5V BOOST USB HOST MODE POWER - and it's not controlled by software. So
there's nothing to reference.

>
> > + };
> > +};
> > +
> > +&codec {
> > + status = "okay";
> > +};
> > +
> > +&codec_analog {
> > + status = "okay";
> > +};
> > +
> > +&dai {
> > + status = "okay";
> > };
> >
> > &ehci0 {
> > @@ -267,6 +284,31 @@
> > vcc-hdmi-supply = <&reg_dldo1>;
> > };
> >
> > +&sound {
> > + status = "okay";
> > + simple-audio-card,widgets = "Microphone", "Internal Microphone Left",
> > + "Microphone", "Internal Microphone Right",
> > + "Headphone", "Headphone Jack",
> > + "Speaker", "Internal Speaker";
> > + simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
> > + simple-audio-card,routing =
> > + "Left DAC", "AIF1 Slot 0 Left",
> > + "Right DAC", "AIF1 Slot 0 Right",
> > + "INL", "LINEOUT",
> > + "INR", "LINEOUT",
> > + "Internal Speaker", "OUTL",
> > + "Internal Speaker", "OUTR",
> > + "Headphone Jack", "HP",
> > + "AIF1 Slot 0 Left ADC", "Left ADC",
> > + "AIF1 Slot 0 Right ADC", "Right ADC",
> > + "Left ADC", "ADC",
> > + "Right ADC", "ADC",
> > + "Internal Microphone Left", "MBIAS",
> > + "MIC1", "Internal Microphone Left",
> > + "Internal Microphone Right", "HBIAS",
> > + "MIC2", "Internal Microphone Right";
>
> The schematics is missing the actual jack, but this looks to be correct.
>
> ChenYu
>
> > +};
> > +
> > &uart0 {
> > pinctrl-names = "default";
> > pinctrl-0 = <&uart0_pb_pins>;
> > --
> > 2.19.1
> >

2018-11-15 05:48:58

by Vasily Khoruzhick

[permalink] [raw]
Subject: Re: [PATCH v6 3/3] arm64: dts: allwinner: a64: enable sound on Pinebook

On Wed, Nov 7, 2018 at 11:30 PM Chen-Yu Tsai <[email protected]> wrote:
> > +
> > + speaker_amp: speaker_amp {
> > + compatible = "simple-audio-amplifier";
> > + enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
>
> You might want to add a sound-name-prefix property. See
>
> Documentation/devicetree/bindings/sound/name-prefix.txt
>
> Also this should have a reference to its power supply regulator.

You're right, it should reference its power supply which should be a
fixed regulator controlled via GPIO from AXP803.

Unfortunately there's no AXP803 GPIO support yet and
simple-audio-amplifier doesn't have regulator property.

I have no time (and interest) to work on it in near future, so if
anyone wants to pick it up - feel free to do so.

Regards,
Vasily

2018-11-17 16:04:29

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v6 3/3] arm64: dts: allwinner: a64: enable sound on Pinebook

On Thu, Nov 15, 2018 at 1:48 PM Vasily Khoruzhick <[email protected]> wrote:
>
> On Wed, Nov 7, 2018 at 11:30 PM Chen-Yu Tsai <[email protected]> wrote:
> > > +
> > > + speaker_amp: speaker_amp {
> > > + compatible = "simple-audio-amplifier";
> > > + enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
> >
> > You might want to add a sound-name-prefix property. See
> >
> > Documentation/devicetree/bindings/sound/name-prefix.txt
> >
> > Also this should have a reference to its power supply regulator.
>
> You're right, it should reference its power supply which should be a
> fixed regulator controlled via GPIO from AXP803.
>
> Unfortunately there's no AXP803 GPIO support yet and
> simple-audio-amplifier doesn't have regulator property.
>
> I have no time (and interest) to work on it in near future, so if
> anyone wants to pick it up - feel free to do so.

Understood. I can try to pick it up when I have some extra time.

On the other hand, I tried this series on my Pine64 and (with
the necessary device tree changes) on my Bananapi M64. While
audio played (did not stall), no audio was actually coming out
of the headphones I had plugged in. I made sure that all needed
mixer controls were enabled, and the DAPM graph read all green
from the DAI to the Headphone jack.

Any ideas?


Regards
ChenYu

2018-11-17 17:13:08

by Vasily Khoruzhick

[permalink] [raw]
Subject: Re: [PATCH v6 3/3] arm64: dts: allwinner: a64: enable sound on Pinebook

On Sat, Nov 17, 2018 at 8:02 AM Chen-Yu Tsai <[email protected]> wrote:
>
> On Thu, Nov 15, 2018 at 1:48 PM Vasily Khoruzhick <[email protected]> wrote:
> >
> > On Wed, Nov 7, 2018 at 11:30 PM Chen-Yu Tsai <[email protected]> wrote:
> > > > +
> > > > + speaker_amp: speaker_amp {
> > > > + compatible = "simple-audio-amplifier";
> > > > + enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
> > >
> > > You might want to add a sound-name-prefix property. See
> > >
> > > Documentation/devicetree/bindings/sound/name-prefix.txt
> > >
> > > Also this should have a reference to its power supply regulator.
> >
> > You're right, it should reference its power supply which should be a
> > fixed regulator controlled via GPIO from AXP803.
> >
> > Unfortunately there's no AXP803 GPIO support yet and
> > simple-audio-amplifier doesn't have regulator property.
> >
> > I have no time (and interest) to work on it in near future, so if
> > anyone wants to pick it up - feel free to do so.
>
> Understood. I can try to pick it up when I have some extra time.
>
> On the other hand, I tried this series on my Pine64 and (with
> the necessary device tree changes) on my Bananapi M64. While
> audio played (did not stall), no audio was actually coming out
> of the headphones I had plugged in. I made sure that all needed
> mixer controls were enabled, and the DAPM graph read all green
> from the DAI to the Headphone jack.
>
> Any ideas?

Please show output of amixer. My guess is that you don't have 'AIF1
DAC' enabled.

>
> Regards
> ChenYu