summaryrefslogtreecommitdiff
path: root/driver/battery
diff options
context:
space:
mode:
Diffstat (limited to 'driver/battery')
-rw-r--r--driver/battery/max17055.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/driver/battery/max17055.c b/driver/battery/max17055.c
index bd7e23cb30..b425e828b4 100644
--- a/driver/battery/max17055.c
+++ b/driver/battery/max17055.c
@@ -50,6 +50,9 @@
#define STATUS_POR 0x0002
#define STATUS_BST 0x0008
+/* Config reg (0x1d) flags */
+#define CONF_TSEL 0x8000
+
/* FStat reg (0x3d) flags */
#define FSTAT_DNR 0x0001
@@ -378,6 +381,16 @@ static void max17055_init(void)
return;
}
+ /* Set CONFIG.TSEL to measure temperature using external thermistor */
+ if (max17055_read(REG_CONFIG, &reg)) {
+ CPRINTS("%s: failed to read reg %02x", __func__, REG_CONFIG);
+ return;
+ }
+ if (max17055_write(REG_CONFIG, (reg | CONF_TSEL))) {
+ CPRINTS("%s: failed to write reg %02x", __func__, REG_CONFIG);
+ return;
+ }
+
CPRINTS("max17055 configuration succeeded!");
}
DECLARE_HOOK(HOOK_INIT, max17055_init, HOOK_PRIO_DEFAULT);