197 lines
5.2 KiB
Diff
197 lines
5.2 KiB
Diff
|
From bea662718e1c1be94923b2905e51c63974d3779f Mon Sep 17 00:00:00 2001
|
||
|
From: Ondrej Jirman <megi@xff.cz>
|
||
|
Date: Sun, 4 Sep 2022 23:25:19 +0200
|
||
|
Subject: [PATCH 280/389] arm64: dts: rk3399-pinephone-pro: Add sound support
|
||
|
|
||
|
Add support for Pinephone Pro sound card and codec.
|
||
|
|
||
|
It also adds a jack detection GPIO to the sound card definition, and
|
||
|
creates a new set of ADC keys for handling headset buttons.
|
||
|
|
||
|
Co-developed-by: Arnaud Ferraris <arnaud.ferraris@gmail.com>
|
||
|
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@gmail.com>
|
||
|
Signed-off-by: Ondrej Jirman <megi@xff.cz>
|
||
|
---
|
||
|
.../dts/rockchip/rk3399-pinephone-pro.dts | 119 ++++++++++++++++++
|
||
|
1 file changed, 119 insertions(+)
|
||
|
|
||
|
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
|
||
|
index 472699d5af9b..34c506d20fa2 100644
|
||
|
--- a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
|
||
|
+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
|
||
|
@@ -132,6 +132,70 @@ key-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
|
||
|
+
|
||
|
+ rt5640-sound {
|
||
|
+ compatible = "simple-audio-card";
|
||
|
+ pinctrl-names = "default";
|
||
|
+ pinctrl-0 = <&hp_det>;
|
||
|
+ simple-audio-card,name = "PinePhonePro";
|
||
|
+ simple-audio-card,aux-devs = <&speaker_amp>;
|
||
|
+ simple-audio-card,format = "i2s";
|
||
|
+ simple-audio-card,mclk-fs = <256>;
|
||
|
+ simple-audio-card,hp-det-gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_LOW>;
|
||
|
+ simple-audio-card,pin-switches = "Internal Speaker";
|
||
|
+
|
||
|
+ simple-audio-card,widgets =
|
||
|
+ "Microphone", "Headset Microphone",
|
||
|
+ "Microphone", "Internal Microphone",
|
||
|
+ "Headphone", "Headphones",
|
||
|
+ "Speaker", "Internal Earpiece",
|
||
|
+ "Speaker", "Internal Speaker",
|
||
|
+ "Line", "Line In Modem",
|
||
|
+ "Line", "Line Out Modem";
|
||
|
+
|
||
|
+ simple-audio-card,routing =
|
||
|
+ "Headphones", "HPOL",
|
||
|
+ "Headphones", "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>;
|
||
|
@@ -229,6 +293,8 @@ vcc1v8_codec: vcc1v8-codec-regulator {
|
||
|
pinctrl-names = "default";
|
||
|
pinctrl-0 = <&vcc1v8_codec_en>;
|
||
|
regulator-name = "vcc1v8_codec";
|
||
|
+ regulator-always-on;
|
||
|
+ regulator-boot-on;
|
||
|
regulator-min-microvolt = <1800000>;
|
||
|
regulator-max-microvolt = <1800000>;
|
||
|
vin-supply = <&vcc3v3_sys>;
|
||
|
@@ -369,8 +435,13 @@ regulator-state-mem {
|
||
|
|
||
|
vcca3v0_codec: LDO_REG1 {
|
||
|
regulator-name = "vcca3v0_codec";
|
||
|
+ regulator-always-on;
|
||
|
+ regulator-boot-on;
|
||
|
regulator-min-microvolt = <3000000>;
|
||
|
regulator-max-microvolt = <3000000>;
|
||
|
+ regulator-state-mem {
|
||
|
+ regulator-on-in-suspend;
|
||
|
+ };
|
||
|
};
|
||
|
|
||
|
vcc3v0_touch: LDO_REG2 {
|
||
|
@@ -384,8 +455,13 @@ regulator-state-mem {
|
||
|
|
||
|
vcca1v8_codec: LDO_REG3 {
|
||
|
regulator-name = "vcca1v8_codec";
|
||
|
+ regulator-always-on;
|
||
|
+ regulator-boot-on;
|
||
|
regulator-min-microvolt = <1800000>;
|
||
|
regulator-max-microvolt = <1800000>;
|
||
|
+ regulator-state-mem {
|
||
|
+ regulator-on-in-suspend;
|
||
|
+ };
|
||
|
};
|
||
|
|
||
|
rk818_pwr_on: LDO_REG4 {
|
||
|
@@ -562,6 +638,34 @@ opp07 {
|
||
|
};
|
||
|
};
|
||
|
|
||
|
+&i2c1 {
|
||
|
+ status = "okay";
|
||
|
+
|
||
|
+ clock-frequency = <400000>;
|
||
|
+ i2c-scl-rising-time-ns = <300>;
|
||
|
+ i2c-scl-falling-time-ns = <15>;
|
||
|
+ // 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";
|
||
|
+ assigned-clocks = <&cru SCLK_I2S0_8CH>;
|
||
|
+ assigned-clock-rates = <11289599>;
|
||
|
+ realtek,dmic1-data-pin = <1>;
|
||
|
+ realtek,in3-differential;
|
||
|
+ realtek,lout-differential;
|
||
|
+ #sound-dai-cells = <0>;
|
||
|
+ };
|
||
|
+};
|
||
|
+
|
||
|
&i2c3 {
|
||
|
i2c-scl-rising-time-ns = <450>;
|
||
|
i2c-scl-falling-time-ns = <15>;
|
||
|
@@ -583,6 +687,13 @@ touchscreen@14 {
|
||
|
};
|
||
|
};
|
||
|
|
||
|
+&i2s0 {
|
||
|
+ rockchip,playback-channels = <2>;
|
||
|
+ rockchip,capture-channels = <2>;
|
||
|
+ pinctrl-0 = <&i2s0_2ch_bus>;
|
||
|
+ status = "okay";
|
||
|
+};
|
||
|
+
|
||
|
&io_domains {
|
||
|
bt656-supply = <&vcc1v8_dvp>;
|
||
|
audio-supply = <&vcca1v8_codec>;
|
||
|
@@ -703,6 +814,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>;
|
||
|
+ };
|
||
|
};
|
||
|
};
|
||
|
|
||
|
--
|
||
|
2.35.3
|
||
|
|