--- zzzz-none-000/linux-4.4.60/drivers/power/reset/msm-poweroff.c 2017-04-08 07:53:53.000000000 +0000 +++ dragonfly-4020-701/linux-4.4.60/drivers/power/reset/msm-poweroff.c 2018-11-08 13:36:17.000000000 +0000 @@ -21,9 +21,10 @@ #include #include #include +#include static void __iomem *msm_ps_hold; -static int do_msm_restart(struct notifier_block *nb, unsigned long action, +int do_msm_restart(struct notifier_block *nb, unsigned long action, void *data) { writel(0, msm_ps_hold); @@ -43,6 +44,22 @@ do_msm_restart(&restart_nb, 0, NULL); } +static void do_arm_pm_restart(enum reboot_mode reboot_mode, const char *cmd) { + do_msm_restart(0, 0, 0); +} + +static int do_msm_reboot_notifier(struct notifier_block *nb, + unsigned long action, void *data) +{ + /* Normal Reboot Enable PS HOLD reset sequence */ + arm_pm_restart = do_arm_pm_restart; + return NOTIFY_DONE; +} + +static struct notifier_block reboot_nb1 = { + .notifier_call = do_msm_reboot_notifier, +}; + static int msm_restart_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -53,10 +70,10 @@ if (IS_ERR(msm_ps_hold)) return PTR_ERR(msm_ps_hold); - register_restart_handler(&restart_nb); - pm_power_off = do_msm_poweroff; + register_reboot_notifier(&reboot_nb1); + return 0; }