gjdwebserver-overlay/sys-kernel/pinephone-pro-sources/files/0054-arm64-dts-rk3399-pinephone-pro-Add-audio-support.patch
Gerben Jan Dijkman 4b1427b69b Changed ebuild
2022-01-15 02:12:55 +01:00

140 lines
3.5 KiB
Diff

From: Ondrej Jirman <megous@megous.com>
Date: Wed, 24 Nov 2021 01:58:45 +0100
Subject: [PATCH 18/18] arm64: dts: rk3399-pinephone-pro: Add audio support
The codec is complicated, good luck! :D
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
.../boot/dts/rockchip/rk3399-pinephone-pro.dts | 96 ++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
index 88601c9..b2709ae 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
@@ -168,6 +168,69 @@ power {
};
};
+ // in1 - digital mic daughhterboard
+ // in2 - headset mic
+ // in3 - modem output (muxed with mono)
+ // spol - earphone
+ // hpo - heaphones
+ // lout - modem input
+ // spaker - amp enabled by SPK_CTL_H
+ //
+ // mclk - GPIO4_A0/I2S_CLK
+ //
+ // some gpio-jack-detection driver?
+ //pinctrl-0 = <&hp_det>; // GPIO4_D4
+
+ rt5640-sound {
+ compatible = "simple-audio-card";
+ simple-audio-card,name = "rockchip,rt5640-codec";
+ simple-audio-card,aux-devs = <&speaker_amp>;
+ simple-audio-card,format = "i2s";
+ simple-audio-card,mclk-fs = <256>;
+
+ simple-audio-card,widgets =
+ "Microphone", "Headset Microphone",
+ "Microphone", "Internal Microphone",
+ "Headphone", "Headphone Jack",
+ "Speaker", "Internal Earpiece",
+ "Speaker", "Internal Speaker",
+ "Line", "Line In Modem",
+ "Line", "Line Out Modem";
+
+ simple-audio-card,routing =
+ "Headphone Jack", "HPOL",
+ "Headphone Jack", "HPOR",
+ "Internal Earpiece", "SPOLP",
+ "Internal Earpiece", "SPOLN",
+ "Internal Speaker", "Speaker Amp OUTL",
+ "Internal Speaker", "Speaker Amp OUTR",
+ "Speaker Amp INL", "HPOL",
+ "Speaker Amp INR", "HPOR",
+ "DMIC1", "Internal Microphone",
+ "Headset Microphone", "MICBIAS1",
+ "IN2P", "Headset Microphone",
+ "Line Out Modem", "LOUTL",
+ "Line Out Modem", "LOUTR",
+ "IN3P", "Line In Modem",
+ "IN3N", "Line In Modem";
+
+ simple-audio-card,cpu {
+ sound-dai = <&i2s0>;
+ };
+
+ simple-audio-card,codec {
+ sound-dai = <&rt5640>;
+ };
+ };
+
+ speaker_amp: audio-amplifier {
+ compatible = "simple-audio-amplifier";
+ pinctrl-names = "default";
+ pinctrl-0 = <&spk_en>;
+ enable-gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
+ sound-name-prefix = "Speaker Amp";
+ };
+
sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
clocks = <&rk818 1>;
@@ -737,6 +800,24 @@ ucam_out: endpoint {
};
};
};
+
+ // XXX: modem codec supplies:
+ // - vcc1v8_codec
+ // - vcca3v0_codec
+
+ // supplies: (always on currently)
+ // - vcca3v0_codec
+ // - vcca1v8_codec
+ // - vcc5v0_sys - spk_vcc
+ rt5640: rt5640@1c {
+ compatible = "realtek,rt5640";
+ reg = <0x1c>;
+ clocks = <&cru SCLK_I2S_8CH_OUT>;
+ clock-names = "mclk";
+ realtek,dmic1-data-pin = <1>;
+ realtek,in3-differential;
+ #sound-dai-cells = <0>;
+ };
};
&i2c3 {
@@ -874,6 +955,13 @@ ak09911: compass@c {
};
};
+&i2s0 {
+ rockchip,playback-channels = <2>;
+ rockchip,capture-channels = <2>;
+ pinctrl-0 = <&i2s0_2ch_bus>;
+ status = "okay";
+};
+
&io_domains {
status = "okay";
@@ -1086,6 +1174,14 @@ sound {
vcc1v8_codec_en: vcc1v8-codec-en {
rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>;
};
+
+ hp_det: hp-det {
+ rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+
+ spk_en: spk-en {
+ rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
};
};