Lines Matching refs:bat_cap
227 struct ab8500_fg_battery_capacity bat_cap; member
1007 return (cap_mah * 1000) / di->bat_cap.max_mah_design; in ab8500_fg_convert_mah_to_permille()
1019 return cap_pm * di->bat_cap.max_mah_design / 1000; in ab8500_fg_convert_permille_to_mah()
1060 di->bat_cap.mah, in ab8500_fg_calc_cap_charging()
1064 if (di->bat_cap.mah + di->accu_charge > 0) in ab8500_fg_calc_cap_charging()
1065 di->bat_cap.mah += di->accu_charge; in ab8500_fg_calc_cap_charging()
1067 di->bat_cap.mah = 0; in ab8500_fg_calc_cap_charging()
1072 if (di->bat_cap.mah >= di->bat_cap.max_mah_design || in ab8500_fg_calc_cap_charging()
1074 di->bat_cap.mah = di->bat_cap.max_mah_design; in ab8500_fg_calc_cap_charging()
1077 ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); in ab8500_fg_calc_cap_charging()
1078 di->bat_cap.permille = in ab8500_fg_calc_cap_charging()
1079 ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_charging()
1085 return di->bat_cap.mah; in ab8500_fg_calc_cap_charging()
1104 di->bat_cap.mah = ab8500_fg_add_cap_sample(di, mah); in ab8500_fg_calc_cap_discharge_voltage()
1105 di->bat_cap.permille = in ab8500_fg_calc_cap_discharge_voltage()
1106 ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_voltage()
1108 return di->bat_cap.mah; in ab8500_fg_calc_cap_discharge_voltage()
1125 di->bat_cap.mah, in ab8500_fg_calc_cap_discharge_fg()
1129 if (di->bat_cap.mah + di->accu_charge > 0) in ab8500_fg_calc_cap_discharge_fg()
1130 di->bat_cap.mah += di->accu_charge; in ab8500_fg_calc_cap_discharge_fg()
1132 di->bat_cap.mah = 0; in ab8500_fg_calc_cap_discharge_fg()
1134 if (di->bat_cap.mah >= di->bat_cap.max_mah_design) in ab8500_fg_calc_cap_discharge_fg()
1135 di->bat_cap.mah = di->bat_cap.max_mah_design; in ab8500_fg_calc_cap_discharge_fg()
1141 permille = ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1145 di->bat_cap.permille = permille_volt; in ab8500_fg_calc_cap_discharge_fg()
1146 di->bat_cap.mah = ab8500_fg_convert_permille_to_mah(di, in ab8500_fg_calc_cap_discharge_fg()
1147 di->bat_cap.permille); in ab8500_fg_calc_cap_discharge_fg()
1154 ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1156 ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1157 di->bat_cap.permille = in ab8500_fg_calc_cap_discharge_fg()
1158 ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1161 return di->bat_cap.mah; in ab8500_fg_calc_cap_discharge_fg()
1174 percent = DIV_ROUND_CLOSEST(di->bat_cap.permille, 10); in ab8500_fg_capacity_level()
1201 struct ab8500_fg_cap_scaling *cs = &di->bat_cap.cap_scale; in ab8500_fg_calculate_scaled_capacity()
1202 int capacity = di->bat_cap.prev_percent; in ab8500_fg_calculate_scaled_capacity()
1223 DIV_ROUND_CLOSEST(di->bat_cap.prev_percent * in ab8500_fg_calculate_scaled_capacity()
1233 if (di->bat_cap.prev_percent >= in ab8500_fg_calculate_scaled_capacity()
1237 capacity = di->bat_cap.prev_percent; in ab8500_fg_calculate_scaled_capacity()
1259 struct ab8500_fg_cap_scaling *cs = &di->bat_cap.cap_scale; in ab8500_fg_update_cap_scalers()
1264 di->bat_cap.cap_scale.disable_cap_level = in ab8500_fg_update_cap_scalers()
1265 di->bat_cap.cap_scale.scaled_cap; in ab8500_fg_update_cap_scalers()
1267 di->bat_cap.cap_scale.disable_cap_level); in ab8500_fg_update_cap_scalers()
1271 cs->cap_to_scale[1] = di->bat_cap.prev_percent; in ab8500_fg_update_cap_scalers()
1275 max(di->bat_cap.prev_percent, in ab8500_fg_update_cap_scalers()
1295 int percent = DIV_ROUND_CLOSEST(di->bat_cap.permille, 10); in ab8500_fg_check_capacity_limits()
1297 di->bat_cap.level = ab8500_fg_capacity_level(di); in ab8500_fg_check_capacity_limits()
1299 if (di->bat_cap.level != di->bat_cap.prev_level) { in ab8500_fg_check_capacity_limits()
1304 if (!(!di->flags.charging && di->bat_cap.level > in ab8500_fg_check_capacity_limits()
1305 di->bat_cap.prev_level) || init) { in ab8500_fg_check_capacity_limits()
1307 di->bat_cap.prev_level, in ab8500_fg_check_capacity_limits()
1308 di->bat_cap.level); in ab8500_fg_check_capacity_limits()
1309 di->bat_cap.prev_level = di->bat_cap.level; in ab8500_fg_check_capacity_limits()
1314 di->bat_cap.prev_level, in ab8500_fg_check_capacity_limits()
1315 di->bat_cap.level); in ab8500_fg_check_capacity_limits()
1325 di->bat_cap.prev_percent = 0; in ab8500_fg_check_capacity_limits()
1326 di->bat_cap.permille = 0; in ab8500_fg_check_capacity_limits()
1328 di->bat_cap.prev_mah = 0; in ab8500_fg_check_capacity_limits()
1329 di->bat_cap.mah = 0; in ab8500_fg_check_capacity_limits()
1337 di->bat_cap.prev_percent = percent; in ab8500_fg_check_capacity_limits()
1338 di->bat_cap.prev_mah = di->bat_cap.mah; in ab8500_fg_check_capacity_limits()
1342 if (!di->bat_cap.cap_scale.enable && in ab8500_fg_check_capacity_limits()
1344 di->bat_cap.cap_scale.enable = true; in ab8500_fg_check_capacity_limits()
1345 di->bat_cap.cap_scale.cap_to_scale[0] = 100; in ab8500_fg_check_capacity_limits()
1346 di->bat_cap.cap_scale.cap_to_scale[1] = in ab8500_fg_check_capacity_limits()
1347 di->bat_cap.prev_percent; in ab8500_fg_check_capacity_limits()
1348 di->bat_cap.cap_scale.disable_cap_level = 100; in ab8500_fg_check_capacity_limits()
1350 } else if (di->bat_cap.prev_percent != percent) { in ab8500_fg_check_capacity_limits()
1355 di->bat_cap.prev_percent = percent; in ab8500_fg_check_capacity_limits()
1356 di->bat_cap.prev_mah = di->bat_cap.mah; in ab8500_fg_check_capacity_limits()
1360 } else if (di->bat_cap.prev_percent != percent) { in ab8500_fg_check_capacity_limits()
1367 di->bat_cap.prev_percent = 1; in ab8500_fg_check_capacity_limits()
1372 percent > di->bat_cap.prev_percent) || init) { in ab8500_fg_check_capacity_limits()
1379 di->bat_cap.prev_percent, in ab8500_fg_check_capacity_limits()
1381 di->bat_cap.permille); in ab8500_fg_check_capacity_limits()
1382 di->bat_cap.prev_percent = percent; in ab8500_fg_check_capacity_limits()
1383 di->bat_cap.prev_mah = di->bat_cap.mah; in ab8500_fg_check_capacity_limits()
1389 di->bat_cap.prev_percent, in ab8500_fg_check_capacity_limits()
1391 di->bat_cap.permille); in ab8500_fg_check_capacity_limits()
1397 di->bat_cap.cap_scale.scaled_cap = in ab8500_fg_check_capacity_limits()
1401 di->bat_cap.prev_percent, in ab8500_fg_check_capacity_limits()
1402 di->bat_cap.cap_scale.scaled_cap); in ab8500_fg_check_capacity_limits()
1497 cap = di->bat_cap.user_mah; in force_capacity()
1498 if (cap > di->bat_cap.max_mah_design) { in force_capacity()
1500 " %d\n", cap, di->bat_cap.max_mah_design); in force_capacity()
1501 cap = di->bat_cap.max_mah_design; in force_capacity()
1503 ab8500_fg_fill_cap_sample(di, di->bat_cap.user_mah); in force_capacity()
1504 di->bat_cap.permille = ab8500_fg_convert_mah_to_permille(di, cap); in force_capacity()
1505 di->bat_cap.mah = cap; in force_capacity()
1514 cap = di->bat_cap.user_mah; in check_sysfs_capacity()
1517 di->bat_cap.user_mah); in check_sysfs_capacity()
1519 lower = di->bat_cap.permille - di->bm->fg_params->user_cap_limit * 10; in check_sysfs_capacity()
1520 upper = di->bat_cap.permille + di->bm->fg_params->user_cap_limit * 10; in check_sysfs_capacity()
1530 lower, cap_permille, upper, cap, di->bat_cap.mah); in check_sysfs_capacity()
1781 di->bat_cap.max_mah_design, in ab8500_fg_algorithm()
1782 di->bat_cap.max_mah, in ab8500_fg_algorithm()
1783 di->bat_cap.mah, in ab8500_fg_algorithm()
1784 di->bat_cap.permille, in ab8500_fg_algorithm()
1785 di->bat_cap.level, in ab8500_fg_algorithm()
1786 di->bat_cap.prev_mah, in ab8500_fg_algorithm()
1787 di->bat_cap.prev_percent, in ab8500_fg_algorithm()
1788 di->bat_cap.prev_level, in ab8500_fg_algorithm()
2134 di->bat_cap.max_mah_design); in ab8500_fg_get_property()
2138 di->bat_cap.max_mah); in ab8500_fg_get_property()
2144 di->bat_cap.max_mah); in ab8500_fg_get_property()
2147 di->bat_cap.prev_mah); in ab8500_fg_get_property()
2150 val->intval = di->bat_cap.max_mah_design; in ab8500_fg_get_property()
2153 val->intval = di->bat_cap.max_mah; in ab8500_fg_get_property()
2158 val->intval = di->bat_cap.max_mah; in ab8500_fg_get_property()
2160 val->intval = di->bat_cap.prev_mah; in ab8500_fg_get_property()
2167 val->intval = di->bat_cap.prev_percent; in ab8500_fg_get_property()
2174 val->intval = di->bat_cap.prev_level; in ab8500_fg_get_property()
2234 di->bat_cap.max_mah = di->bat_cap.mah; in ab8500_fg_get_ext_psy_data()
2261 di->bat_cap.max_mah_design = in ab8500_fg_get_ext_psy_data()
2264 di->bat_cap.max_mah = in ab8500_fg_get_ext_psy_data()
2265 di->bat_cap.max_mah_design; in ab8500_fg_get_ext_psy_data()
2454 return sysfs_emit(buf, "%d\n", di->bat_cap.max_mah); in charge_full_show()
2467 di->bat_cap.max_mah = (int) charge_full; in charge_full_store()
2473 return sysfs_emit(buf, "%d\n", di->bat_cap.prev_mah); in charge_now_show()
2486 di->bat_cap.user_mah = (int) charge_now; in charge_now_store()
3038 di->bat_cap.max_mah_design = di->bm->bi->charge_full_design_uah; in ab8500_fg_bind()
3039 di->bat_cap.max_mah = di->bat_cap.max_mah_design; in ab8500_fg_bind()