Lines Matching refs:bat_cap

222 	struct ab8500_fg_battery_capacity bat_cap;  member
1002 return (cap_mah * 1000) / di->bat_cap.max_mah_design; in ab8500_fg_convert_mah_to_permille()
1014 return cap_pm * di->bat_cap.max_mah_design / 1000; in ab8500_fg_convert_permille_to_mah()
1055 di->bat_cap.mah, in ab8500_fg_calc_cap_charging()
1059 if (di->bat_cap.mah + di->accu_charge > 0) in ab8500_fg_calc_cap_charging()
1060 di->bat_cap.mah += di->accu_charge; in ab8500_fg_calc_cap_charging()
1062 di->bat_cap.mah = 0; in ab8500_fg_calc_cap_charging()
1067 if (di->bat_cap.mah >= di->bat_cap.max_mah_design || in ab8500_fg_calc_cap_charging()
1069 di->bat_cap.mah = di->bat_cap.max_mah_design; in ab8500_fg_calc_cap_charging()
1072 ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); in ab8500_fg_calc_cap_charging()
1073 di->bat_cap.permille = in ab8500_fg_calc_cap_charging()
1074 ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_charging()
1080 return di->bat_cap.mah; in ab8500_fg_calc_cap_charging()
1099 di->bat_cap.mah = ab8500_fg_add_cap_sample(di, mah); in ab8500_fg_calc_cap_discharge_voltage()
1100 di->bat_cap.permille = in ab8500_fg_calc_cap_discharge_voltage()
1101 ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_voltage()
1103 return di->bat_cap.mah; in ab8500_fg_calc_cap_discharge_voltage()
1120 di->bat_cap.mah, in ab8500_fg_calc_cap_discharge_fg()
1124 if (di->bat_cap.mah + di->accu_charge > 0) in ab8500_fg_calc_cap_discharge_fg()
1125 di->bat_cap.mah += di->accu_charge; in ab8500_fg_calc_cap_discharge_fg()
1127 di->bat_cap.mah = 0; in ab8500_fg_calc_cap_discharge_fg()
1129 if (di->bat_cap.mah >= di->bat_cap.max_mah_design) in ab8500_fg_calc_cap_discharge_fg()
1130 di->bat_cap.mah = di->bat_cap.max_mah_design; in ab8500_fg_calc_cap_discharge_fg()
1136 permille = ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1140 di->bat_cap.permille = permille_volt; in ab8500_fg_calc_cap_discharge_fg()
1141 di->bat_cap.mah = ab8500_fg_convert_permille_to_mah(di, in ab8500_fg_calc_cap_discharge_fg()
1142 di->bat_cap.permille); in ab8500_fg_calc_cap_discharge_fg()
1149 ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1151 ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1152 di->bat_cap.permille = in ab8500_fg_calc_cap_discharge_fg()
1153 ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1156 return di->bat_cap.mah; in ab8500_fg_calc_cap_discharge_fg()
1169 percent = DIV_ROUND_CLOSEST(di->bat_cap.permille, 10); in ab8500_fg_capacity_level()
1196 struct ab8500_fg_cap_scaling *cs = &di->bat_cap.cap_scale; in ab8500_fg_calculate_scaled_capacity()
1197 int capacity = di->bat_cap.prev_percent; in ab8500_fg_calculate_scaled_capacity()
1218 DIV_ROUND_CLOSEST(di->bat_cap.prev_percent * in ab8500_fg_calculate_scaled_capacity()
1228 if (di->bat_cap.prev_percent >= in ab8500_fg_calculate_scaled_capacity()
1232 capacity = di->bat_cap.prev_percent; in ab8500_fg_calculate_scaled_capacity()
1254 struct ab8500_fg_cap_scaling *cs = &di->bat_cap.cap_scale; in ab8500_fg_update_cap_scalers()
1259 di->bat_cap.cap_scale.disable_cap_level = in ab8500_fg_update_cap_scalers()
1260 di->bat_cap.cap_scale.scaled_cap; in ab8500_fg_update_cap_scalers()
1262 di->bat_cap.cap_scale.disable_cap_level); in ab8500_fg_update_cap_scalers()
1266 cs->cap_to_scale[1] = di->bat_cap.prev_percent; in ab8500_fg_update_cap_scalers()
1270 max(di->bat_cap.prev_percent, in ab8500_fg_update_cap_scalers()
1290 int percent = DIV_ROUND_CLOSEST(di->bat_cap.permille, 10); in ab8500_fg_check_capacity_limits()
1292 di->bat_cap.level = ab8500_fg_capacity_level(di); in ab8500_fg_check_capacity_limits()
1294 if (di->bat_cap.level != di->bat_cap.prev_level) { in ab8500_fg_check_capacity_limits()
1299 if (!(!di->flags.charging && di->bat_cap.level > in ab8500_fg_check_capacity_limits()
1300 di->bat_cap.prev_level) || init) { in ab8500_fg_check_capacity_limits()
1302 di->bat_cap.prev_level, in ab8500_fg_check_capacity_limits()
1303 di->bat_cap.level); in ab8500_fg_check_capacity_limits()
1304 di->bat_cap.prev_level = di->bat_cap.level; in ab8500_fg_check_capacity_limits()
1309 di->bat_cap.prev_level, in ab8500_fg_check_capacity_limits()
1310 di->bat_cap.level); in ab8500_fg_check_capacity_limits()
1320 di->bat_cap.prev_percent = 0; in ab8500_fg_check_capacity_limits()
1321 di->bat_cap.permille = 0; in ab8500_fg_check_capacity_limits()
1323 di->bat_cap.prev_mah = 0; in ab8500_fg_check_capacity_limits()
1324 di->bat_cap.mah = 0; in ab8500_fg_check_capacity_limits()
1332 di->bat_cap.prev_percent = percent; in ab8500_fg_check_capacity_limits()
1333 di->bat_cap.prev_mah = di->bat_cap.mah; in ab8500_fg_check_capacity_limits()
1337 if (!di->bat_cap.cap_scale.enable && in ab8500_fg_check_capacity_limits()
1339 di->bat_cap.cap_scale.enable = true; in ab8500_fg_check_capacity_limits()
1340 di->bat_cap.cap_scale.cap_to_scale[0] = 100; in ab8500_fg_check_capacity_limits()
1341 di->bat_cap.cap_scale.cap_to_scale[1] = in ab8500_fg_check_capacity_limits()
1342 di->bat_cap.prev_percent; in ab8500_fg_check_capacity_limits()
1343 di->bat_cap.cap_scale.disable_cap_level = 100; in ab8500_fg_check_capacity_limits()
1345 } else if (di->bat_cap.prev_percent != percent) { in ab8500_fg_check_capacity_limits()
1350 di->bat_cap.prev_percent = percent; in ab8500_fg_check_capacity_limits()
1351 di->bat_cap.prev_mah = di->bat_cap.mah; in ab8500_fg_check_capacity_limits()
1355 } else if (di->bat_cap.prev_percent != percent) { in ab8500_fg_check_capacity_limits()
1362 di->bat_cap.prev_percent = 1; in ab8500_fg_check_capacity_limits()
1367 percent > di->bat_cap.prev_percent) || init) { in ab8500_fg_check_capacity_limits()
1374 di->bat_cap.prev_percent, in ab8500_fg_check_capacity_limits()
1376 di->bat_cap.permille); in ab8500_fg_check_capacity_limits()
1377 di->bat_cap.prev_percent = percent; in ab8500_fg_check_capacity_limits()
1378 di->bat_cap.prev_mah = di->bat_cap.mah; in ab8500_fg_check_capacity_limits()
1384 di->bat_cap.prev_percent, in ab8500_fg_check_capacity_limits()
1386 di->bat_cap.permille); in ab8500_fg_check_capacity_limits()
1392 di->bat_cap.cap_scale.scaled_cap = in ab8500_fg_check_capacity_limits()
1396 di->bat_cap.prev_percent, in ab8500_fg_check_capacity_limits()
1397 di->bat_cap.cap_scale.scaled_cap); in ab8500_fg_check_capacity_limits()
1492 cap = di->bat_cap.user_mah; in force_capacity()
1493 if (cap > di->bat_cap.max_mah_design) { in force_capacity()
1495 " %d\n", cap, di->bat_cap.max_mah_design); in force_capacity()
1496 cap = di->bat_cap.max_mah_design; in force_capacity()
1498 ab8500_fg_fill_cap_sample(di, di->bat_cap.user_mah); in force_capacity()
1499 di->bat_cap.permille = ab8500_fg_convert_mah_to_permille(di, cap); in force_capacity()
1500 di->bat_cap.mah = cap; in force_capacity()
1509 cap = di->bat_cap.user_mah; in check_sysfs_capacity()
1512 di->bat_cap.user_mah); in check_sysfs_capacity()
1514 lower = di->bat_cap.permille - di->bm->fg_params->user_cap_limit * 10; in check_sysfs_capacity()
1515 upper = di->bat_cap.permille + di->bm->fg_params->user_cap_limit * 10; in check_sysfs_capacity()
1525 lower, cap_permille, upper, cap, di->bat_cap.mah); in check_sysfs_capacity()
1776 di->bat_cap.max_mah_design, in ab8500_fg_algorithm()
1777 di->bat_cap.max_mah, in ab8500_fg_algorithm()
1778 di->bat_cap.mah, in ab8500_fg_algorithm()
1779 di->bat_cap.permille, in ab8500_fg_algorithm()
1780 di->bat_cap.level, in ab8500_fg_algorithm()
1781 di->bat_cap.prev_mah, in ab8500_fg_algorithm()
1782 di->bat_cap.prev_percent, in ab8500_fg_algorithm()
1783 di->bat_cap.prev_level, in ab8500_fg_algorithm()
2129 di->bat_cap.max_mah_design); in ab8500_fg_get_property()
2133 di->bat_cap.max_mah); in ab8500_fg_get_property()
2139 di->bat_cap.max_mah); in ab8500_fg_get_property()
2142 di->bat_cap.prev_mah); in ab8500_fg_get_property()
2145 val->intval = di->bat_cap.max_mah_design; in ab8500_fg_get_property()
2148 val->intval = di->bat_cap.max_mah; in ab8500_fg_get_property()
2153 val->intval = di->bat_cap.max_mah; in ab8500_fg_get_property()
2155 val->intval = di->bat_cap.prev_mah; in ab8500_fg_get_property()
2162 val->intval = di->bat_cap.prev_percent; in ab8500_fg_get_property()
2169 val->intval = di->bat_cap.prev_level; in ab8500_fg_get_property()
2229 di->bat_cap.max_mah = di->bat_cap.mah; in ab8500_fg_get_ext_psy_data()
2256 di->bat_cap.max_mah_design = in ab8500_fg_get_ext_psy_data()
2259 di->bat_cap.max_mah = in ab8500_fg_get_ext_psy_data()
2260 di->bat_cap.max_mah_design; in ab8500_fg_get_ext_psy_data()
2448 return sysfs_emit(buf, "%d\n", di->bat_cap.max_mah); in charge_full_show()
2461 di->bat_cap.max_mah = (int) charge_full; in charge_full_store()
2467 return sysfs_emit(buf, "%d\n", di->bat_cap.prev_mah); in charge_now_show()
2480 di->bat_cap.user_mah = (int) charge_now; in charge_now_store()
3032 di->bat_cap.max_mah_design = di->bm->bi->charge_full_design_uah; in ab8500_fg_bind()
3033 di->bat_cap.max_mah = di->bat_cap.max_mah_design; in ab8500_fg_bind()