LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Dr. H. Nikolaus Schaller" <hns@goldelico.com>
Cc: Tony Lindgren <tony@atomide.com>,
	Marek Belisko <marek@goldelico.com>,
	Benoit Cousson <bcousson@baylibre.com>,
	Sebastian Reichel <sre@kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	devicetree@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	linux-omap@vger.kernel.org,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH v4 3/6] Documentation: DT: Document twl4030-madc-battery bindings
Date: Sat, 4 Apr 2015 10:16:56 +0200	[thread overview]
Message-ID: <20150404081655.GD31064@amd> (raw)
In-Reply-To: <D659872E-E276-4E00-BAFC-1E461EDA1FA7@goldelico.com>

Hi!

> >> Please propose your own code doing that so that we can test if it is
> >> better.
> > 
> > So, how does this look?
> > 
> > It looks to me like you have cca 0.1 Ohm resistance in your system,
> 
> This is completely unknown.
> 
> > and are using cca 75mA while discharging, and charge by cca 1.4A.
> 
> Where do you get these figures from?

Least squares fitting of my coefficients to your tables.

> A GTA04 board discharges usually between 50 and 400 mA (depending on activities)
> and if you turn on WiFi, it will be up to 600 mA. If you use 3G it can draw even more
> during operation.

How big battery do you have? According to least squares fitting,
assuming maximum charge of .46A, you were taking about 25mA when
doing the discharge test.

> Total current going in is 500-800 mA (depending on USB negotiations) and this is
> split into system operation and charging current. So 1.4A charging current is not
> possible. Rather 200-500 mA.
> 
> So it might be that the battery is discharged although the system is connected
> to a charger.

Yah, and your battery meter will be wrong in such case, as will be
mine, because they are based on same information. The thing is, mine
can be improved without adding more tables. 

> > It is tricky to do a good job near 0%... or anywhere else. See for
> > example
> > 
> > http://cseweb.ucsd.edu/~trosing/lectures/battery.pdf
> > 
> > You start a call, percentage goes down, end a call, it will go
> > back up. I'm pretty sure you will not be able to make a call with "5%"
> > indication from your code at low battery temperature (say -10C).
> 
> The whole system is heating up a little, so that you never have -10C for the
> battery.

Umm. When not calling, your phone should not heat itself up. And you
definitely can power it down, leave it in outer pocket, then power it
up. It is actually something people do when they want to preserve battery...

> I think you are trying to solve situations that don’t exist in practice.
> 
> And AFAIK, the GTA04 board is the only user of this driver in case the battery
> has no built-in fuel gauge. So why improve it beyond what the GTA04
> users need?

Because then other users can share the same code, and because you
avoid big ugly tables in dts.

> I repeat myself: this driver is not built for highest precision because there are
> better methods (fuel gauge chip). These might not be available so this fall-back
> driver has been built.
> 
> It is definitively better than no driver and worse than the optimum.

And my email suggested solution better than your driver, so why not
just use it?


> > #perc = percent(volt)
> > compute(charging, 1)
> > compute(discharging, 0)
> 
> Please explain what you calculate here. Especially what “Badness” is?

Badness is error in least squares method.

Here are updated tables:

pavel@duo:~/g/tui/ofone$ ./liion_maps
Charging
Voltage  4.2 V ; table  100 %  internal voltage 4.18 V current 0.078 A computed  97 %
Voltage  4.1 V ; table  75 %  internal voltage 4.08 V current 0.078 A computed  87 %
Voltage  4.0 V ; table  55 %  internal voltage 3.93 V current 0.233 A computed  69 %
Voltage  3.9 V ; table  25 %  internal voltage 3.76 V current 0.467 A computed  26 %
Voltage  3.8 V ; table  5 %  internal voltage 3.66 V current 0.467 A computed  3 %
Voltage  3.7 V ; table  2 %  internal voltage 3.56 V current 0.467 A computed  2 %
Voltage  3.6 V ; table  1 %  internal voltage 3.46 V current 0.467 A computed  1 %
Voltage  3.3 V ; table  0 %  internal voltage 3.16 V current 0.467 A computed  -1 %
Badness  395.4861761427434
Discharging
Voltage  4.2 V ; table  100 %  internal voltage 4.21 V current -0.025 A computed  100 %
Voltage  4.1 V ; table  95 %  internal voltage 4.11 V current -0.025 A computed  91 %
Voltage  4.0 V ; table  70 %  internal voltage 4.01 V current -0.025 A computed  79 %
Voltage  3.8 V ; table  50 %  internal voltage 3.81 V current -0.025 A computed  46 %
Voltage  3.7 V ; table  10 %  internal voltage 3.71 V current -0.025 A computed  3 %
Voltage  3.6 V ; table  5 %  internal voltage 3.61 V current -0.025 A computed  2 %
Voltage  3.3 V ; table  0 %  internal voltage 3.31 V current -0.025 A computed  0 %
Badness  171.69576218433212
pavel@duo:~/g/tui/ofone$ python

									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2015-04-04  8:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 21:27 [PATCH v4 0/6] Convert twl4030_madc_battery to IIO consumer and add DT aupport Marek Belisko
2015-03-10 21:27 ` [PATCH v4 1/6] power: twl4030-madc-battery: Convert to iio consumer Marek Belisko
2015-04-06 17:39   ` Sebastian Reichel
2015-03-10 21:27 ` [PATCH v4 2/6] power: twl4030_madc_battery: Add device tree support Marek Belisko
2015-03-10 21:27 ` [PATCH v4 3/6] Documentation: DT: Document twl4030-madc-battery bindings Marek Belisko
2015-03-11 15:24   ` Tony Lindgren
2015-03-11 16:16     ` Dr. H. Nikolaus Schaller
2015-03-11 16:44       ` Tony Lindgren
2015-03-11 17:13         ` Dr. H. Nikolaus Schaller
2015-03-11 17:43           ` Tony Lindgren
2015-03-11 19:36             ` Sebastian Reichel
2015-03-11 19:37               ` Tony Lindgren
2015-03-31  7:26         ` Pavel Machek
2015-04-01  8:18           ` Dr. H. Nikolaus Schaller
2015-04-01 20:16             ` Pavel Machek
2015-04-01 20:39               ` Dr. H. Nikolaus Schaller
2015-04-04  8:16                 ` Pavel Machek [this message]
2015-04-04  9:46                   ` Dr. H. Nikolaus Schaller
2015-04-01 16:30   ` Rob Herring
2015-04-01 16:46     ` Dr. H. Nikolaus Schaller
2015-03-10 21:27 ` [PATCH v4 4/6] ARM: dts: omap3-gta04: Add battery support Marek Belisko
2015-03-16 20:53   ` Tony Lindgren
2015-03-16 21:04     ` Tony Lindgren
2015-03-10 21:27 ` [PATCH v4 5/6] power: twl4030_madc_battery: Add of_twl4030_madc_match to MODULE_DEVICE_TABLE Marek Belisko
2015-03-10 21:27 ` [PATCH v4 6/6] power: twl4030_madc_battery: Add missing MODULE_ALIAS Marek Belisko
2015-04-06 17:45   ` Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150404081655.GD31064@amd \
    --to=pavel@ucw.cz \
    --cc=bcousson@baylibre.com \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=galak@codeaurora.org \
    --cc=hns@goldelico.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=marek@goldelico.com \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --cc=tony@atomide.com \
    --subject='Re: [PATCH v4 3/6] Documentation: DT: Document twl4030-madc-battery bindings' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).