I just got the idea, turned off my tablet and came back after a little while. I left it plugged into my trusty laptop that compiles these kernels. Went up from 80% to 93%, so nice to confirm that somebody else is getting these results.
Could be several reasons why. I reexamined the code, downloaded the honeycomb sources and pershoot's p3_battery.c and ran a diff. Pershoot seems to have added an extra function that I'm not sure what it does. However, I think I got most of the changes related to usb charging. Here are several reasons why I think it only works turned off:
1: Could be that powered on it uses as much energy as the usb charging supplies making a net gain of 0% for the battery. I let my tablet watch a few episodes of TMNT for its own enjoyment with the screen on full brightness. % didn't go down but didn't go up either. Not sure if that's conclusive evidence but it's something to keep in mind.
2: There is some other code in the rom that overrides my bypass of the disabled usb charging. What motivation could be behind this? I can think of only 1 reason: if you loose your adapter or you accidentally step on it or some other unfortunate event breaks it you're forced to buy a new one and not go cheap and use another adapter. Can't really confirm this one.
3: Some other kernel driver code prevents usb charging that is only active during regular mode and not charging mode. I could confirm this one but that would require an awful lot of comparing. Somebody else bored (almost to the point of death) and want to verify this?
Ok. I've reviewed your code p3_battery.c and I saw your changes with
info.batt_improper_ta and others. It should be correct, this var never will be 1, so, the problem maybe is in other place... I've seen that depending of the port, it enable 2A max or 0,5A, this is, if it detects a dedicated charger, will enable 2A charging; if it detects a data USB port (as PC USB port), will only enable 0,5 A, maybe enought for maintain the charge but not enought to charge the battery (I think this is the situation I suffer yesterday). Because any reason, I think when we connect a external battery or maybe a non-samsung wall charger, it detects as a USB port and only enable 0.5A charging instead of 2A. This is also in
p3_set_chg_en function you edited, some few lines down your
//battery->info.batt_improper_ta = 1; line, when battery->current_cable_status is not CHARGER_USB,
p3_set_charging(battery, 2); should be changed also to
p3_set_charging(battery, 1);, it is, where it says:
static void p3_set_chg_en(struct battery_data *battery, int enable)
{
...
else if (battery->current_cable_status ==
CHARGER_USB) {
pr_info("USB charger!!");
p3_set_charging(battery, 1);
//gpio_set_value(charger_enable_line, 0);
} else {
pr_info("else type charger!!");
p3_set_charging(battery, 2);
gpio_set_value(charger_enable_line, 0);
}
...
}
change by this:
static void p3_set_chg_en(struct battery_data *battery, int enable)
{
...
else if (battery->current_cable_status ==
CHARGER_USB) {
pr_info("USB charger!!");
p3_set_charging(battery, 1);
//gpio_set_value(charger_enable_line, 0);
} else {
pr_info("else type charger!!");
p3_set_charging(battery, 1); /* the change here */
gpio_set_value(charger_enable_line, 0);
}
...
}
I haven't any compiler (I'm using wordpad to read the code!!), so I cannot test it... If you want to compile this changes (from ver 1.2 trial 19), I'll test it.
Regards,