diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-19 19:51:37 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-19 19:51:37 +0000 |
commit | ff6e0390329c60cbfd3a8e087ec82a59a73844df (patch) | |
tree | cd03b35fc4a9447fcce3e820f4ebc745818f679f | |
parent | 1b698b09516d8df7602a8a62ff7f483ef9c97cf0 (diff) | |
parent | 3a3b2f9442decdfe4c1cffbbe4571d98ab6da676 (diff) | |
download | bms-android-gs-shusky-5.15-android15-beta.tar.gz |
Snap for 11594826 from 3a3b2f9442decdfe4c1cffbbe4571d98ab6da676 to android14-gs-pixel-5.15-24Q3-releaseandroid-15-beta-1_r0.8android-gs-shusky-5.15-android15-beta
Change-Id: I643e260bb3aedfe3887e74b97deca3370dd9b75a
Signed-off-by: Coastguard Worker <android-build-coastguard-worker@google.com>
-rw-r--r-- | max1720x_battery.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/max1720x_battery.c b/max1720x_battery.c index 39fbb91..a405aae 100644 --- a/max1720x_battery.c +++ b/max1720x_battery.c @@ -1501,67 +1501,6 @@ static void max1720x_handle_update_filtercfg(struct max1720x_chip *chip, #define EEPROM_CC_OVERFLOW_BIT BIT(15) #define MAXIM_CYCLE_COUNT_RESET 655 -#define OVERFLOW_START_ENTRY 65 -#define EEPROM_DELTA_CYCLE 10 -#define CYCLE_LSB_UNIT 100 /* LSB: 1% */ -static int max1720x_history_empty(struct max17x0x_eeprom_history *entry) -{ - return entry->tempco == 0xffff && entry->rcomp0 == 0xffff; -} - -/* find the first empty entry starting from a position */ -static int max1720x_find_empty(int offset) -{ - struct max17x0x_eeprom_history temp = { 0 }; - int ret, index; - - /* recover (last - OVERFLOW_START_ENTRY + 1) entries */ - for (index = offset; index < BATT_MAX_HIST_CNT; index++) { - ret = gbms_storage_read_data(GBMS_TAG_HIST, &temp, - sizeof(temp), index); - if (ret < 0) - return -EIO; - - if (max1720x_history_empty(&temp)) - break; - } - - return index == BATT_MAX_HIST_CNT ? -1 : index - offset; -} - -static int max1720x_check_history(struct max1720x_chip *chip) -{ - struct max17x0x_eeprom_history temp = { 0 }; - int ret, misplaced_count, first_empty, est_cycle; - - /* when the entry before the overflow is non empty we are good */ - ret = gbms_storage_read_data(GBMS_TAG_HIST, &temp, sizeof(temp), - OVERFLOW_START_ENTRY - 1); - if (ret < 0 || !max1720x_history_empty(&temp)) - return ret; - - /* # entries that need to be moved from OVERFLOW_START_ENTRY */ - misplaced_count = max1720x_find_empty(OVERFLOW_START_ENTRY); - - if (misplaced_count <= 0) - return misplaced_count; - - /* where entries will be moved to */ - first_empty = max1720x_find_empty(0); - - if (first_empty < 0) - return -EINVAL; - - est_cycle = (first_empty + misplaced_count) * EEPROM_DELTA_CYCLE; - - gbms_logbuffer_devlog(chip->monitor_log, chip->dev, - LOGLEVEL_INFO, 0, LOGLEVEL_INFO, - "0x4856 %d %d %d %d", - first_empty, misplaced_count, chip->cycle_count, est_cycle); - - return 0; -} - static int max1720x_restore_battery_cycle(struct max1720x_chip *chip) { int ret; @@ -1612,7 +1551,6 @@ static int max1720x_restore_battery_cycle(struct max1720x_chip *chip) chip->cycle_reg_ok = true; max1720x_update_cycle_count(chip); - max1720x_check_history(chip); return 0; } |