CV: Constant Voltage constant pressure
SMMB charger: Switch-ModeBattery Charger and Boost peripheral switch-mode battery charger and boost peripherals
OCV:Open circuitvoltage
EOC: End OfCharge end of charge
UUC: UnusableCapacity not electricity
Corresponding source code file \ kernel \ drivers \ power \ qpnp-vm-bms.c, PMIC battery management system Qualcomm QPNP voltage mode (Qualcomm'sQPNP Voltage-Mode (VM) PMIC Battery Management System), provides an interface to the client the battery is ready to read the relevant properties, its main function is based on a periodic sampling VBAT (vattery voltage) calculated SOC (state ofcharge)
The following learning kernel \ Documentation \ devicetree \ bindings \ power \ qpnp-vm-bms.txt
Parent requires the following properties
See kernel \ arch \ arm \ boot \ dts qcom \ pm8909_bms msm-pm8909.dtsi file \: qcom, vmbms node
- compatible : Must be "qcom,qpnp-vm-bms" for the BM driver.
- reg :Offset and length of the PMIC peripheral register map.
For example reg = <0x4000 0x100>;
- interrupts : The interrupt mappings.
The format should be
<slave-id peripheral-idinterrupt-number>.
such as
interrupts = <0x0 0x40 0x0>,
<0x00x40 0x3>,
<0x00x40 0x4>,
<0x00x40 0x5>;
- interrupt-names : names for the mappedbms interrupt
Thefollowing interrupts are required:
0: leave CV state离开恒压状态
1: enter CV state
2: good ocv generated
3: ocv_thr
4: fifo update
5: fsm state changed
such as
interrupt-names = "leave_cv",
"ocv_thr",
"fifo_update_done",
"fsm_state_change";
Furthermore, the child node may alternatively comprise:
- qcom,batt-pres-status : A subnode with aregister address for the SMBB
batteryinterface's BATT_PRES_STATUS register. If this node is
added,then the BMS will try to detect offmode battery removal
viathe battery interface's offmode battery removal circuit.
This is a child node with respect to a battery interface register BATT_PRES_STATUS SMMB address, if this node increases, BMS will attempt to patch plug offmode circuit detects the battery Battery interface by offmode
E.g
qcom,batt-pres-status@1208 {
reg= <0x1208 0x1>;
};
Battery curve:
- qcom,battery-data : A phandle to a nodecontaining the available batterydata
profiles.See the batterydata bindings documentation for more
details.
The value of this node is a pHandle, it points to a valid node curve data comprises a battery, see the kernel \ Documentation \ devicetree \ bindings \ batterydata \ batterydata.txt
在kernel\arch\arm\boot\dts\qcom\msm8909-qrd-skue.dtsi中定义
/ {
qrd_batterydata:qcom,battery-data {
qcom,rpull-up-kohm= <0>;
qcom,vref-batt-therm= <1800000>;
#include"batterydata-qrd-skue-4v35-2000mah.dtsi"
};
};
&pm8909_bms {
status= "okay";
qcom,resume-soc= <95>;
qcom,use-reported-soc;
qcom,force-bms-active-on-charger;
qcom,battery-data = <&qrd_batterydata>;
};
Parent requires property
- qcom,v-cutoff-uv : cutoff voltage wherethe battery is considered dead in
micro-volts(微伏).
Shutdown voltage, for calculating the SOC, as modified shutdown voltage, in addition to this modification, batteries also need to modify qcom curve data, v-cutoff-uv, in fact, preferably is a battery in the curve data.
For example qcom, v-cutoff-uv = <3400000>;
- qcom,max-voltage-uv : maximum voltage forthe battery in micro-volts.
Maximum battery voltage in millivolts, such qcom, max-voltage-uv = <4200000>;
- qcom,r-conn-mohm : connector resistancein milli-ohms.
Resistor is connected, as qcom, r--mohm conn = <0>;
- qcom,shutdown-soc-valid-limit : If theocv upon restart is within this
distanceof the shutdown ocv, the BMS will try to force
thenew SoC to the old one to provide charge continuity.
Thatis to say,
if(abs(shutdown-soc - current-soc) < limit)
thenuse old SoC.
如qcom,shutdown-soc-valid-limit =<100>;
- qcom,low-soc-calculate-soc-threshold :The SoC threshold for when
theperiodic calculate_soc work speeds up. This ensures
SoCis updated in userspace constantly when we are near
shutdown.
When the SOC is below this threshold, calculate_soc shorter working cycle, so that the user can continue to update the SOC close off a space in time. As qcom, low-soc-calculate-soc-threshold = <15>;
- qcom,low-voltage-threshold : The batteryvoltage threshold in micro-volts for
whenthe BMS tries to wake up and hold a wakelock to
ensurea clean shutdown.
Low-voltage threshold for the shutdown, when this value is reached BMS try to wake up and hold wake locks to ensure a clean shutdown. As qcom, low-voltage-threshold = <3450000>;
qcom,low-voltage-calculate-soc-ms : Thetime period between subsequent
SoCrecalculations when the current voltage is below qcom,low-voltagethreshold. This takes precedence over qcom,low-soc-calculate-soc-ms.
When the battery voltage is below qcom, low-voltage threshold, and then recalculate the soc time period, is preferred to qcom, low-soc-calculate-soc-ms, such as qcom, low-voltage-calculate-soc-ms = <1000 > ;.
qcom,low-soc-calculate-soc-ms : The timeperiod between subsequent
SoCrecalculations when the current SoC is below qcom,low-soc-calculate-soc-threshold.This takes precedenceover qcom,calculate-soc-ms.
QCOM SOC is lower than the current, while low-soc-calculate-soc-threshold, then recalculates the period of the SOC, which takes precedence over qcom, calculate-soc-ms, such as low-soc-calculate-soc-ms = <5000> ;
qcom,calculate-soc-ms : The time periodbetween subsequent SoC
recalculationswhen the current SoC is above or equal qcom,low-soc-calculate-soc-threshold.
The current SOC> = qcom, calculation of low-soc-calculate-soc-threshold soc time period. As qcom, calculate-soc-ms = <20000>;
qcom,volatge-soc-timeout-ms : The timeoutperiod after which the module starts
reportingvolage based SOC and does not use the VMBMS algorithmfor SOC calculation.
If no algorithm to calculate VMBMS SOC, voltage module to report after this time based SOC. As qcom, volatge-soc-timeout-ms = <60000>;
- qcom,bms-vadc: Corresponding VADCdevice's phandle.
phandle VADC corresponding device, qcom, bms-vadc = <& pm8909_vadc>;
qcom,bms-adc_tm: Corresponding ADC_TMdevice's phandle to set recurring
measurements andreceive notifications for vbatt.
Phandle ADC_TM corresponding apparatus, for setting a measurement cycle and receiving the notification vbatt. As qcom, bms-adc_tm = <& pm8909_adc_tm>;
- qcom,pmic-revid : Phandle pointing to therevision peripheral node.
Revision point of peripheral nodes phandle, such qcom, pmic-revid = <& pm8909_revid>;
Parent node Optional properties
Parent optional attributes
qcom,s1-sample-interval-ms: The samplingrate in ms of the accumulator in state
S1.(i.e) the rate at which the accumulator is being filledwith vbat samples. Minimum value = 0 and Maximumvalue = 2550ms.
qcom,s2-sample-interval-ms: The samplingrate in ms of the accumulator in state
S2.(i.e) the rate at which the accumulator is being filledwith vbat samples. Minimum value = 0 and Maximumvalue = 2550ms.
qcom,s1-sample-count: The number ofsamples to be accululated for one FIFO in
stateS1. Possible values are - 0, 4, 8, 16, 32, 64, 128, 256.
qcom,s2-sample-count: The number ofsamples to be accululated for one FIFO in
stateS2. Possible values are - 0, 4, 8, 16, 32, 64, 128, 256.
qcom,s1-fifo-legth: Number of FIFO's to be filled in state S1, togenerate
thefifo_update_done interrupt. Possile values - 0 to 8
qcom,s2-fifo-legth: Number of FIFO's to be filled in state S2, togenerate
thefifo_update_done interrupt. Possible values- 0 to 8
Above several optional attributes not used not describe.
qcom,force-s3-on-suspend : Bool propertyto force the BMS into S3 (sleep) state
whileentering into system suspend.
If this, when the system enters hibernation this property forced BMS S3 (sleep) state.
- qcom,force-bms-active-on-charger: Boolproperty to keep BMS FSM active
ifcharger is present.
As long as the charger, ensure BMS FSM active.
- qcom,report-charger-eoc : Bool propertyto indicate if BMS needs to indicate
EOCto charger.
BMS instructions need to be informed EOC (end of charge) to the charger
- qcom,ignore-shutdown-soc: A boolean thatcontrols whether BMS will
tryto force the startup SoC to be the same as the
shutdownSoC. Defining it will make BMS ignore the
shutdownSoC.
BMS control whether to try to force upon startup and shutdown SOC as SOC, if you define this shutdown will ignore BMS SOC, SOC will not use the last shutdown, under normal circumstances require so this means that boot, so there is no use of this property
- qcom,use-voltage-soc : A boolean thatcontrols whether BMS will use
voltage-basedSoC instead of a coulomb counter based
one.Voltage-based SoC will not guarantee linearity.
The BMS to determine whether the value of this voltage based SOC based approach instead of coulomb fuel gauge, voltage-based SOC does not guarantee linearity.
- qcom,disable-bms : Bool property to disable the VMBMS hardware module.
Enablethis property if BMS is not supported or an external
fuelgauge is used.
This property is used to turn off the VM BMS hardware modules, or does not support the use of an external power BMS timing enabling this attribute.
- qcom,s3-ocv-tolerence-uv : The S3 stateOCV tolerence threshold in uV. The
LSBvalue is 300uV and maximum value is 76500uV.
S3 state compatible OCV threshold, the minimum and maximum values are 300uV 76500uV.
- qcom,low-soc-fifo-length : The fifolength (of S2 STATE) to be used at lower
SOCs.If this value is not specified the system uses
defaultlenght.
FIFO length state S2 when the SOC is low, if not specified, the system default length, here qcom, low-soc-fifo-length = <2>;
- qcom,resume-soc: Capacity in percent at which charging should resume
whena fully charged battery drops below this level.
When the battery is full the percentage is lower than this value, the charging is restarted. As qcom, resume-soc = <99>;
- qcom,low-temp-threshold : The temperaturethreshold below which the IBAT
averagingand UUC smoothening is disabled. This value
isin deci-degrees centigrade. If not specified it
defaultsto 0.
When the temperature is lower than the threshold value, and to disable Averaging IBAT UUC (non-consumption) smoothing function, such as not specified default to 0, is not specified here.
- qcom,ibat-avg-samples : The number ofsamples to be averaged for IBAT
estimation.If not specified it defaults to 16.
Thepossible values are 1 to 16.
Using the estimate of the average number of IBAT, as no default is specified as 16, the effective value of 1 to 16, we did not specify.
- qcom,batt-aging-comp : A boolean thatdefines if battery aging compensation
isenabled.
This indicates enabled the definition of battery aging compensation, but I did not use, recommended.
- qcom,use-reported-soc : Bool property toenable the reported_soc logic. To
enablethis feature, qcom,resume-soc must be defined as
aproper value. The BMS is also required to control the
charging,discharging and recharging.
This enabled reported_soc logic, but also to define qcom, resume-soc to a suitable value, BMS controls the charging need, stop charging and recharging. Qualcomm Code default definitions given qcom, use-reported-soc, we commented this core board manufacturers, and increase qcom, report-charger-eoc
qcom, attribute value batt-pres-status desired node
- reg : offset and length of the PMIC LBCbattery interface BATT_PRES_STATUS
register
Such as
qcom,batt-pres-status@1208 {
reg= <0x1208 0x1>;
};
qcom, qpnp-chg-pres nodes required attributes
- reg : offset and length of the PMIC LBCcharger interafce CHARGER_OPTION
register.
Such as
qcom,qpnp-chg-pres@1008 {
reg= <0x1008 0x1>;
};