Skip to content
Snippets Groups Projects
Commit 9ce01413 authored by Dmitry Osipenko's avatar Dmitry Osipenko
Browse files

firmware: psci: Switch to sys-off handler


Use sys-off handler that replaces global pm_power_off variable, allows
to register multiple power-off handlers and includes own reset handler.

Signed-off-by: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
parent ac2b2c47
No related branches found
No related tags found
No related merge requests found
...@@ -296,10 +296,9 @@ static int get_set_conduit_method(struct device_node *np) ...@@ -296,10 +296,9 @@ static int get_set_conduit_method(struct device_node *np)
return 0; return 0;
} }
static int psci_sys_reset(struct notifier_block *nb, unsigned long action, static void psci_sys_reset(struct restart_data *data)
void *data)
{ {
if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) && if ((data->mode == REBOOT_WARM || data->mode == REBOOT_SOFT) &&
psci_system_reset2_supported) { psci_system_reset2_supported) {
/* /*
* reset_type[31] = 0 (architectural) * reset_type[31] = 0 (architectural)
...@@ -310,20 +309,19 @@ static int psci_sys_reset(struct notifier_block *nb, unsigned long action, ...@@ -310,20 +309,19 @@ static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
} else { } else {
invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
} }
return NOTIFY_DONE;
} }
static struct notifier_block psci_sys_reset_nb = { static void psci_sys_poweroff(struct power_off_data *data)
.notifier_call = psci_sys_reset,
.priority = 129,
};
static void psci_sys_poweroff(void)
{ {
invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
} }
static struct sys_off_handler psci_sys_off = {
.restart_cb = psci_sys_reset,
.restart_priority = RESTART_PRIO_DEFAULT + 1,
.power_off_cb = psci_sys_poweroff,
};
static int __init psci_features(u32 psci_func_id) static int __init psci_features(u32 psci_func_id)
{ {
return invoke_psci_fn(PSCI_1_0_FN_PSCI_FEATURES, return invoke_psci_fn(PSCI_1_0_FN_PSCI_FEATURES,
...@@ -485,9 +483,7 @@ static void __init psci_0_2_set_functions(void) ...@@ -485,9 +483,7 @@ static void __init psci_0_2_set_functions(void)
.migrate_info_type = psci_migrate_info_type, .migrate_info_type = psci_migrate_info_type,
}; };
register_restart_handler(&psci_sys_reset_nb); register_sys_off_handler(&psci_sys_off);
pm_power_off = psci_sys_poweroff;
} }
/* /*
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment