mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 09:12:08 +02:00
power🦇trats: Break battery charging with ctrl+C
Add support for disabling battery charging with ctrl+C keyboard combination pressed. Moreover the battery update is done more frequently. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Tom Rini <trini@ti.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
This commit is contained in:
committed by
Minkyu Kang
parent
9199fce239
commit
9dfa3d0734
@@ -41,18 +41,23 @@ static int power_battery_charge(struct pmic *bat)
|
|||||||
for (k = 0; bat->chrg->chrg_bat_present(p_bat->chrg) &&
|
for (k = 0; bat->chrg->chrg_bat_present(p_bat->chrg) &&
|
||||||
bat->chrg->chrg_type(p_bat->muic) &&
|
bat->chrg->chrg_type(p_bat->muic) &&
|
||||||
battery->state_of_chrg < 100; k++) {
|
battery->state_of_chrg < 100; k++) {
|
||||||
udelay(10000000);
|
udelay(2000000);
|
||||||
|
if (!(k % 5))
|
||||||
puts(".");
|
puts(".");
|
||||||
bat->fg->fg_battery_update(p_bat->fg, bat);
|
bat->fg->fg_battery_update(p_bat->fg, bat);
|
||||||
|
|
||||||
if (k == 100) {
|
if (k == 200) {
|
||||||
debug(" %d [V]", battery->voltage_uV);
|
debug(" %d [V]", battery->voltage_uV);
|
||||||
puts("\n");
|
puts("\n");
|
||||||
k = 0;
|
k = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctrlc()) {
|
||||||
|
printf("\nCharging disabled on request.\n");
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
exit:
|
||||||
bat->chrg->chrg_state(p_bat->chrg, CHARGER_DISABLE, 0);
|
bat->chrg->chrg_state(p_bat->chrg, CHARGER_DISABLE, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -205,7 +205,8 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||||||
|
|
||||||
if (strcmp(argv[3], "charge") == 0) {
|
if (strcmp(argv[3], "charge") == 0) {
|
||||||
if (p->pbat) {
|
if (p->pbat) {
|
||||||
printf("PRINT BAT charge %s\n", p->name);
|
printf("BAT: %s charging (ctrl+c to break)\n",
|
||||||
|
p->name);
|
||||||
if (p->low_power_mode)
|
if (p->low_power_mode)
|
||||||
p->low_power_mode();
|
p->low_power_mode();
|
||||||
if (p->pbat->battery_charge)
|
if (p->pbat->battery_charge)
|
||||||
|
Reference in New Issue
Block a user