Lines Matching refs:bat_cap
224 struct ab8500_fg_battery_capacity bat_cap; member
988 return (cap_mah * 1000) / di->bat_cap.max_mah_design; in ab8500_fg_convert_mah_to_permille()
1000 return cap_pm * di->bat_cap.max_mah_design / 1000; in ab8500_fg_convert_permille_to_mah()
1036 di->bat_cap.mah, in ab8500_fg_calc_cap_charging()
1040 if (di->bat_cap.mah + di->accu_charge > 0) in ab8500_fg_calc_cap_charging()
1041 di->bat_cap.mah += di->accu_charge; in ab8500_fg_calc_cap_charging()
1043 di->bat_cap.mah = 0; in ab8500_fg_calc_cap_charging()
1048 if (di->bat_cap.mah >= di->bat_cap.max_mah_design || in ab8500_fg_calc_cap_charging()
1050 di->bat_cap.mah = di->bat_cap.max_mah_design; in ab8500_fg_calc_cap_charging()
1053 ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); in ab8500_fg_calc_cap_charging()
1054 di->bat_cap.permille = in ab8500_fg_calc_cap_charging()
1055 ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_charging()
1061 return di->bat_cap.mah; in ab8500_fg_calc_cap_charging()
1084 di->bat_cap.mah = ab8500_fg_add_cap_sample(di, mah); in ab8500_fg_calc_cap_discharge_voltage()
1085 di->bat_cap.permille = in ab8500_fg_calc_cap_discharge_voltage()
1086 ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_voltage()
1088 return di->bat_cap.mah; in ab8500_fg_calc_cap_discharge_voltage()
1105 di->bat_cap.mah, in ab8500_fg_calc_cap_discharge_fg()
1109 if (di->bat_cap.mah + di->accu_charge > 0) in ab8500_fg_calc_cap_discharge_fg()
1110 di->bat_cap.mah += di->accu_charge; in ab8500_fg_calc_cap_discharge_fg()
1112 di->bat_cap.mah = 0; in ab8500_fg_calc_cap_discharge_fg()
1114 if (di->bat_cap.mah >= di->bat_cap.max_mah_design) in ab8500_fg_calc_cap_discharge_fg()
1115 di->bat_cap.mah = di->bat_cap.max_mah_design; in ab8500_fg_calc_cap_discharge_fg()
1121 permille = ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1125 di->bat_cap.permille = permille_volt; in ab8500_fg_calc_cap_discharge_fg()
1126 di->bat_cap.mah = ab8500_fg_convert_permille_to_mah(di, in ab8500_fg_calc_cap_discharge_fg()
1127 di->bat_cap.permille); in ab8500_fg_calc_cap_discharge_fg()
1134 ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1136 ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1137 di->bat_cap.permille = in ab8500_fg_calc_cap_discharge_fg()
1138 ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); in ab8500_fg_calc_cap_discharge_fg()
1141 return di->bat_cap.mah; in ab8500_fg_calc_cap_discharge_fg()
1154 percent = DIV_ROUND_CLOSEST(di->bat_cap.permille, 10); in ab8500_fg_capacity_level()
1181 struct ab8500_fg_cap_scaling *cs = &di->bat_cap.cap_scale; in ab8500_fg_calculate_scaled_capacity()
1182 int capacity = di->bat_cap.prev_percent; in ab8500_fg_calculate_scaled_capacity()
1203 DIV_ROUND_CLOSEST(di->bat_cap.prev_percent * in ab8500_fg_calculate_scaled_capacity()
1213 if (di->bat_cap.prev_percent >= in ab8500_fg_calculate_scaled_capacity()
1217 capacity = di->bat_cap.prev_percent; in ab8500_fg_calculate_scaled_capacity()
1239 struct ab8500_fg_cap_scaling *cs = &di->bat_cap.cap_scale; in ab8500_fg_update_cap_scalers()
1244 di->bat_cap.cap_scale.disable_cap_level = in ab8500_fg_update_cap_scalers()
1245 di->bat_cap.cap_scale.scaled_cap; in ab8500_fg_update_cap_scalers()
1247 di->bat_cap.cap_scale.disable_cap_level); in ab8500_fg_update_cap_scalers()
1251 cs->cap_to_scale[1] = di->bat_cap.prev_percent; in ab8500_fg_update_cap_scalers()
1255 max(di->bat_cap.prev_percent, in ab8500_fg_update_cap_scalers()
1275 int percent = DIV_ROUND_CLOSEST(di->bat_cap.permille, 10); in ab8500_fg_check_capacity_limits()
1277 di->bat_cap.level = ab8500_fg_capacity_level(di); in ab8500_fg_check_capacity_limits()
1279 if (di->bat_cap.level != di->bat_cap.prev_level) { in ab8500_fg_check_capacity_limits()
1284 if (!(!di->flags.charging && di->bat_cap.level > in ab8500_fg_check_capacity_limits()
1285 di->bat_cap.prev_level) || init) { in ab8500_fg_check_capacity_limits()
1287 di->bat_cap.prev_level, in ab8500_fg_check_capacity_limits()
1288 di->bat_cap.level); in ab8500_fg_check_capacity_limits()
1289 di->bat_cap.prev_level = di->bat_cap.level; in ab8500_fg_check_capacity_limits()
1294 di->bat_cap.prev_level, in ab8500_fg_check_capacity_limits()
1295 di->bat_cap.level); in ab8500_fg_check_capacity_limits()
1305 di->bat_cap.prev_percent = 0; in ab8500_fg_check_capacity_limits()
1306 di->bat_cap.permille = 0; in ab8500_fg_check_capacity_limits()
1308 di->bat_cap.prev_mah = 0; in ab8500_fg_check_capacity_limits()
1309 di->bat_cap.mah = 0; in ab8500_fg_check_capacity_limits()
1317 di->bat_cap.prev_percent = percent; in ab8500_fg_check_capacity_limits()
1318 di->bat_cap.prev_mah = di->bat_cap.mah; in ab8500_fg_check_capacity_limits()
1322 if (!di->bat_cap.cap_scale.enable && in ab8500_fg_check_capacity_limits()
1324 di->bat_cap.cap_scale.enable = true; in ab8500_fg_check_capacity_limits()
1325 di->bat_cap.cap_scale.cap_to_scale[0] = 100; in ab8500_fg_check_capacity_limits()
1326 di->bat_cap.cap_scale.cap_to_scale[1] = in ab8500_fg_check_capacity_limits()
1327 di->bat_cap.prev_percent; in ab8500_fg_check_capacity_limits()
1328 di->bat_cap.cap_scale.disable_cap_level = 100; in ab8500_fg_check_capacity_limits()
1330 } else if (di->bat_cap.prev_percent != percent) { in ab8500_fg_check_capacity_limits()
1335 di->bat_cap.prev_percent = percent; in ab8500_fg_check_capacity_limits()
1336 di->bat_cap.prev_mah = di->bat_cap.mah; in ab8500_fg_check_capacity_limits()
1340 } else if (di->bat_cap.prev_percent != percent) { in ab8500_fg_check_capacity_limits()
1347 di->bat_cap.prev_percent = 1; in ab8500_fg_check_capacity_limits()
1352 percent > di->bat_cap.prev_percent) || init) { in ab8500_fg_check_capacity_limits()
1359 di->bat_cap.prev_percent, in ab8500_fg_check_capacity_limits()
1361 di->bat_cap.permille); in ab8500_fg_check_capacity_limits()
1362 di->bat_cap.prev_percent = percent; in ab8500_fg_check_capacity_limits()
1363 di->bat_cap.prev_mah = di->bat_cap.mah; in ab8500_fg_check_capacity_limits()
1369 di->bat_cap.prev_percent, in ab8500_fg_check_capacity_limits()
1371 di->bat_cap.permille); in ab8500_fg_check_capacity_limits()
1377 di->bat_cap.cap_scale.scaled_cap = in ab8500_fg_check_capacity_limits()
1381 di->bat_cap.prev_percent, in ab8500_fg_check_capacity_limits()
1382 di->bat_cap.cap_scale.scaled_cap); in ab8500_fg_check_capacity_limits()
1477 cap = di->bat_cap.user_mah; in force_capacity()
1478 if (cap > di->bat_cap.max_mah_design) { in force_capacity()
1480 " %d\n", cap, di->bat_cap.max_mah_design); in force_capacity()
1481 cap = di->bat_cap.max_mah_design; in force_capacity()
1483 ab8500_fg_fill_cap_sample(di, di->bat_cap.user_mah); in force_capacity()
1484 di->bat_cap.permille = ab8500_fg_convert_mah_to_permille(di, cap); in force_capacity()
1485 di->bat_cap.mah = cap; in force_capacity()
1494 cap = di->bat_cap.user_mah; in check_sysfs_capacity()
1497 di->bat_cap.user_mah); in check_sysfs_capacity()
1499 lower = di->bat_cap.permille - di->bm->fg_params->user_cap_limit * 10; in check_sysfs_capacity()
1500 upper = di->bat_cap.permille + di->bm->fg_params->user_cap_limit * 10; in check_sysfs_capacity()
1510 lower, cap_permille, upper, cap, di->bat_cap.mah); in check_sysfs_capacity()
1760 di->bat_cap.max_mah_design, in ab8500_fg_algorithm()
1761 di->bat_cap.max_mah, in ab8500_fg_algorithm()
1762 di->bat_cap.mah, in ab8500_fg_algorithm()
1763 di->bat_cap.permille, in ab8500_fg_algorithm()
1764 di->bat_cap.level, in ab8500_fg_algorithm()
1765 di->bat_cap.prev_mah, in ab8500_fg_algorithm()
1766 di->bat_cap.prev_percent, in ab8500_fg_algorithm()
1767 di->bat_cap.prev_level, in ab8500_fg_algorithm()
2113 di->bat_cap.max_mah_design); in ab8500_fg_get_property()
2117 di->bat_cap.max_mah); in ab8500_fg_get_property()
2123 di->bat_cap.max_mah); in ab8500_fg_get_property()
2126 di->bat_cap.prev_mah); in ab8500_fg_get_property()
2129 val->intval = di->bat_cap.max_mah_design; in ab8500_fg_get_property()
2132 val->intval = di->bat_cap.max_mah; in ab8500_fg_get_property()
2137 val->intval = di->bat_cap.max_mah; in ab8500_fg_get_property()
2139 val->intval = di->bat_cap.prev_mah; in ab8500_fg_get_property()
2146 val->intval = di->bat_cap.prev_percent; in ab8500_fg_get_property()
2153 val->intval = di->bat_cap.prev_level; in ab8500_fg_get_property()
2211 di->bat_cap.max_mah = di->bat_cap.mah; in ab8500_fg_get_ext_psy_data()
2240 di->bat_cap.max_mah_design = in ab8500_fg_get_ext_psy_data()
2244 di->bat_cap.max_mah = in ab8500_fg_get_ext_psy_data()
2245 di->bat_cap.max_mah_design; in ab8500_fg_get_ext_psy_data()
2429 return sprintf(buf, "%d\n", di->bat_cap.max_mah); in charge_full_show()
2443 di->bat_cap.max_mah = (int) charge_full; in charge_full_store()
2451 return sprintf(buf, "%d\n", di->bat_cap.prev_mah); in charge_now_show()
2463 ret, charge_now, di->bat_cap.prev_mah); in charge_now_store()
2466 di->bat_cap.user_mah = (int) charge_now; in charge_now_store()
3073 di->bat_cap.max_mah_design = MILLI_TO_MICRO * in ab8500_fg_probe()
3076 di->bat_cap.max_mah = di->bat_cap.max_mah_design; in ab8500_fg_probe()