X-Power AXP288 PMIC Fuel Gauge Driver
Subsystems (4)
v3 cover X-Power AXP288 PMIC Fuel Gauge Driver
New power_supply driver at driver/power which interfaces with the axp20x mfd driver as a cell. Provides battery info, monitors for changes, and generates alerts on temperature and capacity issues
Todd Brandt (3):
mfd/axp20x: change battery cell name to fuel gauge mfd/axp20x: add support for fuel gauge cell X-Power AXP288 PMIC Fuel Gauge Driver
v1: 01/07/14
v2: 01/22/14
- replaced the const in axp20x_acpi_match declaration
- reformatted the commit text
- added IIO as driver dependency
- moved debug info to debugfs in file fuelgauge
- added HEALTH_COLD value to health calculation
- added better cleanup to remove call
cancelling any delayed work calls unregistration of the power_supply
v3: 01/28/14
- moved debugs create and init config regs after error case
- freed the virqs in the remove function
- remove .owner field as it is populated automatically
drivers/mfd/axp20x.c | 8 ++++---- drivers/power/Kconfig | 9 +++++++++ drivers/power/Makefile | 1 + include/linux/mfd/axp20x.h | 43 +++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 55 insertions(+), 6 deletions(-)
Signature · 1 line
2.1.0
PATCH v3 1/3 mfd/axp20x: change battery cell name to fuel gauge
Name changes to the battery cell structure to a more generic cell type: fuel gauge.
--- drivers/mfd/axp20x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
v1: 01/07/14
v2: 01/22/14
- replaced the const in axp20x_acpi_match declaration
v3: same as v2
drivers/mfd/axp20x.c +4 -4
@@ -87,7 +87,7 @@ static struct resource axp20x_pek_resources[] = { }, }; -static struct resource axp288_battery_resources[] = { +static struct resource axp288_fuel_gauge_resources[] = { { .start =AXP288_IRQ_QWBTU , .end =AXP288_IRQ_QWBTU ,
@@ -350,9 +350,9 @@ static struct mfd_cell axp288_cells[] = { .resources = axp288_charger_resources, }, { - .name = "axp288_battery", - .num_resources = ARRAY_SIZE(axp288_battery_resources), - .resources = axp288_battery_resources, + .name = "axp288_fuel_gauge", + .num_resources = ARRAY_SIZE(axp288_fuel_gauge_resources), + .resources = axp288_fuel_gauge_resources, }, { .name = "axp288_pmic_acpi",
Signature · 1 line
2.1.0
PATCH v3 2/3 mfd/axp20x: add support for fuel gauge cell
In reply to Todd BrandtRegister definitions and platform data structure for fuel gauge cell devices.
--- include/linux/mfd/axp20x.h | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-)
v3: same as v1-2 and is already accepted, re-included for continuity
include/linux/mfd/axp20x.h +41 -2
@@ -124,10 +124,27 @@ enum {#define AXP288_PMIC_ADC_H 0x56#define AXP288_PMIC_ADC_L 0x57#define AXP288_ADC_TS_PIN_CTRL 0x84 -#define AXP288_PMIC_ADC_EN 0x84 -#define AXP288_FG_TUNE5 0xed +/* Fuel Gauge */ +#define AXP288_FG_RDC1_REG 0xba +#define AXP288_FG_RDC0_REG 0xbb +#define AXP288_FG_OCVH_REG 0xbc +#define AXP288_FG_OCVL_REG 0xbd +#define AXP288_FG_OCV_CURVE_REG 0xc0 +#define AXP288_FG_DES_CAP1_REG 0xe0 +#define AXP288_FG_DES_CAP0_REG 0xe1 +#define AXP288_FG_CC_MTR1_REG 0xe2 +#define AXP288_FG_CC_MTR0_REG 0xe3 +#define AXP288_FG_OCV_CAP_REG 0xe4 +#define AXP288_FG_CC_CAP_REG 0xe5 +#define AXP288_FG_LOW_CAP_REG 0xe6 +#define AXP288_FG_TUNE0 0xe8 +#define AXP288_FG_TUNE1 0xe9 +#define AXP288_FG_TUNE2 0xea +#define AXP288_FG_TUNE3 0xeb +#define AXP288_FG_TUNE4 0xec +#define AXP288_FG_TUNE5 0xed/* Regulators IDs */ enum {
@@ -236,4 +253,26 @@ struct axp20x_dev { const struct regmap_irq_chip *regmap_irq_chip; }; +#define BATTID_LEN 64 +#define OCV_CURVE_SIZE 32 +#define MAX_THERM_CURVE_SIZE 25 +#define PD_DEF_MIN_TEMP 0 +#define PD_DEF_MAX_TEMP 55 + +struct axp20x_fg_pdata { +char battid[BATTID_LEN +1 ]; +int design_cap; +int min_volt; +int max_volt; +int max_temp; +int min_temp; +int cap1; +int cap0; +int rdc1; +int rdc0; +int ocv_curve[OCV_CURVE_SIZE ]; +int tcsz; +int thermistor_curve[MAX_THERM_CURVE_SIZE ][2 ]; +}; +#endif /* __LINUX_MFD_AXP20X_H */
Signature · 1 line
2.1.0
PATCH v3 3/3 X-Power AXP288 PMIC Fuel Gauge Driver
In reply to Todd BrandtNew power_supply driver at driver/power which interfaces with the axp20x mfd driver as a cell. Provides battery info, monitors for changes, and generates alerts on temperature and capacity issues
--- drivers/power/Kconfig | 9 + drivers/power/Makefile | 1 + drivers/power/axp288_fuel_gauge.c | 1151 +++++++++++++++++++++++++++++++++++++ 3 files changed, 1161 insertions(+) create mode 100644 drivers/power/axp288_fuel_gauge.c
v1: 01/07/14
v2: 01/22/14
- reformatted the commit text
- added IIO as driver dependency
- moved debug info to debugfs in file fuelgauge
- added HEALTH_COLD value to health calculation
- added better cleanup to remove call
cancelling any delayed work calls unregistration of the power_supply
v3: 01/28/14
- moved debugs create and init config regs after error case
- freed the virqs in the remove function
- remove .owner field as it is populated automatically
drivers/power/Kconfig +9 -0
@@ -192,6 +192,15 @@ config BATTERY_DA9052 Say Y here to enable support for batteries charger integrated into DA9052 PMIC. +config AXP288_FUEL_GAUGE + tristate "X-Powers AXP288 Fuel Gauge" + depends on MFD_AXP20X && IIO + help + Say yes here to have support for X-Power power management IC (PMIC) + Fuel Gauge. The device provides battery statistics and status + monitoring as well as alerts for battery over/under voltage and + over/under temperature. + config BATTERY_MAX17040 tristate "Maxim MAX17040 Fuel Gauge" depends on I2C
drivers/power/Makefile +1 -0
@@ -59,3 +59,4 @@ obj-$(CONFIG_POWER_AVS) += avs/ obj-$(CONFIG_CHARGER_SMB347) += smb347-charger.o obj-$(CONFIG_CHARGER_TPS65090) += tps65090-charger.o obj-$(CONFIG_POWER_RESET) += reset/ +obj-$(CONFIG_AXP288_FUEL_GAUGE) += axp288_fuel_gauge.o
drivers/power/axp288_fuel_gauge.c new file +1151 -0
1,151 lines not on this page · raw message
Signature · 1 line
2.1.0