Re: [PATCH resend v2] power: supply: bq27xxx: enable writing capacity values for bq27421 + bq27500

From: H. Nikolaus Schaller
Date: Sat Sep 09 2017 - 16:22:08 EST


Hi Liam,

> Am 08.09.2017 um 22:28 schrieb H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>:
>
> Hi Liam,
>
>> Am 08.09.2017 um 22:19 schrieb Liam Breck <liam@xxxxxxxxxxxxxxxxx>:
>>
>> Hi Nikolaus,
>>
>> On Fri, Sep 8, 2017 at 10:38 AM, H. Nikolaus Schaller <hns@xxxxxxxxxxxxx> wrote:
>>> Hi Liam,
>>> I finally continues testing on OpenPandora.
>>>
>>>> Am 31.08.2017 um 22:19 schrieb Liam Breck <liam@xxxxxxxxxxxxxxxxx>:
>>>>
>>>> Hi,
>>>>
>>>> This may be a fix that allows >0 input from DT, but won't try to
>>>> program the register since the first 3 fields aren't compatible:
>>>>
>>>> ... bq27500_dm_regs[] = {
>>>> ...
>>>> [bq27xxx_dm_design_energy] = { 0, 0, 0, 0, 65535 }, /* missing on chip */
>>>> NB: align columns with other rows
>>>
>>> I have tried with this DT
>>>
>>> bat: battery {
>>> compatible = "simple-battery", "openpandora-battery";
>>> voltage-min-design-microvolt = <3250000>;
>>> energy-full-design-microwatt-hours = <14800000>;
>>> charge-full-design-microamp-hours = <4100000>;
>>> };
>>>
>>> and here is the result:
>>>
>>>> root@letux:~# dmesg|fgrep bq27
>>>> [ 10.391235] bq27xxx_battery_setup
>>>> [ 10.391265] bq27xxx_battery_setup: dm_regs=bf0520e0
>>>> [ 10.393798] (NULL device *): hwmon: 'bq27500-1-0' is not a valid name attribute, please fix
>>>> [ 10.432678] bq27xxx_battery_settings
>>>> [ 10.432952] bq27xxx_battery_set_config
>>>> [ 10.432952] bq27xxx_battery_unseal
>>>> [ 10.485168] bq27xxx_battery_update_dm_block
>>>> [ 10.485198] bq27xxx-battery 2-0055: update design-capacity to 4100
>>>
>>> looks good
>>>
>>>> [ 10.485229] bq27xxx_battery_update_dm_block
>>>> [ 10.485229] bq27xxx-battery 2-0055: buffer does not match design-energy dm spec
>>>
>>> ok, ignored
>>>
>>>> [ 10.511718] bq27xxx_battery_update_dm_block
>>>> [ 10.511749] bq27xxx-battery 2-0055: update terminate-voltage to 3250
>>>
>>> looks good
>>>
>>>> [ 10.826446] bq27xxx_battery_seal
>>>> [ 12.150939] bq27xxx_battery_platform_probe
>>>> [ 12.151031] bq27xxx_battery_setup
>>>> [ 12.151062] bq27xxx_battery_setup: dm_regs= (null)
>>>> [ 12.153411] (NULL device *): hwmon: 'bq27000-battery' is not a valid name attribute, please fix
>>>> [ 12.154327] bq27xxx_battery_settings
>>>> [ 12.154357] power_supply bq27000-battery: power_supply_get_battery_info currently only supports devicetree
>>>> [ 12.154388] bq27xxx_battery_settings: power_supply_get_battery_info failed ret=-6
>>
>> Is there also a bq27000 chip on this device, or a battery with it
>> embedded? If so, it doesn't appear to have a DT node (correct for
>> embedded), hence that warning, which isn't useful in that case. Prob
>> battery_settings() should do:
>> if (!di->dev->of_node || power_supply_get_battery_info(...) < 0) return;
>> altho that would be wrong once get_battery_info() supports ACPI config...
>
> No it is not available, but could be. The bq27000 can be connected through
> HDQ to an OMAP3 and therefore there is no auto-detection. If it is configured
> the driver will be loaded. Even if there is no battery_info.
>
> In fact we use the same defconfig for several devices and there is one (GTA04)
> which only has a bq27000 inside the battery.
>
>>
>>> ... login:
>>>
>>>> root@letux:~# cat /sys/class/power_supply/bq27500-1-0/uevent
>>>> POWER_SUPPLY_NAME=bq27500-1-0
>>>> POWER_SUPPLY_STATUS=Discharging
>>>> POWER_SUPPLY_PRESENT=1
>>>> POWER_SUPPLY_VOLTAGE_NOW=3892000
>>>> POWER_SUPPLY_CURRENT_NOW=-317000
>>>> POWER_SUPPLY_CAPACITY=0
>>>
>>> oops.
>>>
>>>> POWER_SUPPLY_CAPACITY_LEVEL=Low
>>>> POWER_SUPPLY_TEMP=223
>>>> POWER_SUPPLY_TIME_TO_EMPTY_NOW=0
>>>> POWER_SUPPLY_TECHNOLOGY=Li-ion
>>>> POWER_SUPPLY_CHARGE_FULL=1147000
>>>> POWER_SUPPLY_CHARGE_NOW=2665000
>>>> POWER_SUPPLY_CHARGE_FULL_DESIGN=4100000
>>>> POWER_SUPPLY_CYCLE_COUNT=6
>>>> POWER_SUPPLY_ENERGY_NOW=0
>>>> POWER_SUPPLY_POWER_AVG=64395
>>>> POWER_SUPPLY_HEALTH=Dead
>>>
>>> oops. But maybe the bq27500 needs a full cycle first
>>
>> I wouldn't guess that the above state is due to the DM update
>> sequence, but I suppose that's possible. Another update pass might
>> clarify that.
>
> Ok, will do tomorrow.

It seems as if the bq27500 needs some time (or a reboot) to recover from no battery and
powered off. Here right after powering on again (same device, same SD card):

root@letux:~# dmesg|fgrep bq27
[ 10.619140] bq27xxx_battery_setup
[ 10.619171] bq27xxx_battery_setup: dm_regs=bf0520e0
[ 10.621734] (NULL device *): hwmon: 'bq27500-1-0' is not a valid name attribute, please fix
[ 10.622680] bq27xxx_battery_settings
[ 10.622955] bq27xxx_battery_set_config
[ 10.622955] bq27xxx_battery_unseal
[ 10.756469] bq27xxx_battery_update_dm_block
[ 10.756500] bq27xxx-battery 2-0055: design-capacity has 4100
[ 10.756500] bq27xxx_battery_update_dm_block
[ 10.756530] bq27xxx-battery 2-0055: buffer does not match design-energy dm spec
[ 10.766723] bq27xxx_battery_update_dm_block
[ 10.766754] bq27xxx-battery 2-0055: terminate-voltage has 3250
[ 10.766754] bq27xxx_battery_seal
[ 12.300842] bq27xxx_battery_platform_probe
[ 12.300933] bq27xxx_battery_setup
[ 12.300964] bq27xxx_battery_setup: dm_regs= (null)
[ 12.303314] (NULL device *): hwmon: 'bq27000-battery' is not a valid name attribute, please fix
[ 12.304229] bq27xxx_battery_settings
[ 12.304260] power_supply bq27000-battery: power_supply_get_battery_info currently only supports devicetree
[ 12.304290] bq27xxx_battery_settings: power_supply_get_battery_info failed ret=-6
root@letux:~# cat /sys/class/power_supply/bq27500-1-0/uevent
POWER_SUPPLY_NAME=bq27500-1-0
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_VOLTAGE_NOW=3952000
POWER_SUPPLY_CURRENT_NOW=-299000
POWER_SUPPLY_CAPACITY=0
POWER_SUPPLY_CAPACITY_LEVEL=Low
POWER_SUPPLY_TEMP=220
POWER_SUPPLY_TIME_TO_EMPTY_NOW=0
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CHARGE_FULL=3751000
POWER_SUPPLY_CHARGE_NOW=0
POWER_SUPPLY_CHARGE_FULL_DESIGN=4100000
POWER_SUPPLY_CYCLE_COUNT=6
POWER_SUPPLY_ENERGY_NOW=0
POWER_SUPPLY_POWER_AVG=64398
POWER_SUPPLY_HEALTH=Dead
POWER_SUPPLY_MANUFACTURER=Texas Instruments
root@letux:~#

and another time:

root@letux:~# dmesg|fgrep bq27
[ 10.595611] bq27xxx_battery_setup
[ 10.599182] bq27xxx_battery_setup: dm_regs=bf05b0e0
[ 10.698791] (NULL device *): hwmon: 'bq27500-1-0' is not a valid name attribute, please fix
[ 10.764831] bq27xxx_battery_settings
[ 10.765075] bq27xxx_battery_set_config
[ 10.765106] bq27xxx_battery_unseal
[ 10.819915] bq27xxx_battery_update_dm_block
[ 10.819946] bq27xxx-battery 2-0055: design-capacity has 4100
[ 10.819976] bq27xxx_battery_update_dm_block
[ 10.819976] bq27xxx-battery 2-0055: buffer does not match design-energy dm spec
[ 10.831481] bq27xxx_battery_update_dm_block
[ 10.831512] bq27xxx-battery 2-0055: terminate-voltage has 3250
[ 10.831542] bq27xxx_battery_seal
[ 13.000305] bq27xxx_battery_platform_probe
[ 13.000396] bq27xxx_battery_setup
[ 13.000427] bq27xxx_battery_setup: dm_regs= (null)
[ 13.002807] (NULL device *): hwmon: 'bq27000-battery' is not a valid name attribute, please fix
[ 13.003692] bq27xxx_battery_settings
[ 13.003723] power_supply bq27000-battery: power_supply_get_battery_info currently only supports devicetree
[ 13.003723] bq27xxx_battery_settings: power_supply_get_battery_info failed ret=-6
root@letux:~# cat /sys/class/power_supply/bq27500-1-0/uevent
POWER_SUPPLY_NAME=bq27500-1-0
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_VOLTAGE_NOW=3996000
POWER_SUPPLY_CURRENT_NOW=211000
POWER_SUPPLY_CAPACITY=0
POWER_SUPPLY_CAPACITY_LEVEL=Low
POWER_SUPPLY_TEMP=270
POWER_SUPPLY_TIME_TO_FULL_NOW=94740
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CHARGE_FULL=3751000
POWER_SUPPLY_CHARGE_NOW=0
POWER_SUPPLY_CHARGE_FULL_DESIGN=4100000
POWER_SUPPLY_CYCLE_COUNT=6
POWER_SUPPLY_ENERGY_NOW=0
POWER_SUPPLY_POWER_AVG=759
POWER_SUPPLY_HEALTH=Dead
POWER_SUPPLY_MANUFACTURER=Texas Instruments
root@letux:~#

So rebooting is not enough to awake it.

>
>>
>>>> POWER_SUPPLY_MANUFACTURER=Texas Instruments
>>>
>>> vvv after plugging in charger
>>>
>>>> root@letux:~# cat /sys/class/power_supply/bq27500-1-0/uevent
>>>> POWER_SUPPLY_NAME=bq27500-1-0
>>>> POWER_SUPPLY_STATUS=Charging
>>>> POWER_SUPPLY_PRESENT=1
>>>> POWER_SUPPLY_VOLTAGE_NOW=3923000
>>>> POWER_SUPPLY_CURRENT_NOW=204000
>>>> POWER_SUPPLY_CAPACITY=0
>>>> POWER_SUPPLY_CAPACITY_LEVEL=Low
>>>> POWER_SUPPLY_TEMP=249
>>>> POWER_SUPPLY_TIME_TO_EMPTY_NOW=0
>>>> POWER_SUPPLY_TECHNOLOGY=Li-ion
>>>> POWER_SUPPLY_CHARGE_FULL=1147000
>>>> POWER_SUPPLY_CHARGE_NOW=2665000
>>>> POWER_SUPPLY_CHARGE_FULL_DESIGN=4100000
>>>> POWER_SUPPLY_CYCLE_COUNT=6
>>>> POWER_SUPPLY_ENERGY_NOW=0
>>>> POWER_SUPPLY_POWER_AVG=800
>>>> POWER_SUPPLY_HEALTH=Dead
>>>> POWER_SUPPLY_MANUFACTURER=Texas Instruments
>>>> root@letux:~#
>>>
>>> Now a reboot after removing charger and battery for several minutes:
>>>
>>>> root@letux:~# dmesg|fgrep bq27
>>>> [ 10.482818] bq27xxx_battery_setup
>>>> [ 12.179687] bq27xxx_battery_platform_probe
>>>> [ 12.179779] bq27xxx_battery_setup
>>>> [ 12.179809] bq27xxx_battery_setup: dm_regs= (null)
>>>> [ 12.182495] (NULL device *): hwmon: 'bq27000-battery' is not a valid name attribute, please fix
>>>> [ 12.183502] bq27xxx_battery_settings
>>>> [ 12.183532] power_supply bq27000-battery: power_supply_get_battery_info currently only supports devicetree
>>>> [ 12.183563] bq27xxx_battery_settings: power_supply_get_battery_info failed ret=-6
>>>> [ 15.145812] bq27xxx_battery_setup: dm_regs=bf0520e0
>>>> [ 15.152618] (NULL device *): hwmon: 'bq27500-1-0' is not a valid name attribute, please fix
>>>> [ 15.346557] bq27xxx_battery_settings
>>>> [ 15.350585] bq27xxx_battery_set_config
>>>> [ 15.354553] bq27xxx_battery_unseal
>>>> [ 15.576538] bq27xxx_battery_update_dm_block
>>>> [ 15.580993] bq27xxx-battery 2-0055: design-capacity has 4100
>>>
>>> ^^^ ok, no change needed
>>>
>>>> [ 15.676818] bq27xxx_battery_update_dm_block
>>>> [ 15.681243] bq27xxx-battery 2-0055: buffer does not match design-energy dm spec
>>>> [ 15.798675] bq27xxx_battery_update_dm_block
>>>> [ 15.803100] bq27xxx-battery 2-0055: update terminate-voltage to 3250
>>>
>>> ^^^ looks as if this is not stored in NVM. Should it be?
>>
>> Oh dear. I imagine this is due to a flaw in the multi-block DM update
>> logic. It could be that one of the pauses between calls should be
>> longer The terminate-voltage spec comes from this datasheet:
>> page 19, http://www.ti.com/lit/ds/symlink/bq27500.pdf
>>
>> It's possible that this second pass did update it. What does the next
>> reboot show?
>
> Will boot tomorrow with exactly the same system and report.

This time it did have remembered the terminate-voltage:
(copy from above)

[ 10.766754] bq27xxx-battery 2-0055: terminate-voltage has 3250

>
>>
>>> BTW: it would be nice if all "update" messages could tell the old value as well.
>>
>> We have the orig values in memory since we read the block before
>> updating. Feel free to patch that in :-)
>
> Ok.

Is a one-liner. Will submit a PATCH.

>
>>
>>>> [ 16.011169] bq27xxx_battery_seal
>>>> root@letux:~# cat /sys/class/power_supply/bq27500-1-0/uevent
>>>> POWER_SUPPLY_NAME=bq27500-1-0
>>>> POWER_SUPPLY_STATUS=Discharging
>>>> POWER_SUPPLY_PRESENT=1
>>>> POWER_SUPPLY_VOLTAGE_NOW=3894000
>>>> POWER_SUPPLY_CURRENT_NOW=-291000
>>>> POWER_SUPPLY_CAPACITY=71
>>>
>>> ^^^ looks as if the bq27500 did recover from reprogramming
>>>
>>>> POWER_SUPPLY_CAPACITY_LEVEL=Normal
>>>> POWER_SUPPLY_TEMP=223
>>>> POWER_SUPPLY_TIME_TO_EMPTY_NOW=31200
>>>> POWER_SUPPLY_TECHNOLOGY=Li-ion
>>>> POWER_SUPPLY_CHARGE_FULL=3748000
>>>> POWER_SUPPLY_CHARGE_NOW=2713000
>>>> POWER_SUPPLY_CHARGE_FULL_DESIGN=4100000
>>>> POWER_SUPPLY_CYCLE_COUNT=6
>>>> POWER_SUPPLY_ENERGY_NOW=9930000
>>>> POWER_SUPPLY_POWER_AVG=64407
>>>> POWER_SUPPLY_HEALTH=Good
>>>
>>> ^^^ same here
>>>
>>>> POWER_SUPPLY_MANUFACTURER=Texas Instruments
>>>> root@letux:~#
>>
>> For general use on OpenPandora, you wouldn't have
>> config...dt_updates_nvm option set,
>
> Yes.
>
>> so the driver should report what
>> the chip settings are and whether they aren't what the DT spec'd.
>> Let's verify that too...
>
> Ok.

Now here a reboot with a newly built kernel with CONFIG_BATTERY_BQ27XXX_DT_UPDATES_NVM disabled
and real battery definition:

root@letux:~# dmesg|fgrep bq27
[ 10.339141] bq27xxx_battery_setup
[ 10.342712] bq27xxx_battery_setup: dm_regs=bf0520de
[ 10.362854] (NULL device *): hwmon: 'bq27500-1-0' is not a valid name attribute, please fix
[ 11.945251] bq27xxx_battery_platform_probe
[ 11.945312] bq27xxx_battery_setup
[ 11.945373] bq27xxx_battery_setup: dm_regs= (null)
[ 11.947662] (NULL device *): hwmon: 'bq27000-battery' is not a valid name attribute, please fix
[ 11.948608] bq27xxx_battery_settings
[ 11.948608] power_supply bq27000-battery: power_supply_get_battery_info currently only supports devicetree
[ 11.948638] bq27xxx_battery_settings: power_supply_get_battery_info failed ret=-6
[ 15.036163] bq27xxx_battery_settings
[ 15.112274] bq27xxx_battery_set_config
[ 15.138916] bq27xxx_battery_unseal
[ 15.246124] bq27xxx_battery_update_dm_block
[ 15.250579] bq27xxx-battery 2-0055: design-capacity has 4100; update to 4000 disallowed for flash/NVM data memory
[ 15.418457] bq27xxx_battery_update_dm_block
[ 15.423034] bq27xxx-battery 2-0055: buffer does not match design-energy dm spec
[ 15.569061] bq27xxx_battery_update_dm_block
[ 15.573516] bq27xxx-battery 2-0055: terminate-voltage has 3250; update to 3200 disallowed for flash/NVM data memory
[ 15.664703] bq27xxx_battery_seal
root@letux:~# cat /sys/class/power_supply/bq27500-1-0/uevent
POWER_SUPPLY_NAME=bq27500-1-0
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_VOLTAGE_NOW=3996000
POWER_SUPPLY_CURRENT_NOW=166000
POWER_SUPPLY_CAPACITY=1
POWER_SUPPLY_CAPACITY_LEVEL=Low
POWER_SUPPLY_TEMP=251
POWER_SUPPLY_TIME_TO_FULL_NOW=70560
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CHARGE_FULL=3751000
POWER_SUPPLY_CHARGE_NOW=7000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4100000
POWER_SUPPLY_CYCLE_COUNT=6
POWER_SUPPLY_ENERGY_NOW=0
POWER_SUPPLY_POWER_AVG=828
POWER_SUPPLY_HEALTH=Dead
POWER_SUPPLY_MANUFACTURER=Texas Instruments
root@letux:~#


And another reboot (powered up in between):

root@letux:~# dmesg|fgrep bq27
[ 10.271545] bq27xxx_battery_setup
[ 10.271575] bq27xxx_battery_setup: dm_regs=bf0520de
[ 10.274139] (NULL device *): hwmon: 'bq27500-1-0' is not a valid name attribute, please fix
[ 10.345062] bq27xxx_battery_settings
[ 10.345306] bq27xxx_battery_set_config
[ 10.345336] bq27xxx_battery_unseal
[ 10.382415] bq27xxx_battery_update_dm_block
[ 10.382446] bq27xxx-battery 2-0055: design-capacity has 4100; update to 4000 disallowed for flash/NVM data memory
[ 10.382446] bq27xxx_battery_update_dm_block
[ 10.382476] bq27xxx-battery 2-0055: buffer does not match design-energy dm spec
[ 10.392852] bq27xxx_battery_update_dm_block
[ 10.392883] bq27xxx-battery 2-0055: terminate-voltage has 3250; update to 3200 disallowed for flash/NVM data memory
[ 10.392883] bq27xxx_battery_seal
[ 11.832763] bq27xxx_battery_platform_probe
[ 11.832855] bq27xxx_battery_setup
[ 11.832885] bq27xxx_battery_setup: dm_regs= (null)
[ 11.846038] (NULL device *): hwmon: 'bq27000-battery' is not a valid name attribute, please fix
[ 11.846984] bq27xxx_battery_settings
[ 11.847015] power_supply bq27000-battery: power_supply_get_battery_info currently only supports devicetree
[ 11.847045] bq27xxx_battery_settings: power_supply_get_battery_info failed ret=-6
root@letux:~# cat /sys/class/power_supply/bq27500-1-0/uevent
POWER_SUPPLY_NAME=bq27500-1-0
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_VOLTAGE_NOW=4001000
POWER_SUPPLY_CURRENT_NOW=200000
POWER_SUPPLY_CAPACITY=1
POWER_SUPPLY_CAPACITY_LEVEL=Low
POWER_SUPPLY_TEMP=270
POWER_SUPPLY_TIME_TO_FULL_NOW=69420
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CHARGE_FULL=3751000
POWER_SUPPLY_CHARGE_NOW=32000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4100000
POWER_SUPPLY_CYCLE_COUNT=6
POWER_SUPPLY_ENERGY_NOW=51000
POWER_SUPPLY_POWER_AVG=756
POWER_SUPPLY_HEALTH=Dead
POWER_SUPPLY_MANUFACTURER=Texas Instruments
root@letux:~#

And after reenabling CONFIG_BATTERY_BQ27XXX_DT_UPDATES_NVM

root@letux:~# dmesg|fgrep bq27
[ 10.316589] bq27xxx_battery_setup
[ 10.320129] bq27xxx_battery_setup: dm_regs=bf0520e0
[ 10.440979] (NULL device *): hwmon: 'bq27500-1-0' is not a valid name attribute, please fix
[ 10.441986] bq27xxx_battery_settings
[ 10.442230] bq27xxx_battery_set_config
[ 10.442260] bq27xxx_battery_unseal
[ 10.503662] bq27xxx_battery_update_dm_block
[ 10.503723] bq27xxx-battery 2-0055: update design-capacity from 4100 to 4000
[ 10.503723] bq27xxx_battery_update_dm_block
[ 10.503753] bq27xxx-battery 2-0055: buffer does not match design-energy dm spec
[ 10.544769] bq27xxx_battery_update_dm_block
[ 10.544799] bq27xxx-battery 2-0055: update terminate-voltage from 3250 to 3200
[ 10.866546] bq27xxx_battery_seal
[ 11.892913] bq27xxx_battery_platform_probe
[ 11.893005] bq27xxx_battery_setup
[ 11.893035] bq27xxx_battery_setup: dm_regs= (null)
[ 11.913208] (NULL device *): hwmon: 'bq27000-battery' is not a valid name attribute, please fix
[ 11.914154] bq27xxx_battery_settings
[ 11.914184] power_supply bq27000-battery: power_supply_get_battery_info currently only supports devicetree
[ 11.914215] bq27xxx_battery_settings: power_supply_get_battery_info failed ret=-6
root@letux:~# cat /sys/class/power_supply/bq27500-1-0/uevent
POWER_SUPPLY_NAME=bq27500-1-0
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_VOLTAGE_NOW=4012000
POWER_SUPPLY_CURRENT_NOW=256000
POWER_SUPPLY_CAPACITY=3
POWER_SUPPLY_CAPACITY_LEVEL=Low
POWER_SUPPLY_TEMP=284
POWER_SUPPLY_TIME_TO_FULL_NOW=54960
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CHARGE_FULL=3751000
POWER_SUPPLY_CHARGE_NOW=76000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4000000
POWER_SUPPLY_CYCLE_COUNT=6
POWER_SUPPLY_ENERGY_NOW=188000
POWER_SUPPLY_POWER_AVG=1027
POWER_SUPPLY_HEALTH=Dead
POWER_SUPPLY_MANUFACTURER=Texas Instruments
root@letux:~#

This time reprogramming worked and the capacity level is regenerating.

So I'd say everything works as expected.

I'll send my latest patches for review asap.

BR,
Nikolaus