Commit Graph

20 Commits

Author SHA1 Message Date
Zhenhua Huang d70481a53c power: smb358-charger: Fix minor issue in smb358 charger
Fix log printing and braces issue.

Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
Change-Id: Iadcc0623b6841f29767d2e9cf16c89d6b251aa55
2015-02-27 10:48:27 +08:00
Linux Build Service Account 81db5cadd3 Merge "power: smb358-charger: Conditionally update battery status in term handler" 2014-12-17 00:00:13 -08:00
Zhenhua Huang 3c2e1b7716 power: smb358-charger: Conditionally update battery status in term handler
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>
2014-12-16 19:25:56 +08:00
Zhenhua Huang e498677413 power: smb358-charger: Modify api to notify charger type
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>
2014-12-12 17:57:21 +08:00
Linux Build Service Account 69e0c36815 Merge "power: smb358-charger: Add hysteresis for JEITA control" 2014-11-24 08:42:34 -08:00
Zhenhua Huang 8512953ac8 power: smb358-charger: Add hysteresis for JEITA control
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>
2014-11-24 14:48:23 +08:00
Zhenhua Huang 21eee7f3fa power: smb358-charger: Fix issue when doing charger type detection
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>
2014-11-06 13:55:05 +08:00
Linux Build Service Account 9242b119d2 Merge "power: smb358-charger: Implement JEITA support through PMIC" 2014-08-25 08:22:19 -07:00
Zhenhua Huang 99a4a3b64d power: smb358-charger: Implement JEITA support through PMIC
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>
2014-08-18 10:20:26 +08:00
Zhenhua Huang 569b1acec6 power: smb358-charger: Add BMS controlled termination/recharge
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>
2014-08-14 11:04:39 +08:00
Zhenhua Huang 590e2f4132 power: smb358-charger: Add flexible implemention for i2c pull up supply
Flexible implemention for i2c pull up, adding an optional configuration
to indicate if pull-up source needed.

Change-Id: I1e837499ed533c4bcd5c13535952a30a7e3e6292
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
2014-08-11 16:19:23 +08:00
Linux Build Service Account 65cdff5d07 Merge "power: smb358-charger: Workaround for frequent recharge issue" 2014-08-09 07:56:44 -07:00
Linux Build Service Account 591d269279 Merge "power: smb358-charger: Add charger inhibit interface" 2014-08-08 12:02:05 -07:00
Linux Build Service Account 1a4cf9913b Merge "power: smb358-charger: Explictly enable/disable charging during boot" 2014-08-04 14:53:25 -07:00
Zhenhua Huang 433729335b power: smb358-charger: Workaround for frequent recharge issue
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>
2014-08-04 16:03:55 +08:00
Zhenhua Huang ba373d74bc power: smb358-charger: Add charger inhibit interface
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>
2014-08-04 12:35:12 +08:00
Zhenhua Huang 36308dcff8 power: smb358-charger: Explictly enable/disable charging during boot
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>
2014-08-04 11:29:55 +08:00
Zhenhua Huang 92771ee9ea power: smb358-charger: Fix an uninitialized variable issue
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>
2014-08-01 16:29:42 +08:00
Zhenhua Huang 01a74380fb power: qpnp-bms: add a taper charging notification
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>
2014-03-31 18:48:10 +08:00
Zhenhua Huang b2c2c8c17a power: smb358-charger: Add smb358 charger driver
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>
2014-03-27 15:48:48 +08:00