Skip to content

Commit e0f1abe

Browse files
Rajanikanth H.VAnton Vorontsov
authored andcommitted
ab8500: Add devicetree support for fuelgauge
- This patch adds device tree support for fuelgauge driver - optimize bm devices platform_data usage and of_probe(...) Note: of_probe() routine for battery managed devices is made common across all bm drivers. - test status: - interrupt numbers assigned differs between legacy and FDT mode. Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
1 parent e9f14c1 commit e0f1abe

11 files changed

Lines changed: 667 additions & 96 deletions

File tree

‎Documentation/devicetree/bindings/mfd/ab8500.txt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ ab8500-bm : : : Battery Manager
2424
ab8500-btemp : : : Battery Temperature
2525
ab8500-charger : : : Battery Charger
2626
ab8500-codec : : : Audio Codec
27-
ab8500-fg : : : Fuel Gauge
27+
ab8500-fg : : vddadc : Fuel Gauge
28+
: NCONV_ACCU : : Accumulate N Sample Conversion
29+
: BATT_OVV : : Battery Over Voltage
30+
: LOW_BAT_F : : LOW threshold battery voltage
31+
: CC_INT_CALIB : : Coulomb Counter Internal Calibration
32+
: CCEOC : : Coulomb Counter End of Conversion
2833
ab8500-gpadc : HW_CONV_END : vddadc : Analogue to Digital Converter
2934
SW_CONV_END : :
3035
ab8500-gpio : : : GPIO Controller
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
=== AB8500 Fuel Gauge Driver ===
2+
3+
AB8500 is a mixed signal multimedia and power management
4+
device comprising: power and energy-management-module,
5+
wall-charger, usb-charger, audio codec, general purpose adc,
6+
tvout, clock management and sim card interface.
7+
8+
Fuelgauge support is part of energy-management-modules, other
9+
components of this module are:
10+
main-charger, usb-combo-charger and battery-temperature-monitoring.
11+
12+
The properties below describes the node for fuelgauge driver.
13+
14+
Required Properties:
15+
- compatible = This shall be: "stericsson,ab8500-fg"
16+
- battery = Shall be battery specific information
17+
Example:
18+
ab8500_fg {
19+
compatible = "stericsson,ab8500-fg";
20+
battery = <&ab8500_battery>;
21+
};
22+
23+
dependent node:
24+
ab8500_battery: ab8500_battery {
25+
};
26+
This node will provide information on 'thermistor interface' and
27+
'battery technology type' used.
28+
29+
Properties of this node are:
30+
thermistor-on-batctrl:
31+
A boolean value indicating thermistor interface to battery
32+
33+
Note:
34+
'btemp' and 'batctrl' are the pins interfaced for battery temperature
35+
measurement, 'btemp' signal is used when NTC(negative temperature
36+
coefficient) resister is interfaced external to battery whereas
37+
'batctrl' pin is used when NTC resister is internal to battery.
38+
39+
Example:
40+
ab8500_battery: ab8500_battery {
41+
thermistor-on-batctrl;
42+
};
43+
indicates: NTC resister is internal to battery, 'batctrl' is used
44+
for thermal measurement.
45+
46+
The absence of property 'thermal-on-batctrl' indicates
47+
NTC resister is external to battery and 'btemp' signal is used
48+
for thermal measurement.
49+
50+
battery-type:
51+
This shall be the battery manufacturing technology type,
52+
allowed types are:
53+
"UNKNOWN" "NiMH" "LION" "LIPO" "LiFe" "NiCd" "LiMn"
54+
Example:
55+
ab8500_battery: ab8500_battery {
56+
stericsson,battery-type = "LIPO";
57+
}
58+

‎arch/arm/boot/dts/dbx5x0.dtsi‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,17 @@
352352
vddadc-supply = <&ab8500_ldo_tvout_reg>;
353353
};
354354

355-
ab8500-usb {
355+
ab8500_battery: ab8500_battery {
356+
stericsson,battery-type = "LIPO";
357+
thermistor-on-batctrl;
358+
};
359+
360+
ab8500_fg {
361+
compatible = "stericsson,ab8500-fg";
362+
battery = <&ab8500_battery>;
363+
};
364+
365+
ab8500_usb {
356366
compatible = "stericsson,ab8500-usb";
357367
interrupts = < 90 0x4
358368
96 0x4

‎drivers/mfd/ab8500-core.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,13 @@ static struct mfd_cell __devinitdata ab8500_bm_devs[] = {
10511051
},
10521052
{
10531053
.name = "ab8500-fg",
1054+
.of_compatible = "stericsson,ab8500-fg",
10541055
.num_resources = ARRAY_SIZE(ab8500_fg_resources),
10551056
.resources = ab8500_fg_resources,
1057+
#ifndef CONFIG_OF
1058+
.platform_data = &ab8500_bm_data,
1059+
.pdata_size = sizeof(ab8500_bm_data),
1060+
#endif
10561061
},
10571062
{
10581063
.name = "ab8500-chargalg",

‎drivers/power/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o
3838
obj-$(CONFIG_BATTERY_JZ4740) += jz4740-battery.o
3939
obj-$(CONFIG_BATTERY_INTEL_MID) += intel_mid_battery.o
4040
obj-$(CONFIG_BATTERY_RX51) += rx51_battery.o
41-
obj-$(CONFIG_AB8500_BM) += ab8500_charger.o ab8500_btemp.o ab8500_fg.o abx500_chargalg.o
41+
obj-$(CONFIG_AB8500_BM) += ab8500_bmdata.o ab8500_charger.o ab8500_btemp.o ab8500_fg.o abx500_chargalg.o
4242
obj-$(CONFIG_CHARGER_ISP1704) += isp1704_charger.o
4343
obj-$(CONFIG_CHARGER_MAX8903) += max8903_charger.o
4444
obj-$(CONFIG_CHARGER_TWL4030) += twl4030_charger.o

0 commit comments

Comments
 (0)