Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Nov 2018 12:51:42 +0000
From:      Tom Jones <thj@freebsd.org>
To:        Emmanuel Vadot <manu@bidouilliste.com>
Cc:        Johannes Lundberg <johalun0@gmail.com>, freebsd-current <freebsd-current@freebsd.org>, manu@freebsd.org
Subject:   Re: axp288 on Intel HW
Message-ID:  <20181122125141.GA34096@tom-desk.erg.abdn.ac.uk>
In-Reply-To: <20181122061745.98faaa8b790e97c7da019588@bidouilliste.com>
References:  <CAECmPwsov=h76Xp_1KAzjfQnDnT6oFtu5gY%2BgUBU%2BGO%2BTWM1VA@mail.gmail.com> <20181122061745.98faaa8b790e97c7da019588@bidouilliste.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 22, 2018 at 06:17:45AM +0100, Emmanuel Vadot wrote:
> 
>  Hi,
> 
>  Allwinner PMIC on X86, interesting :)
> 
> On Fri, 16 Nov 2018 08:51:31 +0000
> Johannes Lundberg <johalun0@gmail.com> wrote:
> 
> > Hi
> > 
> > I have a Lenovo Ideapad Miix 310 that has a Intel CherryTrail CPU and it
> > runs FreeBSD quite nicely (with accelerated graphics). What I'm missing is
> > battery life status..
> > 
> > I can get this information using smb (for some reason i2c just returns
> > error sending start condition)
> > smbmsg -f /dev/smb6 -s 0x68 -c 0xB9 -i 1 -F %d
> > 
> > In emergency this works but it would be nice to have a kernel driver for
> > it.
> > 
> > I found the axp2xx driver for Allwinner in the tree. Would it be possible
> > to share this with amd64 with not too much effort?
> 
>  The first step would be to add acpi attach functions (no idea how this
> works), then compare the registers with the pmics supported by the
> axp2xx driver to check what regulators are present and controllable (if
> any) and also checking the registers for talking to the battery
> controller part.
>  I don't see why it wouldn't work but I haven't checked details on how
> supported chips differs with this one.
> 
> > 
> > If not, all I'm really interested in is battery status so I might just hack
> > together a simple driver for that report values to hw.acpi.battery (because
> > I don't think there is a sysctl for battery info that aggregates different
> > sources?)
> 
>  We don't have a generic battery/power supply framework yes.


On an ACPI there is an IOCTL that will collate battery information from
anything in the battery devclass. There is an acpi_battery_register
function, but what it actually does is set up sysctls.

I have a patch to land (hopefully this week) that you would need first. 

I have a driver for a maxim fuel gauge on a unreasonably complicated laptop
that includes an example of what you have to do to be a battery:

https://github.com/adventureloop/gpdpocket/blob/master/chvpower/chvpower.c#L148

To support battery on arm (say for the pinebook) we need a more general
system. I plan to extract out the current battery code from acpi as a
first attempt at this.

- [tj]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20181122125141.GA34096>