diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile index 688e3f786b736..020213c7936d6 100644 --- a/arch/arm/boot/dts/overlays/Makefile +++ b/arch/arm/boot/dts/overlays/Makefile @@ -75,6 +75,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ fe-pi-audio.dtbo \ fsm-demo.dtbo \ gc9a01.dtbo \ + geekworm-x120x.dtbo \ ghost-amp.dtbo \ goodix.dtbo \ googlevoicehat-soundcard.dtbo \ diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README index 9f7578b8a9e83..5f35ee995124b 100644 --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README @@ -1561,6 +1561,15 @@ Params: speed Display SPI bus speed debug Debug output level {0-7} +Name: geekworm-x120x +Info: Geekworm X120x UPS boards for the Raspberry Pi 5, such as the X1202 + and X1206. Adds the MAX17040-compatible fuel gauge at I2C address + 0x36 and a gpio-charger for the GPIO that reports input power, and + links the two so the battery can report whether it is charging. +Load: dtoverlay=geekworm-x120x,= +Params: gpio GPIO that reports input power (default 6) + + Name: ghost-amp Info: An overlay for the Ghost amplifier. Load: dtoverlay=ghost-amp,= diff --git a/arch/arm/boot/dts/overlays/geekworm-x120x-overlay.dts b/arch/arm/boot/dts/overlays/geekworm-x120x-overlay.dts new file mode 100644 index 0000000000000..c408468b8a02b --- /dev/null +++ b/arch/arm/boot/dts/overlays/geekworm-x120x-overlay.dts @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Definitions for Geekworm X120x UPS boards such as the X1202 and X1206: +// a MAX17040-compatible fuel gauge on I2C plus a GPIO that reports input +// power, linked so the battery knows its charger. +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "brcm,bcm2712"; + + fragment@0 { + target-path = "/"; + __overlay__ { + x120x_charger: charger { + compatible = "gpio-charger"; + gpios = <&gpio 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; + charger-type = "mains"; + status = "okay"; + }; + }; + }; + + fragment@1 { + target = <&i2c_arm>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + x120x_battery: fuel-gauge@36 { + compatible = "maxim,max17040"; + reg = <0x36>; + power-supplies = <&x120x_charger>; + status = "okay"; + }; + }; + }; + + __overrides__ { + gpio = <&x120x_charger>,"gpios:4"; + }; +};