diff options
author | Jone Chou <jonechou@google.com> | 2022-03-14 02:50:11 +0800 |
---|---|---|
committer | Jone Chou <jonechou@google.com> | 2022-03-14 10:25:04 +0800 |
commit | daa56173946e85a7ab7209e1af0335e48c602d85 (patch) | |
tree | 189759ddd636657c856cf7272bd1f163a373c4b5 | |
parent | 80e9c96619836a1dfbdd314d3a9aadbce3810c98 (diff) | |
download | reset-daa56173946e85a7ab7209e1af0335e48c602d85.tar.gz |
power: reset: add shutdown methodandroid-t-beta-1_r0.4android-gs-raviole-5.10-t-beta-1
Use shutdown method, exynos_power_off, to detect
power key is really released, execute
acpm_prepare_reboot and then SMC to TF-A to do
real power off actions.
Bug: 201317385
Signed-off-by: Jone Chou <jonechou@google.com>
Change-Id: Ic328c705a7b130f8bca2a731e329cd2389ed7003
-rw-r--r-- | exynos-gs201-reboot.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/exynos-gs201-reboot.c b/exynos-gs201-reboot.c index 915d4aa..a649ecd 100644 --- a/exynos-gs201-reboot.c +++ b/exynos-gs201-reboot.c @@ -116,24 +116,6 @@ 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()) { - 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; } @@ -158,6 +140,27 @@ 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; @@ -238,6 +241,7 @@ 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, |