]> Git Repo - linux.git/commitdiff
power: supply: wilco_ec: Add long life charging mode
authorCrag Wang <[email protected]>
Thu, 30 Jul 2020 03:26:09 +0000 (11:26 +0800)
committerSebastian Reichel <[email protected]>
Fri, 31 Jul 2020 12:33:56 +0000 (14:33 +0200)
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 <[email protected]>
Reviewed-by: Mario Limonciello <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
Documentation/ABI/testing/sysfs-class-power-wilco
drivers/power/supply/power_supply_sysfs.c
drivers/power/supply/wilco-charger.c
include/linux/power_supply.h

index da1d6ffe5e3ce8eb0a8287158726fa934f651e65..84fde1d0ada065e1fd972acaea4eef4d8c4b7b73 100644 (file)
@@ -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
index b903cb4dca2be293d4cacc77a2894a5bc29aec16..3d383086018c5b69c5e17f0c353f34f4fc837e3e 100644 (file)
@@ -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[] = {
index b3c6d7cdd731818c6e011bba9c5826b82fd3697d..98ade073ef05fec46a804126f7635adfc30cd1e0 100644 (file)
@@ -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;
        }
index b5ee35d3c3046cf4c0309bd2ce268e88163c3b1e..97cc4b85bf6126115dc97eb580463e43725eed64 100644 (file)
@@ -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 {
This page took 0.083358 seconds and 4 git commands to generate.