Batteries, lithium, ions, chargers...
At last :)
I've managed to get charging work correctly, red led blinks when charging is in progress, and lights solid when charging finished. (Denis reported that his PDA has yellow led, btw, it does not matter :)) Problem was stupid: GPJ2, GPJ3 and GPJ6 (and not GPJ4 as I've reported before!) are affected in battery charging. I'll post patch after some testing ;)
Here's short description:
when charger connected, GPF2 goes to 0, and EINT2 interrupt occurs. In that case we should:
- set GPA2 and GPA3 to 1
- wait for some time, GPF3 should become 0 (not sure that it's necessary)
- then we need to set GPJ2, GPJ3 and GPJ6 to 1
when charging is finished, GPF3 becomes 1 (GPF2 still 0!), in that case we should:
- set GPA2 and GPA3 to 0, set GPA6 and GPA7 to 1
- set GPJ2, GPJ3, GPJ6 to 0
when charger is disconnected, GPF2 = 1. Each charger connecting/disconnecting event EINT2 occurs. But it doesn't when charging finished - so we should poll GPF3 periodically to prevent battery overcharging ;)
Now I'm working on getting battery level. It seems that rx1950 doesn't have any "smart" chips that estimate battery level. Sad. Very sad. It isn't possible to estimate battery level precisely only with battery voltage and temperature :( h1900 and h4100 has same situation, driver adc_battery exists in hh tree. I'm going to adapt it for rx1950.
Btw, if anyone who reads this blog knows way to estimate battery level with voltage and temp - please contact me.
P.S. wince doesn't believe that linux can charge battery :)
If I reboot from linux to windows after charging battery in linux, wince has same battery level which it has before booting to linux. Only removing/inserting battery helps it to detect _real_ battery level ;)