summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-08-07 21:27:37 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-08-07 21:27:37 -0700
commit449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e (patch)
tree31db869c221d9a0de519a7c2206374029fa9943e /include
parentb79675e15a754ca51b9fc631e0961ccdd4ec3fc7 (diff)
parent46cbd0b05799e8234b719d18f3a4b27679c4c92e (diff)
downloadlinux-449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e.tar.bz2
Merge tag 'for-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel: "Power-supply core: - add COOL/WARM/HOT state from JEITA JISC8712:2015 specification - convert simple-battery DT binding to YAML - add long-life charging mode Battery/charger drivers: - bq25150: new charger driver - bq27xxx: add support for BQ27z561 and BQ28z610 - max17040: support CAPACITY_ALERT_MIN - sbs-battery: add PEC support - wilco-ec: support long-life charging mode - bq25890: fix DT binding - misc. fixes and cleanups Reset drivers: - linkstation: new reset driver" * tag 'for-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (32 commits) power: supply: wilco_ec: Add long life charging mode power: supply: bq27xxx_battery: Add the BQ28z610 Battery monitor dt-bindings: power: Add BQ28z610 compatible power: supply: bq27xxx_battery: Add the BQ27Z561 Battery monitor dt-bindings: power: Add BQ27Z561 compatible power: supply: test_power: Fix battery_current initial value power: supply: Fix kerneldoc of power_supply_temp2resist_simple() power: supply: cpcap-battery: Fix kerneldoc of cpcap_battery_read_accumulated() dt-bindings: power: Convert battery.txt to battery.yaml power: supply: rt5033_battery: Fix error code in rt5033_battery_probe() power: supply: max17040: Add POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN power: supply: check if calc_soc succeeded in pm860x_init_battery power: supply: bq2xxxx: Replace HTTP links with HTTPS ones power: reset: add driver for LinkStation power off power: supply: sc27xx: prevent adc * 1000 from overflow math64: New DIV_S64_ROUND_CLOSEST helper power: fix duplicated words in bq2415x_charger.h power: Convert to DEFINE_SHOW_ATTRIBUTE power: reset: keystone-reset: Replace HTTP links with HTTPS ones power: supply: bq25150 introduce the bq25150 ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/math64.h19
-rw-r--r--include/linux/power/bq2415x_charger.h4
-rw-r--r--include/linux/power/bq27xxx_battery.h2
-rw-r--r--include/linux/power_supply.h4
4 files changed, 27 insertions, 2 deletions
diff --git a/include/linux/math64.h b/include/linux/math64.h
index d097119419e6..3381d9e33c4e 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -281,4 +281,23 @@ u64 mul_u64_u64_div_u64(u64 a, u64 mul, u64 div);
#define DIV64_U64_ROUND_CLOSEST(dividend, divisor) \
({ u64 _tmp = (divisor); div64_u64((dividend) + _tmp / 2, _tmp); })
+/*
+ * DIV_S64_ROUND_CLOSEST - signed 64bit divide with 32bit divisor rounded to nearest integer
+ * @dividend: signed 64bit dividend
+ * @divisor: signed 32bit divisor
+ *
+ * Divide signed 64bit dividend by signed 32bit divisor
+ * and round to closest integer.
+ *
+ * Return: dividend / divisor rounded to nearest integer
+ */
+#define DIV_S64_ROUND_CLOSEST(dividend, divisor)( \
+{ \
+ s64 __x = (dividend); \
+ s32 __d = (divisor); \
+ ((__x > 0) == (__d > 0)) ? \
+ div_s64((__x + (__d / 2)), __d) : \
+ div_s64((__x - (__d / 2)), __d); \
+} \
+)
#endif /* _LINUX_MATH64_H */
diff --git a/include/linux/power/bq2415x_charger.h b/include/linux/power/bq2415x_charger.h
index 4ca08321e251..f3c267f2a467 100644
--- a/include/linux/power/bq2415x_charger.h
+++ b/include/linux/power/bq2415x_charger.h
@@ -14,8 +14,8 @@
* value is -1 then default chip value (specified in datasheet) will be
* used.
*
- * Value resistor_sense is needed for for configuring charge and
- * termination current. It it is less or equal to zero, configuring charge
+ * Value resistor_sense is needed for configuring charge and
+ * termination current. If it is less or equal to zero, configuring charge
* and termination current will not be possible.
*
* For automode support is needed to provide name of power supply device
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 507c5e214c42..987d9652aa4e 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -30,6 +30,8 @@ enum bq27xxx_chip {
BQ27426,
BQ27441,
BQ27621,
+ BQ27Z561,
+ BQ28Z610,
};
struct bq27xxx_device_info;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index ac1345a48ad0..97cc4b85bf61 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -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 {
@@ -62,6 +63,9 @@ enum {
POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
POWER_SUPPLY_HEALTH_OVERCURRENT,
POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED,
+ POWER_SUPPLY_HEALTH_WARM,
+ POWER_SUPPLY_HEALTH_COOL,
+ POWER_SUPPLY_HEALTH_HOT,
};
enum {