/********************** Boot threshold voltage limit is set in the ADC driver,judge here only to prevent 0% capacity but voltage is more than 3.5V leading to shut down immediately after boot ***********************/ static void battery_capacity_check(struct bq27541_device_info *di) { int rsoc; rsoc = bq27410_battery_rsoc(di); if(rsoc <= 0){ if(is_usbcharging()){ printk("usb charging and capacity less than 0%,continue charging\n"); low_usb_charge = true; return; }else if(!is_accharging()){ printk("no charging and capacity less than 0%,power off\n"); kernel_power_off(); } } return; }
/********************** Boot threshold voltage limit is set in the ADC driver,judge here only to prevent 0% capacity but voltage is more than 3.5V leading to shut down immediately after boot ***********************/ static void battery_capacity_check(struct bq27541_device_info *di) { int rsoc; rsoc = bq27541_battery_rsoc(di); if(rsoc <= 0){ if(is_usbcharging()){ printk("usb charging and capacity less than 0%,continue charging\n"); low_usb_charge = true; return; }else if(!is_accharging()){ printk("no charging and capacity less than 0%,power off\n"); kernel_power_off(); } } #if defined(CONFIG_REBOOT_TO_POWER_OFF) if ((board_boot_mode() == BOOT_MODE_REBOOT) ) if((0 == charge_status_now) && (rsoc <= 5)) kernel_power_off(); #endif return; }