summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-08-21 12:05:10 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-08-21 12:05:10 -0700
commit2be02a7c996aa733bb36e29e07715621b0de9736 (patch)
tree8bb6dd627780d735d1d8a3fabcfaa83c525e3d59 /include/linux
parent283955dfacfe9e4716b13aa7cd360544717f00cb (diff)
parent2da28b059e0ddcd2e1956eeae383246207965573 (diff)
Merge tag 'for-v7.3' 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 PbAc, NiZn, RAM, and ZnAr battery chemistry types - Create LED triggers based on properties instead of device type - Provide power_supply_get_system_batteries() for usage with USB-C - Add registration init callback for race-free device setup Power-supply drivers: - new TI BQ25630 charger driver - new SG Micro sgm41542 charger driver - bq257xx: Add support for BQ25792 - max8903: add DC and USB input current-limit controls - max17042_battery: Initialize MAX17055 from battery info - sbs-battery: map newly introduced battery chemistries - drop extra error messages for IRQ request failures - lot's of driver removal race condition fixes - misc small cleanups and fixes Reset drivers: - add MCF5441x RCM power-on reason driver - misc small cleanups and fixes" * tag 'for-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (115 commits) power: supply: bq27xxx: bq27z561: fix invalid AverageEnergy address power: supply: bq27xxx: bq28z610: fix invalid AverageEnergy address power: supply: bq27xxx: bq27520g4: fix REG_TTES address power: supply: max17040: synchronize work cancellation on suspend power: supply: lp8727: fix use-after-free in lp8727_release_irq() power: supply: bq256xx: drain usb_work before freeing the charger power: supply: qcom_battmgr: fix battery chemistry strncmp length power: supply: bd99954: Drop bad register fields power: supply: bd71828: Do not hide errors power: supply: bd71828: Drop duplicate power-supply property power: supply: bd71828: Fix current direction power: supply: bd71815: Fix temperature reading power: supply: add stubs for notifier registration helpers power: supply: ucs1002: fix use-after-free on remove power: supply: lp8788-charger: fix use-after-free on remove power: supply: ab8500_fg: fix use-after-free on remove power: supply: bq24257: fix use-after-free on remove power: supply: qcom_battmgr: fix use-after-free power: supply: max17040: drop incorrect I2C functionality check power: supply: charger-manager: register regulators before exposing sysfs ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mfd/bq257xx.h14
-rw-r--r--include/linux/power/max17042_battery.h2
-rw-r--r--include/linux/power_supply.h36
3 files changed, 50 insertions, 2 deletions
diff --git a/include/linux/mfd/bq257xx.h b/include/linux/mfd/bq257xx.h
index 4ec72eb920f2..379ef4ee8291 100644
--- a/include/linux/mfd/bq257xx.h
+++ b/include/linux/mfd/bq257xx.h
@@ -200,6 +200,20 @@
#define BQ25792_REG0A_TRECHG_MASK GENMASK(5, 4)
#define BQ25792_REG0A_VRECHG_MASK GENMASK(3, 0)
+#define BQ25792_CELL_1S 0
+#define BQ25792_CELL_2S 1
+#define BQ25792_CELL_3S 2
+#define BQ25792_CELL_4S 3
+
+#define BQ25792_TRECHG_64MS 0
+#define BQ25792_TRECHG_256MS 1
+#define BQ25792_TRECHG_1024MS 2
+#define BQ25792_TRECHG_2048MS 3
+
+#define BQ25792_VRECHG_MIN_UV 50000
+#define BQ25792_VRECHG_STEP_UV 50000
+#define BQ25792_VRECHG_MAX_UV 800000
+
/* VOTG regulation */
#define BQ25792_REG0B_VOTG_MASK GENMASK(10, 0)
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
index 13aeab1597c6..810e068eafd2 100644
--- a/include/linux/power/max17042_battery.h
+++ b/include/linux/power/max17042_battery.h
@@ -25,6 +25,7 @@
#define MAX17042_CHARACTERIZATION_DATA_SIZE 48
#define MAX17055_MODELCFG_REFRESH_BIT BIT(15)
+#define MAX17055_MODELCFG_VCHG_BIT BIT(10)
enum max17042_register {
MAX17042_STATUS = 0x00,
@@ -124,6 +125,7 @@ enum max17055_register {
MAX17055_ConvgCfg = 0x49,
MAX17055_VFRemCap = 0x4A,
+ MAX17055_SoftWakeup = 0x60,
MAX17055_STATUS2 = 0xB0,
MAX17055_POWER = 0xB1,
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 7a5e4c3242a0..e749d2189335 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -83,6 +83,10 @@ enum {
POWER_SUPPLY_TECHNOLOGY_LiFe,
POWER_SUPPLY_TECHNOLOGY_NiCd,
POWER_SUPPLY_TECHNOLOGY_LiMn,
+ POWER_SUPPLY_TECHNOLOGY_PbAc,
+ POWER_SUPPLY_TECHNOLOGY_NiZn,
+ POWER_SUPPLY_TECHNOLOGY_RAM,
+ POWER_SUPPLY_TECHNOLOGY_ZnAr,
};
enum {
@@ -281,6 +285,15 @@ struct power_supply_desc {
int (*property_is_writeable)(struct power_supply *psy,
enum power_supply_property psp);
void (*external_power_changed)(struct power_supply *psy);
+ /*
+ * Optional registration-time initialization. This runs in sleepable
+ * process context after driver data and any battery info are available,
+ * but before the device is added. The callback must not publish changes or
+ * start asynchronous activity that can access the power supply before
+ * registration completes. Return 0 on success or a negative errno on
+ * failure.
+ */
+ int (*init)(struct power_supply *psy);
/*
* Set if thermal zone should not be created for this power supply.
@@ -346,7 +359,8 @@ struct power_supply {
#endif
#ifdef CONFIG_LEDS_TRIGGERS
- struct led_trigger *trig;
+ struct led_trigger *charging_or_full_trig;
+ struct led_trigger *online_trig;
struct led_trigger *charging_trig;
struct led_trigger *full_trig;
struct led_trigger *charging_blink_full_solid_trig;
@@ -802,15 +816,33 @@ struct power_supply_battery_info {
int bti_resistance_tolerance;
};
+#if IS_ENABLED(CONFIG_POWER_SUPPLY)
extern int power_supply_reg_notifier(struct notifier_block *nb);
extern void power_supply_unreg_notifier(struct notifier_block *nb);
-#if IS_ENABLED(CONFIG_POWER_SUPPLY)
extern struct power_supply *power_supply_get_by_name(const char *name);
+extern int __must_check power_supply_get_system_batteries(struct device *dev,
+ struct power_supply ***psys);
+extern void power_supply_put_system_batteries(struct power_supply **psys, int count);
extern void power_supply_put(struct power_supply *psy);
#else
+static inline int power_supply_reg_notifier(struct notifier_block *nb)
+{ return -EOPNOTSUPP; }
+static inline void power_supply_unreg_notifier(struct notifier_block *nb) {}
static inline void power_supply_put(struct power_supply *psy) {}
static inline struct power_supply *power_supply_get_by_name(const char *name)
{ return NULL; }
+static inline int __must_check power_supply_get_system_batteries(struct device *dev,
+ struct power_supply ***psys)
+{
+ if (psys)
+ *psys = NULL;
+ return 0;
+}
+
+static inline void power_supply_put_system_batteries(struct power_supply **psys,
+ int count)
+{
+}
#endif
extern struct power_supply *power_supply_get_by_reference(struct fwnode_handle *fwnode,
const char *property);