mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-30 18:41:11 +00:00
battery/max17055: Measure temperature using external thermistor
By default max17055 measures from internal temperature sensor. BUG=b:68170538 BRANCH=none TEST=place a heat source on top of the battery pack and see temperature rise from 'battery' command Change-Id: I1c0bb981e366a8a73d2e14e6c1fc92327069e8f1 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/735080 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
@@ -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, ®)) {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user