From e081ae51adb8424a3e452ee2fb0977ab88cd137a Mon Sep 17 00:00:00 2001 From: Lei Chen Date: Wed, 23 Aug 2023 11:15:41 +0800 Subject: [PATCH] charger:optimize the factory shutdown sequence The device auto reboot after shutdown command receive in factory. The correct seq is sending shutdown command-->unplug the USB cable -->device shutdown. Optimize the shutdown sequence for factory. Change-Id: I7f66f932c782192776b36d96457548d49947bd18 Signed-off-by: Lei Chen Reviewed-on: https://gerrit.mot.com/2717398 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Reviewed-by: Lei Chen Tested-by: Jira Key Reviewed-by: Wei Xu Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- drivers/power/mmi_charger/mmi_charger.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/mmi_charger/mmi_charger.c b/drivers/power/mmi_charger/mmi_charger.c index 97a5b6e63579..e69b044a91b0 100644 --- a/drivers/power/mmi_charger/mmi_charger.c +++ b/drivers/power/mmi_charger/mmi_charger.c @@ -238,6 +238,7 @@ struct mmi_charger_chip { int max_chrg_temp; bool enable_charging_limit; bool enable_factory_poweroff; + bool factory_syspoweroff_wait; bool start_factory_kill_disabled; int upper_limit_capacity; int lower_limit_capacity; @@ -2614,7 +2615,7 @@ static int mmi_charger_reboot(struct notifier_block *nb, chip->force_charger_disabled = true; schedule_delayed_work(&chip->heartbeat_work, msecs_to_jiffies(0)); while (chip->max_charger_rate != MMI_POWER_SUPPLY_CHARGE_RATE_NONE && - shutdown_triggered && !chip->empty_vbat_shutdown_triggered) { + (shutdown_triggered || chip->factory_syspoweroff_wait) && !chip->empty_vbat_shutdown_triggered) { mmi_info(chip, "Wait for charger removal\n"); msleep(100); } @@ -2758,6 +2759,9 @@ static int mmi_parse_dt(struct mmi_charger_chip *chip) chip->enable_factory_poweroff = of_property_read_bool(node, "mmi,enable-factory-poweroff"); + chip->factory_syspoweroff_wait = + of_property_read_bool(node, "mmi,factory-syspoweroff-wait"); + chip->start_factory_kill_disabled = of_property_read_bool(node, "mmi,start-factory-kill-disabled");