Lines Matching full:bat
193 static int power_update_battery(struct pmic *p, struct pmic *bat) in power_update_battery() argument
195 struct power_battery *pb = bat->pbat; in power_update_battery()
205 pb->bat->state_of_chrg = (val >> 8); in power_update_battery()
209 pb->bat->voltage_uV = ((val & 0xFFUL) >> 3) + ((val & 0xFF00) >> 3); in power_update_battery()
210 pb->bat->voltage_uV = (pb->bat->voltage_uV * 625); in power_update_battery()
213 pb->bat->capacity = val >> 2; in power_update_battery()
218 static int power_check_battery(struct pmic *p, struct pmic *bat) in power_check_battery() argument
220 struct power_battery *pb = bat->pbat; in power_check_battery()
236 pb->bat->version = val; in power_check_battery()
238 power_update_battery(p, bat); in power_check_battery()
239 debug("fg ver: 0x%x\n", pb->bat->version); in power_check_battery()
240 printf("BAT: state_of_charge(SOC):%d%%\n", in power_check_battery()
241 pb->bat->state_of_chrg); in power_check_battery()
244 pb->bat->voltage_uV / 1000000, in power_check_battery()
245 pb->bat->voltage_uV % 1000000, in power_check_battery()
246 pb->bat->capacity); in power_check_battery()
248 if (pb->bat->voltage_uV > 3850000) in power_check_battery()
249 pb->bat->state = EXT_SOURCE; in power_check_battery()
250 else if (pb->bat->voltage_uV < 3600000 || pb->bat->state_of_chrg < 5) in power_check_battery()
251 pb->bat->state = CHARGE; in power_check_battery()
253 pb->bat->state = NORMAL; in power_check_battery()