linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sre@kernel.org (Sebastian Reichel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] sbs-battery: fix power status when battery is dry
Date: Wed, 30 Mar 2016 17:09:20 +0200	[thread overview]
Message-ID: <20160330150919.GA21068@earth> (raw)
In-Reply-To: <1459328310.29450.24.camel@mtksdaap41>

Hi,

On Wed, Mar 30, 2016 at 04:58:30PM +0800, YH Huang wrote:
> If I revise the description in this way(using your clear explanation):
> ------------------------------------------------------------------------
> The battery capacity changing course is like this:
> 
> full: BATTERY_FULLY_CHARGED => POWER_SUPPLY_STATUS_FULL
> <unplug AC>
> high->low: BATTERY_DISCHARGING => POWER_SUPPLY_STATUS_DISCHARGING
> ~0%: DISCHARGING & FULLY_DISCHARGED => POWER_SUPPLY_STATUS_NOT_CHARGING
> <plug in AC>
> 0%~20%: FULLY_DISCHARGED => POWER_SUPPLY_STATUS_CHARGING
> 20%~: No flag => POWER_SUPPLY_STATUS_CHARGING
> 
> For now, it is not exactly right to show the status as
> POWER_SUPPLY_STATUS_NOT_CHARGING when the battery is dry
> (FULLY_DISCHARGED) and AC is plugged in.
> Although the battery is in a low level, system works fine with the AC
> charging.
> It is better to say that the battery is charging.
> ------------------------------------------------------------------------
> 
> How about this?
> By the way, should I also revise the title?

POWER_SUPPLY_STATUS_NOT_CHARGING is used for AC connected, but
battery not charging (e.g. because battery temperature is out
of acceptable range). If you are discharging use
POWER_SUPPLY_STATUS_DISCHARGING.

You should just ignore the FULLY_DISCHARGED bit in the status
property. If you don't want to loose the information about fully
discharged battery add POWER_SUPPLY_PROP_CAPACITY_LEVEL, which maps:

BATTERY_FULLY_CHARGED => POWER_SUPPLY_CAPACITY_LEVEL_FULL
FULLY_DISCHARGED => POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL
otherwise => POWER_SUPPLY_CAPACITY_LEVEL_NORMAL

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160330/b28a67d3/attachment.sig>

  parent reply	other threads:[~2016-03-30 15:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23  9:53 [PATCH] sbs-battery: fix power status when battery is dry YH Huang
2016-03-24  4:01 ` Daniel Kurtz
2016-03-24  6:43   ` YH Huang
2016-03-25  3:06     ` Daniel Kurtz
2016-03-28  2:32       ` YH Huang
2016-03-28 10:05         ` Daniel Kurtz
2016-03-28 15:57           ` Rhyland Klein
2016-03-29  1:52             ` YH Huang
2016-03-29 15:05               ` Rhyland Klein
2016-03-30  8:58                 ` YH Huang
2016-03-30 15:09                   ` Rhyland Klein
2016-03-30 15:09                   ` Sebastian Reichel [this message]
2016-03-31  2:42                     ` YH Huang
2016-04-02  3:46                       ` Sebastian Reichel
2016-04-06  2:35                         ` YH Huang

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=20160330150919.GA21068@earth \
    --to=sre@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).