Skip to contentSkip to conversation

power: power_supply: Add power_supply_prop_precharge/endcharge

RFC In review Liam Breck 2 participants 3 messages Mar 29, 2017 – Apr 14, 2017

Subsystems (2)
lore
Share & tools
lore

Liam Breck

author
#0 lore raw

RFC 1/1 power: power_supply: Add power_supply_prop_precharge/endcharge

Battery chargers allow get/set of:
POWER_SUPPLY_PROP_PRECHARGE_CURRENT
POWER_SUPPLY_PROP_ENDCHARGE_CURRENT

Cc Tony Lindgren <[email protected]>
Cc Hans de Goede <[email protected]>

---

Hi Sebastian,
This is a RFC draft of the power_supply property patch for my bq24190_charger series. It also highlights charge_term_current with a cosmetic change. Is this the same as the proposed endcharge_current?

 Documentation/power/power_supply_class.txt | 10 ++++++++--
 drivers/power/supply/power_supply_sysfs.c  |  2 ++
 include/linux/power_supply.h               |  4 ++++
 3 files changed, 14 insertions(+), 2 deletions(-)
Documentation/power/power_supply_class.txt +8 -2
index dc92c77..ccffdad 100644
@@ -119,13 +119,19 @@ CHARGE_COUNTER - the current charge counter (in µAh).  This could easily
 be negative; there is no empty or full value.  It is only useful for
 relative, time-based measurements.
 
+PRECHARGE_CURRENT - the maximum charge current during precharge phase
+of charge cycle (typically 20% of battery capacity).
+ENDCHARGE_CURRENT - charge cycle terminates when battery voltage is
+above recharge threshold, and charge current is below this setting
+(typically 10% of battery capacity).
+
 CONSTANT_CHARGE_CURRENT - constant charge current programmed by charger.
 CONSTANT_CHARGE_CURRENT_MAX - maximum charge current supported by the
 power supply object.
 INPUT_CURRENT_LIMIT - input current limit programmed by charger. Indicates
 the current drawn from a charging source.
-CHARGE_TERM_CURRENT - Charge termination current used to detect the end of charge
-condition.
+CHARGE_TERM_CURRENT - Charge termination current used to detect the end of
+charge condition.
 
 CALIBRATE - battery or coulomb counter calibration status
 
drivers/power/supply/power_supply_sysfs.c +2 -0
index bcde8d1..7b091c9 100644
@@ -165,6 +165,8 @@ static struct device_attribute power_supply_attrs[] = {
 	POWER_SUPPLY_ATTR(charge_now),
 	POWER_SUPPLY_ATTR(charge_avg),
 	POWER_SUPPLY_ATTR(charge_counter),
+	POWER_SUPPLY_ATTR(precharge_current),
+	POWER_SUPPLY_ATTR(endcharge_current),
 	POWER_SUPPLY_ATTR(constant_charge_current),
 	POWER_SUPPLY_ATTR(constant_charge_current_max),
 	POWER_SUPPLY_ATTR(constant_charge_voltage),
include/linux/power_supply.h +4 -0
index f1e4b30..b909935 100644
@@ -115,6 +115,8 @@ enum power_supply_property {
 	POWER_SUPPLY_PROP_CHARGE_NOW,
 	POWER_SUPPLY_PROP_CHARGE_AVG,
 	POWER_SUPPLY_PROP_CHARGE_COUNTER,
+	POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
+	POWER_SUPPLY_PROP_ENDCHARGE_CURRENT,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
@@ -379,6 +381,8 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
 	case POWER_SUPPLY_PROP_CHARGE_NOW:
 	case POWER_SUPPLY_PROP_CHARGE_AVG:
 	case POWER_SUPPLY_PROP_CHARGE_COUNTER:
+	case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
+	case POWER_SUPPLY_PROP_ENDCHARGE_CURRENT:
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
 	case POWER_SUPPLY_PROP_CURRENT_MAX:
Signature · 1 line
2.9.3
author
#1 lore raw

Hi Sebastian,

I'm blocked on this question...

This is a draft of the power_supply_prop_precharge/endcharge_current patch for my charger patchset. It highlights charge_term_current with a cosmetic change. Is that the same as the proposed endcharge_current?

BTW the _get_battery_info() & bq27xxx_battery series (dependency of above) is now at 17 revisions, counting partial series posts. Andrew's been sending feedback since v7. The _battery_info part is stable.

Thanks

Quoted 83 lines · Liam Breck

Battery chargers allow get/set of:
POWER_SUPPLY_PROP_PRECHARGE_CURRENT
POWER_SUPPLY_PROP_ENDCHARGE_CURRENT

Cc Tony Lindgren <[email protected]>
Cc Hans de Goede <[email protected]>

---

Hi Sebastian,
This is a RFC draft of the power_supply property patch for my bq24190_charger series. It also highlights charge_term_current with a cosmetic change. Is this the same as the proposed endcharge_current?

 Documentation/power/power_supply_class.txt | 10 ++++++++--
 drivers/power/supply/power_supply_sysfs.c  |  2 ++
 include/linux/power_supply.h               |  4 ++++
 3 files changed, 14 insertions(+), 2 deletions(-)
Documentation/power/power_supply_class.txt +8 -2
index dc92c77..ccffdad 100644
@@ -119,13 +119,19 @@ CHARGE_COUNTER - the current charge counter (in µAh).  This could easily
 be negative; there is no empty or full value.  It is only useful for
 relative, time-based measurements.
 
+PRECHARGE_CURRENT - the maximum charge current during precharge phase
+of charge cycle (typically 20% of battery capacity).
+ENDCHARGE_CURRENT - charge cycle terminates when battery voltage is
+above recharge threshold, and charge current is below this setting
+(typically 10% of battery capacity).
+
 CONSTANT_CHARGE_CURRENT - constant charge current programmed by charger.
 CONSTANT_CHARGE_CURRENT_MAX - maximum charge current supported by the
 power supply object.
 INPUT_CURRENT_LIMIT - input current limit programmed by charger. Indicates
 the current drawn from a charging source.
-CHARGE_TERM_CURRENT - Charge termination current used to detect the end of charge
-condition.
+CHARGE_TERM_CURRENT - Charge termination current used to detect the end of
+charge condition.
 
 CALIBRATE - battery or coulomb counter calibration status
 
drivers/power/supply/power_supply_sysfs.c +2 -0
index bcde8d1..7b091c9 100644
@@ -165,6 +165,8 @@ static struct device_attribute power_supply_attrs[] = {
        POWER_SUPPLY_ATTR(charge_now),
        POWER_SUPPLY_ATTR(charge_avg),
        POWER_SUPPLY_ATTR(charge_counter),
+       POWER_SUPPLY_ATTR(precharge_current),
+       POWER_SUPPLY_ATTR(endcharge_current),
        POWER_SUPPLY_ATTR(constant_charge_current),
        POWER_SUPPLY_ATTR(constant_charge_current_max),
        POWER_SUPPLY_ATTR(constant_charge_voltage),
include/linux/power_supply.h +4 -1
index f1e4b30..b909935 100644
@@ -115,6 +115,8 @@ enum power_supply_property {
        POWER_SUPPLY_PROP_CHARGE_NOW,
        POWER_SUPPLY_PROP_CHARGE_AVG,
        POWER_SUPPLY_PROP_CHARGE_COUNTER,
+       POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
+       POWER_SUPPLY_PROP_ENDCHARGE_CURRENT,
        POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
        POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
        POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
@@ -379,6 +381,8 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
        case POWER_SUPPLY_PROP_CHARGE_NOW:
        case POWER_SUPPLY_PROP_CHARGE_AVG:
        case POWER_SUPPLY_PROP_CHARGE_COUNTER:
+       case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
+       case POWER_SUPPLY_PROP_ENDCHARGE_CURRENT:
        case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
        case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
        case POWER_SUPPLY_PROP_CURRENT_MAX:
--

2.9.3

#2 lore raw

Hi Liam,

Quoted 5 lines · Liam Breck

I'm blocked on this question...

This is a draft of the power_supply_prop_precharge/endcharge_current patch for my charger patchset. It highlights charge_term_current with a cosmetic change. Is that the same as the proposed endcharge_current?

Yes, it is.

-- Sebastian