On SMB, battery termination status updates even when we disable
charging termination. Handle this case by updating the battery status
only if required.
CRs-Fixed: 771020
Change-Id: I37f703d423785e23fd90a7736ffd13ffaf10982f
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
Use power_supply_set_supply_type to notify the charger type
to the USB driver. The charger detection is done by SMB358
instead of the USB driver.
CRs-fixed: 770166
Change-Id: I0f0854892695abd5f1ed714e7bc4d5e959c286b3
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
Add an hysteresis offset to prevent irq storm when battery temperature
around JEITA thresholds.
Change-Id: I3c609b27eb7d1df36a811cbbc5e35316fdfa0f60
CRs-Fixed: 754679
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
Automatic power source detection is a feature of SMB which can
detect charger type automatically. Fix the register mask to correctly
detect the charger type.
Change-Id: I054dcc573aee69ddcc4aa67a47788c400cf54860
CRs-Fixed: 747478
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
Support JEITA based on PMIC therm. The SMB358 also supports JEITA
configuration in hardware, however in some designs the battery
thermistor is only connected to the PMIC's THERM pin. For such
condition, add the JEITA support using PMIC VADC for thermal reading.
Add some properties to support this feature:
qcom,warm-bat-decidegc
qcom,cool-bat-decidegc
qcom,warm-bat-ma
qcom,cool-bat-ma
qcom,warm-bat-mv
qcom,cool-bat-mv
JEITA only supported when all of these properties are defined.
Change-Id: I26a1ee0312e86f37a185531483167edfa3039fdf
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
BMS based termination/recharge allows BMS/FG to control charging.
This is useful in cooperation with voltage mode BMS, where due to
a hardware limitation it's required that the EOC and recharge is
always controlled by BMS module.
The BMS module can independently start/stop charging by writing
the STATUS property of battery power-supply. To enable this feature,
following DT params need to be defined:
qcom,bms-controlled-charging
qcom,iterm-disabled
Change-Id: I28f0a0a772194cc195eceab778b4ef8f61d4b3da
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
When battery voltage(Vbatt) is higher than around 4.2v, and
charging is disabled, Charger stops switching. In such a
case, system load is provided by battery rather than input,
even though input is still connected. As a workaround, we need
make reg09[0:3] to be a non-zero value which keeps the switcher
active.
Change-Id: I94459eb5e65013edb9977fc742f83be4901d5f35
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
The charger inhibit option prevents battery charging upon
insertion of charger when battery voltage is above the
programmed inhibit threshold.
Change-Id: Iaa9fd7e897f4eca3bdf8a060f15a5a181f7eb888
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
Call charging enable/disable function explicitly during boot.
It makes sure charging is enabled correctly regardless of the default
setting.
Change-Id: I2dc82fb1864c34a92d5309cb3543d27132a11db1
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
Uninitialized cfg structure may cause random crash when calling
regulator_register() function. Fix this by initializing it to 0
by default.
While at it, fix another minor typo issue.
Change-Id: I0b96fd8f47091adacf1d3cd5d159509060a1a516
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
SMB chip only has a 20-30mV accuracy for VDDMAX. Since it never
meets the 10mV accuracy that BMS expects, taper charging detection
will fail. Fix this by implementing the notification from SMB
driver to BMS driver.
Change-Id: I1936aecec2c281dc98173b80db105871e6869a1d
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
This driver supports external smb358 switch mode charger,
can reach up to 2A charging current. This driver instead of
original qpnp-charger, will co-work with PMIC internal BMS
(Battery Monitor System).
Change-Id: I4c520e2812284af0af348beae516eba5f95c49f3
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>