Skip to content

Commit 50fa861

Browse files
committed
Merge tag 'for-v3.18' of git://git.infradead.org/battery-2.6
Pull power supply and reset updates from Sebastian Reichel: - Initial support for the following chips * max77836 (charger) * max14577 (charger) * bq27742 (battery gauge) * ltc2952 (poweroff) * stih416 (restart) * syscon-reboot (restart) * gpio-restart (restart) - cleanup of power supply core - misc fixes in power supply and reset drivers * tag 'for-v3.18' of git://git.infradead.org/battery-2.6: (48 commits) power: ab8500_fg: Fix build warning Documentation: charger: max14577: Update the date of introducing ABI power: reset: corrections for simple syscon reboot driver Documentation: power: reset: Add documentation for generic SYSCON reboot driver power: reset: Add generic SYSCON register mapped reset bq27x00_battery: Fix flag reading for bq27742 power: reset: use restart_notifier mechanism for msm-poweroff power: Add simple gpio-restart driver power: reset: st: Provide DT bindings for ST's Power Reset driver power: reset: Add restart functionality for STiH41x platforms power: charger-manager: Fix NULL pointer exception with missing cm-fuel-gauge power: max14577: Fix circular config SYSFS dependency power: gpio-charger: do not use gpio value directly power: max8925: Use of_get_child_by_name power: max8925: Fix NULL ptr dereference on memory allocation failure bq27x00_battery: Add support to bq27742 Documentation: charger: max14577: Document exported sysfs entry devicetree: mfd: max14577: Add device tree bindings document power: max17040: Add ID for MAX77836 Fuel Gauge block charger: max14577: Configure battery-dependent settings from DTS and sysfs ... Conflicts: drivers/power/reset/Kconfig drivers/power/reset/Makefile
2 parents 6b04908 + 7881c64 commit 50fa861

33 files changed

Lines changed: 1919 additions & 249 deletions

‎Documentation/ABI/testing/sysfs-class-power‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,17 @@ Description:
1818
This file is writeable and can be used to set the assumed
1919
battery 'full level'. As batteries age, this value has to be
2020
amended over time.
21+
22+
What: /sys/class/power_supply/max14577-charger/device/fast_charge_timer
23+
Date: October 2014
24+
KernelVersion: 3.18.0
25+
Contact: Krzysztof Kozlowski <k.kozlowski@samsung.com>
26+
Description:
27+
This entry shows and sets the maximum time the max14577
28+
charger operates in fast-charge mode. When the timer expires
29+
the device will terminate fast-charge mode (charging current
30+
will drop to 0 A) and will trigger interrupt.
31+
32+
Valid values:
33+
- 5, 6 or 7 (hours),
34+
- 0: disabled.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Drive a GPIO line that can be used to restart the system from a restart
2+
handler.
3+
4+
This binding supports level and edge triggered reset. At driver load
5+
time, the driver will request the given gpio line and install a restart
6+
handler. If the optional properties 'open-source' is not found, the GPIO line
7+
will be driven in the inactive state. Otherwise its not driven until
8+
the restart is initiated.
9+
10+
When the system is restarted, the restart handler will be invoked in
11+
priority order. The gpio is configured as an output, and driven active,
12+
triggering a level triggered reset condition. This will also cause an
13+
inactive->active edge condition, triggering positive edge triggered
14+
reset. After a delay specified by active-delay, the GPIO is set to
15+
inactive, thus causing an active->inactive edge, triggering negative edge
16+
triggered reset. After a delay specified by inactive-delay, the GPIO
17+
is driven active again. After a delay specified by wait-delay, the
18+
restart handler completes allowing other restart handlers to be attempted.
19+
20+
Required properties:
21+
- compatible : should be "gpio-restart".
22+
- gpios : The GPIO to set high/low, see "gpios property" in
23+
Documentation/devicetree/bindings/gpio/gpio.txt. If the pin should be
24+
low to reset the board set it to "Active Low", otherwise set
25+
gpio to "Active High".
26+
27+
Optional properties:
28+
- open-source : Treat the GPIO as being open source and defer driving
29+
it to when the restart is initiated. If this optional property is not
30+
specified, the GPIO is initialized as an output in its inactive state.
31+
- priority : A priority ranging from 0 to 255 (default 128) according to
32+
the following guidelines:
33+
0: Restart handler of last resort, with limited restart
34+
capabilities
35+
128: Default restart handler; use if no other restart handler is
36+
expected to be available, and/or if restart functionality is
37+
sufficient to restart the entire system
38+
255: Highest priority restart handler, will preempt all other
39+
restart handlers
40+
- active-delay: Delay (default 100) to wait after driving gpio active [ms]
41+
- inactive-delay: Delay (default 100) to wait after driving gpio inactive [ms]
42+
- wait-delay: Delay (default 3000) to wait after completing restart
43+
sequence [ms]
44+
45+
Examples:
46+
47+
gpio-restart {
48+
compatible = "gpio-restart";
49+
gpios = <&gpio 4 0>;
50+
priority = <128>;
51+
active-delay = <100>;
52+
inactive-delay = <100>;
53+
wait-delay = <3000>;
54+
};
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
Maxim MAX14577/77836 Multi-Function Device
2+
3+
MAX14577 is a Multi-Function Device with Micro-USB Interface Circuit, Li+
4+
Battery Charger and SFOUT LDO output for powering USB devices. It is
5+
interfaced to host controller using I2C.
6+
7+
MAX77836 additionally contains PMIC (with two LDO regulators) and Fuel Gauge.
8+
9+
10+
Required properties:
11+
- compatible : Must be "maxim,max14577" or "maxim,max77836".
12+
- reg : I2C slave address for the max14577 chip (0x25 for max14577/max77836)
13+
- interrupts : IRQ line for the chip.
14+
- interrupt-parent : The parent interrupt controller.
15+
16+
17+
Required nodes:
18+
- charger :
19+
Node for configuring the charger driver.
20+
Required properties:
21+
- compatible : "maxim,max14577-charger"
22+
or "maxim,max77836-charger"
23+
- maxim,fast-charge-uamp : Current in uA for Fast Charge;
24+
Valid values:
25+
- for max14577: 90000 - 950000;
26+
- for max77836: 45000 - 475000;
27+
- maxim,eoc-uamp : Current in uA for End-Of-Charge mode;
28+
Valid values:
29+
- for max14577: 50000 - 200000;
30+
- for max77836: 5000 - 100000;
31+
- maxim,ovp-uvolt : OverVoltage Protection Threshold in uV;
32+
In an overvoltage condition, INT asserts and charging
33+
stops. Valid values:
34+
- 6000000, 6500000, 7000000, 7500000;
35+
- maxim,constant-uvolt : Battery Constant Voltage in uV;
36+
Valid values:
37+
- 4000000 - 4280000 (step by 20000);
38+
- 4350000;
39+
40+
41+
Optional nodes:
42+
- max14577-muic/max77836-muic :
43+
Node used only by extcon consumers.
44+
Required properties:
45+
- compatible : "maxim,max14577-muic" or "maxim,max77836-muic"
46+
47+
- regulators :
48+
Required properties:
49+
- compatible : "maxim,max14577-regulator"
50+
or "maxim,max77836-regulator"
51+
52+
May contain a sub-node per regulator from the list below. Each
53+
sub-node should contain the constraints and initialization information
54+
for that regulator. See regulator.txt for a description of standard
55+
properties for these sub-nodes.
56+
57+
List of valid regulator names:
58+
- for max14577: CHARGER, SAFEOUT.
59+
- for max77836: CHARGER, SAFEOUT, LDO1, LDO2.
60+
61+
The SAFEOUT is a fixed voltage regulator so there is no need to specify
62+
voltages for it.
63+
64+
65+
Example:
66+
67+
#include <dt-bindings/interrupt-controller/irq.h>
68+
69+
max14577@25 {
70+
compatible = "maxim,max14577";
71+
reg = <0x25>;
72+
interrupt-parent = <&gpx1>;
73+
interrupts = <5 IRQ_TYPE_NONE>;
74+
75+
muic: max14577-muic {
76+
compatible = "maxim,max14577-muic";
77+
};
78+
79+
regulators {
80+
compatible = "maxim,max14577-regulator";
81+
82+
SAFEOUT {
83+
regulator-name = "SAFEOUT";
84+
};
85+
CHARGER {
86+
regulator-name = "CHARGER";
87+
regulator-min-microamp = <90000>;
88+
regulator-max-microamp = <950000>;
89+
regulator-boot-on;
90+
};
91+
};
92+
93+
charger {
94+
compatible = "maxim,max14577-charger";
95+
96+
maxim,constant-uvolt = <4350000>;
97+
maxim,fast-charge-uamp = <450000>;
98+
maxim,eoc-uamp = <50000>;
99+
maxim,ovp-uvolt = <6500000>;
100+
};
101+
};
102+
103+
104+
max77836@25 {
105+
compatible = "maxim,max77836";
106+
reg = <0x25>;
107+
interrupt-parent = <&gpx1>;
108+
interrupts = <5 IRQ_TYPE_NONE>;
109+
110+
muic: max77836-muic {
111+
compatible = "maxim,max77836-muic";
112+
};
113+
114+
regulators {
115+
compatible = "maxim,max77836-regulator";
116+
117+
SAFEOUT {
118+
regulator-name = "SAFEOUT";
119+
};
120+
CHARGER {
121+
regulator-name = "CHARGER";
122+
regulator-min-microamp = <90000>;
123+
regulator-max-microamp = <950000>;
124+
regulator-boot-on;
125+
};
126+
LDO1 {
127+
regulator-name = "LDO1";
128+
regulator-min-microvolt = <2700000>;
129+
regulator-max-microvolt = <2700000>;
130+
};
131+
LDO2 {
132+
regulator-name = "LDO2";
133+
regulator-min-microvolt = <800000>;
134+
regulator-max-microvolt = <3950000>;
135+
};
136+
};
137+
138+
charger {
139+
compatible = "maxim,max77836-charger";
140+
141+
maxim,constant-uvolt = <4350000>;
142+
maxim,fast-charge-uamp = <225000>;
143+
maxim,eoc-uamp = <7500>;
144+
maxim,ovp-uvolt = <6500000>;
145+
};
146+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Binding for the LTC2952 PowerPath controller
2+
3+
This chip is used to externally trigger a system shut down. Once the trigger has
4+
been sent, the chips' watchdog has to be reset to gracefully shut down.
5+
If the Linux systems decides to shut down it powers off the platform via the
6+
kill signal.
7+
8+
Required properties:
9+
10+
- compatible: Must contain: "lltc,ltc2952"
11+
- trigger-gpios: phandle + gpio-specifier for the GPIO connected to the
12+
chip's trigger line
13+
- watchdog-gpios: phandle + gpio-specifier for the GPIO connected to the
14+
chip's watchdog line
15+
- kill-gpios: phandle + gpio-specifier for the GPIO connected to the
16+
chip's kill line
17+
18+
Example:
19+
20+
ltc2952 {
21+
compatible = "lltc,ltc2952";
22+
23+
trigger-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
24+
watchdog-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
25+
kill-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
26+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*Device-Tree bindings for ST SW reset functionality
2+
3+
Required properties:
4+
- compatible: should be "st,<chip>-restart".
5+
- st,syscfg: should be a phandle of the syscfg node.
6+
7+
Example node:
8+
restart {
9+
compatible = "st,stih416-restart";
10+
st,syscfg = <&syscfg_sbc>;
11+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Generic SYSCON mapped register reset driver
2+
3+
This is a generic reset driver using syscon to map the reset register.
4+
The reset is generally performed with a write to the reset register
5+
defined by the register map pointed by syscon reference plus the offset
6+
with the mask defined in the reboot node.
7+
8+
Required properties:
9+
- compatible: should contain "syscon-reboot"
10+
- regmap: this is phandle to the register map node
11+
- offset: offset in the register map for the reboot register (in bytes)
12+
- mask: the reset value written to the reboot register (32 bit access)
13+
14+
Default will be little endian mode, 32 bit access only.
15+
16+
Examples:
17+
18+
reboot {
19+
compatible = "syscon-reboot";
20+
regmap = <&regmapnode>;
21+
offset = <0x0>;
22+
mask = <0x1>;
23+
};

‎Documentation/power/charger-manager.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Charger Manager supports the following:
2929
While the battery is being charged and the system is in suspend-to-RAM,
3030
we may need to monitor the battery health by looking at the ambient or
3131
battery temperature. We can accomplish this by waking up the system
32-
periodically. However, such a method wakes up devices unncessary for
32+
periodically. However, such a method wakes up devices unnecessarily for
3333
monitoring the battery health and tasks, and user processes that are
3434
supposed to be kept suspended. That, in turn, incurs unnecessary power
3535
consumption and slow down charging process. Or even, such peak power

‎Documentation/power/power_supply_class.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ VOLTAGE_MAX, VOLTAGE_MIN - same as _DESIGN voltage values except that
101101
these ones should be used if hardware could only guess (measure and
102102
retain) the thresholds of a given power supply.
103103

104+
VOLTAGE_BOOT - Reports the voltage measured during boot
105+
106+
CURRENT_BOOT - Reports the current measured during boot
107+
104108
CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when
105109
battery considered full/empty.
106110

@@ -123,6 +127,8 @@ the current drawn from a charging source.
123127
CHARGE_TERM_CURRENT - Charge termination current used to detect the end of charge
124128
condition.
125129

130+
CALIBRATE - battery or coulomb counter calibration status
131+
126132
CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger.
127133
CONSTANT_CHARGE_VOLTAGE_MAX - maximum charge voltage supported by the
128134
power supply object.

0 commit comments

Comments
 (0)