firmware-utils: bump to git HEAD
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0988-overlays-Add-ghost-amp-overlay.patch
1 From 96f25d50e2352922e16ae74bb16fd8b6985f0f66 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Wed, 30 Sep 2020 12:17:48 +0100
4 Subject: [PATCH] overlays: Add ghost-amp overlay
5
6 Add an overlay for the Ghost amplifier.
7
8 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
9 ---
10 arch/arm/boot/dts/overlays/Makefile | 1 +
11 arch/arm/boot/dts/overlays/README | 7 ++
12 .../boot/dts/overlays/ghost-amp-overlay.dts | 119 ++++++++++++++++++
13 3 files changed, 127 insertions(+)
14 create mode 100644 arch/arm/boot/dts/overlays/ghost-amp-overlay.dts
15
16 --- a/arch/arm/boot/dts/overlays/Makefile
17 +++ b/arch/arm/boot/dts/overlays/Makefile
18 @@ -45,6 +45,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
19 exc3000.dtbo \
20 fe-pi-audio.dtbo \
21 fsm-demo.dtbo \
22 + ghost-amp.dtbo \
23 goodix.dtbo \
24 googlevoicehat-soundcard.dtbo \
25 gpio-fan.dtbo \
26 --- a/arch/arm/boot/dts/overlays/README
27 +++ b/arch/arm/boot/dts/overlays/README
28 @@ -775,6 +775,13 @@ Load: dtoverlay=fsm-demo,<param>=<val>
29 Params: fsm_debug Enable debug logging (default off)
30
31
32 +Name: ghost-amp
33 +Info: An overlay for the Ghost amplifier.
34 +Load: dtoverlay=ghost-amp,<param>=<val>
35 +Params: fsm_debug Enable debug logging of the GPIO FSM (default
36 + off)
37 +
38 +
39 Name: goodix
40 Info: Enables I2C connected Goodix gt9271 multiple touch controller using
41 GPIOs 4 and 17 (pins 7 and 11 on GPIO header) for interrupt and reset.
42 --- /dev/null
43 +++ b/arch/arm/boot/dts/overlays/ghost-amp-overlay.dts
44 @@ -0,0 +1,119 @@
45 +// Overlay for the PCM5122-based Ghost amplifier using gpio-fsm
46 +/dts-v1/;
47 +/plugin/;
48 +
49 +#include <dt-bindings/gpio/gpio-fsm.h>
50 +
51 +#define ENABLE GF_SW(0)
52 +#define FAULT GF_IP(0) // GPIO5
53 +#define RELAY1 GF_OP(0) // GPIO22
54 +#define RELAY2 GF_OP(1) // GPIO23
55 +
56 +/ {
57 + compatible = "brcm,bcm2835";
58 +
59 + fragment@0 {
60 + target = <&i2s>;
61 + __overlay__ {
62 + status = "okay";
63 + };
64 + };
65 +
66 + fragment@1 {
67 + target = <&i2c1>;
68 + __overlay__ {
69 + #address-cells = <1>;
70 + #size-cells = <0>;
71 + status = "okay";
72 +
73 + pcm5122@4c {
74 + #sound-dai-cells = <0>;
75 + compatible = "ti,pcm5122";
76 + reg = <0x4c>;
77 + AVDD-supply = <&vdd_3v3_reg>;
78 + DVDD-supply = <&vdd_3v3_reg>;
79 + CPVDD-supply = <&vdd_3v3_reg>;
80 + status = "okay";
81 + };
82 + };
83 + };
84 +
85 + fragment@2 {
86 + target = <&sound>;
87 + iqaudio_dac: __overlay__ {
88 + compatible = "iqaudio,iqaudio-dac";
89 + i2s-controller = <&i2s>;
90 + mute-gpios = <&amp 0 0>;
91 + iqaudio-dac,auto-mute-amp;
92 + status = "okay";
93 + };
94 + };
95 +
96 + fragment@3 {
97 + target-path = "/";
98 + __overlay__ {
99 + amp: ghost-amp {
100 + compatible = "rpi,gpio-fsm";
101 +
102 + debug = <0>;
103 + gpio-controller;
104 + #gpio-cells = <2>;
105 + num-soft-gpios = <1>;
106 + gpio-line-names = "enable";
107 + input-gpios = <&gpio 5 1>; // FAULT (active low)
108 + output-gpios = <&gpio 22 0>, // RELAY1
109 + <&gpio 23 0>; // RELAY2
110 + shutdown-timeout-ms = <1000>;
111 +
112 + amp_off {
113 + start_state;
114 + shutdown_state;
115 +
116 + set = <RELAY2 0>,
117 + <RELAY1 0>;
118 + amp_on_1 = <ENABLE 1>;
119 + fault = <FAULT 1>;
120 + };
121 +
122 + amp_on_1 {
123 + set = <RELAY1 1>;
124 + amp_on = <GF_DELAY 1500>;
125 + amp_off = <ENABLE 0>;
126 + fault = <FAULT 1>;
127 + };
128 +
129 + amp_on {
130 + set = <RELAY2 1>;
131 + amp_off_wait = <ENABLE 0>;
132 + fault = <FAULT 1>;
133 + };
134 +
135 + amp_off_wait {
136 + amp_off_1 = <GF_DELAY (30*60*1000)>,
137 + <GF_SHUTDOWN 0>;
138 + amp_on = <ENABLE 1>;
139 + fault = <FAULT 1>;
140 + };
141 +
142 + amp_off_1 {
143 + set = <RELAY2 0>;
144 + amp_on = <ENABLE 1>;
145 + amp_off = <GF_DELAY 100>;
146 + fault = <FAULT 1>;
147 + };
148 +
149 + // Keep this a distinct state to prevent
150 + // changes and for the diagnostic output
151 + fault {
152 + set = <RELAY2 0>,
153 + <RELAY1 0>;
154 + shutdown_state;
155 + };
156 + };
157 + };
158 + };
159 +
160 + __overrides__ {
161 + fsm_debug = <&amp>,"debug:0";
162 + };
163 +};