Hey guys, I've attached a diff of the drivers/power/twl4030_bci_battery.c I've been working on. It sets up the twl chip so it handles starting and stopping of the battery better, as per my charge hack that some people have been using here: http://boards.openpandora.org/index.php?/topic/1488-better-battery-charging-... It also detects when the battery is full, and instead of saying "Discharging" even though it is still plugged in, it now says "Full" in /sys/class/power_supply/twl4030_bci_battery/status. This can be used by scripts to detect when it is actually full. Related to Chris' work, it also handles the battery full interrupt in the twl4030battery_charged_evt function. I had thoughts to have it call a script in a known (root writable) location which could simply be Chris' shutdown interface (or any other logic we might want) but commented it out for three important reasons 1) I question the actual design safety of doing so. This is a script that would be run as root, and even though only root could edit that script, is that really a safe thing to do? 2) I have no idea how to do it. As you can see in the diff, I tried system(), but I can't just include stdlib.h. So if this is a good idea, someone please explain to me how a kernel module is supposed to execute a file? Actually, system or its ilk is probably an even worse idea, as it then blocks the interrupt. Gotta be a fork first. 3) I had a third reason but I've forgotten it now.
I want to incorporate Chris' "don't restart when shut down even if it's still plugged in" hack, but it really should be user selectable, which means dropping a new property into sysfs I think. Any thoughts? I've already got the show and set functions written, I just can't think of what property to use. Could we co-opt "CHARGE_FULL_DESIGN" for this? I can't find any information on what charge_full_design is supposed to be. May have to add our own custom properties for this, I think. Don't want to though, seems very unclean to me. Got to be a better way.
Anywho, definitely still to come are changes to pndevmapperd to monitor the battery status and make the charge LED blink when it reads Full. Probably tomorrow. Also, unless Chris gets to it first, I've got the changes to the rtc to allow the Pandora to be booted on alarm. It's a very simple change, just need to clean it up. Also probably tomorrow, or Friday.