Skip to content

Commit 46cbd0b

Browse files
CragWsre
authored andcommitted
power: supply: wilco_ec: Add long life charging mode
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]>
1 parent 707d678 commit 46cbd0b

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

Documentation/ABI/testing/sysfs-class-power-wilco

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Description:
1414
Charging begins when level drops below
1515
charge_control_start_threshold, and ceases when
1616
level is above charge_control_end_threshold.
17+
Long Life: Customized charge rate for last longer battery life.
18+
On Wilco device this mode is pre-configured in the factory
19+
through EC's private PID. Swiching to a different mode will
20+
be denied by Wilco EC when Long Life mode is enabled.
1721

1822
What: /sys/class/power_supply/wilco-charger/charge_control_start_threshold
1923
Date: April 2019

drivers/power/supply/power_supply_sysfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ static const char * const POWER_SUPPLY_CHARGE_TYPE_TEXT[] = {
8787
[POWER_SUPPLY_CHARGE_TYPE_STANDARD] = "Standard",
8888
[POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE] = "Adaptive",
8989
[POWER_SUPPLY_CHARGE_TYPE_CUSTOM] = "Custom",
90+
[POWER_SUPPLY_CHARGE_TYPE_LONGLIFE] = "Long Life",
9091
};
9192

9293
static const char * const POWER_SUPPLY_HEALTH_TEXT[] = {

drivers/power/supply/wilco-charger.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ enum charge_mode {
2727
CHARGE_MODE_AC = 3, /* Mostly AC use, used for Trickle */
2828
CHARGE_MODE_AUTO = 4, /* Used for Adaptive */
2929
CHARGE_MODE_CUSTOM = 5, /* Used for Custom */
30+
CHARGE_MODE_LONGLIFE = 6, /* Used for Long Life */
3031
};
3132

3233
#define CHARGE_LOWER_LIMIT_MIN 50
@@ -48,6 +49,8 @@ static int psp_val_to_charge_mode(int psp_val)
4849
return CHARGE_MODE_AUTO;
4950
case POWER_SUPPLY_CHARGE_TYPE_CUSTOM:
5051
return CHARGE_MODE_CUSTOM;
52+
case POWER_SUPPLY_CHARGE_TYPE_LONGLIFE:
53+
return CHARGE_MODE_LONGLIFE;
5154
default:
5255
return -EINVAL;
5356
}
@@ -67,6 +70,8 @@ static int charge_mode_to_psp_val(enum charge_mode mode)
6770
return POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE;
6871
case CHARGE_MODE_CUSTOM:
6972
return POWER_SUPPLY_CHARGE_TYPE_CUSTOM;
73+
case CHARGE_MODE_LONGLIFE:
74+
return POWER_SUPPLY_CHARGE_TYPE_LONGLIFE;
7075
default:
7176
return -EINVAL;
7277
}

include/linux/power_supply.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ enum {
4848
POWER_SUPPLY_CHARGE_TYPE_STANDARD, /* normal speed */
4949
POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE, /* dynamically adjusted speed */
5050
POWER_SUPPLY_CHARGE_TYPE_CUSTOM, /* use CHARGE_CONTROL_* props */
51+
POWER_SUPPLY_CHARGE_TYPE_LONGLIFE, /* slow speed, longer life */
5152
};
5253

5354
enum {

0 commit comments

Comments
 (0)