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

Commit 86017c34 authored by Nicholas Troast's avatar Nicholas Troast
Browse files

power: introduce SMB138X charger driver



This driver supports the SMB138X charger device.

Register access is provided by the parent device via regmap. Interrupts
are controlled by the parent device, and handlers are registered by the
SMB138X charger driver.

The power supply framework is used to communicate battery and usb
properties to userspace and other driver consumers such as fuel gauge
and USB.

VBUS regulator is registered for supporting OTG.

CRs-Fixed: 1023141
Change-Id: I36796332af667874c1246ec35984122d45de6938
Signed-off-by: default avatarNicholas Troast <ntroast@codeaurora.org>
parent fc0eb09a
Loading
Loading
Loading
Loading
+202 −0
Original line number Original line Diff line number Diff line
Qualcomm Technologies, Inc. SMB138X Charger Specific Bindings

SMB138X Charger is an efficient programmable battery charger capable of charging
a high-capacity lithium-ion battery over micro-USB or USB Type-C ultrafast with
Quick Charge 2.0, Quick Charge 3.0 support. Wireless charging features full
A4WP Rezence 1.2, WPC 1.2, and PMA support.

=======================
Required Node Structure
=======================

SMB138X Charger must be described in two levels of devices nodes.

==================================
First Level Node - SMB138X Charger
==================================

Charger specific properties:
- compatible
  Usage:      required
  Value type: <string>
  Definition: String which indicates the charging mode. Can be one of the
	      following:
              Standalone/Parallel Master	- "qcom,smb138x-charger"
	      Parallel Slave			- "qcom,smb138x-parallel-slave"

- qcom,suspend-input
  Usage:      optional
  Value type: <empty>
  Definition: Boolean flag which indicates that the charger should not draw
	      current from any of its input sources (USB, DC).

- qcom,fcc-max-ua
  Usage:      optional
  Value type: <u32>
  Definition: Specifies the maximum fast charge current in micro-amps.

- qcom,usb-icl-ua
  Usage:      optional
  Value type: <u32>
  Definition: Specifies the USB input current limit in micro-amps.

- qcom,dc-icl-ua
  Usage:      optional
  Value type: <u32>
  Definition: Specifies the DC input current limit in micro-amps.

- qcom,micro-usb
  Usage:      optional
  Value type: <empty>
  Definition: Boolean flag which indicates that the connector type is micro usb.

================================================
Second Level Nodes - SMB138X Charger Peripherals
================================================

Peripheral specific properties:
- reg
  Usage:      required
  Value type: <prop-encoded-array>
  Definition: Address and size of the peripheral's register block.

- interrupts
  Usage:      required
  Value type: <prop-encoded-array>
  Definition: Peripheral interrupt specifier.

- interrupt-names
  Usage:      required
  Value type: <stringlist>
  Definition: Interrupt names.  This list must match up 1-to-1 with the
	      interrupts specified in the 'interrupts' property.

=======================================
Second Level Nodes - SMB138X Regulators
=======================================

The following regulator nodes are supported:
"qcom,smb138x-vbus"	- Regulator for enabling VBUS

- regulator-name
  Usage:      required
  Value type: <string>
  Definition: Specifies the name for this regulator.

=======
Example
=======

smb138x_charger: qcom,smb138x-charger {
	compatible = "qcom,qpnp-smb138x-charger";
	#address-cells = <1>;
	#size-cells = <1>;

	qcom,suspend-input;

	qcom,chgr@1000 {
		reg = <0x1000 0x100>;
		interrupts =    <0x10 0x0 IRQ_TYPE_EDGE_BOTH>,
				<0x10 0x1 IRQ_TYPE_EDGE_BOTH>,
				<0x10 0x2 IRQ_TYPE_EDGE_BOTH>,
				<0x10 0x3 IRQ_TYPE_EDGE_BOTH>,
				<0x10 0x4 IRQ_TYPE_EDGE_BOTH>;

		interrupt-names =       "chg-error",
					"chg-state-change",
					"step-chg-state-change",
					"step-chg-soc-update-fail",
					"step-chg-soc-update-request";
	};

	qcom,otg@1100 {
		reg = <0x1100 0x100>;
		interrupts =    <0x11 0x0 IRQ_TYPE_EDGE_BOTH>,
				<0x11 0x1 IRQ_TYPE_EDGE_BOTH>,
				<0x11 0x2 IRQ_TYPE_EDGE_BOTH>,
				<0x11 0x3 IRQ_TYPE_EDGE_BOTH>;

		interrupt-names =       "otg-fail",
					"otg-overcurrent",
					"otg-oc-dis-sw-sts",
					"testmode-change-detect";
	};

	qcom,bat-if@1200 {
		reg = <0x1200 0x100>;
		interrupts =    <0x12 0x0 IRQ_TYPE_EDGE_BOTH>,
				<0x12 0x1 IRQ_TYPE_EDGE_BOTH>,
				<0x12 0x2 IRQ_TYPE_EDGE_BOTH>,
				<0x12 0x3 IRQ_TYPE_EDGE_BOTH>,
				<0x12 0x4 IRQ_TYPE_EDGE_BOTH>,
				<0x12 0x5 IRQ_TYPE_EDGE_BOTH>;

		interrupt-names =       "bat-temp",
					"bat-ocp",
					"bat-ov",
					"bat-low",
					"bat-therm-or-id-missing",
					"bat-terminal-missing";
	};

	qcom,usb-chgpth@1300 {
		reg = <0x1300 0x100>;
		interrupts =    <0x13 0x0 IRQ_TYPE_EDGE_BOTH>,
				<0x13 0x1 IRQ_TYPE_EDGE_BOTH>,
				<0x13 0x2 IRQ_TYPE_EDGE_BOTH>,
				<0x13 0x3 IRQ_TYPE_EDGE_BOTH>,
				<0x13 0x4 IRQ_TYPE_EDGE_BOTH>,
				<0x13 0x5 IRQ_TYPE_EDGE_BOTH>,
				<0x13 0x6 IRQ_TYPE_EDGE_BOTH>,
				<0x13 0x7 IRQ_TYPE_EDGE_BOTH>;

		interrupt-names =       "usbin-collapse",
					"usbin-lt-3p6v",
					"usbin-uv",
					"usbin-ov",
					"usbin-plugin",
					"usbin-src-change",
					"usbin-icl-change",
					"type-c-change";
	};

	qcom,dc-chgpth@1400 {
		reg = <0x1400 0x100>;
		interrupts =    <0x14 0x0 IRQ_TYPE_EDGE_BOTH>,
				<0x14 0x1 IRQ_TYPE_EDGE_BOTH>,
				<0x14 0x2 IRQ_TYPE_EDGE_BOTH>,
				<0x14 0x3 IRQ_TYPE_EDGE_BOTH>,
				<0x14 0x4 IRQ_TYPE_EDGE_BOTH>,
				<0x14 0x5 IRQ_TYPE_EDGE_BOTH>,
				<0x14 0x6 IRQ_TYPE_EDGE_BOTH>;

		interrupt-names =       "dcin-collapse",
					"dcin-lt-3p6v",
					"dcin-uv",
					"dcin-ov",
					"dcin-plugin",
					"div2-en-dg",
					"dcin-icl-change";
	};

	qcom,chgr-misc@1600 {
		reg = <0x1600 0x100>;
		interrupts =    <0x16 0x0 IRQ_TYPE_EDGE_BOTH>,
				<0x16 0x1 IRQ_TYPE_EDGE_BOTH>,
				<0x16 0x2 IRQ_TYPE_EDGE_BOTH>,
				<0x16 0x3 IRQ_TYPE_EDGE_BOTH>,
				<0x16 0x4 IRQ_TYPE_EDGE_BOTH>,
				<0x16 0x5 IRQ_TYPE_EDGE_BOTH>,
				<0x16 0x6 IRQ_TYPE_EDGE_BOTH>,
				<0x16 0x7 IRQ_TYPE_EDGE_BOTH>;

		interrupt-names =       "wdog-snarl",
					"wdog-bark",
					"aicl-fail",
					"aicl-done",
					"high-duty-cycle",
					"input-current-limiting",
					"temperature-change",
					"switcher-power-ok";
	};
};
+11 −0
Original line number Original line Diff line number Diff line
@@ -440,6 +440,17 @@ config SMB1360_CHARGER_FG
	  The driver reports the status via the power supply framework.
	  The driver reports the status via the power supply framework.
	  A status change triggers an IRQ via the device STAT pin.
	  A status change triggers an IRQ via the device STAT pin.


config SMB138X_CHARGER
	tristate "SMB138X Battery Charger"
	depends on MFD_I2C_PMIC
	help
	  Say Y to include support for SMB138X Battery Charger.
	  SMB1380 is a dual phase 6A battery charger, and SMB1381 is a single
	  phase 5A battery charger.
	  The driver supports charger enable/disable.
	  The driver reports the charger status via the power supply framework.
	  A charger status change triggers an IRQ via the device STAT pin.

config SMB358_CHARGER
config SMB358_CHARGER
	tristate "SMB358 Battery Charger"
	tristate "SMB358 Battery Charger"
	depends on I2C
	depends on I2C
+1 −0
Original line number Original line Diff line number Diff line
@@ -64,6 +64,7 @@ obj-$(CONFIG_SMB1351_USB_CHARGER) += smb1351-charger.o
obj-$(CONFIG_SMB350_CHARGER)   += smb350_charger.o
obj-$(CONFIG_SMB350_CHARGER)   += smb350_charger.o
obj-$(CONFIG_SMB135X_CHARGER)   += smb135x-charger.o
obj-$(CONFIG_SMB135X_CHARGER)   += smb135x-charger.o
obj-$(CONFIG_SMB1360_CHARGER_FG) += smb1360-charger-fg.o
obj-$(CONFIG_SMB1360_CHARGER_FG) += smb1360-charger-fg.o
obj-$(CONFIG_SMB138X_CHARGER)	+= smb138x-charger.o pmic-voter.o
obj-$(CONFIG_SMB358_CHARGER)	+= smb358-charger.o
obj-$(CONFIG_SMB358_CHARGER)	+= smb358-charger.o
obj-$(CONFIG_SMB23X_CHARGER)	+= smb23x-charger.o
obj-$(CONFIG_SMB23X_CHARGER)	+= smb23x-charger.o
obj-$(CONFIG_BATTERY_BQ28400)	+= bq28400_battery.o
obj-$(CONFIG_BATTERY_BQ28400)	+= bq28400_battery.o