Linux-PM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH RESEND 1/1] power_supply: wilco_ec: Add permanent long life charging mode
@ 2020-07-15 14:55 Crag Wang
  2020-07-27 23:34 ` Sebastian Reichel
  2020-07-30  3:26 ` [PATCH v2 1/1] power_supply: wilco_ec: Add " Crag Wang
  0 siblings, 2 replies; 5+ messages in thread
From: Crag Wang @ 2020-07-15 14:55 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: mathewk, mario.limonciello, campello, Crag Wang, linux-pm, linux-kernel

This is a long life mode set in the factory for extended warranty
battery, the power charging rate is customized so that battery at
work last longer.

Presently switching to a different battery charging mode is through
EC PID 0x0710 to configure the battery firmware, this operation will
be blocked by EC with failure code 0x01 when PLL mode is already
in use.

Signed-off-by: Crag Wang <crag.wang@dell.com>
---
 Documentation/ABI/testing/sysfs-class-power-wilco | 3 +++
 drivers/power/supply/power_supply_sysfs.c         | 1 +
 drivers/power/supply/wilco-charger.c              | 5 +++++
 include/linux/power_supply.h                      | 1 +
 4 files changed, 10 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-class-power-wilco b/Documentation/ABI/testing/sysfs-class-power-wilco
index da1d6ffe5e3c..1c91b17b6fd4 100644
--- a/Documentation/ABI/testing/sysfs-class-power-wilco
+++ b/Documentation/ABI/testing/sysfs-class-power-wilco
@@ -14,6 +14,9 @@ Description:
 			Charging begins when level drops below
 			charge_control_start_threshold, and ceases when
 			level is above charge_control_end_threshold.
+		Permanent Long Life: Last longer battery life, this mode
+			is programmed once in the factory. Switching to a
+			different mode is unavailable.
 
 What:		/sys/class/power_supply/wilco-charger/charge_control_start_threshold
 Date:		April 2019
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index bc79560229b5..af3884015ad8 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -87,6 +87,7 @@ static const char * const POWER_SUPPLY_CHARGE_TYPE_TEXT[] = {
 	[POWER_SUPPLY_CHARGE_TYPE_STANDARD]	= "Standard",
 	[POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE]	= "Adaptive",
 	[POWER_SUPPLY_CHARGE_TYPE_CUSTOM]	= "Custom",
+	[POWER_SUPPLY_CHARGE_TYPE_LONGLIFE]	= "Permanent Long Life",
 };
 
 static const char * const POWER_SUPPLY_HEALTH_TEXT[] = {
diff --git a/drivers/power/supply/wilco-charger.c b/drivers/power/supply/wilco-charger.c
index b3c6d7cdd731..713c3018652f 100644
--- a/drivers/power/supply/wilco-charger.c
+++ b/drivers/power/supply/wilco-charger.c
@@ -27,6 +27,7 @@ enum charge_mode {
 	CHARGE_MODE_AC = 3,	/* Mostly AC use, used for Trickle */
 	CHARGE_MODE_AUTO = 4,	/* Used for Adaptive */
 	CHARGE_MODE_CUSTOM = 5,	/* Used for Custom */
+	CHARGE_MODE_LONGLIFE = 6, /* Used for Permanent Long Life */
 };
 
 #define CHARGE_LOWER_LIMIT_MIN	50
@@ -48,6 +49,8 @@ static int psp_val_to_charge_mode(int psp_val)
 		return CHARGE_MODE_AUTO;
 	case POWER_SUPPLY_CHARGE_TYPE_CUSTOM:
 		return CHARGE_MODE_CUSTOM;
+	case POWER_SUPPLY_CHARGE_TYPE_LONGLIFE:
+		return CHARGE_MODE_LONGLIFE;
 	default:
 		return -EINVAL;
 	}
@@ -67,6 +70,8 @@ static int charge_mode_to_psp_val(enum charge_mode mode)
 		return POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE;
 	case CHARGE_MODE_CUSTOM:
 		return POWER_SUPPLY_CHARGE_TYPE_CUSTOM;
+	case CHARGE_MODE_LONGLIFE:
+		return POWER_SUPPLY_CHARGE_TYPE_LONGLIFE;
 	default:
 		return -EINVAL;
 	}
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index ac1345a48ad0..528a3eaa2320 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -48,6 +48,7 @@ enum {
 	POWER_SUPPLY_CHARGE_TYPE_STANDARD,	/* normal speed */
 	POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE,	/* dynamically adjusted speed */
 	POWER_SUPPLY_CHARGE_TYPE_CUSTOM,	/* use CHARGE_CONTROL_* props */
+	POWER_SUPPLY_CHARGE_TYPE_LONGLIFE,	/* slow speed, longer life */
 };
 
 enum {
-- 
2.17.1

---
The original author, Nick no longer being around and that's why he's not on CC.

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

* Re: [PATCH RESEND 1/1] power_supply: wilco_ec: Add permanent long life charging mode
  2020-07-15 14:55 [PATCH RESEND 1/1] power_supply: wilco_ec: Add permanent long life charging mode Crag Wang
@ 2020-07-27 23:34 ` Sebastian Reichel
  2020-07-28  6:48   ` Wang, Crag
  2020-07-30  3:26 ` [PATCH v2 1/1] power_supply: wilco_ec: Add " Crag Wang
  1 sibling, 1 reply; 5+ messages in thread
From: Sebastian Reichel @ 2020-07-27 23:34 UTC (permalink / raw)
  To: Crag Wang
  Cc: mathewk, mario.limonciello, campello, Crag Wang, linux-pm, linux-kernel


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

Hi,

On Wed, Jul 15, 2020 at 10:55:12PM +0800, Crag Wang wrote:
> This is a long life mode set in the factory for extended warranty
> battery, the power charging rate is customized so that battery at
> work last longer.
> 
> Presently switching to a different battery charging mode is through
> EC PID 0x0710 to configure the battery firmware, this operation will
> be blocked by EC with failure code 0x01 when PLL mode is already
> in use.
> 
> Signed-off-by: Crag Wang <crag.wang@dell.com>
> ---
>  Documentation/ABI/testing/sysfs-class-power-wilco | 3 +++
>  drivers/power/supply/power_supply_sysfs.c         | 1 +
>  drivers/power/supply/wilco-charger.c              | 5 +++++
>  include/linux/power_supply.h                      | 1 +
>  4 files changed, 10 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-class-power-wilco b/Documentation/ABI/testing/sysfs-class-power-wilco
> index da1d6ffe5e3c..1c91b17b6fd4 100644
> --- a/Documentation/ABI/testing/sysfs-class-power-wilco
> +++ b/Documentation/ABI/testing/sysfs-class-power-wilco
> @@ -14,6 +14,9 @@ Description:
>  			Charging begins when level drops below
>  			charge_control_start_threshold, and ceases when
>  			level is above charge_control_end_threshold.
> +		Permanent Long Life: Last longer battery life, this mode
> +			is programmed once in the factory. Switching to a
> +			different mode is unavailable.

The documentation lacks one important aspect: What happens
if I have a device where the factory did not program "Long Life"?
I.e. what happens when

# cat /sys/class/power_supply/wilco-charger/charge_type
Standard
# echo "Long Life" > /sys/class/power_supply/wilco-charger/charge_type

Will the controller switch into permanent long life battery mode
without any exit strategy?

>  What:		/sys/class/power_supply/wilco-charger/charge_control_start_threshold
>  Date:		April 2019
> diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
> index bc79560229b5..af3884015ad8 100644
> --- a/drivers/power/supply/power_supply_sysfs.c
> +++ b/drivers/power/supply/power_supply_sysfs.c
> @@ -87,6 +87,7 @@ static const char * const POWER_SUPPLY_CHARGE_TYPE_TEXT[] = {
>  	[POWER_SUPPLY_CHARGE_TYPE_STANDARD]	= "Standard",
>  	[POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE]	= "Adaptive",
>  	[POWER_SUPPLY_CHARGE_TYPE_CUSTOM]	= "Custom",
> +	[POWER_SUPPLY_CHARGE_TYPE_LONGLIFE]	= "Permanent Long Life",

The "Permanent" part is specific to the Wilco EC, so I think it's
better to avoid it in the generic API. I think it's better to use
just "Long Life" (and keep the wilco specific sysfs Documentation,
that Long Life configuration is permanent).

-- Sebastian

>  };
>  
>  static const char * const POWER_SUPPLY_HEALTH_TEXT[] = {
> diff --git a/drivers/power/supply/wilco-charger.c b/drivers/power/supply/wilco-charger.c
> index b3c6d7cdd731..713c3018652f 100644
> --- a/drivers/power/supply/wilco-charger.c
> +++ b/drivers/power/supply/wilco-charger.c
> @@ -27,6 +27,7 @@ enum charge_mode {
>  	CHARGE_MODE_AC = 3,	/* Mostly AC use, used for Trickle */
>  	CHARGE_MODE_AUTO = 4,	/* Used for Adaptive */
>  	CHARGE_MODE_CUSTOM = 5,	/* Used for Custom */
> +	CHARGE_MODE_LONGLIFE = 6, /* Used for Permanent Long Life */
>  };
>  
>  #define CHARGE_LOWER_LIMIT_MIN	50
> @@ -48,6 +49,8 @@ static int psp_val_to_charge_mode(int psp_val)
>  		return CHARGE_MODE_AUTO;
>  	case POWER_SUPPLY_CHARGE_TYPE_CUSTOM:
>  		return CHARGE_MODE_CUSTOM;
> +	case POWER_SUPPLY_CHARGE_TYPE_LONGLIFE:
> +		return CHARGE_MODE_LONGLIFE;
>  	default:
>  		return -EINVAL;
>  	}
> @@ -67,6 +70,8 @@ static int charge_mode_to_psp_val(enum charge_mode mode)
>  		return POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE;
>  	case CHARGE_MODE_CUSTOM:
>  		return POWER_SUPPLY_CHARGE_TYPE_CUSTOM;
> +	case CHARGE_MODE_LONGLIFE:
> +		return POWER_SUPPLY_CHARGE_TYPE_LONGLIFE;
>  	default:
>  		return -EINVAL;
>  	}
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index ac1345a48ad0..528a3eaa2320 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -48,6 +48,7 @@ enum {
>  	POWER_SUPPLY_CHARGE_TYPE_STANDARD,	/* normal speed */
>  	POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE,	/* dynamically adjusted speed */
>  	POWER_SUPPLY_CHARGE_TYPE_CUSTOM,	/* use CHARGE_CONTROL_* props */
> +	POWER_SUPPLY_CHARGE_TYPE_LONGLIFE,	/* slow speed, longer life */
>  };
>  
>  enum {
> -- 
> 2.17.1
> 
> ---
> The original author, Nick no longer being around and that's why he's not on CC.

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

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

* RE: [PATCH RESEND 1/1] power_supply: wilco_ec: Add permanent long life charging mode
  2020-07-27 23:34 ` Sebastian Reichel
@ 2020-07-28  6:48   ` Wang, Crag
  0 siblings, 0 replies; 5+ messages in thread
From: Wang, Crag @ 2020-07-28  6:48 UTC (permalink / raw)
  To: Sebastian Reichel, Crag Wang
  Cc: mathewk, Limonciello, Mario, campello, linux-pm, linux-kernel

> > +		Permanent Long Life: Last longer battery life, this mode
> > +			is programmed once in the factory. Switching to a
> > +			different mode is unavailable.
> 
> The documentation lacks one important aspect: What happens if I have a
> device where the factory did not program "Long Life"?
> I.e. what happens when
> 
> # cat /sys/class/power_supply/wilco-charger/charge_type
> Standard
> # echo "Long Life" > /sys/class/power_supply/wilco-charger/charge_type
> 
> Will the controller switch into permanent long life battery mode without any
> exit strategy?
>

The set_property attempt will convert "Long Life" to its index of charge mode
and send a EC command to Property ID 0x0710 for configuration. This try will be
denied by EC because "Long Life" mode must be set (enable/disable) through a
different PID that isn't publicly known. In the factory there's a proprietary tool
in use for PLL configuration.

In above example after the run the charge mode will remain unchanged i.e.: 
"Standard".

> >  What:		/sys/class/power_supply/wilco-
> charger/charge_control_start_threshold
> >  Date:		April 2019
> > diff --git a/drivers/power/supply/power_supply_sysfs.c
> > b/drivers/power/supply/power_supply_sysfs.c
> > index bc79560229b5..af3884015ad8 100644
> > --- a/drivers/power/supply/power_supply_sysfs.c
> > +++ b/drivers/power/supply/power_supply_sysfs.c
> > @@ -87,6 +87,7 @@ static const char * const
> POWER_SUPPLY_CHARGE_TYPE_TEXT[] = {
> >  	[POWER_SUPPLY_CHARGE_TYPE_STANDARD]	= "Standard",
> >  	[POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE]	= "Adaptive",
> >  	[POWER_SUPPLY_CHARGE_TYPE_CUSTOM]	= "Custom",
> > +	[POWER_SUPPLY_CHARGE_TYPE_LONGLIFE]	= "Permanent Long
> Life",
> 
> The "Permanent" part is specific to the Wilco EC, so I think it's better to avoid
> it in the generic API. I think it's better to use just "Long Life" (and keep the
> wilco specific sysfs Documentation, that Long Life configuration is
> permanent).

Agree with you, I will include this modification in the next patch.


> 
> -- Sebastian
> 


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

* [PATCH v2 1/1] power_supply: wilco_ec: Add long life charging mode
  2020-07-15 14:55 [PATCH RESEND 1/1] power_supply: wilco_ec: Add permanent long life charging mode Crag Wang
  2020-07-27 23:34 ` Sebastian Reichel
@ 2020-07-30  3:26 ` Crag Wang
  2020-07-31 13:30   ` Sebastian Reichel
  1 sibling, 1 reply; 5+ messages in thread
From: Crag Wang @ 2020-07-30  3:26 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: mario.limonciello, mathewk, campello, crag.wang, linux-pm, linux-kernel

This is a long life mode set in the factory for extended warranty
battery, the power charging rate is customized so that battery at
work last longer.

Presently switching to a different battery charging mode is through
EC PID 0x0710 to configure the battery firmware, this operation will
be blocked by EC with failure code 0x01 when PLL mode is already
in use.

Signed-off-by: Crag Wang <crag.wang@dell.com>
Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>
---
 Documentation/ABI/testing/sysfs-class-power-wilco | 4 ++++
 drivers/power/supply/power_supply_sysfs.c         | 1 +
 drivers/power/supply/wilco-charger.c              | 5 +++++
 include/linux/power_supply.h                      | 1 +
 4 files changed, 11 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-class-power-wilco b/Documentation/ABI/testing/sysfs-class-power-wilco
index da1d6ffe5e3c..84fde1d0ada0 100644
--- a/Documentation/ABI/testing/sysfs-class-power-wilco
+++ b/Documentation/ABI/testing/sysfs-class-power-wilco
@@ -14,6 +14,10 @@ Description:
 			Charging begins when level drops below
 			charge_control_start_threshold, and ceases when
 			level is above charge_control_end_threshold.
+		Long Life: Customized charge rate for last longer battery life.
+			On Wilco device this mode is pre-configured in the factory
+			through EC's private PID. Swiching to a different mode will
+			be denied by Wilco EC when Long Life mode is enabled.
 
 What:		/sys/class/power_supply/wilco-charger/charge_control_start_threshold
 Date:		April 2019
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index bc79560229b5..cfb87b8b8392 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -87,6 +87,7 @@ static const char * const POWER_SUPPLY_CHARGE_TYPE_TEXT[] = {
 	[POWER_SUPPLY_CHARGE_TYPE_STANDARD]	= "Standard",
 	[POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE]	= "Adaptive",
 	[POWER_SUPPLY_CHARGE_TYPE_CUSTOM]	= "Custom",
+	[POWER_SUPPLY_CHARGE_TYPE_LONGLIFE]	= "Long Life",
 };
 
 static const char * const POWER_SUPPLY_HEALTH_TEXT[] = {
diff --git a/drivers/power/supply/wilco-charger.c b/drivers/power/supply/wilco-charger.c
index b3c6d7cdd731..98ade073ef05 100644
--- a/drivers/power/supply/wilco-charger.c
+++ b/drivers/power/supply/wilco-charger.c
@@ -27,6 +27,7 @@ enum charge_mode {
 	CHARGE_MODE_AC = 3,	/* Mostly AC use, used for Trickle */
 	CHARGE_MODE_AUTO = 4,	/* Used for Adaptive */
 	CHARGE_MODE_CUSTOM = 5,	/* Used for Custom */
+	CHARGE_MODE_LONGLIFE = 6, /* Used for Long Life */
 };
 
 #define CHARGE_LOWER_LIMIT_MIN	50
@@ -48,6 +49,8 @@ static int psp_val_to_charge_mode(int psp_val)
 		return CHARGE_MODE_AUTO;
 	case POWER_SUPPLY_CHARGE_TYPE_CUSTOM:
 		return CHARGE_MODE_CUSTOM;
+	case POWER_SUPPLY_CHARGE_TYPE_LONGLIFE:
+		return CHARGE_MODE_LONGLIFE;
 	default:
 		return -EINVAL;
 	}
@@ -67,6 +70,8 @@ static int charge_mode_to_psp_val(enum charge_mode mode)
 		return POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE;
 	case CHARGE_MODE_CUSTOM:
 		return POWER_SUPPLY_CHARGE_TYPE_CUSTOM;
+	case CHARGE_MODE_LONGLIFE:
+		return POWER_SUPPLY_CHARGE_TYPE_LONGLIFE;
 	default:
 		return -EINVAL;
 	}
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index ac1345a48ad0..528a3eaa2320 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -48,6 +48,7 @@ enum {
 	POWER_SUPPLY_CHARGE_TYPE_STANDARD,	/* normal speed */
 	POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE,	/* dynamically adjusted speed */
 	POWER_SUPPLY_CHARGE_TYPE_CUSTOM,	/* use CHARGE_CONTROL_* props */
+	POWER_SUPPLY_CHARGE_TYPE_LONGLIFE,	/* slow speed, longer life */
 };
 
 enum {
-- 
2.17.1

---
The original author, Nick no longer being around and that's why he's not on CC.

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

* Re: [PATCH v2 1/1] power_supply: wilco_ec: Add long life charging mode
  2020-07-30  3:26 ` [PATCH v2 1/1] power_supply: wilco_ec: Add " Crag Wang
@ 2020-07-31 13:30   ` Sebastian Reichel
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2020-07-31 13:30 UTC (permalink / raw)
  To: Crag Wang
  Cc: mario.limonciello, mathewk, campello, crag.wang, linux-pm, linux-kernel


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

Hi,

On Thu, Jul 30, 2020 at 11:26:09AM +0800, Crag Wang wrote:
> This is a long life mode set in the factory for extended warranty
> battery, the power charging rate is customized so that battery at
> work last longer.
> 
> Presently switching to a different battery charging mode is through
> EC PID 0x0710 to configure the battery firmware, this operation will
> be blocked by EC with failure code 0x01 when PLL mode is already
> in use.
> 
> Signed-off-by: Crag Wang <crag.wang@dell.com>
> Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>
> ---

Thanks, queued.

-- Sebastian

>  Documentation/ABI/testing/sysfs-class-power-wilco | 4 ++++
>  drivers/power/supply/power_supply_sysfs.c         | 1 +
>  drivers/power/supply/wilco-charger.c              | 5 +++++
>  include/linux/power_supply.h                      | 1 +
>  4 files changed, 11 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-class-power-wilco b/Documentation/ABI/testing/sysfs-class-power-wilco
> index da1d6ffe5e3c..84fde1d0ada0 100644
> --- a/Documentation/ABI/testing/sysfs-class-power-wilco
> +++ b/Documentation/ABI/testing/sysfs-class-power-wilco
> @@ -14,6 +14,10 @@ Description:
>  			Charging begins when level drops below
>  			charge_control_start_threshold, and ceases when
>  			level is above charge_control_end_threshold.
> +		Long Life: Customized charge rate for last longer battery life.
> +			On Wilco device this mode is pre-configured in the factory
> +			through EC's private PID. Swiching to a different mode will
> +			be denied by Wilco EC when Long Life mode is enabled.
>  
>  What:		/sys/class/power_supply/wilco-charger/charge_control_start_threshold
>  Date:		April 2019
> diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
> index bc79560229b5..cfb87b8b8392 100644
> --- a/drivers/power/supply/power_supply_sysfs.c
> +++ b/drivers/power/supply/power_supply_sysfs.c
> @@ -87,6 +87,7 @@ static const char * const POWER_SUPPLY_CHARGE_TYPE_TEXT[] = {
>  	[POWER_SUPPLY_CHARGE_TYPE_STANDARD]	= "Standard",
>  	[POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE]	= "Adaptive",
>  	[POWER_SUPPLY_CHARGE_TYPE_CUSTOM]	= "Custom",
> +	[POWER_SUPPLY_CHARGE_TYPE_LONGLIFE]	= "Long Life",
>  };
>  
>  static const char * const POWER_SUPPLY_HEALTH_TEXT[] = {
> diff --git a/drivers/power/supply/wilco-charger.c b/drivers/power/supply/wilco-charger.c
> index b3c6d7cdd731..98ade073ef05 100644
> --- a/drivers/power/supply/wilco-charger.c
> +++ b/drivers/power/supply/wilco-charger.c
> @@ -27,6 +27,7 @@ enum charge_mode {
>  	CHARGE_MODE_AC = 3,	/* Mostly AC use, used for Trickle */
>  	CHARGE_MODE_AUTO = 4,	/* Used for Adaptive */
>  	CHARGE_MODE_CUSTOM = 5,	/* Used for Custom */
> +	CHARGE_MODE_LONGLIFE = 6, /* Used for Long Life */
>  };
>  
>  #define CHARGE_LOWER_LIMIT_MIN	50
> @@ -48,6 +49,8 @@ static int psp_val_to_charge_mode(int psp_val)
>  		return CHARGE_MODE_AUTO;
>  	case POWER_SUPPLY_CHARGE_TYPE_CUSTOM:
>  		return CHARGE_MODE_CUSTOM;
> +	case POWER_SUPPLY_CHARGE_TYPE_LONGLIFE:
> +		return CHARGE_MODE_LONGLIFE;
>  	default:
>  		return -EINVAL;
>  	}
> @@ -67,6 +70,8 @@ static int charge_mode_to_psp_val(enum charge_mode mode)
>  		return POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE;
>  	case CHARGE_MODE_CUSTOM:
>  		return POWER_SUPPLY_CHARGE_TYPE_CUSTOM;
> +	case CHARGE_MODE_LONGLIFE:
> +		return POWER_SUPPLY_CHARGE_TYPE_LONGLIFE;
>  	default:
>  		return -EINVAL;
>  	}
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index ac1345a48ad0..528a3eaa2320 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -48,6 +48,7 @@ enum {
>  	POWER_SUPPLY_CHARGE_TYPE_STANDARD,	/* normal speed */
>  	POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE,	/* dynamically adjusted speed */
>  	POWER_SUPPLY_CHARGE_TYPE_CUSTOM,	/* use CHARGE_CONTROL_* props */
> +	POWER_SUPPLY_CHARGE_TYPE_LONGLIFE,	/* slow speed, longer life */
>  };
>  
>  enum {
> -- 
> 2.17.1
> 
> ---
> The original author, Nick no longer being around and that's why he's not on CC.

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

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 14:55 [PATCH RESEND 1/1] power_supply: wilco_ec: Add permanent long life charging mode Crag Wang
2020-07-27 23:34 ` Sebastian Reichel
2020-07-28  6:48   ` Wang, Crag
2020-07-30  3:26 ` [PATCH v2 1/1] power_supply: wilco_ec: Add " Crag Wang
2020-07-31 13:30   ` Sebastian Reichel

Linux-PM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pm/0 linux-pm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pm linux-pm/ https://lore.kernel.org/linux-pm \
		linux-pm@vger.kernel.org
	public-inbox-index linux-pm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git