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

Commit 5dd6baeb authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-smbcharger: add the qpnp smbcharger driver"

parents dd2d02d4 0d7288b3
Loading
Loading
Loading
Loading
+263 −0
Original line number Diff line number Diff line
QPNP SMB Battery Charger

QPNP SMB Charger is a single-cell switching mode battery charger. It can charge
the battery and power the system via the USB and AC adapter input.

The QPNP SMB Charger interfaces via the SPMI bus.

There are six different peripherals adding the following functionality.
Each of these peripherals are implemented as subnodes in the example at the
end of this file.

- qcom,chgr:		Supports charging control and status
			reporting.
- qcom,bat-if:		Battery status reporting such as presence,
			temperature reporting and voltage collapse
			protection.
- qcom,usb-chgpth:	USB charge path detection and input current
			limiting configuration.
- qcom,dc-chgpth:	DC charge path detection and input current
			limiting configuration.
- qcom,chg-misc:	Miscellaneous features such as safety timers
			and SYSOK pin control
- qcom,chg-otg:		OTG configuration control.

Parent node required properties:
- compatible:		Must be "qcom,qpnp-smbcharger"
- spmi-dev-container:	Must be included in the parent node to set up the spmi
			sub node devices.
- #address-cells:	Must be <1>
- #size-cells:		Must be <1>

Sub node required properties:
- reg:			The SPMI address for this peripheral
- interrupts:		Specifies the interrupt associated with the peripheral.
- interrupt-names:	Specifies the interrupt names for the peripheral. Every
			available interrupt needs to have an associated name
			with it to indentify its purpose.

			The following lists each subnode and their corresponding
			required interrupt names:

			qcom,chgr:
			 - chg-tcc-thr:		Triggers on charge completion.
			 - chg-taper-thr:	Triggers on the taper charge
						transtion.
			 - chg-inhibit:		Notifies on battery voltage
						being too high to resume
						charging.
			 - chg-rechg-thr:	Triggers on battery voltage
						falling below the resume
						threshold.

			qcom,bat-if:
			 - batt-hot:		Triggers on battery temperature
						hitting the hot threshold.
						Charging stops.
			 - batt-warm:		Triggers on battery temperature
						hitting the warm threshold.
						Charging current is reduced.
			 - batt-cool:		Triggers on battery temperature
						hitting the cool threshold.
						Charging current is reduced
			 - batt-cold:		Triggers on battery temperature
						hitting the cold threshold.
						Charging stops.
			 - batt-missing:	Battery missing status
						interrupt.
			 - batt-low:		Triggers on battery voltage
						falling across a low threshold.

			qcom,usb-chgpth:
			 - usbin-uv:		USB input voltage falls below a
						valid threshold.
			 - usbin-src-det:	USB automatic source detection
						finishes.

			qcom,dc-chgpth:
			 - dcin-uv:		DC input voltage falls below a
						valid threshold.

			qcom,chgr-misc:
			 - safety-timeout-mins:	Charger watchdog timer
						interrupt.
			 - temp-shutdown:	Triggers when charger goes
						overtemp and causes a shutdown.
			 - power-ok:		Triggers when the charger
						switcher turns on or off.

Optional Properties:
- qcom,battery-psy-name		The name of the main battery power supply that
				the charger will register. Failing to define
				this property will default the name to
				"battery".
- qcom,bms-psy-name		The psy name to use for reporting battery
				capacity. If left unspecified the capacity uses
				a preprogrammed default value of 50.
- qcom,float-voltage-mv		Float Voltage in mV - the maximum voltage up
				to which the battery is charged. Supported
				range 3600mV to 4500mV
- qcom,charging-timeout-mins	Maximum duration in minutes that a single
				charge cycle may last.  Supported values are:
				0, 192, 384, 768, and 1536.  A value of 0
				means that no charge cycle timeout is used and
				charging can continue indefinitely.
- qcom,precharging-timeout-mins	Maximum duration in minutes that a single
				precharge cycle may last.  Supported values
				are: 0, 24, 48, 96, 192.  A value of 0 means
				that no precharge cycle timeout is used and
				charging can continue indefinitely. Note that
				the qcom,charging-timeout-mins property must
				be specified in order for this to take effect.
- qcom,dc-psy-type		The type of charger connected to the DC path.
				Can be "Mains" or "Wireless"
- qcom,dc-psy-ma		The current in mA dc path can support. Must be
				specified if dc-psy-type is specified. Valid
				range 300mA to 2000mA.
- qcom,charging-disabled	Set this if charging should be disabled in the
				build by default.
- qcom,resume-delta-mv		Specifies the minimum voltage drop in
				millivolts below the float voltage that is
				required in order to initiate a new charging
				cycle. Supported values are: 50, 100, 200 and
				300mV.
- qcom,bmd-algo-disabled	Indicates if the battery missing detection
				algorithm is disabled. If this node is present
				SMB uses the THERM pin for battery missing
				detection.
- qcom,bmd-pin-src		A string that indicates the source pin for the
				battery missind detection. This can be either:
				- "bpd_none"
					battery is considered always present
				- "bpd_id"
					battery id pin is used
				- "bpd_thm"
					battery therm pin is used
				- "bpd_thm_id"
					both pins are used (battery is
					considered missing if either pin is
					floating).
- qcom,iterm-ma			Specifies the termination current to indicate
				end-of-charge. Possible values in mA:
				50, 100, 150, 200, 250, 300, 500, 600.
- qcom,iterm-disabled		Disables the termination current feature. This
				is a boolean property.
- regulator-name		A string used as a descriptive name for OTG
				regulator.
- qcom,thermal-mitigation:	Array of input current limit values for
				different system thermal mitigation levels.
				This should be a flat array that denotates the
				maximum charge current in mA for each thermal
				level.
- qcom,soft-vfloat-comp-disabled	Set this property when the battery is
					powered via external source and could
					go above the float voltage.

Example:
	qcom,qpnp-smbcharger {
		spmi-dev-container;
		compatible = "qcom,qpnp-smbcharger";
		#address-cells = <1>;
		#size-cells = <1>;

		qcom,iterm-ma = <100>;
		qcom,float-voltage-mv = <4200>;
		qcom,resume-delta-mv = <100>;
		qcom,bmd-pin-src = "bpd_thm_id";
		qcom,dc-psy-type = "Mains";
		qcom,dc-psy-ma = <1500>;
		qcom,bms-psy-name = "bms";
		qcom,battery-psy-name = "battery";
		qcom,thermal-mitigation = <1500 700 600 325>;

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

			interrupt-names =	"chg-error",
						"chg-inhibit",
						"chg-prechg-sft",
						"chg-complete-chg-sft",
						"chg-p2f-thr",
						"chg-rechg-thr",
						"chg-taper-thr",
						"chg-tcc-thr";
		};

		qcom,otg@1100 {
			reg = <0x1100 0x100>;
		};

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

			interrupt-names =	"batt-hot",
						"batt-warm",
						"batt-cold",
						"batt-cool",
						"batt-ov",
						"batt-low",
						"batt-missing",
						"batt-term-missing";
		};

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

			interrupt-names =	"usbin-uv",
						"usbin-ov",
						"usbin-src-det",
						"otg-fail",
						"otg-oc",
						"aicl-done",
						"usbid-change";
		};

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

			interrupt-names =	"dcin-uv",
						"dcin-ov";
		};

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

			interrupt-names =	"power-ok",
						"temp-shutdown",
						"safety-timeout",
						"flash-fail",
						"otst2",
						"otst3";
		};
	};
+10 −0
Original line number Diff line number Diff line
@@ -445,6 +445,16 @@ config QPNP_CHARGER
	  also offers relevant information to userspace via the power supply
	  framework.

config QPNP_SMBCHARGER
	tristate "QPNP SMB Charger driver"
	depends on SPMI
	depends on OF_SPMI
	help
	  Say Y here to enable the dual path switch mode battery charger which
	  supports USB detection and battery charging up to 3A.
	  The driver also offers relevant information to userspace via the
	  power supply framework.

config PM8921_BMS
	tristate "PM8921 Battery Monitoring System driver"
	depends on MFD_PM8921_CORE
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ obj-$(CONFIG_QPNP_BMS) += qpnp-bms.o batterydata-lib.o
obj-$(CONFIG_QPNP_VM_BMS)	+= qpnp-vm-bms.o batterydata-lib.o batterydata-interface.o
obj-$(CONFIG_QPNP_CHARGER)	+= qpnp-charger.o
obj-$(CONFIG_QPNP_LINEAR_CHARGER)	+= qpnp-linear-charger.o
obj-$(CONFIG_QPNP_SMBCHARGER)	+= qpnp-smbcharger.o
obj-$(CONFIG_CHARGER_SMB347)	+= smb347-charger.o
obj-$(CONFIG_CHARGER_TPS65090)	+= tps65090-charger.o
obj-$(CONFIG_BATTERY_BCL)	+= battery_current_limit.o
+2460 −0

File added.

Preview size limit exceeded, changes collapsed.