57 lines
1.5 KiB
Diff
57 lines
1.5 KiB
Diff
From fe39810e7f9460987b24b876a0ebf5ee1d5defdb Mon Sep 17 00:00:00 2001
|
|
From: Ondrej Jirman <megous@megous.com>
|
|
Date: Fri, 28 Feb 2020 19:17:43 +0100
|
|
Subject: [PATCH 247/323] power: supply: axp20x_battery: Configure OCV/CAP
|
|
table during probe
|
|
|
|
WIP
|
|
|
|
Signed-off-by: Ondrej Jirman <megous@megous.com>
|
|
---
|
|
drivers/power/supply/axp20x_battery.c | 22 ++++++++++++++++++++++
|
|
1 file changed, 22 insertions(+)
|
|
|
|
diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c
|
|
index b906dfe85..99494bd1a 100644
|
|
--- a/drivers/power/supply/axp20x_battery.c
|
|
+++ b/drivers/power/supply/axp20x_battery.c
|
|
@@ -592,6 +592,22 @@ static const struct of_device_id axp20x_battery_ps_id[] = {
|
|
};
|
|
MODULE_DEVICE_TABLE(of, axp20x_battery_ps_id);
|
|
|
|
+static int axp20x_battery_update_ocv_table(struct axp20x_batt_ps *axp20x_batt)
|
|
+{
|
|
+ struct power_supply_battery_ocv_table *tab;
|
|
+ struct power_supply_battery_info *info;
|
|
+ int tab_size;
|
|
+
|
|
+ info = &axp20x_batt->batt_info;
|
|
+
|
|
+ tab = power_supply_find_ocv2cap_table(info, 20, &tab_size);
|
|
+ if (tab) {
|
|
+ /*XXX: program values into the PMIC */
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int axp20x_power_probe(struct platform_device *pdev)
|
|
{
|
|
struct axp20x_batt_ps *axp20x_batt;
|
|
@@ -670,6 +686,12 @@ static int axp20x_power_probe(struct platform_device *pdev)
|
|
axp20x_batt->max_ccc = ccc;
|
|
axp20x_set_constant_charge_current(axp20x_batt, ccc);
|
|
}
|
|
+
|
|
+ if (axp20x_battery_update_ocv_table(axp20x_batt))
|
|
+ dev_err(&pdev->dev,
|
|
+ "couldn't configure ocv table\n");
|
|
+
|
|
+ /*XXX: maybe also set initial RDC */
|
|
}
|
|
|
|
/*
|
|
--
|
|
2.34.0
|
|
|