[Gta04-owner] New "3.7-gta04" branch in my kernel tree.

Sven Dyroff S.Dyroff at phytec.de
Mon Feb 18 10:48:09 CET 2013


Hello Neil,

thank you, this already sounds very good! In order to make it perfect - 
and perhaps to make it easier to use by Radek and others, would it be 
possible and make sense to introduce a new health state like 
POWER_SUPPLY_HEALTH_UNCALIBRATED and using this? Then distros like QtMoko 
could savely rely on this state for example for displaying the battery 
indicator within another color as usual.

Best regards
   Sven
 




Von:    NeilBrown <neilb at suse.de>
An:     List for communicating with real GTA04 owners 
<gta04-owner at goldelico.com>
Kopie:  S.Dyroff at phytec.de
Datum:  16.02.2013 21:49
Betreff:        Re: [Gta04-owner] New "3.7-gta04" branch in my kernel 
tree.


On Fri, 15 Feb 2013 09:52:17 +0100 Sven Dyroff <S.Dyroff at phytec.de> wrote:

> Hello Neil,
>
> > I've just created a new "3.7-gta04" branch in
> git://neil.brown.name/gta04
> >
> > It contains the 3.7-based kernel that was in my 'mainline' branch
> recently,
> > but with a little bit of tidying up and some minor enhancements:
> >
> > - If no bq27000 battery charge monitor can be found, it is now 
correctly
> >   reported as "not present" rather than "not calibrated".
>
> please also make the driver stop ignoring values when battery is not
> calibrated. Discussions within this list should have revealed that most
> people prefer to have inaccurate values instead of having none - 
including
> me.

I'd like to still make it possible to tell if the battery thinks those 
values
are reliable or not.  Maybe I can just set health to "unknown" if the 
battery
is present but not calibrated.

Maybe something like this.

NeilBrown



diff --git a/drivers/power/bq27x00_battery.c 
b/drivers/power/bq27x00_battery.c
index 96d64c66e..f3bde0e 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -426,33 +426,26 @@ static void bq27x00_update(struct 
bq27x00_device_info *di)
/* read error */
cache.flags = -1;
if (cache.flags >= 0) {
-               if (!is_bq27500 && !is_bq27425
-                               && (cache.flags & BQ27000_FLAG_CI)) {
-                       dev_dbg(di->dev, "battery is not calibrated! 
ignoring capacity values\n");
-                       cache.capacity = -ENODATA;
-                       cache.energy = -ENODATA;
-                       cache.time_to_empty = -ENODATA;
-                       cache.time_to_empty_avg = -ENODATA;
-                       cache.time_to_full = -ENODATA;
-                       cache.charge_full = -ENODATA;
-                       cache.health = -ENODATA;
-               } else {
-                       cache.capacity = bq27x00_battery_read_rsoc(di);
-                       if (!is_bq27425) {
-                               cache.energy = 
bq27x00_battery_read_energy(di);
-                               cache.time_to_empty =
-                                       bq27x00_battery_read_time(di,
-                                                       BQ27x00_REG_TTE);
-                               cache.time_to_empty_avg =
-                                       bq27x00_battery_read_time(di,
- BQ27x00_REG_TTECP);
-                               cache.time_to_full =
-                                       bq27x00_battery_read_time(di,
-                                                       BQ27x00_REG_TTF);
-                       }
-                       cache.charge_full = bq27x00_battery_read_lmd(di);
-                       cache.health = bq27x00_battery_read_health(di);
+               cache.capacity = bq27x00_battery_read_rsoc(di);
+               if (!is_bq27425) {
+                       cache.energy = bq27x00_battery_read_energy(di);
+                       cache.time_to_empty =
+                               bq27x00_battery_read_time(di,
+ BQ27x00_REG_TTE);
+                       cache.time_to_empty_avg =
+                               bq27x00_battery_read_time(di,
+ BQ27x00_REG_TTECP);
+                       cache.time_to_full =
+                               bq27x00_battery_read_time(di,
+ BQ27x00_REG_TTF);
}
+               cache.charge_full = bq27x00_battery_read_lmd(di);
+               cache.health = bq27x00_battery_read_health(di);
+               if (!is_bq27500 && !is_bq27425
+                   && cache.heath == POWER_SUPPLY_HEALTH_GOOD
+                   && (cache.flags & BQ27000_FLAG_CI))
+                       cache.health = POWER_SUPPLY_HEALTH_UNKNOWN;
+
cache.temperature = bq27x00_battery_read_temperature(di);
if (!is_bq27425)
cache.cycle_count = bq27x00_battery_read_cyct(di);
[Anhang "signature.asc" gelöscht von Sven Dyroff/Mainz/Phytec] 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20130218/bb1c5bb5/attachment-0001.html>


More information about the Gta04-owner mailing list