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

Commit a7a83056 authored by Harry Yang's avatar Harry Yang
Browse files

Merge branch 'dev/pmic_kernel_4.9' into msm-4.9



Change-Id: I5269ffc52d2b0ebca268246e53689550d976ed85
Signed-off-by: default avatarHarry Yang <harryy@codeaurora.org>
parents 6862ebda e701c8cb
Loading
Loading
Loading
Loading
+422 −0
Original line number Diff line number Diff line
Qualcomm Techonologies, Inc. QPNP PMIC Fuel Gauge Gen3 Device

QPNP PMIC FG Gen3 device provides interface to the clients to read properties
related to the battery. Its main function is to retrieve the State of Charge
(SOC), in percentage scale representing the amount of charge left in the
battery.

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

FG Gen3 device must be described in two levels of device nodes.  The first
level describes the FG Gen3 device.  The second level describes one or more
peripherals managed by FG Gen3 driver. All the peripheral specific parameters
such as base address, interrupts etc., should be under second level node.

====================================
First Level Node - FG Gen3 device
====================================

- compatible
	Usage:      required
	Value type: <string>
	Definition: Should be "qcom,fg-gen3".

- qcom,pmic-revid
	Usage:      required
	Value type: <phandle>
	Definition: Should specify the phandle of PMIC revid module. This is
		    used to identify the PMIC subtype.

- io-channels
- io-channel-names
	Usage:      required
	Value type: <phandle>
	Definition: For details about IIO bindings see:
		    Documentation/devicetree/bindings/iio/iio-bindings.txt

- qcom,rradc-base
	Usage:      required
	Value type: <u32>
	Definition: Should specify the base address of RR_ADC peripheral. This
		    is used for reading certain peripheral registers under it.

- qcom,fg-cutoff-voltage
	Usage:      optional
	Value type: <u32>
	Definition: The voltage (in mV) where the fuel gauge will steer the SOC
		    to be zero. For example, if the cutoff voltage is set to
		    3400mv, the fuel gauge will try to count SoC so that the
		    battery SOC will be 0 when it is 3400mV. If this property
		    is not specified, then the default value used will be
		    3200mV.

- qcom,fg-empty-voltage
	Usage:      optional
	Value type: <u32>
	Definition: The voltage threshold (in mV) based on which the empty soc
		    interrupt will be triggered. When the empty soc interrupt
		    fires, battery soc will be set to 0 and the userspace will
		    be notified via the power supply framework. The userspace
		    will read 0% soc and immediately shutdown. If this property
		    is not specified, then the default value used will be
		    2800mV.

- qcom,fg-vbatt-low-thr
	Usage:      optional
	Value type: <u32>
	Definition: The voltage threshold (in mV) which upon set will be used
		    for configuring the low battery voltage threshold.

- qcom,fg-recharge-voltage
	Usage:      optional
	Value type: <u32>
	Definition: The voltage threshold (in mV) based on which the charging
		    will be resumed once the charging is complete. If this
		    property is not specified, then the default value will be
		    4250mV.

- qcom,fg-chg-term-current
	Usage:      optional
	Value type: <u32>
	Definition: Battery current (in mA) at which the fuel gauge will issue
		    an end of charge if the charger is configured to use the
		    fuel gauge ADC for end of charge detection. If this
		    property is not specified, then the default value used
		    will be 100mA.

- qcom,fg-sys-term-current
	Usage:      optional
	Value type: <u32>
	Definition: Battery current (in mA) at which the fuel gauge will try to
		    scale towards 100%. When the charge current goes above this
		    the SOC should be at 100%. If this property is not
		    specified, then the default value used will be -125mA.
		    This value has to be specified in negative values for
		    the charging current.

- qcom,fg-delta-soc-thr
	Usage:      optional
	Value type: <u32>
	Definition: Percentage of SOC increase upon which the delta monotonic &
		    battery SOC interrupts will be triggered. If this property
		    is not specified, then the default value will be 1.
		    Possible values are in the range of 0 to 12.

- qcom,fg-recharge-soc-thr
	Usage:      optional
	Value type: <u32>
	Definition: Percentage of monotonic SOC upon which the charging will
		    will be resumed once the charging is complete. If this
		    property is not specified, then the default value will be
		    95.

- qcom,fg-rsense-sel
	Usage:      optional
	Value type: <u32>
	Definition: Specifies the source of sense resistor.
		    Allowed values are:
		    0 - Rsense is from Battery FET
		    2 - Rsense is Battery FET and SMB
		    Option 2 can be used only when a parallel charger is
		    present. If this property is not specified, then the
		    default value will be 2.

- qcom,fg-jeita-thresholds
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: A list of integers which holds the jeita thresholds (degC)
		    in the following order. Allowed size is 4.
		    Element 0 - JEITA cold threshold
		    Element 1 - JEITA cool threshold
		    Element 2 - JEITA warm threshold
		    Element 3 - JEITA hot threshold
		    If these parameters are not specified, then the default
		    values used will be 0, 5, 45, 50.

- qcom,fg-esr-timer-charging
	Usage:      optional
	Value type: <u32>
	Definition: Number of cycles between ESR pulses while the battery is
		    charging.

- qcom,fg-esr-timer-awake
	Usage:      optional
	Value type: <u32>
	Definition: Number of cycles between ESR pulses while the system is
		    awake and the battery is discharging.

- qcom,fg-esr-timer-asleep
	Usage:      optional
	Value type: <u32>
	Definition: Number of cycles between ESR pulses while the system is
		    asleep and the battery is discharging. This option requires
		    qcom,fg-esr-timer-awake to be defined.

- qcom,cycle-counter-en
	Usage:      optional
	Value type: <empty>
	Definition: Enables the cycle counter feature.

- qcom,fg-force-load-profile
	Usage:      optional
	Value type: <empty>
	Definition: If set, battery profile will be force loaded if the profile
		    loaded earlier by bootloader doesn't match with the profile
		    available in the device tree.

- qcom,cl-start-capacity
	Usage:      optional
	Value type: <u32>
	Definition: Battery SOC threshold to start the capacity learning.
		    If this is not specified, then the default value used
		    will be 15.

- qcom,cl-min-temp
	Usage:      optional
	Value type: <u32>
	Definition: Lower limit of battery temperature to start the capacity
		    learning. If this is not specified, then the default value
		    used will be 150. Unit is in decidegC.

- qcom,cl-max-temp
	Usage:      optional
	Value type: <u32>
	Definition: Upper limit of battery temperature to start the capacity
		    learning. If this is not specified, then the default value
		    used will be 450 (45C). Unit is in decidegC.

- qcom,cl-max-increment
	Usage:      optional
	Value type: <u32>
	Definition: Maximum capacity increment allowed per capacity learning
		    cycle. If this is not specified, then the default value
		    used will be 5 (0.5%). Unit is in decipercentage.

- qcom,cl-max-decrement
	Usage:      optional
	Value type: <u32>
	Definition: Maximum capacity decrement allowed per capacity learning
		    cycle. If this is not specified, then the default value
		    used will be 100 (10%). Unit is in decipercentage.

- qcom,cl-min-limit
	Usage:      optional
	Value type: <u32>
	Definition: Minimum limit that the capacity cannot go below in a
		    capacity learning cycle. If this is not specified, then
		    the default value is 0. Unit is in decipercentage.

- qcom,cl-max-limit
	Usage:      optional
	Value type: <u32>
	Definition: Maximum limit that the capacity cannot go above in a
		    capacity learning cycle. If this is not specified, then
		    the default value is 0. Unit is in decipercentage.

- qcom,battery-thermal-coefficients
	Usage:      optional
	Value type: <u8>
	Definition: Byte array of battery thermal coefficients.
		    This should be exactly 3 bytes in length.

- qcom,fg-jeita-hyst-temp
	Usage:      optional
	Value type: <u32>
	Definition: Hysteresis applied to Jeita temperature comparison.
		    Possible values are:
			0 - No hysteresis
			1,2,3 - Value in Celsius.

- qcom,fg-batt-temp-delta
	Usage:      optional
	Value type: <u32>
	Definition: Battery temperature delta interrupt threshold. Possible
		    values are: 2, 4, 6 and 10. Unit is in Kelvin.

- qcom,hold-soc-while-full
	Usage:      optional
	Value type: <empty>
	Definition: A boolean property that when defined holds SOC at 100% when
		    the battery is full.

- qcom,ki-coeff-soc-dischg
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: Array of monotonic SOC threshold values to change the ki
		    coefficient for medium discharge current during discharge.
		    This should be defined in the ascending order and in the
		    range of 0-100. Array limit is set to 3.

- qcom,ki-coeff-med-dischg
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: Array of ki coefficient values for medium discharge current
		    during discharge. These values will be applied when the
		    monotonic SOC goes below the SOC threshold specified under
		    qcom,ki-coeff-soc-dischg. Array limit is set to 3. This
		    property should be specified if qcom,ki-coeff-soc-dischg
		    is specified to make it fully functional. Value has no
		    unit. Allowed range is 0 to 62200 in micro units.

- qcom,ki-coeff-hi-dischg
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: Array of ki coefficient values for high discharge current
		    during discharge. These values will be applied when the
		    monotonic SOC goes below the SOC threshold specified under
		    qcom,ki-coeff-soc-dischg. Array limit is set to 3. This
		    property should be specified if qcom,ki-coeff-soc-dischg
		    is specified to make it fully functional. Value has no
		    unit. Allowed range is 0 to 62200 in micro units.

- qcom,fg-rconn-mohms
	Usage:      optional
	Value type: <u32>
	Definition: Battery connector resistance (Rconn) in milliohms. If Rconn
		    is specified, then ESR to Rslow scaling factors will be
		    updated to account it for an accurate ESR.

- qcom,fg-esr-clamp-mohms
	Usage:      optional
	Value type: <u32>
	Definition: Equivalent series resistance (ESR) in milliohms. If this
		    is specified, then ESR will be clamped to this value when
		    ESR is found to be dropping below this. Default value is
		    20.

- qcom,fg-esr-filter-switch-temp
	Usage:      optional
	Value type: <u32>
	Definition: Battery temperature threshold below which low temperature
		    ESR filter coefficients will be switched to normal
		    temperature ESR filter coefficients. If this is not
		    specified, then the default value used will be 100. Unit is
		    in decidegC.

- qcom,fg-esr-tight-filter-micro-pct
	Usage:      optional
	Value type: <u32>
	Definition: Value in micro percentage for ESR tight filter. If this is
		    not specified, then a default value of 3907 (0.39 %) will
		    be used. Lowest possible value is 1954 (0.19 %).

- qcom,fg-esr-broad-filter-micro-pct
	Usage:      optional
	Value type: <u32>
	Definition: Value in micro percentage for ESR broad filter. If this is
		    not specified, then a default value of 99610 (9.96 %) will
		    be used. Lowest possible value is 1954 (0.19 %).

- qcom,fg-esr-tight-lt-filter-micro-pct
	Usage:      optional
	Value type: <u32>
	Definition: Value in micro percentage for low temperature ESR tight
		    filter. If this is not specified, then a default value of
		    48829 (4.88 %) will be used. Lowest possible value is 1954
		    (0.19 %).

- qcom,fg-esr-broad-lt-filter-micro-pct
	Usage:      optional
	Value type: <u32>
	Definition: Value in micro percentage for low temperature ESR broad
		    filter. If this is not specified, then a default value of
		    148438 (14.84 %) will be used. Lowest possible value is
		    1954 (0.19 %).

- qcom,fg-auto-recharge-soc
	Usage:      optional
	Value type: <empty>
	Definition: A boolean property when defined will configure automatic
		    recharge SOC threshold. If not specified, automatic
		    recharge voltage threshold will be configured. This has
		    to be configured in conjunction with the charger side
		    configuration for proper functionality.

- qcom,slope-limit-temp-threshold
	Usage:      optional
	Value type: <u32>
	Definition: Battery temperature threshold to decide when slope limit
		    coefficients should be applied along with charging status.
		    Unit is in decidegC.

- qcom,slope-limit-coeffs
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: A list of integers which holds the slope limit coefficients
		    in the following order. Allowed size is 4. Possible values
		    are from 0 to 31. Unit is in decipercentage.
		    Element 0 - Low temperature discharging
		    Element 1 - Low temperature charging
		    Element 2 - High temperature discharging
		    Element 3 - High temperature charging
		    These coefficients have to be specified along with the
		    property "qcom,slope-limit-temp-threshold" to make dynamic
		    slope limit adjustment functional.

==========================================================
Second Level Nodes - Peripherals managed by FG Gen3 driver
==========================================================
- reg
	Usage:      required
	Value type: <prop-encoded-array>
	Definition: Addresses and sizes for the specified peripheral

- interrupts
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: Interrupt mapping as per the interrupt encoding

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

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

pmi8998_fg: qpnp,fg {
	compatible = "qcom,fg-gen3";
	#address-cells = <1>;
	#size-cells = <1>;
	qcom,pmic-revid = <&pmi8998_revid>;
	io-channels = <&pmi8998_rradc 3>;
	io-channel-names = "rradc_batt_id";
	qcom,rradc-base = <0x4500>;
	qcom,ki-coeff-soc-dischg = <30 60 90>;
	qcom,ki-coeff-med-dischg = <800 1000 1400>;
	qcom,ki-coeff-hi-dischg = <1200 1500 2100>;
	qcom,slope-limit-temp-threshold = <100>;
	qcom,slope-limit-coeffs = <10 11 12 13>;
	qcom,battery-thermal-coefficients = [9d 50 ff];
	status = "okay";

	qcom,fg-batt-soc@4000 {
		status = "okay";
		reg = <0x4000 0x100>;
		interrupts = <0x2 0x40 0x0 IRQ_TYPE_EDGE_BOTH>,
			     <0x2 0x40 0x1 IRQ_TYPE_EDGE_BOTH>,
			     <0x2 0x40 0x2 IRQ_TYPE_EDGE_BOTH>,
			     <0x2 0x40 0x3 IRQ_TYPE_EDGE_BOTH>;
		interrupt-names = "soc-update",
				  "soc-ready",
				  "bsoc-delta",
				  "msoc-delta";

	};

	qcom,fg-batt-info@4100 {
		status = "okay";
		reg = <0x4100 0x100>;
		interrupts = <0x2 0x41 0x3 IRQ_TYPE_EDGE_BOTH>;
		interrupt-names = "batt-missing";
	};

	qcom,fg-memif@4400 {
		status = "okay";
		reg = <0x4400 0x100>;
	};
};
+32 −0
Original line number Diff line number Diff line
QPNP Qnovo pulse engine

QPNP Qnovo is a pulse charging engine which works in tandem with the QPNP SMB2
Charger device. It configures the QPNP SMB2 charger to charge/discharge as per
pulse characteristics.

The QPNP Qnovo pulse engine has a single peripheral assigned to it.

Required properties:
- compatible:		Must be "qcom,qpnp-qnovo"
- qcom,pmic-revid:	Should specify the phandle of PMIC
			revid module. This is used to identify
			the PMIC subtype.

- reg:			The address for this peripheral
- interrupts:		Specifies the interrupt associated with the peripheral.
- interrupt-names:	Specifies the interrupt name for the peripheral. Qnovo
			peripheral has only one interrupt "ptrain-done".

Optional Properties:
- qcom,external-rsense:		To indicate whether the platform uses external or
				internal rsense for measuring battery current.

Example:

	qcom,qpnp-qnovo@1500 {
		compatible = "qcom,qpnp-qnovo";
		reg = <0x1500 0x100>;
		interrupts = <0x2 0x15 0x0 IRQ_TYPE_NONE>;
		interrupt-names = "ptrain-done";
		qcom,pmic-revid = <&pmi8998_revid>;
	};
+315 −0

File added.

Preview size limit exceeded, changes collapsed.

+115 −0
Original line number Diff line number Diff line
Summit smb1351 battery charger

SMB1351 is a single-cell battery charger. It can charge
the battery and power the system via the USB/AC adapter input.

The smb1351 interface is via I2C bus.

Required Properties:
- compatible			Must be "qcom,smb1351-charger".
- reg				The device 7-bit I2C address.

Required Properties for standalone charger:
- regulator-name		A string used as a descriptive name for OTG regulator.
- pinctrl-names			The state name of the pin configuration. Only
				support "default".
- pinctrl-0			The phandle of the pin configuration node in
				pinctrl for smb_int_pin.

Optional Properties:

- interrupts			This indicates the IRQ number of the GPIO
				connected to the STAT pin.
- qcom,fastchg-current-max-ma 	Fast Charging current in mA. Supported range is
				from 1000mA to 4500mA.
- qcom,chg-autonomous-mode	This is a bool property and it indicates that the
				charger is configured for autonomous operation and
				does not require any software configuration.
- qcom,disable-apsd		This is a bool property which disables automatic
				power source detection (APSD). If this is set
				charger detection is done by DCIN UV irq.
- qcom,charging-disabled	This is a bool property which disables charging.
- qcom,using-pmic-therm		This property indicates thermal pin connected to pmic or smb.
- qcom,bms-psy-name		This is a string and it points to the bms
				power supply name.
- qcom,iterm-ma			Specifies the termination current to indicate end-of-charge.
				Possible values in mA - 70, 100, 200, 300, 400, 500, 600, 700.
- qcom,iterm-disabled		Disables the termination current feature. This is a bool
				property.
- qcom,float-voltage-mv	 	Float Voltage in mV - the maximum voltage up to which
				the battery is charged. Supported range 3500mV to 4500mV
- qcom,recharge-mv		Recharge threshold in mV - the offset from the float-volatge
				as which the charger restarts charging. Possible
				values are 50mV and 100mV.
- qcom,recharge-disabled	Boolean value which disables the auto-recharge.
- qcom,bms-controlled-charging	This property enables BMS to control EOC and
				recharge. BMS and charger communicates with each
				other via power_supply framework. This
				property should be used with 'qcom,iterm-disabled'
				to ensure EOC detection in charger is disabled.
- qcom,force-hvdcp-2p0		Boolean value which allows to force hvdcp working on 2.0 mode.
- qcom,parallel-charger		Boolean value which enables the parallel charger.
- qcom,chg-vadc			Corresponding VADC device's phandle.
- qcom,chg-adc_tm		phandle to the corresponding VADC device to read the ADC channels.
- qcom,batt-cold-decidegc	Cold battery temperature in decidegC.
- qcom,batt-hot-decidegc	Hot battery temperature in decidegC.
- qcom,batt-missing-decidegc	This is a property indicating battery missing temperature, if
				higher than it, battery should exist.
- qcom,batt-warm-decidegc:	Warm battery temperature in decidegC. After hitting this threshold,
				"qcom,warm-bat-ma" defines maximum charging current and
				"qcom,warm-bat-mv" defines maximum target voltage.
- qcom,batt-cool-decidegc:       Cool battery temperature in decidegC. After hitting this threshold,
				"qcom,cool-bat-ma" defines maximum charging current and
				"qcom,cool-bat-mv" defines maximum target voltage.
- qcom,batt-warm-ma:		Maximum warm battery charge current in milli-amps.
- qcom,batt-cool-ma:		Maximum cool battery charge current in milli-amps.
- qcom,batt-warm-mv:		Maximum warm battery target voltage in milli-volts.
- qcom,batt-cool-mv:		Maximum cool battery target voltage in milli-volts.
- qcom,parallel-en-pin-polarity Specify the polarity of enable signal controlled
				via pin in a parallel-charger configuration.
				0 - Active low and 1  - Active high.
				If not specified the default value is active-low.
- qcom,parallel-external-current-sense If present specifies external rsense is
				used for charge current sensing.

Example for standalone charger:

&i2c_4 {
	smb1351_otg_supply: smb1351-charger@57 {
		compatible = "qcom,smb1351-charger";
		reg = <0x57>;
		interrupt-parent = <&msm_gpio>;
		interrupts = <62 2>;
		pinctrl-names = "default";
		pinctrl-0 = <&smb_int_default>;
		qcom,float-voltage-mv = <4350>;
		qcom,iterm-ma = <100>;
		qcom,recharge-mv = <100>;
		qcom,bms-psy-name = "bms";
		regulator-name = "smb1351_otg_vreg";
		qcom,using-pmic-therm;
		qcom,chg-adc_tm = <&pm8916_adc_tm>;
		qcom,chg-vadc = <&pm8916_vadc>;
		qcom,batt-hot-decidegc = <550>;
		qcom,batt-cold-decidegc = <0>;
		qcom,batt-missing-decidegc = <(-200)>;
		qcom,batt-warm-decidegc = <500>;
		qcom,batt-cool-decidegc = <50>;
		qcom,batt-warm-ma = <350>;
		qcom,batt-cool-ma = <350>;
		qcom,batt-warm-mv = <4200>;
		qcom,batt-cool-mv = <4200>;
	};
};

Example for parallel charger:

&i2c_11 {
	smb1351-charger@1d {
		compatible = "qcom,smb1351-charger";
		reg = <0x1d>;
		qcom,parallel-charger;
		qcom,float-voltage-mv = <4400>;
		qcom,recharge-mv = <100>;
	};
};
+101 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading