Skip to content

Commit

Permalink
Merge tag 'for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:
 "Miscellaneous small fixes and improvements all over the place.

  Nothing stands out in particular"

* tag 'for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (30 commits)
  power: supply: bq25890: Fix initial setting of the F_CONV_RATE field
  power: supply: bq25890: Fix race causing oops at boot
  power: supply: bq27xxx: Fix kernel crash on IRQ handler register error
  power: bq25890: add return values to error messages
  power: supply: axp288-charger: Simplify axp288_get_charger_health()
  power: supply: axp288-charger: Remove unnecessary is_present and is_online helpers
  power: supply: axp288-charger: Add depends on IOSF_MBIO to Kconfig
  power: supply: ab8500_bmdata: Use standard phandle
  dt-bindings: power: supply: ab8500: Standard monitored-battery
  power: supply: axp288_charger: Fix missing mutex_init()
  power: supply: max17042_battery: Prevent int underflow in set_soc_threshold
  power: supply: max17042_battery: Clear status bits in interrupt handler
  MAINTAINERS: power: supply: max17040: add entry with reviewers
  MAINTAINERS: power: supply: max17042: add entry with reviewers
  power: supply: max17040: fix null-ptr-deref in max17040_probe()
  power: supply: rt5033_battery: Change voltage values to µV
  power: supply: axp288-charger: Optimize register reading method
  dt-bindings: power: Bindings for Samsung batteries
  power: supply: cpcap-battery: use device_get_match_data() to simplify code
  power: supply: max17042_battery: fix typo in MAX17042_IAvg_empty
  ...
  • Loading branch information
torvalds committed Nov 4, 2021
2 parents c1e2e03 + 22ad4f9 commit 72e65f7
Show file tree
Hide file tree
Showing 22 changed files with 335 additions and 191 deletions.
13 changes: 13 additions & 0 deletions Documentation/ABI/testing/sysfs-class-power
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,19 @@ Description:

Valid values: Represented in microvolts

What: /sys/class/power_supply/<supply_name>/cycle_count
Date: January 2010
Contact: [email protected]
Description:
Reports the number of full charge + discharge cycles the
battery has undergone.

Access: Read

Valid values:
Integer > 0: representing full cycles
Integer = 0: cycle_count info is not available

**USB Properties**

What: /sys/class/power_supply/<supply_name>/input_current_limit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ required:
- compatible
- reg

additionalProperties: false
unevaluatedProperties: false

examples:
- |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/samsung,battery.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Samsung SDI Batteries

maintainers:
- Linus Walleij <[email protected]>

description: |
Samsung SDI (Samsung Digital Interface) batteries are all different versions
of lithium ion chemistry devices used for mobile phones, laptops and other
portable electronics. The batteries are adapted to a specific product and
the physical restrictions make it impossible to use another battery with the
product, so product device trees can specify these batteries. Operating
systems should determine hardware characteristics of the batteries from the
compatible string.
properties:
compatible:
oneOf:
- const: samsung,eb-l1m7flu
description: 3.8V 1500 mAh battery used in Samsung GT-I8190
- const: samsung,eb425161la
description: 3.8V 1500 mAh battery used in Samsung SGH-T599 and SGH-I407
- const: samsung,eb425161lu
description: 3.8V 1500 mAh battery used in Samsung GT-I8160
- const: samsung,eb485159lu
description: 3.8V 1700 mAh battery used in Samsung GT-S7710
- const: samsung,eb535151vu
description: 3.8V 1500 mAh battery used in Samsung GT-I9070
- const: samsung,eb585157lu
description: 3.8V 2000 mAh battery used in Samsung GT-I8530

required:
- compatible

additionalProperties: false

examples:
- |
power {
#address-cells = <1>;
#size-cells = <0>;
battery: battery {
compatible = "samsung,eb425161la";
};
charger@11 {
reg = <0x11>;
monitored-battery = <&battery>;
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ properties:
compatible:
const: stericsson,ab8500-btemp

battery:
monitored-battery:
$ref: /schemas/types.yaml#/definitions/phandle
description: phandle to battery node

battery:
$ref: /schemas/types.yaml#/definitions/phandle
deprecated: true

interrupts:
maxItems: 5

Expand All @@ -42,7 +46,7 @@ properties:

required:
- compatible
- battery
- monitored-battery
- interrupts
- interrupt-names
- io-channels
Expand All @@ -56,7 +60,7 @@ examples:
pmic {
battery-temperature {
compatible = "stericsson,ab8500-btemp";
battery = <&ab8500_battery>;
monitored-battery = <&battery>;
interrupts = <20 IRQ_TYPE_LEVEL_HIGH>,
<80 IRQ_TYPE_LEVEL_HIGH>,
<83 IRQ_TYPE_LEVEL_HIGH>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ properties:
compatible:
const: stericsson,ab8500-chargalg

battery:
monitored-battery:
$ref: /schemas/types.yaml#/definitions/phandle
description: phandle to battery node

battery:
$ref: /schemas/types.yaml#/definitions/phandle
deprecated: true

required:
- compatible
- battery
- monitored-battery

additionalProperties: false

Expand All @@ -32,6 +36,6 @@ examples:
pmic {
charging-algorithm {
compatible = "stericsson,ab8500-chargalg";
battery = <&ab8500_battery>;
monitored-battery = <&ab8500_battery>;
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ properties:
compatible:
const: stericsson,ab8500-charger

battery:
monitored-battery:
$ref: /schemas/types.yaml#/definitions/phandle
description: phandle to battery node

battery:
$ref: /schemas/types.yaml#/definitions/phandle
deprecated: true

vddadc-supply:
description: Supply for USB and Main charger

Expand Down Expand Up @@ -66,7 +70,7 @@ properties:

required:
- compatible
- battery
- monitored-battery
- vddadc-supply
- interrupts
- interrupt-names
Expand All @@ -81,7 +85,7 @@ examples:
pmic {
charger {
compatible = "stericsson,ab8500-charger";
battery = <&ab8500_battery>;
monitored-battery = <&battery>;
vddadc-supply = <&ab8500_ldo_tvout_reg>;
interrupts = <10 IRQ_TYPE_LEVEL_HIGH>,
<11 IRQ_TYPE_LEVEL_HIGH>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ properties:
compatible:
const: stericsson,ab8500-fg

battery:
monitored-battery:
$ref: /schemas/types.yaml#/definitions/phandle
description: phandle to battery node

battery:
$ref: /schemas/types.yaml#/definitions/phandle
deprecated: true

interrupts:
maxItems: 5

Expand All @@ -41,7 +45,7 @@ properties:

required:
- compatible
- battery
- monitored-battery
- interrupts
- interrupt-names
- io-channels
Expand All @@ -55,7 +59,7 @@ examples:
pmic {
fuel-gauge {
compatible = "stericsson,ab8500-fg";
battery = <&ab8500_battery>;
monitored-battery = <&battery>;
interrupts = <24 IRQ_TYPE_LEVEL_HIGH>,
<8 IRQ_TYPE_LEVEL_HIGH>,
<28 IRQ_TYPE_LEVEL_HIGH>,
Expand Down
21 changes: 21 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -11508,6 +11508,27 @@ S: Maintained
F: Documentation/devicetree/bindings/iio/proximity/maxbotix,mb1232.yaml
F: drivers/iio/proximity/mb1232.c

MAXIM MAX17040 FAMILY FUEL GAUGE DRIVERS
R: Iskren Chernev <[email protected]>
R: Krzysztof Kozlowski <[email protected]>
R: Marek Szyprowski <[email protected]>
R: Matheus Castello <[email protected]>
L: [email protected]
S: Maintained
F: Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml
F: drivers/power/supply/max17040_battery.c

MAXIM MAX17042 FAMILY FUEL GAUGE DRIVERS
R: Hans de Goede <[email protected]>
R: Krzysztof Kozlowski <[email protected]>
R: Marek Szyprowski <[email protected]>
R: Sebastian Krzyszkowiak <[email protected]>
R: Purism Kernel Team <[email protected]>
L: [email protected]
S: Maintained
F: Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml
F: drivers/power/supply/max17042_battery.c

MAXIM MAX77650 PMIC MFD DRIVER
M: Bartosz Golaszewski <[email protected]>
L: [email protected]
Expand Down
4 changes: 2 additions & 2 deletions drivers/power/reset/at91-reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
return -ENOMEM;

reset->rstc_base = devm_of_iomap(&pdev->dev, pdev->dev.of_node, 0, NULL);
if (!reset->rstc_base) {
if (IS_ERR(reset->rstc_base)) {
dev_err(&pdev->dev, "Could not map reset controller address\n");
return -ENODEV;
}
Expand All @@ -203,7 +203,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
for_each_matching_node_and_match(np, at91_ramc_of_match, &match) {
reset->ramc_lpr = (u32)match->data;
reset->ramc_base[idx] = devm_of_iomap(&pdev->dev, np, 0, NULL);
if (!reset->ramc_base[idx]) {
if (IS_ERR(reset->ramc_base[idx])) {
dev_err(&pdev->dev, "Could not map ram controller address\n");
of_node_put(np);
return -ENODEV;
Expand Down
4 changes: 1 addition & 3 deletions drivers/power/reset/ltc2952-poweroff.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ static struct ltc2952_poweroff *ltc2952_data;
*/
static enum hrtimer_restart ltc2952_poweroff_timer_wde(struct hrtimer *timer)
{
ktime_t now;
int state;
struct ltc2952_poweroff *data = to_ltc2952(timer, timer_wde);

Expand All @@ -104,8 +103,7 @@ static enum hrtimer_restart ltc2952_poweroff_timer_wde(struct hrtimer *timer)
state = gpiod_get_value(data->gpio_watchdog);
gpiod_set_value(data->gpio_watchdog, !state);

now = hrtimer_cb_get_time(timer);
hrtimer_forward(timer, now, data->wde_interval);
hrtimer_forward_now(timer, data->wde_interval);

return HRTIMER_RESTART;
}
Expand Down
23 changes: 14 additions & 9 deletions drivers/power/supply/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ config AXP20X_POWER

config AXP288_CHARGER
tristate "X-Powers AXP288 Charger"
depends on MFD_AXP20X && EXTCON_AXP288
depends on MFD_AXP20X && EXTCON_AXP288 && IOSF_MBI
help
Say yes here to have support X-Power AXP288 power management IC (PMIC)
integrated charger.
Expand All @@ -366,29 +366,34 @@ config AXP288_FUEL_GAUGE
over/under temperature.

config BATTERY_MAX17040
tristate "Maxim MAX17040 Fuel Gauge"
tristate "Maxim MAX17040/17041/17043 family Fuel Gauge"
depends on I2C
select REGMAP_I2C
help
Maxim models with ModelGauge are fuel-gauge systems for lithium-ion
(Li+) batteries in handheld and portable equipment, including
max17040, max17041, max17043, max17044, max17048, max17049, max17058,
max17059. It is also included in some batteries like max77836.
Driver supports Maxim fuel-gauge systems for lithium-ion (Li+)
batteries used mainly in handheld and portable equipment.
Supported devices: max17040, max17041, max17043, max17044, max17048,
max17049, max17058, max17059, max77836.

Driver supports reporting SOC (State of Charge, i.e capacity),
voltage and configurable low-SOC wakeup interrupt.

Driver can be build as a module (max17040_battery).

config BATTERY_MAX17042
tristate "Maxim MAX17042/17047/17050/8997/8966 Fuel Gauge"
tristate "Maxim MAX17042/17047/17050/8997/8966 family Fuel Gauge"
depends on I2C
select REGMAP_I2C
help
MAX17042 is fuel-gauge systems for lithium-ion (Li+) batteries
in handheld and portable equipment. The MAX17042 is configured
to operate with a single lithium cell. MAX8997 and MAX8966 are
multi-function devices that include fuel gauages that are compatible
with MAX17042. This driver also supports max17047/50 chips which are
improved version of max17042.
with MAX17042.
Supported devices: max8966, max8997, max17042, max17047, max17050,
max17055, max77693, max77849.

Driver can be build as a module (max17042_battery).

config BATTERY_MAX1721X
tristate "MAX17211/MAX17215 standalone gas-gauge"
Expand Down
3 changes: 1 addition & 2 deletions drivers/power/supply/ab8500_bmdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,7 @@ int ab8500_bm_of_probe(struct device *dev,
const char *btech;
int i;

/* get phandle to 'battery-info' node */
battery_node = of_parse_phandle(np, "battery", 0);
battery_node = of_parse_phandle(np, "monitored-battery", 0);
if (!battery_node) {
dev_err(dev, "battery node or reference missing\n");
return -EINVAL;
Expand Down
Loading

0 comments on commit 72e65f7

Please sign in to comment.