AXP209 proper driver?

Recommended Posts

There are several topics about AXP209 driver: 

Where @zador.blood.stained you say : 


Main purpose of this patch is creating a sysfs interface to get information from AXP202/209 PMU until proper power driver is implemented in mainline kernel.

At the time it was created it was the simplest way to get data from the PMIC or change some settings without using userspace tools like i2cget/i2cset or a custom code based on i2c libraries.

Newer kernels have received proper drivers - starting with 4.12 there is even a battery driver and an ADC IIO driver, but this patch still can be useful i.e. to enable/disable RTC battery changing on some boards.


Are you talking about this patch ? 


(Which is the one from your github? https://github.com/zador-blood-stained/axp209-sysfs-interface )


If so this patch is deprecated right? If yes then where are the proper drivers you are talking about and how to use them to get current battery voltage, capacity%...?





Share this post

Link to post
Share on other sites

Great, have been trying to do my own scrip to read/write directly reg values with i2C. But changing parameters with i2Cset are overwriten after reboot, probably by the current driver...


are those the current driver and armbian patch of it? 








Or this one maybe who knows



My goal is to changes settings to : 

# - set the battery as 4.36V instead of 4.2V
# - Remove boot when AC plugged in.
# - Set GPIO as ADC


Edit : Changing battery to 4.36V worked afterall. I was using i2cset from desktop on a command windows. That may be the reason it was not registering.

However other register keep getting reseted... 


i2cset -y -f 0 0x34 0x33 0xE9

to set 4.36V works ok.


i2cset -y -f 0 0x34 0x83 0x8C

To enable GPIO ADC is ok.
i2cset -y -f 0 0x34 0x90 0x04
i2cset -y -f 0 0x34 0x92 0x04

Those two should set the GPIO 0 and 1 functions as ADC. Those don't work they keep reseting to 0x02...


About remooving auto-boot when AC plugged in, some one suggested on olimex forum to change bit6 of reg40h to 0. But strangely the reg40 reads 0x00 instead of normal default value of 0xD8...

Share this post

Link to post
Share on other sites

After few reboots the value of battery voltage get reset to 0xc9 afterall... So something must be changing it while booting up.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.