diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-29 07:22:45 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-29 07:22:45 +0300 |
commit | 579a70035949b771a63a686db8becdd9b197d986 (patch) | |
tree | 2c53e112c7f0df7b89c9639da94942771cbb9a3a /include/linux | |
parent | 030672aea826adf3dee9100ee8ac303b62c8fe7f (diff) | |
parent | 9580913966488dc78d8d2893c7427d0a84124e74 (diff) | |
download | linux-579a70035949b771a63a686db8becdd9b197d986.tar.xz |
Merge tag 'for-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel:
- New core support:
- battery internal resistance
- battery OCV capacity lookup table
- support for custom sysfs attributes
- Convert all drivers to use power-supply core support for custom sysfs
attributes
- bq24190-charger: bq24196 support
- axp20x-charger: AXP813 support
- sc27xx-battery: new fuel gauge driver
- gpio-poweroff: support for specific active and inactive delays
- Misc fixes
* tag 'for-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (53 commits)
power: supply: bq25890: fix BAT_COMP field definition
power: supply: gpio-charger: Do not use deprecated POWER_SUPPLY_TYPE_USB_*
power: supply: ds2781: switch to devm_power_supply_register
power: supply: ds2780: switch to devm_power_supply_register
power: supply: ds2781: fix race-condition in bin attribute registration
power: supply: ds2780: fix race-condition in bin attribute registration
power: supply: pcf50633: fix race-condition in sysfs registration
power: supply: charger-manager: fix race-condition in sysfs registration
power: supply: charger-manager: simplify generation of sysfs attribute group name
power: supply: bq24257: fix race-condition in sysfs registration
power: supply: bq24190_charger: fix race-condition in sysfs registration
power: supply: lp8788: fix race-condition in sysfs registration
power: supply: ds2781: fix race-condition in sysfs registration
power: supply: ds2780: fix race-condition in sysfs registration
power: supply: bq2415x: fix race-condition in sysfs registration
power: supply: core: add support for custom sysfs attributes
power: supply: sc27xx: Save last battery capacity
power: reset: at91-poweroff: move shdwc related data to one structure
power: supply: sc27xx: Add suspend/resume interfaces
power: supply: sc27xx: Add fuel gauge low voltage alarm
...
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/mfd/axp20x.h | 1 | ||||
-rw-r--r-- | include/linux/power/charger-manager.h | 3 | ||||
-rw-r--r-- | include/linux/power_supply.h | 23 |
3 files changed, 26 insertions, 1 deletions
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index 1293695245df..a353cd22b388 100644 --- a/include/linux/mfd/axp20x.h +++ b/include/linux/mfd/axp20x.h @@ -266,6 +266,7 @@ enum axp20x_variants { #define AXP288_RT_BATT_V_H 0xa0 #define AXP288_RT_BATT_V_L 0xa1 +#define AXP813_ACIN_PATH_CTRL 0x3a #define AXP813_ADC_RATE 0x85 /* Fuel Gauge */ diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h index c4fa907c8f14..2ce8d00c20de 100644 --- a/include/linux/power/charger-manager.h +++ b/include/linux/power/charger-manager.h @@ -119,7 +119,7 @@ struct charger_regulator { struct charger_cable *cables; int num_cables; - struct attribute_group attr_g; + struct attribute_group attr_grp; struct device_attribute attr_name; struct device_attribute attr_state; struct device_attribute attr_externally_control; @@ -186,6 +186,7 @@ struct charger_desc { int num_charger_regulators; struct charger_regulator *charger_regulators; + const struct attribute_group **sysfs_groups; const char *psy_fuel_gauge; diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index f80769175c56..57b2ab82b951 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -204,6 +204,9 @@ struct power_supply_config { /* Driver private data */ void *drv_data; + /* Device specific sysfs attributes */ + const struct attribute_group **attr_grp; + char **supplied_to; size_t num_supplicants; }; @@ -309,6 +312,13 @@ struct power_supply_info { int use_for_apm; }; +struct power_supply_battery_ocv_table { + int ocv; /* microVolts */ + int capacity; /* percent */ +}; + +#define POWER_SUPPLY_OCV_TEMP_MAX 20 + /* * This is the recommended struct to manage static battery parameters, * populated by power_supply_get_battery_info(). Most platform drivers should @@ -326,6 +336,10 @@ struct power_supply_battery_info { int charge_term_current_ua; /* microAmps */ int constant_charge_current_max_ua; /* microAmps */ int constant_charge_voltage_max_uv; /* microVolts */ + int factory_internal_resistance_uohm; /* microOhms */ + int ocv_temp[POWER_SUPPLY_OCV_TEMP_MAX];/* celsius */ + struct power_supply_battery_ocv_table *ocv_table[POWER_SUPPLY_OCV_TEMP_MAX]; + int ocv_table_size[POWER_SUPPLY_OCV_TEMP_MAX]; }; extern struct atomic_notifier_head power_supply_notifier; @@ -349,6 +363,15 @@ devm_power_supply_get_by_phandle(struct device *dev, const char *property) extern int power_supply_get_battery_info(struct power_supply *psy, struct power_supply_battery_info *info); +extern void power_supply_put_battery_info(struct power_supply *psy, + struct power_supply_battery_info *info); +extern int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table *table, + int table_len, int ocv); +extern struct power_supply_battery_ocv_table * +power_supply_find_ocv2cap_table(struct power_supply_battery_info *info, + int temp, int *table_len); +extern int power_supply_batinfo_ocv2cap(struct power_supply_battery_info *info, + int ocv, int temp); extern void power_supply_changed(struct power_supply *psy); extern int power_supply_am_i_supplied(struct power_supply *psy); extern int power_supply_set_input_current_limit_from_supplier( |