Re: Battery info sysctl for arm devices

From: Daniel O'Connor <darius_at_dons.net.au>
Date: Wed, 11 Dec 2024 12:38:09 UTC

> On 11 Dec 2024, at 17:45, Toby Kurien <toby@tobykurien.com> wrote:
> I am new to FreeBSD and busy implementing a driver for the battery and charge controller in the Pinephone Pro. Everything battery-related appears to fall under ACPI, including the sysctls in hw.acpi.battery.* and I was wondering how battery on ARM is normally handled? Is there a /dev/acpi on ARM or is there a different standard for handling battery on ARM? 
>  
> I looked into the source for upower to see how it handles FreeBSD, but it seems to be based on ACPI. I was wondering if I should "emulate" ACPI by registering "hw.acpi.battery.*" to expose the battery info, but then it seems upower will try to use /dev/acpi, which would fail. Any pointers on how to expose battery state on ARM would be appreciated. 

I think you could emulate the sysctls - I had a similar issue with the Raspberry PiJuice board - unfortunately it looks like the battery infrastructure is glued to ACPI which is disabled (at least on RPi).

For power status (so powerd run the scripts for power coming and going) I send devctl ACPI/ACAD/notify messages.

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum