diff mbox series

[RESEND,v2,1/2] power: supply: Introduces bypass charging property

Message ID 20220210154108.641369-2-rriveram@opensource.cirrus.com
State New
Headers show
Series Introduces bypass charge type property | expand

Commit Message

Ricardo Rivera-Matos Feb. 10, 2022, 3:41 p.m. UTC
Adds a POWER_SUPPLY_CHARGE_TYPE_BYPASS option to the POWER_SUPPLY_PROP_CHARGE_TYPE
property to facilitate bypass charging operation.

In bypass charging operation, the charger bypasses the charging path around the
integrated converter allowing for a "smart" wall adaptor to perform the power
conversion externally.

This operational mode is critical for the USB PPS standard of power adaptors and is
becoming a common feature in modern charging ICs such as:

- BQ25980
- BQ25975
- BQ25960
- LN8000
- LN8410

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
---
 drivers/power/supply/power_supply_sysfs.c | 1 +
 include/linux/power_supply.h              | 1 +
 2 files changed, 2 insertions(+)

Comments

Sebastian Reichel Feb. 11, 2022, 8:43 p.m. UTC | #1
Hi,

On Thu, Feb 10, 2022 at 09:41:07AM -0600, Ricardo Rivera-Matos wrote:
> Adds a POWER_SUPPLY_CHARGE_TYPE_BYPASS option to the POWER_SUPPLY_PROP_CHARGE_TYPE
> property to facilitate bypass charging operation.
> 
> In bypass charging operation, the charger bypasses the charging path around the
> integrated converter allowing for a "smart" wall adaptor to perform the power
> conversion externally.
> 
> This operational mode is critical for the USB PPS standard of power adaptors and is
> becoming a common feature in modern charging ICs such as:
> 
> - BQ25980
> - BQ25975
> - BQ25960
> - LN8000
> - LN8410
> 
> Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
> ---

Sorry for the wait. This needs to update the sysfs ABI documentation:

Documentation/ABI/testing/sysfs-class-power

I think your patch description is a good explanation for that file.
Also I obviously missed to point this out for the "Long Life" charge
type, so please also add a sentence for that so that the property
is properly documented.

(Otherwise the patchset looks fine to me)

Thanks,

-- Sebastian

>  drivers/power/supply/power_supply_sysfs.c | 1 +
>  include/linux/power_supply.h              | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
> index 6ac88fbee3cb..52c909bae457 100644
> --- a/drivers/power/supply/power_supply_sysfs.c
> +++ b/drivers/power/supply/power_supply_sysfs.c
> @@ -89,6 +89,7 @@ static const char * const POWER_SUPPLY_CHARGE_TYPE_TEXT[] = {
>  	[POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE]	= "Adaptive",
>  	[POWER_SUPPLY_CHARGE_TYPE_CUSTOM]	= "Custom",
>  	[POWER_SUPPLY_CHARGE_TYPE_LONGLIFE]	= "Long Life",
> +	[POWER_SUPPLY_CHARGE_TYPE_BYPASS]	= "Bypass",
>  };
>  
>  static const char * const POWER_SUPPLY_HEALTH_TEXT[] = {
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index 86b4d5c4dab9..164779bc7e8f 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -49,6 +49,7 @@ enum {
>  	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 */
> +	POWER_SUPPLY_CHARGE_TYPE_BYPASS,	/* bypassing the charger */
>  };
>  
>  enum {
> -- 
> 2.25.1
>
Ricardo Rivera-Matos Feb. 11, 2022, 9:46 p.m. UTC | #2
Sebastian,

> On Feb 11, 2022, at 2:43 PM, Sebastian Reichel <sebastian.reichel@collabora.com> wrote:
> 
> Hi,
> 
> On Thu, Feb 10, 2022 at 09:41:07AM -0600, Ricardo Rivera-Matos wrote:
>> Adds a POWER_SUPPLY_CHARGE_TYPE_BYPASS option to the POWER_SUPPLY_PROP_CHARGE_TYPE
>> property to facilitate bypass charging operation.
>> 
>> In bypass charging operation, the charger bypasses the charging path around the
>> integrated converter allowing for a "smart" wall adaptor to perform the power
>> conversion externally.
>> 
>> This operational mode is critical for the USB PPS standard of power adaptors and is
>> becoming a common feature in modern charging ICs such as:
>> 
>> - BQ25980
>> - BQ25975
>> - BQ25960
>> - LN8000
>> - LN8410
>> 
>> Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
>> ---
> 
> Sorry for the wait. This needs to update the sysfs ABI documentation:
> 
> Documentation/ABI/testing/sysfs-class-power

Ack
> 
> I think your patch description is a good explanation for that file.
> Also I obviously missed to point this out for the "Long Life" charge
> type, so please also add a sentence for that so that the property
> is properly documented.

As I understand it “Long Life” means the charger reduces its charging rate in order to prolong the battery health.

Is this a fit explanation?
> 
> (Otherwise the patchset looks fine to me)
> 
> Thanks,
> 
> -- Sebastian

Best Regards,
Ricardo

<snip>
diff mbox series

Patch

diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index 6ac88fbee3cb..52c909bae457 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -89,6 +89,7 @@  static const char * const POWER_SUPPLY_CHARGE_TYPE_TEXT[] = {
 	[POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE]	= "Adaptive",
 	[POWER_SUPPLY_CHARGE_TYPE_CUSTOM]	= "Custom",
 	[POWER_SUPPLY_CHARGE_TYPE_LONGLIFE]	= "Long Life",
+	[POWER_SUPPLY_CHARGE_TYPE_BYPASS]	= "Bypass",
 };
 
 static const char * const POWER_SUPPLY_HEALTH_TEXT[] = {
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 86b4d5c4dab9..164779bc7e8f 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -49,6 +49,7 @@  enum {
 	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 */
+	POWER_SUPPLY_CHARGE_TYPE_BYPASS,	/* bypassing the charger */
 };
 
 enum {