linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] power: supply: sbs-battery: relax voltage limit
@ 2021-07-19  7:20 Matthias Schiffer
  2021-07-19  7:20 ` [PATCH 2/2] power: supply: sbs-battery: add support for time_to_empty_now attribute Matthias Schiffer
  2021-08-06 21:50 ` [PATCH 1/2] power: supply: sbs-battery: relax voltage limit Sebastian Reichel
  0 siblings, 2 replies; 4+ messages in thread
From: Matthias Schiffer @ 2021-07-19  7:20 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-pm, linux-kernel, Matthias Schiffer

The Smart Battery Data Specification allows for values 0..65535 mV,
there is no reason to limit the value to 20000.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
---
 drivers/power/supply/sbs-battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index f84dbaab283a..3d6b8247d450 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -102,7 +102,7 @@ static const struct chip_data {
 	[REG_TEMPERATURE] =
 		SBS_DATA(POWER_SUPPLY_PROP_TEMP, 0x08, 0, 65535),
 	[REG_VOLTAGE] =
-		SBS_DATA(POWER_SUPPLY_PROP_VOLTAGE_NOW, 0x09, 0, 20000),
+		SBS_DATA(POWER_SUPPLY_PROP_VOLTAGE_NOW, 0x09, 0, 65535),
 	[REG_CURRENT_NOW] =
 		SBS_DATA(POWER_SUPPLY_PROP_CURRENT_NOW, 0x0A, -32768, 32767),
 	[REG_CURRENT_AVG] =
-- 
2.17.1


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

* [PATCH 2/2] power: supply: sbs-battery: add support for time_to_empty_now attribute
  2021-07-19  7:20 [PATCH 1/2] power: supply: sbs-battery: relax voltage limit Matthias Schiffer
@ 2021-07-19  7:20 ` Matthias Schiffer
  2021-08-06 21:50   ` Sebastian Reichel
  2021-08-06 21:50 ` [PATCH 1/2] power: supply: sbs-battery: relax voltage limit Sebastian Reichel
  1 sibling, 1 reply; 4+ messages in thread
From: Matthias Schiffer @ 2021-07-19  7:20 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-pm, linux-kernel, Matthias Schiffer

As defined by the Smart Battery Data Specification.

An _AVG suffix is added to the enum values REG_TIME_TO_EMPTY and
REG_TIME_TO_FULL to make the distinction clear.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
---
 drivers/power/supply/sbs-battery.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 3d6b8247d450..c4a95b01463a 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -31,8 +31,9 @@ enum {
 	REG_CURRENT_AVG,
 	REG_MAX_ERR,
 	REG_CAPACITY,
-	REG_TIME_TO_EMPTY,
-	REG_TIME_TO_FULL,
+	REG_TIME_TO_EMPTY_NOW,
+	REG_TIME_TO_EMPTY_AVG,
+	REG_TIME_TO_FULL_AVG,
 	REG_STATUS,
 	REG_CAPACITY_LEVEL,
 	REG_CYCLE_COUNT,
@@ -119,9 +120,11 @@ static const struct chip_data {
 		SBS_DATA(POWER_SUPPLY_PROP_ENERGY_FULL, 0x10, 0, 65535),
 	[REG_FULL_CHARGE_CAPACITY_CHARGE] =
 		SBS_DATA(POWER_SUPPLY_PROP_CHARGE_FULL, 0x10, 0, 65535),
-	[REG_TIME_TO_EMPTY] =
+	[REG_TIME_TO_EMPTY_NOW] =
+		SBS_DATA(POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, 0x11, 0, 65535),
+	[REG_TIME_TO_EMPTY_AVG] =
 		SBS_DATA(POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, 0x12, 0, 65535),
-	[REG_TIME_TO_FULL] =
+	[REG_TIME_TO_FULL_AVG] =
 		SBS_DATA(POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, 0x13, 0, 65535),
 	[REG_CHARGE_CURRENT] =
 		SBS_DATA(POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, 0x14, 0, 65535),
@@ -165,6 +168,7 @@ static const enum power_supply_property sbs_properties[] = {
 	POWER_SUPPLY_PROP_CAPACITY,
 	POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN,
 	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
 	POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
 	POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
 	POWER_SUPPLY_PROP_SERIAL_NUMBER,
@@ -748,6 +752,7 @@ static void  sbs_unit_adjustment(struct i2c_client *client,
 		val->intval -= TEMP_KELVIN_TO_CELSIUS;
 		break;
 
+	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
 	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
 	case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG:
 		/* sbs provides time to empty and time to full in minutes.
@@ -966,6 +971,7 @@ static int sbs_get_property(struct power_supply *psy,
 	case POWER_SUPPLY_PROP_CURRENT_NOW:
 	case POWER_SUPPLY_PROP_CURRENT_AVG:
 	case POWER_SUPPLY_PROP_TEMP:
+	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
 	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
 	case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG:
 	case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
-- 
2.17.1


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

* Re: [PATCH 1/2] power: supply: sbs-battery: relax voltage limit
  2021-07-19  7:20 [PATCH 1/2] power: supply: sbs-battery: relax voltage limit Matthias Schiffer
  2021-07-19  7:20 ` [PATCH 2/2] power: supply: sbs-battery: add support for time_to_empty_now attribute Matthias Schiffer
@ 2021-08-06 21:50 ` Sebastian Reichel
  1 sibling, 0 replies; 4+ messages in thread
From: Sebastian Reichel @ 2021-08-06 21:50 UTC (permalink / raw)
  To: Matthias Schiffer; +Cc: linux-pm, linux-kernel

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

Hi,

On Mon, Jul 19, 2021 at 09:20:18AM +0200, Matthias Schiffer wrote:
> The Smart Battery Data Specification allows for values 0..65535 mV,
> there is no reason to limit the value to 20000.
> 
> Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/sbs-battery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
> index f84dbaab283a..3d6b8247d450 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -102,7 +102,7 @@ static const struct chip_data {
>  	[REG_TEMPERATURE] =
>  		SBS_DATA(POWER_SUPPLY_PROP_TEMP, 0x08, 0, 65535),
>  	[REG_VOLTAGE] =
> -		SBS_DATA(POWER_SUPPLY_PROP_VOLTAGE_NOW, 0x09, 0, 20000),
> +		SBS_DATA(POWER_SUPPLY_PROP_VOLTAGE_NOW, 0x09, 0, 65535),
>  	[REG_CURRENT_NOW] =
>  		SBS_DATA(POWER_SUPPLY_PROP_CURRENT_NOW, 0x0A, -32768, 32767),
>  	[REG_CURRENT_AVG] =
> -- 
> 2.17.1
> 

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

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

* Re: [PATCH 2/2] power: supply: sbs-battery: add support for time_to_empty_now attribute
  2021-07-19  7:20 ` [PATCH 2/2] power: supply: sbs-battery: add support for time_to_empty_now attribute Matthias Schiffer
@ 2021-08-06 21:50   ` Sebastian Reichel
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Reichel @ 2021-08-06 21:50 UTC (permalink / raw)
  To: Matthias Schiffer; +Cc: linux-pm, linux-kernel

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

Hi,

On Mon, Jul 19, 2021 at 09:20:19AM +0200, Matthias Schiffer wrote:
> As defined by the Smart Battery Data Specification.
> 
> An _AVG suffix is added to the enum values REG_TIME_TO_EMPTY and
> REG_TIME_TO_FULL to make the distinction clear.
> 
> Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/sbs-battery.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
> index 3d6b8247d450..c4a95b01463a 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -31,8 +31,9 @@ enum {
>  	REG_CURRENT_AVG,
>  	REG_MAX_ERR,
>  	REG_CAPACITY,
> -	REG_TIME_TO_EMPTY,
> -	REG_TIME_TO_FULL,
> +	REG_TIME_TO_EMPTY_NOW,
> +	REG_TIME_TO_EMPTY_AVG,
> +	REG_TIME_TO_FULL_AVG,
>  	REG_STATUS,
>  	REG_CAPACITY_LEVEL,
>  	REG_CYCLE_COUNT,
> @@ -119,9 +120,11 @@ static const struct chip_data {
>  		SBS_DATA(POWER_SUPPLY_PROP_ENERGY_FULL, 0x10, 0, 65535),
>  	[REG_FULL_CHARGE_CAPACITY_CHARGE] =
>  		SBS_DATA(POWER_SUPPLY_PROP_CHARGE_FULL, 0x10, 0, 65535),
> -	[REG_TIME_TO_EMPTY] =
> +	[REG_TIME_TO_EMPTY_NOW] =
> +		SBS_DATA(POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, 0x11, 0, 65535),
> +	[REG_TIME_TO_EMPTY_AVG] =
>  		SBS_DATA(POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, 0x12, 0, 65535),
> -	[REG_TIME_TO_FULL] =
> +	[REG_TIME_TO_FULL_AVG] =
>  		SBS_DATA(POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, 0x13, 0, 65535),
>  	[REG_CHARGE_CURRENT] =
>  		SBS_DATA(POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, 0x14, 0, 65535),
> @@ -165,6 +168,7 @@ static const enum power_supply_property sbs_properties[] = {
>  	POWER_SUPPLY_PROP_CAPACITY,
>  	POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN,
>  	POWER_SUPPLY_PROP_TEMP,
> +	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
>  	POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
>  	POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
>  	POWER_SUPPLY_PROP_SERIAL_NUMBER,
> @@ -748,6 +752,7 @@ static void  sbs_unit_adjustment(struct i2c_client *client,
>  		val->intval -= TEMP_KELVIN_TO_CELSIUS;
>  		break;
>  
> +	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
>  	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
>  	case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG:
>  		/* sbs provides time to empty and time to full in minutes.
> @@ -966,6 +971,7 @@ static int sbs_get_property(struct power_supply *psy,
>  	case POWER_SUPPLY_PROP_CURRENT_NOW:
>  	case POWER_SUPPLY_PROP_CURRENT_AVG:
>  	case POWER_SUPPLY_PROP_TEMP:
> +	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
>  	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
>  	case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG:
>  	case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
> -- 
> 2.17.1
> 

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

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

end of thread, other threads:[~2021-08-06 21:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19  7:20 [PATCH 1/2] power: supply: sbs-battery: relax voltage limit Matthias Schiffer
2021-07-19  7:20 ` [PATCH 2/2] power: supply: sbs-battery: add support for time_to_empty_now attribute Matthias Schiffer
2021-08-06 21:50   ` Sebastian Reichel
2021-08-06 21:50 ` [PATCH 1/2] power: supply: sbs-battery: relax voltage limit 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).