// Overlay for the PCM5122-based Ghost amplifier using gpio-fsm /dts-v1/; /plugin/; #include #define ENABLE GF_SW(0) #define FAULT GF_IP(0) // GPIO5 #define RELAY1 GF_OP(0) // GPIO22 #define RELAY2 GF_OP(1) // GPIO23 #define RELAYSSR GF_OP(2) // GPIO24 / { compatible = "brcm,bcm2835"; fragment@0 { target = <&i2s>; __overlay__ { status = "okay"; }; }; fragment@1 { target = <&i2c1>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; pcm5122@4c { #sound-dai-cells = <0>; compatible = "ti,pcm5122"; reg = <0x4c>; AVDD-supply = <&vdd_3v3_reg>; DVDD-supply = <&vdd_3v3_reg>; CPVDD-supply = <&vdd_3v3_reg>; status = "okay"; }; }; }; fragment@2 { target = <&sound>; iqaudio_dac: __overlay__ { compatible = "iqaudio,iqaudio-dac"; i2s-controller = <&i2s>; mute-gpios = <& 0 0>; iqaudio-dac,auto-mute-amp; status = "okay"; }; }; fragment@3 { target-path = "/"; __overlay__ { amp: ghost-amp { compatible = "rpi,gpio-fsm"; pinctrl-names = "default"; pinctrl-0 = <&ghost_amp_pins>; debug = <0>; gpio-controller; #gpio-cells = <2>; num-swgpios = <1>; gpio-line-names = "enable"; input-gpios = <&gpio 5 1>; // FAULT (active low) output-gpios = <&gpio 22 0>, // RELAY1 <&gpio 23 0>, // RELAY2 <&gpio 24 0>; // RELAYSSR shutdown-timeout-ms = <1000>; amp_off { start_state; shutdown_state; set = , , ; amp_on_1 = ; fault = ; }; amp_on_1 { set = ; amp_on = ; amp_off = ; fault = ; }; amp_on { set = , ; amp_on_wait = ; fault = ; }; amp_on_wait { set = ; amp_off_1 = , ; amp_on = ; fault = ; }; amp_off_1 { set = ; amp_on = ; amp_off = ; fault = ; }; // Keep this a distinct state to prevent // changes and for the diagnostic output fault { set = , , ; amp_off = ; shutdown_state; }; }; }; }; fragment@4 { target = <&gpio>; __overlay__ { ghost_amp_pins: ghost_amp_pins { brcm,pins = <5 22 23 24>; brcm,function = <0 1 1 1>; /* in out out out */ brcm,pull = <2 0 0 0>; /* up none none none */ }; }; }; __overrides__ { fsm_debug = <&>,"debug:0"; }; };