Loading drivers/power/qpnp-fg.c +11 −8 Original line number Original line Diff line number Diff line Loading @@ -3559,6 +3559,7 @@ static int fg_cap_learning_process_full_data(struct fg_chip *chip) int cc_pc_val, rc = -EINVAL; int cc_pc_val, rc = -EINVAL; unsigned int cc_soc_delta_pc; unsigned int cc_soc_delta_pc; int64_t delta_cc_uah; int64_t delta_cc_uah; uint64_t temp; bool batt_missing = is_battery_missing(chip); bool batt_missing = is_battery_missing(chip); if (batt_missing) { if (batt_missing) { Loading @@ -3581,9 +3582,8 @@ static int fg_cap_learning_process_full_data(struct fg_chip *chip) goto fail; goto fail; } } cc_soc_delta_pc = DIV_ROUND_CLOSEST( temp = abs(cc_pc_val - chip->learning_data.init_cc_pc_val); abs(cc_pc_val - chip->learning_data.init_cc_pc_val) cc_soc_delta_pc = DIV_ROUND_CLOSEST_ULL(temp * 100, FULL_PERCENT_28BIT); * 100, FULL_PERCENT_28BIT); delta_cc_uah = div64_s64( delta_cc_uah = div64_s64( chip->learning_data.learned_cc_uah * cc_soc_delta_pc, chip->learning_data.learned_cc_uah * cc_soc_delta_pc, Loading @@ -3591,8 +3591,11 @@ static int fg_cap_learning_process_full_data(struct fg_chip *chip) chip->learning_data.cc_uah = delta_cc_uah + chip->learning_data.cc_uah; chip->learning_data.cc_uah = delta_cc_uah + chip->learning_data.cc_uah; if (fg_debug_mask & FG_AGING) if (fg_debug_mask & FG_AGING) pr_info("current cc_soc=%d cc_soc_pc=%d total_cc_uah = %lld\n", pr_info("current cc_soc=%d cc_soc_pc=%d init_cc_pc_val=%d delta_cc_uah=%lld learned_cc_uah=%lld total_cc_uah = %lld\n", cc_pc_val, cc_soc_delta_pc, cc_pc_val, cc_soc_delta_pc, chip->learning_data.init_cc_pc_val, delta_cc_uah, chip->learning_data.learned_cc_uah, chip->learning_data.cc_uah); chip->learning_data.cc_uah); return 0; return 0; Loading Loading @@ -4147,10 +4150,10 @@ static void status_change_work(struct work_struct *work) if ((chip->wa_flag & USE_CC_SOC_REG) && chip->bad_batt_detection_en if ((chip->wa_flag & USE_CC_SOC_REG) && chip->bad_batt_detection_en && chip->safety_timer_expired) { && chip->safety_timer_expired) { chip->sw_cc_soc_data.delta_soc = uint64_t delta_cc_soc = abs(cc_soc - DIV_ROUND_CLOSEST(abs(cc_soc - chip->sw_cc_soc_data.init_cc_soc); chip->sw_cc_soc_data.init_cc_soc) chip->sw_cc_soc_data.delta_soc = DIV_ROUND_CLOSEST_ULL( * 100, FULL_PERCENT_28BIT); delta_cc_soc * 100, FULL_PERCENT_28BIT); chip->sw_cc_soc_data.full_capacity = chip->sw_cc_soc_data.full_capacity = chip->sw_cc_soc_data.delta_soc + chip->sw_cc_soc_data.delta_soc + chip->sw_cc_soc_data.init_sys_soc; chip->sw_cc_soc_data.init_sys_soc; Loading Loading
drivers/power/qpnp-fg.c +11 −8 Original line number Original line Diff line number Diff line Loading @@ -3559,6 +3559,7 @@ static int fg_cap_learning_process_full_data(struct fg_chip *chip) int cc_pc_val, rc = -EINVAL; int cc_pc_val, rc = -EINVAL; unsigned int cc_soc_delta_pc; unsigned int cc_soc_delta_pc; int64_t delta_cc_uah; int64_t delta_cc_uah; uint64_t temp; bool batt_missing = is_battery_missing(chip); bool batt_missing = is_battery_missing(chip); if (batt_missing) { if (batt_missing) { Loading @@ -3581,9 +3582,8 @@ static int fg_cap_learning_process_full_data(struct fg_chip *chip) goto fail; goto fail; } } cc_soc_delta_pc = DIV_ROUND_CLOSEST( temp = abs(cc_pc_val - chip->learning_data.init_cc_pc_val); abs(cc_pc_val - chip->learning_data.init_cc_pc_val) cc_soc_delta_pc = DIV_ROUND_CLOSEST_ULL(temp * 100, FULL_PERCENT_28BIT); * 100, FULL_PERCENT_28BIT); delta_cc_uah = div64_s64( delta_cc_uah = div64_s64( chip->learning_data.learned_cc_uah * cc_soc_delta_pc, chip->learning_data.learned_cc_uah * cc_soc_delta_pc, Loading @@ -3591,8 +3591,11 @@ static int fg_cap_learning_process_full_data(struct fg_chip *chip) chip->learning_data.cc_uah = delta_cc_uah + chip->learning_data.cc_uah; chip->learning_data.cc_uah = delta_cc_uah + chip->learning_data.cc_uah; if (fg_debug_mask & FG_AGING) if (fg_debug_mask & FG_AGING) pr_info("current cc_soc=%d cc_soc_pc=%d total_cc_uah = %lld\n", pr_info("current cc_soc=%d cc_soc_pc=%d init_cc_pc_val=%d delta_cc_uah=%lld learned_cc_uah=%lld total_cc_uah = %lld\n", cc_pc_val, cc_soc_delta_pc, cc_pc_val, cc_soc_delta_pc, chip->learning_data.init_cc_pc_val, delta_cc_uah, chip->learning_data.learned_cc_uah, chip->learning_data.cc_uah); chip->learning_data.cc_uah); return 0; return 0; Loading Loading @@ -4147,10 +4150,10 @@ static void status_change_work(struct work_struct *work) if ((chip->wa_flag & USE_CC_SOC_REG) && chip->bad_batt_detection_en if ((chip->wa_flag & USE_CC_SOC_REG) && chip->bad_batt_detection_en && chip->safety_timer_expired) { && chip->safety_timer_expired) { chip->sw_cc_soc_data.delta_soc = uint64_t delta_cc_soc = abs(cc_soc - DIV_ROUND_CLOSEST(abs(cc_soc - chip->sw_cc_soc_data.init_cc_soc); chip->sw_cc_soc_data.init_cc_soc) chip->sw_cc_soc_data.delta_soc = DIV_ROUND_CLOSEST_ULL( * 100, FULL_PERCENT_28BIT); delta_cc_soc * 100, FULL_PERCENT_28BIT); chip->sw_cc_soc_data.full_capacity = chip->sw_cc_soc_data.full_capacity = chip->sw_cc_soc_data.delta_soc + chip->sw_cc_soc_data.delta_soc + chip->sw_cc_soc_data.init_sys_soc; chip->sw_cc_soc_data.init_sys_soc; Loading