Re: [meta-freescale] Charger / Battery detection

Fabio Estevam <[email protected]> Sun, 20 Nov 2022 10:44:22 -0300
Newsgroups org.yoctoproject.lists.meta-freescale
Message-ID <CAOMZO5C890ZyfSKarKNQ6gZ0kc_FMf0+T5HoH29t7Xp5QCxqhg@mail.gmail.com>
Hi Andy,

On Sun, Nov 20, 2022 at 10:36 AM Andy Pont <[email protected]> wrote:
>
> Hello,
>
> Is there standard functionality to build into an image for an i.MX8 that
> will allow me to detect, at application level, whether the device is
> running on charger, battery, and what the battery level is?  Does it
> depend on what is used as the PMIC and charging device?

Yes, you need a charger device driver. Take a look at
drivers/power/supply/ for some examples.

The charger devices can expose to userspace information as you describe above.

You can check details at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/ABI/testing/sysfs-class-power?h=v6.0.9

BTW, this is off-topic on this list.