3 3
Chema

[Pine64] axp20 / sys/class/power_supply problems

Recommended Posts

(edited)

Hello,

This is my first attempt to install Armbian on a Pine64 + that I bought 2 weeks ago. I created one from the source, but as the battery management failed, I tried it with a constructed image (Armbian_5.69_Pine64_Debian_stretch_next_4.19.13.img), but it's still the same: everything works fine, except battery management. The state of battery and energy should appear as files in the /sys/class/power/directory, but this directory is not created. I can see this directory and the battery information in other images (like the version of the 3.1 kernel of Ayufan).

What I have seen is a strange error (for me) in dmesg, related to the power management modules (axp..), but I do not know how to solve it:

root@pine64:~# uname -a
Linux pine64 4.19.13-sunxi64 #5.69 SMP Wed Jan 9 18:10:00 CET 2019 aarch64 GNU/Linux

root@pine64:~# dmesg | grep axp

[    1.787551] axp20x-rsb sunxi-rsb-3a3: AXP20x variant AXP803 found

[    1.790301] input: axp20x-pek as /devices/platform/soc/1f03400.rsb/sunxi-rsb-3a3/axp221-pek/input/input0

[    1.795894] axp20x-rsb sunxi-rsb-3a3: AXP20X driver loaded

[    3.065498] axp20x-gpio axp20x-gpio: DMA mask not set

[    3.066057] axp20x-gpio axp20x-gpio: AXP209 pinctrl and GPIO driver loaded

[    5.313564] axp20x-battery-power-supply axp20x-battery-power-supply: DMA mask not set

[    5.316583] axp20x-ac-power-supply axp20x-ac-power-supply: DMA mask not set

[    5.371486] axp20x-adc axp813-adc: DMA mask not set

 

The same dmesg in other images (but these images are based on kernels that are too old for what I need):

root@pinebook:/home/adminq# uname -a
Linux pinebook 3.10.105-bsp-1.2-ayufan-136 #1 SMP PREEMPT Sat Oct 27 21:18:35 UTC 2018 aarch64 GNU/Linux
root@pinebook:/home/adminq# dmesg | grep axp
[   10.729542] axp81x_board_init: axp regl_devs num = 23
[   11.990682] input: axp81x-supplyer as /devices/platform/axp81x_board/axp81x-supplyer.47/input/input1
root@pinebook:/home/adminq# ls /sys/class/power_supply/
ac  battery  usb

 

 

Thank you very much for your wonderful work.

 

Regards.

 

Edited by Chema
Add the board model in the title

Share this post


Link to post
Share on other sites

I'm currently working with Armbian on a Pine64 and it looks like both the 4.14.x kernels and 4.19.x kernels are missing some dtb definitions related to the axp803 powersupply for /sys/class/power_supply to work properly.

 

From what I can tell this thread: https://forum.pine64.org/archive/index.php?thread-1430-1.html

 

Has a bunch of dtb related pieces missing from 4.x kernels

 

Would someone be able to help me decipher the differences and put together a dtb overlay to hopefully sort this out?

 

I'm willing to release the purple smoke (if things go awry) during testing to help get this sorted...

Share this post


Link to post
Share on other sites
11 minutes ago, Igor said:


Modern kernel was written virtually from scratch.

I've gotten that impression as I've dug into things on the Pine64[+] side. I'm a heavy Orange Pi user and the Pine64's power circuitry related to battery support is compelling for a current build of mine. I've been using Armbian base images for the last ~12 months for Orange Pi boards (of various forms) and finally hit a bit of a wall on my understanding thanks to the 4.x kernels missing dtb things for the Pine64[+]. The Pine64 series has been a thorn in my side since I started working with it. I've spent a lot of time digging into what's going on and it seems the dtb's are missing pieces/parts. However, the dtb parts of the kernel are new to me. I've not had to work with them in the past. I opened this thread in the hopes I could receive a bit of guidance and mentorship so I could conntribute patches and useful output to the Armbian project.

 

 

Quote

I have kept an eye on that page on and off and that's part of why I opened this thread. I was hoping to get some help and/or mentorship on building out the dtb's for the Pine64 series of SBCs. The battery/charger side of the Pine64[+] setup seemed incomplete related to the power supply/battery dtb pieces in my research and that page doesn't mention the axp 803 chip in the pine64 as incomplete. I was hoping to get help sorting out what the heck I need to start probing the dtb's. This is new territory for me. I'm content to explode a board or two along the way but I need help figuring out where to begin and start the process of learning so I can submit patches/issues/etc in a useful way for the Armbian devs.

 

Quote

That was my goal. My hope was to work with the Armbian devs/community to improve the dtb support for the /sys/class/power_supply side of the Pine64 series. I am unsure where to start. The best I can sort out presently is that the dtb setup for 3.10 and 4.x is very different and I'm not sure where to begin for sorting out differences. I'm content to throw myself at a wall to work through the problem and/or sacrifice a board or two to the cause. Unfortunately, I need help to figure out where to begin on reconciling the difference between the Pine64 3.10 dtb's and 4.x dtb's. I need help deciphering what the hell is going in on the 3.10.x "official" kernel and 4.x series so I can be of use. This is new territory for me.

 

Quote

cover some time https://www.armbian.com/donate.  

There is "throwing money at the problem" and "affordable". I have a feeling our definitions of both will be within a reasonable margin of error. As content as I may be to throw money at problems, my current cash flow situation doesn't cover the cost of what I'd consider reasonable for implementation, testing and release. As someone who has a $dayJob that's professional programming, I'm not inclined to belittle other programmers with paltry sums and big asks. That would be unreasonable and asinine. If it's OK, I'd prefer learning, donating my time and helping reduce the pain other programmers feel day to day. I'd appreciate NOT belittling you by undervaluing the worth of your precious time.

Share this post


Link to post
Share on other sites
41 minutes ago, KemoNine said:

it seems the dtb's are missing pieces/parts


It's not just that. DTB is hardware configuration but if the driver doesn't support functions, describing them doesn't bring functions up. This is probably the case here - I am not aware if anything has been moved further without investigation.

 

If you need to get an information from the chip and you are not willing to develop a driver further, you still can talk with AXP chip via I2C channels. It's a bit nasty, but it shall work. (use search for more info)

 

44 minutes ago, KemoNine said:

This is new territory for me.


Ratio between people that know something and those who don't is extreme. Several (ten)thousands vs. 1? A lot of questions that newbies asks represent serious projects in value of tens of thousands of dollars. You can't ask amateurs to cover you that. I am making a virtual cue out of peoples wishes. Waiting time would be several years if you want expert attention on your problem ... if that one is working full time. I hope this give you some better scale?

 

45 minutes ago, KemoNine said:

I need help to figure out where to begin on reconciling the difference between the Pine64 3.10 dtb's and 4.x dtb's. I need help deciphering what the hell is going in on the 3.10.x "official" kernel and 4.x series so I can be of use. This is new territory for me.


I suggest people to start with a small things. Take some simple time consuming job away from "people that know something" and chances that AXP driver gets some attention will raise up. If many people will go that path, a lot more could be developed/solved. There are people who are working on the project but they are not hardcore developers. Not even close. But they are around every day and help on towards common goals.

 

1 hour ago, KemoNine said:

my current cash flow situation doesn't cover the cost


On most optimistic estimation Armbian costs are covered up to 3-4% (Xunlong, FriendlyARM & Olimex) while end-users donations coverage is way below 1%.

Share this post


Link to post
Share on other sites
7 hours ago, Igor said:


It's not just that. DTB is hardware configuration but if the driver doesn't support functions, describing them doesn't bring functions up. This is probably the case here - I am not aware if anything has been moved further without investigation.

 

If you need to get an information from the chip and you are not willing to develop a driver further, you still can talk with AXP chip via I2C channels. It's a bit nasty, but it shall work. (use search for more info)

 

I will dig around and see if I can work on enhancing the 4.x series drivers based on the data sheet as well as longsleeps existing driver. I only glanced over some of the code in the drivers.

 

 

7 hours ago, Igor said:


Ratio between people that know something and those who don't is extreme. Several (ten)thousands vs. 1? A lot of questions that newbies asks represent serious projects in value of tens of thousands of dollars. You can't ask amateurs to cover you that. I am making a virtual cue out of peoples wishes. Waiting time would be several years if you want expert attention on your problem ... if that one is working full time. I hope this give you some better scale?

 

I understand. I wasn't trying to imply I expected help or a mentor. I was hoping others who know more about the kernel dtb stuff as well as driver dev could nudge me in a direction or two (as you did above). I understand the time scales and I apologize for using too strong of a word.

 

7 hours ago, Igor said:


I suggest people to start with a small things. Take some simple time consuming job away from "people that know something" and chances that AXP driver gets some attention will raise up. If many people will go that path, a lot more could be developed/solved. There are people who are working on the project but they are not hardcore developers. Not even close. But they are around every day and help on towards common goals.

 

That's a good approach. Would you recommend starting with the drivers and seeing what may or may not be implemented at the code level?

 

7 hours ago, Igor said:


On most optimistic estimation Armbian costs are covered up to 3-4% (Xunlong, FriendlyARM & Olimex) while end-users donations coverage is way below 1%.

 

Understood. If/when I get some extra cash I'll aim it your way. I appreciate the project and the amazing output.

Share this post


Link to post
Share on other sites
On 4/10/2019 at 6:30 PM, KemoNine said:

 

I will dig around and see if I can work on enhancing the 4.x series drivers based on the data sheet as well as longsleeps existing driver. I only glanced over some of the code in the drivers.

 

 

 

I understand. I wasn't trying to imply I expected help or a mentor. I was hoping others who know more about the kernel dtb stuff as well as driver dev could nudge me in a direction or two (as you did above). I understand the time scales and I apologize for using too strong of a word.

 

 

That's a good approach. Would you recommend starting with the drivers and seeing what may or may not be implemented at the code level?

 

 

Understood. If/when I get some extra cash I'll aim it your way. I appreciate the project and the amazing output.

 

I have  BPI_M64 that basically have the same hardware and with Armbian  image I am facing the same issue with the axp20x device.

 

It is strange because if I install image with Kernel from - https://github.com/BPI-SINOVOIP/BPI-M64-bsp-4.4 

I do get those parameters   

root@bpi-iot-ros-ai:~#  ls /sys/class/power_supply/
ac  battery  usb

 

When working with Armbian it doesnt show those values. (ac, battery , usb) 

We need to figure out what to change in the Armbian based kernel sources in order to get it to work also with Armbian.

I have no clue what to look for...

 

Any thoughts?

 

 

UPDATE:

 

Since with kernel based 4.4.98 of BananaPI image it works does anyone know how to take this driver:

https://github.com/BPI-SINOVOIP/BPI-M64-bsp-4.4/tree/master/linux-sunxi/drivers/power/axp

and add it to to Armbian build? 

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.

Guest
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.

Loading...
3 3