Re: [PATCH v5 5/8] power: bq27xxx_battery: Add power_supply_battery_info support
From: Liam Breck <hidden>
Date: 2017-02-07 00:15:53
On Mon, Feb 6, 2017 at 3:29 PM, Andrew F. Davis [off-list ref] wrote:
On 02/04/2017 03:16 AM, Liam Breck wrote:quoted
From: Matt Ranostay <redacted> From: Matt Ranostay <redacted> Previously there was no way to set chip registers in the event that the defaults didn't match the battery in question. BQ27xxx driver now calls power_supply_get_battery_info, checks the inputs, and writes battery data to NVRAM.I haven't had much time to review this, but have you seen our old internal version of this driver?: http://git.ti.com/bms-linux/bms-kernel/blobs/master/drivers/power/bq27x00_battery.c I would like that most of the NVRAM checks and sets are kept in userspace: http://git.ti.com/bms-linux/bqtool/trees/master In kernel don't really have a good way to know when the battery has been swapped and the DT info might not be valid for this new battery. I guess there is really no good way, but I imagine this is why we never upstreamed the rest of this driver before.
But for a huge variety of devices, changing the type of battery is not an option. DT battery characteristics are entirely optional in this patchset; no 'monitored-battery' means no NVRAM update. This patchset also allows field-upgrade of the NVRAM in a linux-generic way, by releasing a kernel or dtb package update. Also I suspect fuel-gauge and charger drivers will be encouraged to support monitored-battery since it's a core feature :-)