Skip to content

overlays: Add geekworm-x120x overlay - #7744

Merged
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
HuggeK:geekworm-x120x-overlay
Nov 9, 2026
Merged

pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
HuggeK:geekworm-x120x-overlay

Conversation

@HuggeK

@HuggeK HuggeK commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

The Geekworm X120x UPS boards for the Pi 5 (X1202, X1206) are normally set up with dtoverlay=i2c-sensor,max17040 plus dtoverlay=gpio-charger,gpio=6,.... Nothing links the two, so the battery can't tell whether it is charging. This overlay creates both nodes and links them with power-supplies.

The link only reaches the battery's status once max17040 honours power-supplies. It doesn't today, because the driver never passes its fwnode to the power supply core. That fix is now on linux-pm: max17040 series.

Tested on a Pi 5 (6.18.50) with an X1202:

  • Stock driver: battery and charger appear as before (status=Unknown, capacity=103).
  • With the max17040 series: on mains it reports status=Full and capacity=100. Unplugging it switches to Discharging. Plugging it back in gives Charging below 100 % (seen at 98 %) and Full at 100 %. The battery sends its uevent within 1 ms of the charger's.

Written with help from Claude Code.

🤖 Generated with Claude Code

@HuggeK

HuggeK commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Our problem: open-flight/openflight#337

@HuggeK
HuggeK force-pushed the geekworm-x120x-overlay branch from d6bf12d to 56e9108 Compare November 8, 2026 14:05
@HuggeK
HuggeK marked this pull request as ready for review November 8, 2026 14:48
@pelwell

pelwell commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

What you have submitted looks fine - it has passed all the tests. However, it did make me think about the use of a pinctrl node purely to set a pull bias on a pin. This is something that can also be specified in the gpio declaration using GPIO_FLAG_xxx flags. You would need to add a #include for the flags declarations, and replace:

        gpios = <&gpio 6 0>;

with:

        gpios = <&gpio 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;

Would you mind making this additional change? See #7746 for some examples.

@pelwell

pelwell commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

P.S. Good luck with upstreaming your driver changes - it can be a brutal process. If you let us know when they are accepted we will happily back-port it to our current kernels.

The Geekworm X120x UPS boards for the Raspberry Pi 5 are currently set
up with two separate overlays:

  dtoverlay=i2c-sensor,max17040
  dtoverlay=gpio-charger,gpio=6,...

Nothing tells the fuel gauge that the charger supplies it, so the
battery cannot report whether it is charging. Add one overlay that
creates both nodes and links them with power-supplies.

The overlay and this description were written with help from Claude
Code (claude-opus-5-5) and tested on a Raspberry Pi 5 with an X1202.

Signed-off-by: Hugo Karlsson <huggek@klattorp.se>
@HuggeK

HuggeK commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

P.S. Good luck with upstreaming your driver changes - it can be a brutal process. If you let us know when they are accepted we will happily back-port it to our current kernels.

I feared the same in regards to that, have heard horror storries but I think it passed? I may be naive of not understanding the process completely. See: https://lore.kernel.org/lkml/179418738021.1255445.3214315853336545090.b4-ty@b4/

@HuggeK
HuggeK force-pushed the geekworm-x120x-overlay branch from 56e9108 to 4e870b5 Compare November 9, 2026 10:03
@pelwell
pelwell merged commit d8cf67b into raspberrypi:rpi-6.18.y Nov 9, 2026
@pelwell

pelwell commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Congratulations on your success. Those commits have not appeared in linux-next yet - drop a reply here when they do and I'll do the back-port.

@HuggeK

HuggeK commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Congratulations on your success. Those commits have not appeared in linux-next yet - drop a reply here when they do and I'll do the back-port.

Thanks. Looks to me like they are in Linux-next now: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/drivers/power/supply/max17040_battery.c

So it would only be open-flight/openflight#319 that's in the way to get it working 100% then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants