summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubbaraman Narayanamurthy <subbaram@codeaurora.org>2016-10-26 18:12:10 -0700
committerSubbaraman Narayanamurthy <subbaram@codeaurora.org>2016-11-07 14:32:09 -0800
commit5652fdc60b50c46128a2c395058912d89f01e1f2 (patch)
treed1dc77846b8117b1faa51b8e39ee3970e6a59207
parente5f967c5a94ec1886c9afbe53616cb78be1d0709 (diff)
qpnp-fg-gen3: extend profile integrity word usage
Currently, profile integrity register is using only bit 0 to indicate whether the profile is loaded or not. Now that the profile can be loaded and/or fuel gauge can be restarted by the bootloader, extend the usage of that word by using other bits to provide more information. This is to aid the debugging. Change-Id: Ib04ab10998de2f57b05cd976c3e9c8a1e2f4c574 Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
-rw-r--r--drivers/power/qcom-charger/qpnp-fg-gen3.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/power/qcom-charger/qpnp-fg-gen3.c b/drivers/power/qcom-charger/qpnp-fg-gen3.c
index c60089032544..c9edc667f35d 100644
--- a/drivers/power/qcom-charger/qpnp-fg-gen3.c
+++ b/drivers/power/qcom-charger/qpnp-fg-gen3.c
@@ -1580,6 +1580,10 @@ static void dump_sram(u8 *buf, int len)
}
}
+#define PROFILE_LOAD_BIT BIT(0)
+#define BOOTLOADER_LOAD_BIT BIT(1)
+#define BOOTLOADER_RESTART_BIT BIT(2)
+#define HLOS_RESTART_BIT BIT(3)
static bool is_profile_load_required(struct fg_chip *chip)
{
u8 buf[PROFILE_COMP_LEN], val;
@@ -1594,7 +1598,7 @@ static bool is_profile_load_required(struct fg_chip *chip)
}
/* Check if integrity bit is set */
- if (val == 0x01) {
+ if (val & PROFILE_LOAD_BIT) {
fg_dbg(chip, FG_STATUS, "Battery profile integrity bit is set\n");
rc = fg_sram_read(chip, PROFILE_LOAD_WORD, PROFILE_LOAD_OFFSET,
buf, PROFILE_COMP_LEN, FG_IMA_DEFAULT);
@@ -1752,7 +1756,7 @@ static void profile_load_work(struct work_struct *work)
fg_dbg(chip, FG_STATUS, "SOC is ready\n");
/* Set the profile integrity bit */
- val = 0x1;
+ val = HLOS_RESTART_BIT | PROFILE_LOAD_BIT;
rc = fg_sram_write(chip, PROFILE_INTEGRITY_WORD,
PROFILE_INTEGRITY_OFFSET, &val, 1, FG_IMA_DEFAULT);
if (rc < 0) {