<macc24>
in case it was me feel free to submit it as yours if you end up upstreaming it
<macromorgan>
I'm going through the battery driver again with a fine-toothed comb to see if I'm missing anything else
<macc24>
i'll just get rest of emulators running on ragnarok, test a patch for display on qualcomm 7c and i can help you with that battery driver
<macromorgan>
right now my outstanding problem is that I can't seem to get a consistent way to guess the battery capacity on bootup when the device is not fully charged
<macromorgan>
things I am looking at: the relaxation voltage (I think BSP driver does more than I am doing and that could play a part) and saving the battery capacity to nvram so you can make an educated guess at bootup.
<macc24>
good luck
kevery1 has joined #linux-rockchip
<macromorgan>
man what I wouldn't give for someone to jump up and say "hey, I have experience writing battery drivers, what can I help you with".
<macc24>
i have experience writing battery drivers but only rk817 :P
kevery has quit [Ping timeout: 256 seconds]
kevery1 is now known as kevery
<macromorgan>
to which I would say "I can measure current, voltage, and columb counts... how do I make an accurate gauge that works when you're full or partially full, plugged in or not plugged in at boot"
<macc24>
idk that someone else might say "if we're plugged in at boot then it makes no sense to try guessing percentage from voltage, check the current, if it's zero then battery is charged -> 100%, if nonzero and charging check the coulomb counter"
camus has quit [Ping timeout: 240 seconds]
camus1 has joined #linux-rockchip
shailangsa has joined #linux-rockchip
camus1 is now known as camus
<amstan>
generally fuel gages should abstract that stuff away and should give you some kind of usable percentage / capacity (mAh current & maH capacity)
<amstan>
you do that by integrating current, every second that battery is on
<amstan>
from time to time there's probably calibration things that are similar to what macc24 is saying, but it's all done automatically
<amstan>
no need to ever look at voltage manually in a driver, unless you just want it displayed for debugging
<macc24>
amstan: isn't euler approximation more and more wrong with time?
<amstan>
"euler approximation", welp, that's a new term for me
<amstan>
idk, maybe that's not the way they do it
<macc24>
rk817 fuel gauge does /some/ abstraction... there's coulomb counter
<amstan>
but the point is that the chips are supposed to do stuff to know these things, and if they don't do that job properly you're pretty much screwed and can't do better
matthias_bgg has quit [Ping timeout: 252 seconds]
<macc24>
macromorgan: i didn't care /that/ much about percentage... i planned to just have a battery indicator that can display just [---]+ on full, [-- ]+ on mostly charged, [- ]+ on mostly empty and [ ]+ on critical
<macc24>
few percent here or there wouldnt matter xD
<macromorgan>
problem is I'm off as much as 20% currently
<macromorgan>
the main issue is that I have to init the columb counter with an estimated value, and that's what I'm currently struggling with, the correct initial value
<macromorgan>
but I'm digging through BSP code again to see if I missed something (I am almost certain I did)
<macc24>
macromorgan: idk maybe init it only when full?
<macromorgan>
hmm
<macromorgan>
I wonder if there is a way for a kernel driver to return "I don't know" when asked for capacity?
<macc24>
NULL
<macc24>
-EINVAL
<macc24>
my suggestions
<macromorgan>
right, but do the drivers support that?
<macc24>
still... i dont think the upstream would like computing values
<macc24>
capacity values*
<macromorgan>
at least a few drivers do it
<macromorgan>
plus that's really not a big deal since it's a simple math function, it's not like we're using some complex formula to say "if I have 2000000 mA left and a capacity of 3000000 mA, I am at 67%).
<macc24>
we might end up making libbattery :v
<macromorgan>
I would love to see some love for libdrm and the Rockchip RGA...