Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a897a101 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull power supply and reset updates from Sebastian Reichel:
 "New drivers:
   - Linear ltc3651 charger driver
   - Motorola CPCAP battery fuel-gauge driver

  New chip/feature support:
   - bq27xxx: prepare for chip data setup
   - axp20x_battery: support max charge current setup

  New core features:
   - add Apple Brick ID type
   - support "supplied-from" device property for generic ACPI/pdata support
   - support strings for sysfs properties representing enums
   - introduce battery-info (backend is DT only for now)
   - provide reboot-mode header globally

  .. and misc fixes"

* tag 'for-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (39 commits)
  power: supply: sbs-battery: Don't needlessly set CAPACITY_MODE
  power: supply: sbs-battery: Prevent CAPACITY_MODE races
  power: supply: bq24735: remove incorrect le16_to_cpu calls
  power: supply: sbs-battery: remove incorrect le16_to_cpu calls
  power: supply: cpcap-charger: Add missing power_supply_config
  power: supply: twl4030-charger: move allocation of iio channel to the beginning
  power: supply: twl4030-charger: allocate iio by devm_iio_channel_get() and fix error path
  power: supply: core: constify psy_tcd_ops.
  dt-bindings: power: supply: cpcap-battery: Add power-supplies property
  dt-bindings: power: supply: move max8903-charger.txt to proper location
  dt-bindings: power: supply: move maxim,max14656.txt to proper location
  power: supply: twl4030_charger: Use sysfs_match_string() helper
  power: reset: reboot-mode: Make include file global
  power: supply: axp20x_battery: add DT support for battery max constant charge current
  power: supply: axp20x_battery: add support for DT battery
  power: supply: bq27xxx: Add power_supply_battery_info support
  power: supply: bq27xxx: Add chip data memory read/write support
  power: supply: bq27xxx: Add bulk transfer bus methods
  dt-bindings: power: supply: bq27xxx: Add monitored-battery documentation
  power: supply: core: Add power_supply_prop_precharge
  ...
parents eceeae41 bfa953d3
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
What: /sys/class/power_supply/twl4030_ac/max_current
      /sys/class/power_supply/twl4030_usb/max_current
Description:
	Read/Write limit on current which may
	be drawn from the ac (Accessory Charger) or
	USB port.

	Value is in micro-Amps.

	Value is set automatically to an appropriate
	value when a cable is plugged or unplugged.

	Value can the set by writing to the attribute.
	The change will only persist until the next
	plug event.  These event are reported via udev.


What: /sys/class/power_supply/twl4030_usb/mode
Description:
	Changing mode for USB port.
+57 −0
Original line number Diff line number Diff line
Battery Characteristics

The devicetree battery node provides static battery characteristics.
In smart batteries, these are typically stored in non-volatile memory
on a fuel gauge chip. The battery node should be used where there is
no appropriate non-volatile memory, or it is unprogrammed/incorrect.

Upstream dts files should not include battery nodes, unless the battery
represented cannot easily be replaced in the system by one of a
different type. This prevents unpredictable, potentially harmful,
behavior should a replacement that changes the battery type occur
without a corresponding update to the dtb.

Required Properties:
 - compatible: Must be "simple-battery"

Optional Properties:
 - voltage-min-design-microvolt: drained battery voltage
 - energy-full-design-microwatt-hours: battery design energy
 - charge-full-design-microamp-hours: battery design capacity
 - precharge-current-microamp: current for pre-charge phase
 - charge-term-current-microamp: current for charge termination phase
 - constant-charge-current-max-microamp: maximum constant input current
 - constant-charge-voltage-max-microvolt: maximum constant input voltage

Battery properties are named, where possible, for the corresponding
elements in enum power_supply_property, defined in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/power_supply.h

Batteries must be referenced by chargers and/or fuel-gauges
using a phandle. The phandle's property should be named
"monitored-battery".

Example:

	bat: battery {
		compatible = "simple-battery";
		voltage-min-design-microvolt = <3200000>;
		energy-full-design-microwatt-hours = <5290000>;
		charge-full-design-microamp-hours = <1430000>;
		precharge-current-microamp = <256000>;
		charge-term-current-microamp = <128000>;
		constant-charge-current-max-microamp = <900000>;
		constant-charge-voltage-max-microvolt = <4200000>;
	};

	charger: charger@11 {
		....
		monitored-battery = <&bat>;
		...
	};

	fuel_gauge: fuel-gauge@22 {
		....
		monitored-battery = <&bat>;
		...
	};
+24 −7
Original line number Diff line number Diff line
Binding for TI BQ27XXX fuel gauge family
TI BQ27XXX fuel gauge family

Required properties:
- compatible: Should contain one of the following:
- compatible: contains one of the following:
 * "ti,bq27200" - BQ27200
 * "ti,bq27210" - BQ27210
 * "ti,bq27500" - deprecated, use revision specific property below
@@ -26,11 +26,28 @@ Required properties:
 * "ti,bq27425" - BQ27425
 * "ti,bq27441" - BQ27441
 * "ti,bq27621" - BQ27621
- reg: integer, i2c address of the device.
- reg: integer, I2C address of the fuel gauge.

Optional properties:
- monitored-battery: phandle of battery characteristics node
    The fuel gauge uses the following battery properties:
    + energy-full-design-microwatt-hours
    + charge-full-design-microamp-hours
    + voltage-min-design-microvolt
  Both or neither of the *-full-design-*-hours properties must be set.
  See Documentation/devicetree/bindings/power/supply/battery.txt

Example:

bq27510g3 {
	bat: battery {
		compatible = "simple-battery";
		voltage-min-design-microvolt = <3200000>;
		energy-full-design-microwatt-hours = <5290000>;
		charge-full-design-microamp-hours = <1430000>;
	};

	bq27510g3: fuel-gauge@55 {
		compatible = "ti,bq27510g3";
		reg = <0x55>;
		monitored-battery = <&bat>;
	};
+31 −0
Original line number Diff line number Diff line
Motorola CPCAP PMIC battery driver binding

Required properties:
- compatible: Shall be "motorola,cpcap-battery"
- interrupts: Interrupt specifier for each name in interrupt-names
- interrupt-names: Should contain the following entries:
		   "lowbph", "lowbpl", "chrgcurr1", "battdetb"
- io-channels: IIO ADC channel specifier for each name in io-channel-names
- io-channel-names: Should contain the following entries:
		    "battdetb", "battp", "chg_isense", "batti"
- power-supplies: List of phandles for power-supplying devices, as
		  described in power_supply.txt. Typically a reference
		  to cpcap_charger.

Example:

cpcap_battery: battery {
	compatible = "motorola,cpcap-battery";
	interrupts-extended = <
		&cpcap 5 0 &cpcap 3 0
		&cpcap 20 0 &cpcap 54 0
	>;
	interrupt-names =
		"lowbph", "lowbpl",
		"chrgcurr1", "battdetb";
	io-channels = <&cpcap_adc 0 &cpcap_adc 1
		       &cpcap_adc 5 &cpcap_adc 6>;
	io-channel-names = "battdetb", "battp",
			   "chg_isense", "batti";
	power-supplies = <&cpcap_charger>;
};
+27 −0
Original line number Diff line number Diff line
ltc3651-charger

Required properties:
 - compatible: "lltc,ltc3651-charger"
 - lltc,acpr-gpios: Connect to ACPR output. See remark below.

Optional properties:
 - lltc,fault-gpios: Connect to FAULT output. See remark below.
 - lltc,chrg-gpios: Connect to CHRG output. See remark below.

The ltc3651 outputs are open-drain type and active low. The driver assumes the
GPIO reports "active" when the output is asserted, so if the pins have been
connected directly, the GPIO flags should be set to active low also.

The driver will attempt to aquire interrupts for all GPIOs to detect changes in
line state. If the system is not capabale of providing interrupts, the driver
cannot report changes and userspace will need to periodically read the sysfs
attributes to detect changes.

Example:

	charger: battery-charger {
		compatible = "lltc,ltc3651-charger";
		lltc,acpr-gpios = <&gpio0 68 GPIO_ACTIVE_LOW>;
		lltc,fault-gpios = <&gpio0 64 GPIO_ACTIVE_LOW>;
		lltc,chrg-gpios = <&gpio0 63 GPIO_ACTIVE_LOW>;
	};
Loading