once "full" even on main's isn't the battery discharging?
afaict there is no way to only use power from AC and leave the battery alone - which is a shame (please tell me I'm wrong!)

Calling a userland script from the kernel is probably not a great idea.

I see nothing wrong with polling within a sleep loop as I maintain that halting should not be a setting but should only be initiated by something that a user has actively run and knows is going to happen each time... (There should be a window saying something like "Awaiting shutdown on full charge <cancel>"

Yes leaving the alarm irq enabled is trivial isn't it ;) - can I leave you to provide the patch? As I mentioned earlier I don't have a kernel tree handy to play with and also my Pandora is going to have to go on holiday soon.... (to the health spa - damn that nub) :( 

as for a sysfs property how about CHRISC_WANTS_TO_DISABLE_AC_TRANSITION :D or if you really must AC_POWER_UP_TRANSITION (true/false)

I don't see any issue with adding our own property name, what we want to accomplish will not be needed by phone OEM's and is specific to our needs...

besides isn't CHARGE_FULL_DESIGN to number of milliamps/hrs that the battery is designed to reach when brand new and charged?


Best
Chris


On 28/04/11 04:14, David Goldsmith wrote:
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-beta/
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.
_______________________________________________ Firmware-dev mailing list Firmware-dev@openpandora.org http://openpandora.org/cgi-bin/mailman/listinfo/firmware-dev

-- 
 
Disclaimer:
By sending an email to ANY of my addresses you are agreeing that:

  1. I am by definition, "the intended recipient"

  2. All information in the email is mine to do with as I see fit and
make such financial profit, political mileage, or good joke as it lends
itself to. In particular, I may quote it where I please.

  3. I may take the contents as representing the views of your company.

  4. This overrides any disclaimer or statement of confidentiality that
may be included on your message.