Skip to content

Commit

Permalink
Merge tag 'for-v3.18' of git://git.infradead.org/battery-2.6
Browse files Browse the repository at this point in the history
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
  • Loading branch information
torvalds committed Oct 15, 2014
2 parents 6b04908 + 7881c64 commit 50fa861
Show file tree
Hide file tree
Showing 33 changed files with 1,919 additions and 249 deletions.
14 changes: 14 additions & 0 deletions Documentation/ABI/testing/sysfs-class-power
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,17 @@ Description:
This file is writeable and can be used to set the assumed
battery 'full level'. As batteries age, this value has to be
amended over time.

What: /sys/class/power_supply/max14577-charger/device/fast_charge_timer
Date: October 2014
KernelVersion: 3.18.0
Contact: Krzysztof Kozlowski <[email protected]>
Description:
This entry shows and sets the maximum time the max14577
charger operates in fast-charge mode. When the timer expires
the device will terminate fast-charge mode (charging current
will drop to 0 A) and will trigger interrupt.

Valid values:
- 5, 6 or 7 (hours),
- 0: disabled.
54 changes: 54 additions & 0 deletions Documentation/devicetree/bindings/gpio/gpio-restart.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Drive a GPIO line that can be used to restart the system from a restart
handler.

This binding supports level and edge triggered reset. At driver load
time, the driver will request the given gpio line and install a restart
handler. If the optional properties 'open-source' is not found, the GPIO line
will be driven in the inactive state. Otherwise its not driven until
the restart is initiated.

When the system is restarted, the restart handler will be invoked in
priority order. The gpio is configured as an output, and driven active,
triggering a level triggered reset condition. This will also cause an
inactive->active edge condition, triggering positive edge triggered
reset. After a delay specified by active-delay, the GPIO is set to
inactive, thus causing an active->inactive edge, triggering negative edge
triggered reset. After a delay specified by inactive-delay, the GPIO
is driven active again. After a delay specified by wait-delay, the
restart handler completes allowing other restart handlers to be attempted.

Required properties:
- compatible : should be "gpio-restart".
- gpios : The GPIO to set high/low, see "gpios property" in
Documentation/devicetree/bindings/gpio/gpio.txt. If the pin should be
low to reset the board set it to "Active Low", otherwise set
gpio to "Active High".

Optional properties:
- open-source : Treat the GPIO as being open source and defer driving
it to when the restart is initiated. If this optional property is not
specified, the GPIO is initialized as an output in its inactive state.
- priority : A priority ranging from 0 to 255 (default 128) according to
the following guidelines:
0: Restart handler of last resort, with limited restart
capabilities
128: Default restart handler; use if no other restart handler is
expected to be available, and/or if restart functionality is
sufficient to restart the entire system
255: Highest priority restart handler, will preempt all other
restart handlers
- active-delay: Delay (default 100) to wait after driving gpio active [ms]
- inactive-delay: Delay (default 100) to wait after driving gpio inactive [ms]
- wait-delay: Delay (default 3000) to wait after completing restart
sequence [ms]

Examples:

gpio-restart {
compatible = "gpio-restart";
gpios = <&gpio 4 0>;
priority = <128>;
active-delay = <100>;
inactive-delay = <100>;
wait-delay = <3000>;
};
146 changes: 146 additions & 0 deletions Documentation/devicetree/bindings/mfd/max14577.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
Maxim MAX14577/77836 Multi-Function Device

MAX14577 is a Multi-Function Device with Micro-USB Interface Circuit, Li+
Battery Charger and SFOUT LDO output for powering USB devices. It is
interfaced to host controller using I2C.

MAX77836 additionally contains PMIC (with two LDO regulators) and Fuel Gauge.


Required properties:
- compatible : Must be "maxim,max14577" or "maxim,max77836".
- reg : I2C slave address for the max14577 chip (0x25 for max14577/max77836)
- interrupts : IRQ line for the chip.
- interrupt-parent : The parent interrupt controller.


Required nodes:
- charger :
Node for configuring the charger driver.
Required properties:
- compatible : "maxim,max14577-charger"
or "maxim,max77836-charger"
- maxim,fast-charge-uamp : Current in uA for Fast Charge;
Valid values:
- for max14577: 90000 - 950000;
- for max77836: 45000 - 475000;
- maxim,eoc-uamp : Current in uA for End-Of-Charge mode;
Valid values:
- for max14577: 50000 - 200000;
- for max77836: 5000 - 100000;
- maxim,ovp-uvolt : OverVoltage Protection Threshold in uV;
In an overvoltage condition, INT asserts and charging
stops. Valid values:
- 6000000, 6500000, 7000000, 7500000;
- maxim,constant-uvolt : Battery Constant Voltage in uV;
Valid values:
- 4000000 - 4280000 (step by 20000);
- 4350000;


Optional nodes:
- max14577-muic/max77836-muic :
Node used only by extcon consumers.
Required properties:
- compatible : "maxim,max14577-muic" or "maxim,max77836-muic"

- regulators :
Required properties:
- compatible : "maxim,max14577-regulator"
or "maxim,max77836-regulator"

May contain a sub-node per regulator from the list below. Each
sub-node should contain the constraints and initialization information
for that regulator. See regulator.txt for a description of standard
properties for these sub-nodes.

List of valid regulator names:
- for max14577: CHARGER, SAFEOUT.
- for max77836: CHARGER, SAFEOUT, LDO1, LDO2.

The SAFEOUT is a fixed voltage regulator so there is no need to specify
voltages for it.


Example:

#include <dt-bindings/interrupt-controller/irq.h>

max14577@25 {
compatible = "maxim,max14577";
reg = <0x25>;
interrupt-parent = <&gpx1>;
interrupts = <5 IRQ_TYPE_NONE>;

muic: max14577-muic {
compatible = "maxim,max14577-muic";
};

regulators {
compatible = "maxim,max14577-regulator";

SAFEOUT {
regulator-name = "SAFEOUT";
};
CHARGER {
regulator-name = "CHARGER";
regulator-min-microamp = <90000>;
regulator-max-microamp = <950000>;
regulator-boot-on;
};
};

charger {
compatible = "maxim,max14577-charger";

maxim,constant-uvolt = <4350000>;
maxim,fast-charge-uamp = <450000>;
maxim,eoc-uamp = <50000>;
maxim,ovp-uvolt = <6500000>;
};
};


max77836@25 {
compatible = "maxim,max77836";
reg = <0x25>;
interrupt-parent = <&gpx1>;
interrupts = <5 IRQ_TYPE_NONE>;

muic: max77836-muic {
compatible = "maxim,max77836-muic";
};

regulators {
compatible = "maxim,max77836-regulator";

SAFEOUT {
regulator-name = "SAFEOUT";
};
CHARGER {
regulator-name = "CHARGER";
regulator-min-microamp = <90000>;
regulator-max-microamp = <950000>;
regulator-boot-on;
};
LDO1 {
regulator-name = "LDO1";
regulator-min-microvolt = <2700000>;
regulator-max-microvolt = <2700000>;
};
LDO2 {
regulator-name = "LDO2";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <3950000>;
};
};

charger {
compatible = "maxim,max77836-charger";

maxim,constant-uvolt = <4350000>;
maxim,fast-charge-uamp = <225000>;
maxim,eoc-uamp = <7500>;
maxim,ovp-uvolt = <6500000>;
};
};
26 changes: 26 additions & 0 deletions Documentation/devicetree/bindings/power/reset/ltc2952-poweroff.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Binding for the LTC2952 PowerPath controller

This chip is used to externally trigger a system shut down. Once the trigger has
been sent, the chips' watchdog has to be reset to gracefully shut down.
If the Linux systems decides to shut down it powers off the platform via the
kill signal.

Required properties:

- compatible: Must contain: "lltc,ltc2952"
- trigger-gpios: phandle + gpio-specifier for the GPIO connected to the
chip's trigger line
- watchdog-gpios: phandle + gpio-specifier for the GPIO connected to the
chip's watchdog line
- kill-gpios: phandle + gpio-specifier for the GPIO connected to the
chip's kill line

Example:

ltc2952 {
compatible = "lltc,ltc2952";

trigger-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
watchdog-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
kill-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
};
11 changes: 11 additions & 0 deletions Documentation/devicetree/bindings/power/reset/st-reset.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*Device-Tree bindings for ST SW reset functionality

Required properties:
- compatible: should be "st,<chip>-restart".
- st,syscfg: should be a phandle of the syscfg node.

Example node:
restart {
compatible = "st,stih416-restart";
st,syscfg = <&syscfg_sbc>;
};
23 changes: 23 additions & 0 deletions Documentation/devicetree/bindings/power/reset/syscon-reboot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Generic SYSCON mapped register reset driver

This is a generic reset driver using syscon to map the reset register.
The reset is generally performed with a write to the reset register
defined by the register map pointed by syscon reference plus the offset
with the mask defined in the reboot node.

Required properties:
- compatible: should contain "syscon-reboot"
- regmap: this is phandle to the register map node
- offset: offset in the register map for the reboot register (in bytes)
- mask: the reset value written to the reboot register (32 bit access)

Default will be little endian mode, 32 bit access only.

Examples:

reboot {
compatible = "syscon-reboot";
regmap = <&regmapnode>;
offset = <0x0>;
mask = <0x1>;
};
2 changes: 1 addition & 1 deletion Documentation/power/charger-manager.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Charger Manager supports the following:
While the battery is being charged and the system is in suspend-to-RAM,
we may need to monitor the battery health by looking at the ambient or
battery temperature. We can accomplish this by waking up the system
periodically. However, such a method wakes up devices unncessary for
periodically. However, such a method wakes up devices unnecessarily for
monitoring the battery health and tasks, and user processes that are
supposed to be kept suspended. That, in turn, incurs unnecessary power
consumption and slow down charging process. Or even, such peak power
Expand Down
6 changes: 6 additions & 0 deletions Documentation/power/power_supply_class.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ VOLTAGE_MAX, VOLTAGE_MIN - same as _DESIGN voltage values except that
these ones should be used if hardware could only guess (measure and
retain) the thresholds of a given power supply.

VOLTAGE_BOOT - Reports the voltage measured during boot

CURRENT_BOOT - Reports the current measured during boot

CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when
battery considered full/empty.

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

CALIBRATE - battery or coulomb counter calibration status

CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger.
CONSTANT_CHARGE_VOLTAGE_MAX - maximum charge voltage supported by the
power supply object.
Expand Down
Loading

0 comments on commit 50fa861

Please sign in to comment.