AXP803 Battery Charger Support
#11
So, any way to change battery parameters (capacity, Low Voltage Limit, charge current etc) without recompiling the kernel?
#12
The PMIC and battery parameters are actually all read from the devicetree file, so to change them requires only dtc (the device tree compilter). The devicetree files for each board are in the /boot folder (.dtb). The dtc converts the binary back to a text file and creates the new binary from the text file after edits. The parameters correspond more or less to the registers in the AXP803 datasheet. One important thing is, the register settings are persistent as long as the AXP has either input power or battery power! And the linux driver updates the battery parameters only once if the AXP has empty registers. To reset that, all power has to be removed from the AXP. The battery charger only works properly if the battery parameters are persistent, e.g. the battery is not removed, since it is self learning and adapts certain values over charge cycles...
Come have a chat in the Pine IRC channel >>
#13
(12-03-2017, 03:56 PM)xalius Wrote: The PMIC and battery parameters are actually all read from the devicetree file, so to change them requires only dtc (the device tree compilter). The devicetree files for each board are in the /boot folder (.dtb). The dtc converts the binary back to a text file and creates the new binary from the text file after edits. The parameters correspond more or less to the registers in the AXP803 datasheet. One important thing is, the register settings are persistent as long as the AXP has either input power or battery power! And the linux driver updates the battery parameters only once if the AXP has empty registers. To reset that, all power has to be removed from the AXP. The battery charger only works properly if the battery parameters are persistent, e.g. the battery is not removed, since it is self learning and adapts certain values over charge cycles...

Hi xalius thanks to you info I found the dtb files and changed it like you said to dts, easily described here
So I was able to change the "pmu_battery_cap" to the capacity my battery actually has but I would like to also change the values which are seen in "/sys/class/power_supply/battery/uevent" like for example "POWER_SUPPLY_TECHNOLOGY" to LiPo and POWER_SUPPLY_VOLTAGE_MIN_DESIGN and so on according to this post it should be possible to echo it via rc.local but I am not sure if this is possible since its a different chip (AXP209)

Also how can I figure out which dtb file is used ? Since in my folder there are different once for each board and since I have a Pine64+ I would like to know if I am change the correct file Smile

Would be nice to get an answer ... thanks in advance and happy holidays
#14
Hi, POWER_SUPPLY_TECHNOLOGY and POWER_SUPPLY_VOLTAGE_MIN_DESIGN and some other parameters are hardcoded in the linux driver source, but they are not really used anywhere, so the issue is mostly cosmetic. The relevant parameters are all read from the devicetree...

As for which devicetree blob (dtb) is used (or rather passed to the kernel on boot), this is configured in the u-boot bootloader setup, check boot.cmd/boot.scr files for the load command. Basically u-boot has a function to identify the board from some distinct features (type and size of memory, SID register of the A64, ...) and then sets an environment variable for the u-boot process and for the load command that moves the dtb, initrd and kernel image into RAM...
Come have a chat in the Pine IRC channel >>
#15
(12-22-2017, 05:23 AM)xalius Wrote: Hi, POWER_SUPPLY_TECHNOLOGY and POWER_SUPPLY_VOLTAGE_MIN_DESIGN and some other parameters are hardcoded in the linux driver source, but they are not really used anywhere, so the issue is mostly cosmetic. The relevant parameters are all read from the devicetree...

As for which devicetree blob (dtb) is used (or rather passed to the kernel on boot), this is configured in the u-boot bootloader setup, check boot.cmd/boot.scr files for the load command. Basically u-boot has a function to identify the board from some distinct features (type and size of memory, SID register of the A64, ...) and then sets an environment variable for the u-boot process and for the load command that moves the dtb, initrd and kernel image into RAM...

Of corse these things are in the source code but somehow I have to be able to select the technology shouldn't I ? According to this.
LiFe which is currently is set on my device is LIFE = 4 and I would like to set LIPO = 3 but I have not found any value I could definitly define as this variable

Also the POWER_SUPPLY_VOLTAGE_MIN_DESIGN should be in uV like described here and is currently at 3300 which would be 0,003mV with which the battery would definitly break also I dont think that the AXP can us that low Voltage to still run problerly and supply 5V to the board.

thanks for you answer so far Smile


Possibly Related Threads…
Thread Author Replies Views Last Post
  Programming languages support under PINE64 baryluk 6 13,374 09-23-2020, 11:46 PM
Last Post: Phillip Bell
Wink Pine64 Will support Freenas or openmediavault ? joe 1 5,298 04-13-2017, 07:44 AM
Last Post: xalius
  Remote Desktop Support? Rochambeaux 20 32,280 10-01-2016, 05:08 PM
Last Post: HayseedGeek
  Binfmt_misc support cztian 1 4,032 08-17-2016, 11:49 PM
Last Post: longsleep
Question Joystick/Gamepad support Drakuwa 3 6,589 08-10-2016, 10:12 AM
Last Post: xalius
Big Grin Funny ! Support Intel x86 linux applications on ARM-based ( PINE64 ) not freeware joe 10 17,918 08-09-2016, 05:59 PM
Last Post: dkryder
  Camera support - Ubuntu Xenial 16.04 LTS @lex 3 5,786 08-07-2016, 03:47 AM
Last Post: romansavrulin
  Virtualization Support soccercheng 12 19,308 07-14-2016, 11:04 AM
Last Post: mont3z
  distro with kernel support for DVB-T dongles? mkaut 2 5,104 07-02-2016, 02:36 PM
Last Post: mkaut
  XFS Support? utdrmac 2 3,812 06-30-2016, 01:44 AM
Last Post: longsleep

Forum Jump:


Users browsing this thread: 1 Guest(s)