Merge tag 'for-v6.14' 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:

   - introduce power supply extensions, which allows adding properties
     to a power supply device from a separate driver. This will be used
     initially to extend the generic ACPI charger/battery driver with
     vendor extensions for charge thresholds.

   - convert all drivers from power_supply_for_each_device to new
     power_supply_for_each_psy(), which avoids lots of casting being
     done in the drivers.

   - avoid LED trigger like values in uevent for
     POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR

   - introduce POWER_SUPPLY_PROP_CHARGE_TYPES, which is similar to the
     POWER_SUPPLY_PROP_CHARGE_TYPE property, but also lists the
     available options on the specific platform

  Power-supply drivers

   - dell-laptop: use new power_supply_charge_types_show/_parse helpers

   - stc3117: new driver for equally named fuel gauge chip

   - bq24190: add support for new POWER_SUPPLY_PROP_CHARGE_TYPES

   - bq24190: add BQ24297 support

   - bq27xxx: add voltage min design for bq27000/bq27200

   - cros_charge-control: convert to new power supply extension API

   - multiple drivers: constify 'struct bin_attribute'

   - ds2782: convert to device managed resources

   - max1720x: add charge full property

   - max1720x: support extra thermistor temperatures

   - max17042: add max77705 support

   - ip5xxx-power: add support for IP5306

   - ltc4162-l-charger: add ltc4162-f/s and ltc4015 support

   - gpio-charger: support for default charge current limit

   - misc small cleanups and fixes

  Reset drivers:

   - at91-poweroff: add sam9x7 support"

* tag 'for-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (77 commits)
  power: supply: max1720x: add support for reading internal and thermistor temperatures
  power: supply: ltc4162l: Use GENMASK macro in bitmask operation
  power: supply: max17042: add max77705 fuel gauge support
  dt-bindings: power: supply: max17042: add max77705 support
  power: supply: add undervoltage health status property
  power: supply: max17042: add platform driver variant
  power: supply: max17042: make interrupt shared
  power: reset: keystone: Use syscon_regmap_lookup_by_phandle_args
  power: supply: Use str_enable_disable-like helpers
  platform/x86: dell-laptop: Use power_supply_charge_types_show/_parse() helpers
  power: supply: bq2415x_charger: Immediately reschedule delayed work on notifier events
  power: supply: Add STC3117 fuel gauge unit driver
  dt-bindings: power: supply: Add STC3117 Fuel Gauge
  power: supply: ug3105_battery: Let the core handle POWER_SUPPLY_PROP_TECHNOLOGY
  power: supply: gpio-charger: add support for default charge current limit
  dt-bindings: power: supply: gpio-charger: add support for default charge current limit
  power: supply: Use power_supply_external_power_changed() in __power_supply_changed_work()
  power: supply: core: fix build of extension sysfs group if CONFIG_SYSFS=n
  power: supply: bq2415x_charger: report charging state changes to userspace
  bq27xxx: add voltage min design for bq27000 and bq27200
  ...
This commit is contained in:
Linus Torvalds
2025-01-27 15:37:16 -08:00
54 changed files with 2724 additions and 711 deletions

View File

@@ -407,10 +407,30 @@ Description:
Access: Read, Write
Reading this returns the current active value, e.g. 'Standard'.
Check charge_types to get the values supported by the battery.
Valid values:
"Unknown", "N/A", "Trickle", "Fast", "Standard",
"Adaptive", "Custom", "Long Life", "Bypass"
What: /sys/class/power_supply/<supply_name>/charge_types
Date: December 2024
Contact: linux-pm@vger.kernel.org
Description:
Identical to charge_type but reading returns a list of supported
charge-types with the currently active type surrounded by square
brackets, e.g.: "Fast [Standard] Long_Life".
power_supply class devices may support both charge_type and
charge_types for backward compatibility. In this case both will
always have the same active value and the active value can be
changed by writing either property.
Note charge-types which contain a space such as "Long Life" will
have the space replaced by a '_' resulting in e.g. "Long_Life".
When writing charge-types both variants are accepted.
What: /sys/class/power_supply/<supply_name>/charge_term_current
Date: July 2014
Contact: linux-pm@vger.kernel.org
@@ -433,7 +453,7 @@ Description:
Valid values:
"Unknown", "Good", "Overheat", "Dead",
"Over voltage", "Unspecified failure", "Cold",
"Over voltage", "Under voltage", "Unspecified failure", "Cold",
"Watchdog timer expire", "Safety timer expire",
"Over current", "Calibration required", "Warm",
"Cool", "Hot", "No battery"
@@ -793,3 +813,12 @@ Description:
Access: Read
Valid values: 1-31
What: /sys/class/power_supply/<supply_name>/extensions/<extension_name>
Date: March 2025
Contact: linux-pm@vger.kernel.org
Description:
Reports the extensions registered to the power supply.
Each entry is a link to the device which registered the extension.
Access: Read

View File

@@ -0,0 +1,32 @@
What: /sys/class/power_supply/max1720x/temp_ain1
Date: January 2025
KernelVersion: 6.14
Contact: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Description:
Reports the current temperature reading from AIN1 thermistor.
Access: Read
Valid values: Represented in 1/10 Degrees Celsius
What: /sys/class/power_supply/max1720x/temp_ain2
Date: January 2025
KernelVersion: 6.14
Contact: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Description:
Reports the current temperature reading from AIN2 thermistor.
Access: Read
Valid values: Represented in 1/10 Degrees Celsius
What: /sys/class/power_supply/max1720x/temp_int
Date: January 2025
KernelVersion: 6.14
Contact: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Description:
Reports the current temperature reading from internal die.
Access: Read
Valid values: Represented in 1/10 Degrees Celsius

View File

@@ -22,6 +22,9 @@ properties:
- enum:
- atmel,sama5d2-shdwc
- microchip,sam9x60-shdwc
- items:
- const: microchip,sam9x7-shdwc
- const: microchip,sam9x60-shdwc
reg:
maxItems: 1

View File

@@ -21,6 +21,7 @@ properties:
- ti,bq24192i
- ti,bq24196
- ti,bq24296
- ti,bq24297
reg:
maxItems: 1

View File

@@ -58,6 +58,10 @@ properties:
charge-current-limit-gpios property. Bit 1 second to last
GPIO and so on.
charge-current-limit-default-microamp:
description: Default charge current limit. Must be listed in
charge-current-limit-mapping.
required:
- compatible
@@ -72,6 +76,7 @@ anyOf:
dependencies:
charge-current-limit-gpios: [ charge-current-limit-mapping ]
charge-current-limit-mapping: [ charge-current-limit-gpios ]
charge-current-limit-default-microamp: [charge-current-limit-mapping]
additionalProperties: false
@@ -91,4 +96,5 @@ examples:
charge-current-limit-mapping = <2500000 0x00>, // 2.5 A => both GPIOs low
<700000 0x01>, // 700 mA => GPIO A.12 high
<0 0x02>; // 0 mA => GPIO A.11 high
charge-current-limit-default-microamp = <700000>;
};

View File

@@ -17,12 +17,18 @@ description: |
panels, etc., and a rechargeable Lithium-Ion/Polymer battery.
Specifications about the charger can be found at:
https://www.analog.com/en/products/ltc4162-l.html
https://www.analog.com/en/products/ltc4162-f.html
https://www.analog.com/en/products/ltc4162-s.html
https://www.analog.com/en/products/ltc4015.html
properties:
compatible:
enum:
- lltc,ltc4015
- lltc,ltc4162-f
- lltc,ltc4162-l
- lltc,ltc4162-s
reg:
maxItems: 1

View File

@@ -19,6 +19,7 @@ properties:
- maxim,max17047
- maxim,max17050
- maxim,max17055
- maxim,max77705-battery
- maxim,max77849-battery
reg:

View File

@@ -0,0 +1,74 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/st,stc3117.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: STMicroelectronics STC3117 Fuel Gauge Unit Power Supply
maintainers:
- Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>
- Bhavin Sharma <bhavin.sharma@siliconsignals.io>
description: |
The STC3117 includes the STMicroelectronics OptimGauge algorithm.
It provides accurate battery state-of-charge (SOC) monitoring, tracks
battery parameter changes with operation conditions, temperature,
and aging, and allows the application to get a battery state-of-health
(SOH) indication.
An alarm output signals low SOC or low voltage conditions and also
indicates fault conditions like a missing or swapped battery.
Datasheet is available at
https://www.st.com/resource/en/datasheet/stc3117.pdf
allOf:
- $ref: power-supply.yaml#
properties:
compatible:
enum:
- st,stc3117
reg:
maxItems: 1
monitored-battery:
description: |
The fuel gauge uses the following battery properties:
- charge-full-design-microamp-hours
- voltage-min-design-microvolt
- voltage-max-design-microvolt
shunt-resistor-micro-ohms:
description: Current sense resistor
interrupts:
maxItems: 1
required:
- compatible
- reg
- monitored-battery
- shunt-resistor-micro-ohms
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
battery@70 {
compatible = "st,stc3117";
reg = <0x70>;
interrupt-parent = <&gpio0>;
interrupts = <31 IRQ_TYPE_LEVEL_LOW>;
monitored-battery = <&bat>;
shunt-resistor-micro-ohms = <10000>;
};
};

View File

@@ -147,6 +147,8 @@ properties:
- injoinic,ip5207
# Injoinic IP5209 2.4A Power Bank IC with I2C
- injoinic,ip5209
# Injoinic IP5306 2.1A Power Bank IC with I2C option
- injoinic,ip5306
# Inspur Power System power supply unit version 1
- inspur,ipsps1
# Intel common redudant power supply crps185

View File

@@ -22309,6 +22309,14 @@ T: git git://linuxtv.org/media.git
F: Documentation/devicetree/bindings/media/i2c/st,st-mipid02.yaml
F: drivers/media/i2c/st-mipid02.c
ST STC3117 FUEL GAUGE DRIVER
M: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>
M: Bhavin Sharma <bhavin.sharma@siliconsignals.io>
L: linux-pm@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/power/supply/st,stc3117.yaml
F: drivers/power/supply/stc3117_fuel_gauge.c
ST STM32 FIREWALL
M: Gatien Chevallier <gatien.chevallier@foss.st.com>
S: Maintained

View File

@@ -103,15 +103,15 @@ static bool mute_led_registered;
struct battery_mode_info {
int token;
const char *label;
enum power_supply_charge_type charge_type;
};
static const struct battery_mode_info battery_modes[] = {
{ BAT_PRI_AC_MODE_TOKEN, "Trickle" },
{ BAT_EXPRESS_MODE_TOKEN, "Fast" },
{ BAT_STANDARD_MODE_TOKEN, "Standard" },
{ BAT_ADAPTIVE_MODE_TOKEN, "Adaptive" },
{ BAT_CUSTOM_MODE_TOKEN, "Custom" },
{ BAT_PRI_AC_MODE_TOKEN, POWER_SUPPLY_CHARGE_TYPE_TRICKLE },
{ BAT_EXPRESS_MODE_TOKEN, POWER_SUPPLY_CHARGE_TYPE_FAST },
{ BAT_STANDARD_MODE_TOKEN, POWER_SUPPLY_CHARGE_TYPE_STANDARD },
{ BAT_ADAPTIVE_MODE_TOKEN, POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE },
{ BAT_CUSTOM_MODE_TOKEN, POWER_SUPPLY_CHARGE_TYPE_CUSTOM },
};
static u32 battery_supported_modes;
@@ -2261,46 +2261,42 @@ static ssize_t charge_types_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
ssize_t count = 0;
enum power_supply_charge_type charge_type;
int i;
for (i = 0; i < ARRAY_SIZE(battery_modes); i++) {
bool active;
charge_type = battery_modes[i].charge_type;
if (!(battery_supported_modes & BIT(i)))
if (!(battery_supported_modes & BIT(charge_type)))
continue;
active = dell_battery_mode_is_active(battery_modes[i].token);
count += sysfs_emit_at(buf, count, active ? "[%s] " : "%s ",
battery_modes[i].label);
if (!dell_battery_mode_is_active(battery_modes[i].token))
continue;
return power_supply_charge_types_show(dev, battery_supported_modes,
charge_type, buf);
}
/* convert the last space to a newline */
if (count > 0)
count--;
count += sysfs_emit_at(buf, count, "\n");
return count;
/* No active mode found */
return -EIO;
}
static ssize_t charge_types_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
bool matched = false;
int err, i;
int charge_type, err, i;
charge_type = power_supply_charge_types_parse(battery_supported_modes, buf);
if (charge_type < 0)
return charge_type;
for (i = 0; i < ARRAY_SIZE(battery_modes); i++) {
if (!(battery_supported_modes & BIT(i)))
continue;
if (sysfs_streq(battery_modes[i].label, buf)) {
matched = true;
if (battery_modes[i].charge_type == charge_type)
break;
}
}
if (!matched)
return -EINVAL;
if (i == ARRAY_SIZE(battery_modes))
return -ENOENT;
err = dell_battery_set_mode(battery_modes[i].token);
if (err)
@@ -2430,7 +2426,7 @@ static u32 __init battery_get_supported_modes(void)
for (i = 0; i < ARRAY_SIZE(battery_modes); i++) {
if (dell_smbios_find_token(battery_modes[i].token))
modes |= BIT(i);
modes |= BIT(battery_modes[i].charge_type);
}
return modes;

View File

@@ -26,7 +26,7 @@ config POWER_RESET_AT91_POWEROFF
config POWER_RESET_AT91_RESET
tristate "Atmel AT91 reset driver"
depends on ARCH_AT91
default SOC_AT91SAM9 || SOC_SAM9X60 || SOC_SAMA5
default SOC_AT91SAM9 || SOC_SAM9X60 || SOC_SAM9X7 || SOC_SAMA5
help
This driver supports restart for Atmel AT91SAM9 and SAMA5
SoCs
@@ -34,7 +34,7 @@ config POWER_RESET_AT91_RESET
config POWER_RESET_AT91_SAMA5D2_SHDWC
tristate "Atmel AT91 SAMA5D2-Compatible shutdown controller driver"
depends on ARCH_AT91
default SOC_SAM9X60 || SOC_SAMA5
default SOC_SAM9X60 || SOC_SAM9X7 || SOC_SAMA5
help
This driver supports the alternate shutdown controller for some Atmel
SAMA5 SoCs. It is present for example on SAMA5D2 SoC.

View File

@@ -57,8 +57,6 @@ static int as3722_poweroff_probe(struct platform_device *pdev)
SYS_OFF_PRIO_DEFAULT,
as3722_pm_power_off,
as3722_poweroff);
return 0;
}
static struct platform_driver as3722_poweroff_driver = {

View File

@@ -326,6 +326,7 @@ static const struct of_device_id at91_pmc_ids[] = {
{ .compatible = "atmel,sama5d2-pmc" },
{ .compatible = "microchip,sam9x60-pmc" },
{ .compatible = "microchip,sama7g5-pmc" },
{ .compatible = "microchip,sam9x7-pmc" },
{ /* Sentinel. */ }
};

View File

@@ -44,7 +44,13 @@ static int gpio_poweroff_do_poweroff(struct sys_off_data *data)
/* give it some time */
mdelay(gpio_poweroff->timeout_ms);
WARN_ON(1);
/*
* If code reaches this point, it means that gpio-poweroff has failed
* to actually power off the system.
* Warn the user that the attempt to poweroff via gpio-poweroff
* has gone wrong.
*/
WARN(1, "Failed to poweroff via gpio-poweroff mechanism\n");
return NOTIFY_DONE;
}

View File

@@ -87,26 +87,16 @@ static int rsctrl_probe(struct platform_device *pdev)
return -ENODEV;
/* get regmaps */
pllctrl_regs = syscon_regmap_lookup_by_phandle(np, "ti,syscon-pll");
pllctrl_regs = syscon_regmap_lookup_by_phandle_args(np, "ti,syscon-pll",
1, &rspll_offset);
if (IS_ERR(pllctrl_regs))
return PTR_ERR(pllctrl_regs);
devctrl_regs = syscon_regmap_lookup_by_phandle(np, "ti,syscon-dev");
devctrl_regs = syscon_regmap_lookup_by_phandle_args(np, "ti,syscon-dev",
1, &rsmux_offset);
if (IS_ERR(devctrl_regs))
return PTR_ERR(devctrl_regs);
ret = of_property_read_u32_index(np, "ti,syscon-pll", 1, &rspll_offset);
if (ret) {
dev_err(dev, "couldn't read the reset pll offset!\n");
return -EINVAL;
}
ret = of_property_read_u32_index(np, "ti,syscon-dev", 1, &rsmux_offset);
if (ret) {
dev_err(dev, "couldn't read the rsmux offset!\n");
return -EINVAL;
}
/* set soft/hard reset */
val = of_property_read_bool(np, "ti,soft-reset");
val = val ? RSCFG_RSTYPE_SOFT : RSCFG_RSTYPE_HARD;

View File

@@ -14,6 +14,7 @@
#include <linux/mutex.h>
#include <linux/string.h>
#include <linux/power_supply.h>
#include <linux/string_choices.h>
#include <linux/mfd/88pm860x.h>
#include <linux/delay.h>
@@ -503,8 +504,7 @@ static void pm860x_init_battery(struct pm860x_battery_info *info)
data = pm860x_reg_read(info->i2c, PM8607_POWER_UP_LOG);
bat_remove = data & BAT_WU_LOG;
dev_dbg(info->dev, "battery wake up? %s\n",
bat_remove != 0 ? "yes" : "no");
dev_dbg(info->dev, "battery wake up? %s\n", str_yes_no(bat_remove));
/* restore SOC from RTC domain register */
if (bat_remove == 0) {

View File

@@ -918,6 +918,15 @@ config FUEL_GAUGE_SC27XX
Say Y here to enable support for fuel gauge with SC27XX
PMIC chips.
config FUEL_GAUGE_STC3117
tristate "STMicroelectronics STC3117 fuel gauge driver"
depends on CRC8
depends on I2C
select REGMAP_I2C
help
Say Y here to enable support for fuel gauge with STC3117
chip.
config CHARGER_UCS1002
tristate "Microchip UCS1002 USB Port Power Controller"
depends on I2C

View File

@@ -108,6 +108,7 @@ obj-$(CONFIG_CHARGER_CROS_USBPD) += cros_usbpd-charger.o
obj-$(CONFIG_CHARGER_CROS_PCHG) += cros_peripheral_charger.o
obj-$(CONFIG_CHARGER_SC2731) += sc2731_charger.o
obj-$(CONFIG_FUEL_GAUGE_SC27XX) += sc27xx_fuel_gauge.o
obj-$(CONFIG_FUEL_GAUGE_STC3117) += stc3117_fuel_gauge.o
obj-$(CONFIG_CHARGER_UCS1002) += ucs1002_power.o
obj-$(CONFIG_CHARGER_BD99954) += bd99954-charger.o
obj-$(CONFIG_CHARGER_WILCO) += wilco-charger.o

View File

@@ -540,10 +540,9 @@ static int ab8500_btemp_get_property(struct power_supply *psy,
return 0;
}
static int ab8500_btemp_get_ext_psy_data(struct device *dev, void *data)
static int ab8500_btemp_get_ext_psy_data(struct power_supply *ext, void *data)
{
struct power_supply *psy;
struct power_supply *ext = dev_get_drvdata(dev);
const char **supplicants = (const char **)ext->supplied_to;
struct ab8500_btemp *di;
union power_supply_propval ret;
@@ -617,7 +616,7 @@ static int ab8500_btemp_get_ext_psy_data(struct device *dev, void *data)
*/
static void ab8500_btemp_external_power_changed(struct power_supply *psy)
{
power_supply_for_each_device(psy, ab8500_btemp_get_ext_psy_data);
power_supply_for_each_psy(psy, ab8500_btemp_get_ext_psy_data);
}
/* ab8500 btemp driver interrupts and their respective isr */

Some files were not shown because too many files have changed in this diff Show More