linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] power: supply: bq27xxx_battery: Notify also about status changes
@ 2019-04-26  9:59 Krzysztof Kozlowski
  2019-04-26 10:47 ` Pali Rohár
  2019-05-01 21:31 ` Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2019-04-26  9:59 UTC (permalink / raw)
  To: Pali Rohár, Andrew F. Davis, Sebastian Reichel, linux-pm,
	linux-kernel
  Cc: Krzysztof Kozlowski

User-space might be interested in receiving uevents when the charging
starts/stops or if conditions of battery changes (e.g.
over-temperature).  Notify about changes in battery also when the flags
change, not only SoC.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Changes since v1:
1. Remove unneeded backslash (pointed by Pali).
---
 drivers/power/supply/bq27xxx_battery.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 29b3a4056865..195c18c2f426 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -1612,7 +1612,8 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di)
 			di->charge_design_full = bq27xxx_battery_read_dcap(di);
 	}
 
-	if (di->cache.capacity != cache.capacity)
+	if ((di->cache.capacity != cache.capacity) ||
+	    (di->cache.flags != cache.flags))
 		power_supply_changed(di->bat);
 
 	if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)
-- 
2.7.4


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

* Re: [PATCH v2] power: supply: bq27xxx_battery: Notify also about status changes
  2019-04-26  9:59 [PATCH v2] power: supply: bq27xxx_battery: Notify also about status changes Krzysztof Kozlowski
@ 2019-04-26 10:47 ` Pali Rohár
  2019-05-01 21:31 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Pali Rohár @ 2019-04-26 10:47 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Andrew F. Davis, Sebastian Reichel, linux-pm, linux-kernel

On Friday 26 April 2019 11:59:02 Krzysztof Kozlowski wrote:
> User-space might be interested in receiving uevents when the charging
> starts/stops or if conditions of battery changes (e.g.
> over-temperature).  Notify about changes in battery also when the flags
> change, not only SoC.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Ok, you can add my
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>

> ---
> 
> Changes since v1:
> 1. Remove unneeded backslash (pointed by Pali).
> ---
>  drivers/power/supply/bq27xxx_battery.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
> index 29b3a4056865..195c18c2f426 100644
> --- a/drivers/power/supply/bq27xxx_battery.c
> +++ b/drivers/power/supply/bq27xxx_battery.c
> @@ -1612,7 +1612,8 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di)
>  			di->charge_design_full = bq27xxx_battery_read_dcap(di);
>  	}
>  
> -	if (di->cache.capacity != cache.capacity)
> +	if ((di->cache.capacity != cache.capacity) ||
> +	    (di->cache.flags != cache.flags))
>  		power_supply_changed(di->bat);
>  
>  	if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)

-- 
Pali Rohár
pali.rohar@gmail.com

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

* Re: [PATCH v2] power: supply: bq27xxx_battery: Notify also about status changes
  2019-04-26  9:59 [PATCH v2] power: supply: bq27xxx_battery: Notify also about status changes Krzysztof Kozlowski
  2019-04-26 10:47 ` Pali Rohár
@ 2019-05-01 21:31 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2019-05-01 21:31 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Pali Rohár, Andrew F. Davis, linux-pm, linux-kernel

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

Hi,

On Fri, Apr 26, 2019 at 11:59:02AM +0200, Krzysztof Kozlowski wrote:
> User-space might be interested in receiving uevents when the charging
> starts/stops or if conditions of battery changes (e.g.
> over-temperature).  Notify about changes in battery also when the flags
> change, not only SoC.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Thanks, queued.

-- Sebastian

> 
> ---
> 
> Changes since v1:
> 1. Remove unneeded backslash (pointed by Pali).
> ---
>  drivers/power/supply/bq27xxx_battery.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
> index 29b3a4056865..195c18c2f426 100644
> --- a/drivers/power/supply/bq27xxx_battery.c
> +++ b/drivers/power/supply/bq27xxx_battery.c
> @@ -1612,7 +1612,8 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di)
>  			di->charge_design_full = bq27xxx_battery_read_dcap(di);
>  	}
>  
> -	if (di->cache.capacity != cache.capacity)
> +	if ((di->cache.capacity != cache.capacity) ||
> +	    (di->cache.flags != cache.flags))
>  		power_supply_changed(di->bat);
>  
>  	if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)
> -- 
> 2.7.4
> 

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

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

end of thread, other threads:[~2019-05-01 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-26  9:59 [PATCH v2] power: supply: bq27xxx_battery: Notify also about status changes Krzysztof Kozlowski
2019-04-26 10:47 ` Pali Rohár
2019-05-01 21:31 ` 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).