mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-17 18:36:00 +00:00
parisc: lasi: Register LASI power-off feature as sys_off_handler
Prefer the Linux kernel sys_off_handler functionality over a home-grown implementation. Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
parent
706a741595
commit
e71d47dc2a
@ -97,18 +97,12 @@ void machine_restart(char *cmd)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*chassis_power_off)(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This routine is called from sys_reboot to actually turn off the
|
* This routine is called from sys_reboot to actually turn off the
|
||||||
* machine
|
* machine
|
||||||
*/
|
*/
|
||||||
void machine_power_off(void)
|
void machine_power_off(void)
|
||||||
{
|
{
|
||||||
/* If there is a registered power off handler, call it. */
|
|
||||||
if (chassis_power_off)
|
|
||||||
chassis_power_off();
|
|
||||||
|
|
||||||
/* Put the soft power button back under hardware control.
|
/* Put the soft power button back under hardware control.
|
||||||
* If the user had already pressed the power button, the
|
* If the user had already pressed the power button, the
|
||||||
* following call will immediately power off. */
|
* following call will immediately power off. */
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/pm.h>
|
#include <linux/pm.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#include <linux/reboot.h>
|
||||||
|
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/hardware.h>
|
#include <asm/hardware.h>
|
||||||
@ -145,23 +146,19 @@ static void __init lasi_led_init(unsigned long lasi_hpa)
|
|||||||
* 1 to PWR_ON_L in the Power Control Register
|
* 1 to PWR_ON_L in the Power Control Register
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
static int lasi_power_off(struct sys_off_data *data)
|
||||||
static unsigned long lasi_power_off_hpa __read_mostly;
|
|
||||||
|
|
||||||
static void lasi_power_off(void)
|
|
||||||
{
|
{
|
||||||
unsigned long datareg;
|
struct gsc_asic *lasi = data->cb_data;
|
||||||
|
|
||||||
/* calculate addr of the Power Control Register */
|
/* Power down the machine via Power Control Register */
|
||||||
datareg = lasi_power_off_hpa + 0x0000C000;
|
gsc_writel(0x02, lasi->hpa + 0x0000C000);
|
||||||
|
|
||||||
/* Power down the machine */
|
/* might not be reached: */
|
||||||
gsc_writel(0x02, datareg);
|
return NOTIFY_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init lasi_init_chip(struct parisc_device *dev)
|
static int __init lasi_init_chip(struct parisc_device *dev)
|
||||||
{
|
{
|
||||||
extern void (*chassis_power_off)(void);
|
|
||||||
struct gsc_asic *lasi;
|
struct gsc_asic *lasi;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -212,12 +209,9 @@ static int __init lasi_init_chip(struct parisc_device *dev)
|
|||||||
|
|
||||||
gsc_fixup_irqs(dev, lasi, lasi_choose_irq);
|
gsc_fixup_irqs(dev, lasi, lasi_choose_irq);
|
||||||
|
|
||||||
/* initialize the power off function */
|
/* register the LASI power off function */
|
||||||
/* FIXME: Record the LASI HPA for the power off function. This should
|
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
|
||||||
* ensure that only the first LASI (the one controlling the power off)
|
SYS_OFF_PRIO_DEFAULT, lasi_power_off, lasi);
|
||||||
* should set the HPA here */
|
|
||||||
lasi_power_off_hpa = lasi->hpa;
|
|
||||||
chassis_power_off = lasi_power_off;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user