Skip to content

Commit 4cadc60

Browse files
committed
Merge tag 'for-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel: "Core: - Add battery internal resistance temperature table support Drivers: - sc27xx: Optimize the battery resistance with measuring temperature - max17042-battery: Add MAX17055 support - bq25890-charger: Add support of BQ25892 and BQ25896 chips - misc fixes" * tag 'for-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (44 commits) power: supply: ipaq_micro_battery: remove unneeded semicolon power: supply: bq25890_charger: fix incorrect error return when bq25890_field_read fails power: supply: axp20x_usb_power: Only poll while offline power: supply: axp20x_usb_power: Add wakeup control power: supply: axp20x_usb_power: Allow offlining power: supply: axp20x_usb_power: Use a match structure power: suppy: ucs1002: Make the symbol 'ucs1002_regulator_enable' static power: reset: at91-poweroff: use proper master clock register offset power: reset: at91-poweroff: introduce struct shdwc_reg_config power: supply: bq25890_charger: Add DT and I2C ids for all supported chips dt-bindings: Add new chips to bq25890 binding documentation power: supply: bq25890_charger: Add support of BQ25892 and BQ25896 chips power: supply: core: Update sysfs-class-power ABI document power: supply: sbs-battery: Fix a signedness bug in sbs_get_battery_capacity() power: supply: ltc2941-battery-gauge: fix use-after-free power: supply: max17040: Correct IRQ wake handling power: supply: axp20x_usb_power: Remove unused device_node power: supply: axp20x_ac_power: Add wakeup control power: supply: axp20x_ac_power: Allow offlining power: supply: axp20x_ac_power: Fix reporting online status ...
2 parents 893e591 + 3d32a84 commit 4cadc60

30 files changed

+882
-210
lines changed

Documentation/ABI/testing/sysfs-class-power

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ Description:
189189
Access: Read
190190
Valid values: "Unknown", "Good", "Overheat", "Dead",
191191
"Over voltage", "Unspecified failure", "Cold",
192-
"Watchdog timer expire", "Safety timer expire"
192+
"Watchdog timer expire", "Safety timer expire",
193+
"Over current"
193194

194195
What: /sys/class/power_supply/<supply_name>/precharge_current
195196
Date: June 2017

Documentation/devicetree/bindings/power/supply/battery.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Optional Properties:
3535
for each of the battery capacity lookup table. The first temperature value
3636
specifies the OCV table 0, and the second temperature value specifies the
3737
OCV table 1, and so on.
38+
- resistance-temp-table: An array providing the temperature in degree Celsius
39+
and corresponding battery internal resistance percent, which is used to look
40+
up the resistance percent according to current temperature to get a accurate
41+
batterty internal resistance in different temperatures.
3842

3943
Battery properties are named, where possible, for the corresponding
4044
elements in enum power_supply_property, defined in
@@ -61,6 +65,7 @@ Example:
6165
ocv-capacity-table-0 = <4185000 100>, <4113000 95>, <4066000 90>, ...;
6266
ocv-capacity-table-1 = <4200000 100>, <4185000 95>, <4113000 90>, ...;
6367
ocv-capacity-table-2 = <4250000 100>, <4200000 95>, <4185000 90>, ...;
68+
resistance-temp-table = <20 100>, <10 90>, <0 80>, <(-10) 60>;
6469
};
6570

6671
charger: charger@11 {

Documentation/devicetree/bindings/power/supply/bq25890.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
Binding for TI bq25890 Li-Ion Charger
22

3-
This driver will support the bq25896 and the bq25890. There are other ICs
4-
in the same family but those have not been tested.
3+
This driver will support the bq25892, the bq25896 and the bq25890. There are
4+
other ICs in the same family but those have not been tested.
55

66
Required properties:
77
- compatible: Should contain one of the following:
88
* "ti,bq25890"
9+
* "ti,bq25892"
10+
* "ti,bq25895"
11+
* "ti,bq25896"
912
- reg: integer, i2c address of the device.
1013
- ti,battery-regulation-voltage: integer, maximum charging voltage (in uV);
1114
- ti,charge-current: integer, maximum charging current (in uA);
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
max17040_battery
2+
~~~~~~~~~~~~~~~~
3+
4+
Required properties :
5+
- compatible : "maxim,max17040" or "maxim,max77836-battery"
6+
- reg: i2c slave address
7+
8+
Optional properties :
9+
- maxim,alert-low-soc-level : The alert threshold that sets the state of
10+
charge level (%) where an interrupt is
11+
generated. Can be configured from 1 up to 32
12+
(%). If skipped the power up default value of
13+
4 (%) will be used.
14+
- interrupts : Interrupt line see Documentation/devicetree/
15+
bindings/interrupt-controller/interrupts.txt
16+
- wakeup-source : This device has wakeup capabilities. Use this
17+
property to use alert low SOC level interrupt
18+
as wake up source.
19+
20+
Optional properties support interrupt functionality for alert low state of
21+
charge level, present in some ICs in the same family, and should be used with
22+
compatible "maxim,max77836-battery".
23+
24+
Example:
25+
26+
battery-fuel-gauge@36 {
27+
compatible = "maxim,max77836-battery";
28+
reg = <0x36>;
29+
maxim,alert-low-soc-level = <10>;
30+
interrupt-parent = <&gpio7>;
31+
interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
32+
wakeup-source;
33+
};

Documentation/devicetree/bindings/power/supply/max17042_battery.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ max17042_battery
22
~~~~~~~~~~~~~~~~
33

44
Required properties :
5-
- compatible : "maxim,max17042"
5+
- compatible : one of the following
6+
* "maxim,max17042"
7+
* "maxim,max17047"
8+
* "maxim,max17050"
9+
* "maxim,max17055"
610

711
Optional properties :
812
- maxim,rsns-microohm : Resistance of rsns resistor in micro Ohms

Documentation/devicetree/bindings/power/supply/sc27xx-fg.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Required properties:
1313
- io-channel-names: Should be "bat-temp" or "charge-vol".
1414
- nvmem-cells: A phandle to the calibration cells provided by eFuse device.
1515
- nvmem-cell-names: Should be "fgu_calib".
16+
- sprd,calib-resistance-micro-ohms: Specify the real resistance of coulomb counter
17+
chip in micro Ohms.
1618
- monitored-battery: Phandle of battery characteristics devicetree node.
1719
See Documentation/devicetree/bindings/power/supply/battery.txt
1820

@@ -52,5 +54,6 @@ Example:
5254
nvmem-cells = <&fgu_calib>;
5355
nvmem-cell-names = "fgu_calib";
5456
monitored-battery = <&bat>;
57+
sprd,calib-resistance-micro-ohms = <21500>;
5558
};
5659
};

drivers/power/reset/Kconfig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,14 @@ config POWER_RESET_LTC2952
141141
down via the LTC2952. Bindings are made in the device tree.
142142

143143
config POWER_RESET_MT6323
144-
bool "MediaTek MT6323 power-off driver"
145-
depends on MFD_MT6397
146-
help
147-
The power-off driver is responsible for externally shutdown down
148-
the power of a remote MediaTek SoC MT6323 is connected to through
149-
controlling a tiny circuit BBPU inside MT6323 RTC.
150-
151-
Say Y if you have a board where MT6323 could be found.
144+
bool "MediaTek MT6323 power-off driver"
145+
depends on MFD_MT6397
146+
help
147+
The power-off driver is responsible for externally shutdown down
148+
the power of a remote MediaTek SoC MT6323 is connected to through
149+
controlling a tiny circuit BBPU inside MT6323 RTC.
150+
151+
Say Y if you have a board where MT6323 could be found.
152152

153153
config POWER_RESET_QNAP
154154
bool "QNAP power-off driver"

drivers/power/reset/at91-sama5d2_shdwc.c

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,25 @@
6666

6767
#define SHDW_CFG_NOT_USED (32)
6868

69-
struct shdwc_config {
69+
struct shdwc_reg_config {
7070
u8 wkup_pin_input;
7171
u8 mr_rtcwk_shift;
7272
u8 mr_rttwk_shift;
7373
u8 sr_rtcwk_shift;
7474
u8 sr_rttwk_shift;
7575
};
7676

77+
struct pmc_reg_config {
78+
u8 mckr;
79+
};
80+
81+
struct reg_config {
82+
struct shdwc_reg_config shdwc;
83+
struct pmc_reg_config pmc;
84+
};
85+
7786
struct shdwc {
78-
const struct shdwc_config *cfg;
87+
const struct reg_config *rcfg;
7988
struct clk *sclk;
8089
void __iomem *shdwc_base;
8190
void __iomem *mpddrc_base;
@@ -95,6 +104,7 @@ static const unsigned long long sdwc_dbc_period[] = {
95104
static void __init at91_wakeup_status(struct platform_device *pdev)
96105
{
97106
struct shdwc *shdw = platform_get_drvdata(pdev);
107+
const struct reg_config *rcfg = shdw->rcfg;
98108
u32 reg;
99109
char *reason = "unknown";
100110

@@ -106,11 +116,11 @@ static void __init at91_wakeup_status(struct platform_device *pdev)
106116
if (!reg)
107117
return;
108118

109-
if (SHDW_WK_PIN(reg, shdw->cfg))
119+
if (SHDW_WK_PIN(reg, &rcfg->shdwc))
110120
reason = "WKUP pin";
111-
else if (SHDW_RTCWK(reg, shdw->cfg))
121+
else if (SHDW_RTCWK(reg, &rcfg->shdwc))
112122
reason = "RTC";
113-
else if (SHDW_RTTWK(reg, shdw->cfg))
123+
else if (SHDW_RTTWK(reg, &rcfg->shdwc))
114124
reason = "RTT";
115125

116126
pr_info("AT91: Wake-Up source: %s\n", reason);
@@ -131,9 +141,9 @@ static void at91_poweroff(void)
131141
" str %1, [%0, #" __stringify(AT91_DDRSDRC_LPR) "]\n\t"
132142

133143
/* Switch the master clock source to slow clock. */
134-
"1: ldr r6, [%4, #" __stringify(AT91_PMC_MCKR) "]\n\t"
144+
"1: ldr r6, [%4, %5]\n\t"
135145
" bic r6, r6, #" __stringify(AT91_PMC_CSS) "\n\t"
136-
" str r6, [%4, #" __stringify(AT91_PMC_MCKR) "]\n\t"
146+
" str r6, [%4, %5]\n\t"
137147
/* Wait for clock switch. */
138148
"2: ldr r6, [%4, #" __stringify(AT91_PMC_SR) "]\n\t"
139149
" tst r6, #" __stringify(AT91_PMC_MCKRDY) "\n\t"
@@ -148,7 +158,8 @@ static void at91_poweroff(void)
148158
"r" cpu_to_le32(AT91_DDRSDRC_LPDDR2_PWOFF),
149159
"r" (at91_shdwc->shdwc_base),
150160
"r" cpu_to_le32(AT91_SHDW_KEY | AT91_SHDW_SHDW),
151-
"r" (at91_shdwc->pmc_base)
161+
"r" (at91_shdwc->pmc_base),
162+
"r" (at91_shdwc->rcfg->pmc.mckr)
152163
: "r6");
153164
}
154165

@@ -215,6 +226,7 @@ static u32 at91_shdwc_get_wakeup_input(struct platform_device *pdev,
215226
static void at91_shdwc_dt_configure(struct platform_device *pdev)
216227
{
217228
struct shdwc *shdw = platform_get_drvdata(pdev);
229+
const struct reg_config *rcfg = shdw->rcfg;
218230
struct device_node *np = pdev->dev.of_node;
219231
u32 mode = 0, tmp, input;
220232

@@ -227,10 +239,10 @@ static void at91_shdwc_dt_configure(struct platform_device *pdev)
227239
mode |= AT91_SHDW_WKUPDBC(at91_shdwc_debouncer_value(pdev, tmp));
228240

229241
if (of_property_read_bool(np, "atmel,wakeup-rtc-timer"))
230-
mode |= SHDW_RTCWKEN(shdw->cfg);
242+
mode |= SHDW_RTCWKEN(&rcfg->shdwc);
231243

232244
if (of_property_read_bool(np, "atmel,wakeup-rtt-timer"))
233-
mode |= SHDW_RTTWKEN(shdw->cfg);
245+
mode |= SHDW_RTTWKEN(&rcfg->shdwc);
234246

235247
dev_dbg(&pdev->dev, "%s: mode = %#x\n", __func__, mode);
236248
writel(mode, shdw->shdwc_base + AT91_SHDW_MR);
@@ -239,30 +251,40 @@ static void at91_shdwc_dt_configure(struct platform_device *pdev)
239251
writel(input, shdw->shdwc_base + AT91_SHDW_WUIR);
240252
}
241253

242-
static const struct shdwc_config sama5d2_shdwc_config = {
243-
.wkup_pin_input = 0,
244-
.mr_rtcwk_shift = 17,
245-
.mr_rttwk_shift = SHDW_CFG_NOT_USED,
246-
.sr_rtcwk_shift = 5,
247-
.sr_rttwk_shift = SHDW_CFG_NOT_USED,
254+
static const struct reg_config sama5d2_reg_config = {
255+
.shdwc = {
256+
.wkup_pin_input = 0,
257+
.mr_rtcwk_shift = 17,
258+
.mr_rttwk_shift = SHDW_CFG_NOT_USED,
259+
.sr_rtcwk_shift = 5,
260+
.sr_rttwk_shift = SHDW_CFG_NOT_USED,
261+
},
262+
.pmc = {
263+
.mckr = 0x30,
264+
},
248265
};
249266

250-
static const struct shdwc_config sam9x60_shdwc_config = {
251-
.wkup_pin_input = 0,
252-
.mr_rtcwk_shift = 17,
253-
.mr_rttwk_shift = 16,
254-
.sr_rtcwk_shift = 5,
255-
.sr_rttwk_shift = 4,
267+
static const struct reg_config sam9x60_reg_config = {
268+
.shdwc = {
269+
.wkup_pin_input = 0,
270+
.mr_rtcwk_shift = 17,
271+
.mr_rttwk_shift = 16,
272+
.sr_rtcwk_shift = 5,
273+
.sr_rttwk_shift = 4,
274+
},
275+
.pmc = {
276+
.mckr = 0x28,
277+
},
256278
};
257279

258280
static const struct of_device_id at91_shdwc_of_match[] = {
259281
{
260282
.compatible = "atmel,sama5d2-shdwc",
261-
.data = &sama5d2_shdwc_config,
283+
.data = &sama5d2_reg_config,
262284
},
263285
{
264286
.compatible = "microchip,sam9x60-shdwc",
265-
.data = &sam9x60_shdwc_config,
287+
.data = &sam9x60_reg_config,
266288
}, {
267289
/*sentinel*/
268290
}
@@ -303,7 +325,7 @@ static int __init at91_shdwc_probe(struct platform_device *pdev)
303325
}
304326

305327
match = of_match_node(at91_shdwc_of_match, pdev->dev.of_node);
306-
at91_shdwc->cfg = match->data;
328+
at91_shdwc->rcfg = match->data;
307329

308330
at91_shdwc->sclk = devm_clk_get(&pdev->dev, NULL);
309331
if (IS_ERR(at91_shdwc->sclk))

drivers/power/reset/gpio-restart.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ static int gpio_restart_probe(struct platform_device *pdev)
6464

6565
gpio_restart->reset_gpio = devm_gpiod_get(&pdev->dev, NULL,
6666
open_source ? GPIOD_IN : GPIOD_OUT_LOW);
67-
if (IS_ERR(gpio_restart->reset_gpio)) {
68-
dev_err(&pdev->dev, "Could not get reset GPIO\n");
69-
return PTR_ERR(gpio_restart->reset_gpio);
67+
ret = PTR_ERR_OR_ZERO(gpio_restart->reset_gpio);
68+
if (ret) {
69+
if (ret != -EPROBE_DEFER)
70+
dev_err(&pdev->dev, "Could not get reset GPIO\n");
71+
return ret;
7072
}
7173

7274
gpio_restart->restart_handler.notifier_call = gpio_restart_notify;

drivers/power/supply/Kconfig

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ config WM831X_POWER
7373
provided by Wolfson Microelectronics WM831x PMICs.
7474

7575
config WM8350_POWER
76-
tristate "WM8350 PMU support"
77-
depends on MFD_WM8350
78-
help
79-
Say Y here to enable support for the power management unit
76+
tristate "WM8350 PMU support"
77+
depends on MFD_WM8350
78+
help
79+
Say Y here to enable support for the power management unit
8080
provided by the Wolfson Microelectronics WM8350 PMIC.
8181

8282
config TEST_POWER
@@ -209,16 +209,16 @@ config BATTERY_WM97XX
209209
Say Y to enable support for battery measured by WM97xx aux port.
210210

211211
config BATTERY_SBS
212-
tristate "SBS Compliant gas gauge"
213-
depends on I2C
214-
help
212+
tristate "SBS Compliant gas gauge"
213+
depends on I2C
214+
help
215215
Say Y to include support for SBS battery driver for SBS-compliant
216216
gas gauges.
217217

218218
config CHARGER_SBS
219-
tristate "SBS Compliant charger"
220-
depends on I2C
221-
help
219+
tristate "SBS Compliant charger"
220+
depends on I2C
221+
help
222222
Say Y to include support for SBS compliant battery chargers.
223223

224224
config MANAGER_SBS
@@ -484,11 +484,11 @@ config CHARGER_MANAGER
484484
depends on REGULATOR
485485
select EXTCON
486486
help
487-
Say Y to enable charger-manager support, which allows multiple
488-
chargers attached to a battery and multiple batteries attached to a
489-
system. The charger-manager also can monitor charging status in
490-
runtime and in suspend-to-RAM by waking up the system periodically
491-
with help of suspend_again support.
487+
Say Y to enable charger-manager support, which allows multiple
488+
chargers attached to a battery and multiple batteries attached to a
489+
system. The charger-manager also can monitor charging status in
490+
runtime and in suspend-to-RAM by waking up the system periodically
491+
with help of suspend_again support.
492492

493493
config CHARGER_LT3651
494494
tristate "Analog Devices LT3651 charger"

0 commit comments

Comments
 (0)