linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sbs-battery: fix power status when battery charging near dry
@ 2016-04-06  2:32 YH Huang
  2016-04-09 10:38 ` Daniel Kurtz
  2016-04-10 16:28 ` Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: YH Huang @ 2016-04-06  2:32 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Matthias Brugger
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek,
	YH Huang

POWER_SUPPLY_STATUS_NOT_CHARGING is used for AC connected, but
battery not charging (e.g. because battery temperature is out
of acceptable range).

When battery is charging near dry and BATTERY_FULL_DISCHARGED is set,
it is wrong to set as POWER_SUPPLY_STATUS_NOT_CHARGING.
Just use BATTERY_DISCHARGING to decide the power supply status is
discharging or charging.

Signed-off-by: YH Huang <yh.huang@mediatek.com>
---
 drivers/power/sbs-battery.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/power/sbs-battery.c b/drivers/power/sbs-battery.c
index d6226d6..768b9fc 100644
--- a/drivers/power/sbs-battery.c
+++ b/drivers/power/sbs-battery.c
@@ -382,8 +382,6 @@ static int sbs_get_battery_property(struct i2c_client *client,
 
 		if (ret & BATTERY_FULL_CHARGED)
 			val->intval = POWER_SUPPLY_STATUS_FULL;
-		else if (ret & BATTERY_FULL_DISCHARGED)
-			val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
 		else if (ret & BATTERY_DISCHARGING)
 			val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
 		else
@@ -702,8 +700,6 @@ static void sbs_delayed_work(struct work_struct *work)
 
 	if (ret & BATTERY_FULL_CHARGED)
 		ret = POWER_SUPPLY_STATUS_FULL;
-	else if (ret & BATTERY_FULL_DISCHARGED)
-		ret = POWER_SUPPLY_STATUS_NOT_CHARGING;
 	else if (ret & BATTERY_DISCHARGING)
 		ret = POWER_SUPPLY_STATUS_DISCHARGING;
 	else
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sbs-battery: fix power status when battery charging near dry
  2016-04-06  2:32 [PATCH] sbs-battery: fix power status when battery charging near dry YH Huang
@ 2016-04-09 10:38 ` Daniel Kurtz
  2016-04-10 16:28 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Kurtz @ 2016-04-09 10:38 UTC (permalink / raw)
  To: YH Huang
  Cc: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Matthias Brugger, linux-pm, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	moderated list:ARM/Mediatek SoC support

On Wed, Apr 6, 2016 at 12:32 PM, YH Huang <yh.huang@mediatek.com> wrote:
> POWER_SUPPLY_STATUS_NOT_CHARGING is used for AC connected, but
> battery not charging (e.g. because battery temperature is out
> of acceptable range).
>
> When battery is charging near dry and BATTERY_FULL_DISCHARGED is set,
> it is wrong to set as POWER_SUPPLY_STATUS_NOT_CHARGING.
> Just use BATTERY_DISCHARGING to decide the power supply status is
> discharging or charging.
>
> Signed-off-by: YH Huang <yh.huang@mediatek.com>

Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>

> ---
>  drivers/power/sbs-battery.c |    4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/drivers/power/sbs-battery.c b/drivers/power/sbs-battery.c
> index d6226d6..768b9fc 100644
> --- a/drivers/power/sbs-battery.c
> +++ b/drivers/power/sbs-battery.c
> @@ -382,8 +382,6 @@ static int sbs_get_battery_property(struct i2c_client *client,
>
>                 if (ret & BATTERY_FULL_CHARGED)
>                         val->intval = POWER_SUPPLY_STATUS_FULL;
> -               else if (ret & BATTERY_FULL_DISCHARGED)
> -                       val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
>                 else if (ret & BATTERY_DISCHARGING)
>                         val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
>                 else
> @@ -702,8 +700,6 @@ static void sbs_delayed_work(struct work_struct *work)
>
>         if (ret & BATTERY_FULL_CHARGED)
>                 ret = POWER_SUPPLY_STATUS_FULL;
> -       else if (ret & BATTERY_FULL_DISCHARGED)
> -               ret = POWER_SUPPLY_STATUS_NOT_CHARGING;
>         else if (ret & BATTERY_DISCHARGING)
>                 ret = POWER_SUPPLY_STATUS_DISCHARGING;
>         else
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sbs-battery: fix power status when battery charging near dry
  2016-04-06  2:32 [PATCH] sbs-battery: fix power status when battery charging near dry YH Huang
  2016-04-09 10:38 ` Daniel Kurtz
@ 2016-04-10 16:28 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2016-04-10 16:28 UTC (permalink / raw)
  To: YH Huang
  Cc: Dmitry Eremin-Solenikov, David Woodhouse, Matthias Brugger,
	linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek

[-- Attachment #1: Type: text/plain, Size: 490 bytes --]

Hi,

On Wed, Apr 06, 2016 at 10:32:25AM +0800, YH Huang wrote:
> POWER_SUPPLY_STATUS_NOT_CHARGING is used for AC connected, but
> battery not charging (e.g. because battery temperature is out
> of acceptable range).
> 
> When battery is charging near dry and BATTERY_FULL_DISCHARGED is set,
> it is wrong to set as POWER_SUPPLY_STATUS_NOT_CHARGING.
> Just use BATTERY_DISCHARGING to decide the power supply status is
> discharging or charging.

Thanks, queued.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-10 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-06  2:32 [PATCH] sbs-battery: fix power status when battery charging near dry YH Huang
2016-04-09 10:38 ` Daniel Kurtz
2016-04-10 16:28 ` Sebastian Reichel

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).