power_supply: add throttle state
PATCH 3/3 power_supply: add throttle state
The charger and battery temperature contribute to the platform thermal. The only way to control the temperature
is to control the charging. The charging can be controlled in different way. This could be disabling charger, disabling charging, adjusting CC, or by adjusting the INLMT. This patch adds a structure to define the charger throttle actions. Also this patch adds a throttle_states field to the struct power_supply which can be used by the charger driver to define it's throttle actions for different states
--- include/linux/power_supply.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
include/linux/power_supply.h +15 -0
@@ -209,6 +209,18 @@ union power_supply_propval {struct device_node ; +enum psy_throttle_action { + +PSY_THROTTLE_DISABLE_CHARGER =0 , +PSY_THROTTLE_DISABLE_CHARGING , +PSY_THROTTLE_CC_LIMIT , +PSY_THROTTLE_INPUT_LIMIT , +}; + +struct psy_throttle_state { +enum psy_throttle_action throttle_action; +unsigned throttle_val; +};struct power_supply {const char *name;enum power_supply_type type;
@@ -223,6 +235,9 @@ struct power_supply {size_t num_supplies;struct device_node *of_node; +struct psy_throttle_state *throttle_states; +size_t num_throttle_states; +int (*get_property)(struct power_supply *psy,enum power_supply_property psp,union power_supply_propval *val);
Signature · 1 line
1.7.9.5
Quoted 11 lines · Jenny TC
The charger and battery temperature contribute to the platform thermal. The only way to control the temperature
is to control the charging. The charging can be controlled in different way. This could be disabling charger, disabling charging, adjusting CC, or by adjusting the INLMT. This patch adds a structure to define the charger throttle actions. Also this patch adds athrottle_statesfield to the structpower_supplywhich can be used by the charger driver to define it's throttle actions for different statesSigned-off-by Jenny TC <[email protected]>---
The code itself is OK. But for this and the previous patches I'd like to see at least one user before merging it, i.e. I'd like to see how things actually interact...
include/linux/power_supply.h union power_supply_propval { · line 213
Quoted 13 lines
include/linux/power_supply.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)include/linux/power_supply.h +2
-0@@ -209,6 +209,18 @@ union power_supply_propval {struct device_node ; +enum psy_throttle_action { +
Stray empty line here.
include/linux/power_supply.h union power_supply_propval { · line 216
Quoted 3 lines
include/linux/power_supply.h +3
-0+PSY_THROTTLE_DISABLE_CHARGER =0 , +PSY_THROTTLE_DISABLE_CHARGING , + PSY_THROTTLE_CC_LIMIT,
CHG_CUR?
include/linux/power_supply.h union power_supply_propval { · line 223
Quoted 7 lines
include/linux/power_supply.h +7
-0+ PSY_THROTTLE_INPUT_LIMIT, +}; + +struct psy_throttle_state { +enum psy_throttle_action throttle_action; +unsigned throttle_val; +};
Missing empty line here.
Quoted 15 lines
include/linux/power_supply.h +3
-0struct power_supply {const char *name;enum power_supply_type type;@@ -223,6 +235,9 @@ struct power_supply {size_t num_supplies;struct device_node *of_node; +struct psy_throttle_state *throttle_states; +size_t num_throttle_states; +int (*get_property)(struct power_supply *psy,enum power_supply_property psp,union power_supply_propval *val);Signature · 1 line
1.7.9.5