diff options
author | Jone Chou <jonechou@google.com> | 2022-06-07 17:08:40 +0800 |
---|---|---|
committer | Jone Chou <jonechou@google.com> | 2022-06-07 18:33:41 +0000 |
commit | ffb7c17de003c5226344505eae1c49af68d2e32a (patch) | |
tree | 20ca0213a9113ae08c1c593ff85ced21df4423ab | |
parent | 979edce12fa782d2a70de8b2e4bc4d222ca02cb5 (diff) | |
download | reset-ffb7c17de003c5226344505eae1c49af68d2e32a.tar.gz |
power: reset: power key detection only when power off
1. In power off flow:
- detect power key is really released
- execute acpm_prepare_reboot
- AOSP send SMC to TF-A to do real power off action.
2. In cold reboot flow:
- skip power key detection
- execute acpm_prepare_reboot
- AOSP send SMC to TF-A to do real cold reboot action
Bug: 234066226
Signed-off-by: Jone Chou <jonechou@google.com>
Change-Id: Id9ace2c2b8a9841f5f5ac978b8650cad793c0d7a
(cherry picked from commit 4cc727a5900bc7473b8c0f3b075c6ae63d91e0f9)
-rw-r--r-- | exynos-gs201-reboot.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/exynos-gs201-reboot.c b/exynos-gs201-reboot.c index 0f25600..a8aa509 100644 --- a/exynos-gs201-reboot.c +++ b/exynos-gs201-reboot.c @@ -107,6 +107,27 @@ static int exynos_reboot_handler(struct notifier_block *nb, unsigned long mode, { exynos_reboot_parse(cmd); + if (mode != SYS_POWER_OFF) + return NOTIFY_DONE; + + while (1) { + /* wait for power button release */ + if (!pmic_read_pwrkey_status()) { +#if IS_ENABLED(CONFIG_GS_ACPM) + acpm_prepare_reboot(); +#endif + pr_info("ready to do power off.\n"); + break; + } else { + /* + * if power button is not released, + * wait and check TA again + */ + pr_info("PWR Key is not released.\n"); + } + mdelay(1000); + } + return NOTIFY_DONE; } @@ -131,27 +152,6 @@ static struct notifier_block exynos_restart_nb = { .priority = 130, }; -static void exynos_power_off(struct platform_device *pdev) -{ - while (1) { - /* wait for power button release */ - if (!pmic_read_pwrkey_status()) { -#if IS_ENABLED(CONFIG_GS_ACPM) - acpm_prepare_reboot(); -#endif - pr_info("ready to do power off.\n"); - break; - } else { - /* - * if power button is not released, - * wait and check TA again - */ - pr_info("PWR Key is not released.\n"); - } - mdelay(1000); - } -} - static int exynos_reboot_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -210,7 +210,6 @@ static const struct of_device_id exynos_reboot_of_match[] = { static struct platform_driver exynos_reboot_driver = { .probe = exynos_reboot_probe, - .shutdown = exynos_power_off, .driver = { .name = "exynos-reboot", .of_match_table = exynos_reboot_of_match, |