d1: add new target
[openwrt/staging/wigyori.git] / target / linux / d1 / patches-6.1 / 0083-riscv-dts-allwinner-d1-Add-sound-cards-to-boards.patch
1 From 54b1030c72d74ba6390d62086cbfc6a511f58aa7 Mon Sep 17 00:00:00 2001
2 From: Samuel Holland <samuel@sholland.org>
3 Date: Thu, 11 Aug 2022 00:39:42 -0500
4 Subject: [PATCH 083/117] riscv: dts: allwinner: d1: Add sound cards to boards
5
6 Signed-off-by: Samuel Holland <samuel@sholland.org>
7 ---
8 .../sun20i-d1-common-regulators.dtsi | 5 +++++
9 .../sun20i-d1-lichee-rv-86-panel.dtsi | 21 +++++++++++++++++++
10 .../allwinner/sun20i-d1-lichee-rv-dock.dts | 12 +++++++++++
11 .../boot/dts/allwinner/sun20i-d1-nezha.dts | 12 +++++++++++
12 arch/riscv/boot/dts/allwinner/sun20i-d1.dtsi | 13 +++++++++++-
13 5 files changed, 62 insertions(+), 1 deletion(-)
14
15 diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-common-regulators.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1-common-regulators.dtsi
16 index 11bdc81e38d5..993ebf4e5297 100644
17 --- a/arch/riscv/boot/dts/allwinner/sun20i-d1-common-regulators.dtsi
18 +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-common-regulators.dtsi
19 @@ -18,6 +18,11 @@
20 };
21 };
22
23 +&codec {
24 + avcc-supply = <&reg_aldo>;
25 + hpvcc-supply = <&reg_hpldo>;
26 +};
27 +
28 &lradc {
29 vref-supply = <&reg_aldo>;
30 };
31 diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel.dtsi
32 index 95e30818f218..000d4c1cb28c 100644
33 --- a/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel.dtsi
34 +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel.dtsi
35 @@ -9,6 +9,12 @@
36 ethernet1 = &xr829;
37 };
38
39 + audio_amplifier: audio-amplifier {
40 + compatible = "simple-audio-amplifier";
41 + enable-gpios = <&pio 1 10 GPIO_ACTIVE_HIGH>; /* PB10 */
42 + sound-name-prefix = "Amplifier";
43 + };
44 +
45 dmic_codec: dmic-codec {
46 compatible = "dmic-codec";
47 num-channels = <2>;
48 @@ -51,6 +57,21 @@
49 };
50 };
51
52 +&codec {
53 + aux-devs = <&audio_amplifier>;
54 + routing = "Internal Speaker", "Amplifier OUTL",
55 + "Internal Speaker", "Amplifier OUTR",
56 + "Amplifier INL", "HPOUTL",
57 + "Amplifier INR", "HPOUTR",
58 + "LINEINL", "HPOUTL",
59 + "LINEINR", "HPOUTR",
60 + "MICIN3", "Internal Microphone",
61 + "Internal Microphone", "HBIAS";
62 + widgets = "Microphone", "Internal Microphone",
63 + "Speaker", "Internal Speaker";
64 + status = "okay";
65 +};
66 +
67 &dmic {
68 pinctrl-0 = <&dmic_pb11_d0_pin>, <&dmic_pe17_clk_pin>;
69 pinctrl-names = "default";
70 diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-dock.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-dock.dts
71 index 30359cd08d3f..24ff8278b3af 100644
72 --- a/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-dock.dts
73 +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-dock.dts
74 @@ -48,6 +48,18 @@
75 };
76 };
77
78 +&codec {
79 + routing = "Internal Speaker", "HPOUTL",
80 + "Internal Speaker", "HPOUTR",
81 + "LINEINL", "HPOUTL",
82 + "LINEINR", "HPOUTR",
83 + "MICIN3", "Internal Microphone",
84 + "Internal Microphone", "HBIAS";
85 + widgets = "Microphone", "Internal Microphone",
86 + "Speaker", "Internal Speaker";
87 + status = "okay";
88 +};
89 +
90 &dmic {
91 pinctrl-0 = <&dmic_pb11_d0_pin>, <&dmic_pe17_clk_pin>;
92 pinctrl-names = "default";
93 diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
94 index 54c59f083a3e..b5296e79003c 100644
95 --- a/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
96 +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
97 @@ -51,6 +51,18 @@
98 };
99 };
100
101 +&codec {
102 + routing = "Headphone Jack", "HPOUTL",
103 + "Headphone Jack", "HPOUTR",
104 + "LINEINL", "HPOUTL",
105 + "LINEINR", "HPOUTR",
106 + "MICIN3", "Headset Microphone",
107 + "Headset Microphone", "HBIAS";
108 + widgets = "Microphone", "Headset Microphone",
109 + "Headphone", "Headphone Jack";
110 + status = "okay";
111 +};
112 +
113 &cpu0 {
114 cpu-supply = <&reg_vdd_cpu>;
115 };
116 diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1.dtsi
117 index 25c524264897..df711e83039a 100644
118 --- a/arch/riscv/boot/dts/allwinner/sun20i-d1.dtsi
119 +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1.dtsi
120 @@ -312,10 +312,21 @@
121 };
122
123 codec: audio-codec@2030000 {
124 - compatible = "simple-mfd", "syscon";
125 + compatible = "allwinner,sun20i-d1-codec", "simple-mfd", "syscon";
126 reg = <0x2030000 0x1000>;
127 + interrupts = <41 IRQ_TYPE_LEVEL_HIGH>;
128 + clocks = <&ccu CLK_BUS_AUDIO>,
129 + <&ccu CLK_AUDIO_ADC>,
130 + <&ccu CLK_AUDIO_DAC>,
131 + <&osc24M>,
132 + <&rtc CLK_OSC32K>;
133 + clock-names = "bus", "adc", "dac", "hosc", "losc";
134 + resets = <&ccu RST_BUS_AUDIO>;
135 + dmas = <&dma 7>, <&dma 7>;
136 + dma-names = "rx", "tx";
137 #address-cells = <1>;
138 #size-cells = <1>;
139 + #sound-dai-cells = <0>;
140
141 regulators@2030348 {
142 compatible = "allwinner,sun20i-d1-analog-ldos";
143 --
144 2.20.1
145