diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-13 12:05:23 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-30 08:23:21 +0200 |
commit | dc247478c67d663b6e3f5ce639e06b23b54e6aff (patch) | |
tree | 7414c9d540c5d4600d161cf0bb72ccbd0e3da564 /arch/arm/mach-pxa | |
parent | 441e9f5a72b245b671118f3e771eb129834a7a34 (diff) | |
download | barebox-dc247478c67d663b6e3f5ce639e06b23b54e6aff.tar.gz barebox-dc247478c67d663b6e3f5ce639e06b23b54e6aff.tar.xz |
poweroff: Allow to register poweroff handlers
Allow to register handlers for poweroff. This allows to have multiple
poweroff implementations in a single binary. The implementation is close
to the restart handlers.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/pxa2xx.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa3xx.c | 13 |
2 files changed, 24 insertions, 4 deletions
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c index b712b388c8..e28378e6db 100644 --- a/arch/arm/mach-pxa/pxa2xx.c +++ b/arch/arm/mach-pxa/pxa2xx.c @@ -14,6 +14,7 @@ #include <common.h> #include <init.h> +#include <poweroff.h> #include <reset_source.h> #include <mach/hardware.h> #include <mach/pxa-regs.h> @@ -46,9 +47,7 @@ void pxa_clear_reset_source(void) RCSR = RCSR_GPR | RCSR_SMR | RCSR_WDR | RCSR_HWR; } -device_initcall(pxa_detect_reset_source); - -void __noreturn poweroff(void) +static void __noreturn pxa2xx_poweroff(struct poweroff_handler *handler) { shutdown_barebox(); @@ -57,3 +56,13 @@ void __noreturn poweroff(void) pxa_suspend(PWRMODE_DEEPSLEEP); unreachable(); } + +static int pxa2xx_init(void) +{ + poweroff_handler_register_fn(pxa2xx_poweroff); + + pxa_detect_reset_source(); + + return 0; +} +device_initcall(pxa2xx_init); diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 86ca63b160..ccfd952b5e 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -14,6 +14,7 @@ #include <common.h> #include <init.h> +#include <poweroff.h> #include <reset_source.h> #include <mach/hardware.h> #include <mach/pxa-regs.h> @@ -48,7 +49,7 @@ void pxa_clear_reset_source(void) device_initcall(pxa_detect_reset_source); -void __noreturn poweroff(void) +static void __noreturn pxa3xx_poweroff(struct poweroff_handler *handler) { shutdown_barebox(); @@ -57,3 +58,13 @@ void __noreturn poweroff(void) pxa3xx_suspend(PXA3xx_PM_S3D4C4); unreachable(); } + +static int pxa3xx_init(void) +{ + poweroff_handler_register_fn(pxa3xx_poweroff); + + pxa_detect_reset_source(); + + return 0; +} +device_initcall(pxa3xx_init); |