diff options
Diffstat (limited to 'drivers/parisc/power.c')
-rw-r--r-- | drivers/parisc/power.c | 51 |
1 files changed, 13 insertions, 38 deletions
diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c index 498bae2e34..7a6a3e7f28 100644 --- a/drivers/parisc/power.c +++ b/drivers/parisc/power.c @@ -1,38 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* - * linux/drivers/parisc/power.c - * HP PARISC soft power switch support driver - * - * Copyright (c) 2001-2007 Helge Deller <deller@gmx.de> - * All rights reserved. - * - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL"). - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * HP PARISC soft power switch driver * + * Copyright (c) 2001-2023 Helge Deller <deller@gmx.de> * * HINT: * Support of the soft power switch button may be enabled or disabled at * runtime through the "/proc/sys/kernel/power" procfs entry. - */ + */ #include <linux/module.h> #include <linux/init.h> @@ -62,12 +37,12 @@ #define MFCPU_X(rDiagReg, t_ch, t_th, code) \ (DIAG_CODE(code) + ((rDiagReg)<<21) + ((t_ch)<<16) + ((t_th)<<0) ) - + #define MTCPU(dr, gr) MFCPU_X(dr, gr, 0, 0x12) /* move value of gr to dr[dr] */ #define MFCPU_C(dr, gr) MFCPU_X(dr, gr, 0, 0x30) /* for dr0 and dr8 only ! */ #define MFCPU_T(dr, gr) MFCPU_X(dr, 0, gr, 0xa0) /* all dr except dr0 and dr8 */ - -#define __getDIAG(dr) ( { \ + +#define __getDIAG(dr) ( { \ register unsigned long __res asm("r28");\ __asm__ __volatile__ ( \ ".word %1" : "=&r" (__res) : "i" (MFCPU_T(dr,28) ) \ @@ -85,7 +60,7 @@ static void process_shutdown(void) printk(KERN_ALERT KTHREAD_NAME ": Shutdown requested...\n"); shutdown_timer++; - + /* wait until the button was pressed for 1 second */ if (shutdown_timer == (POWERSWITCH_DOWN_SEC*POWERSWITCH_POLL_PER_SEC)) { static const char msg[] = "Shutting down..."; @@ -135,7 +110,7 @@ static int kpowerswd(void *param) button_not_pressed = (gsc_readl(soft_power_reg) & 0x1); } else { /* - * On gecko style machines (e.g. 712/xx and 715/xx) + * On gecko style machines (e.g. 712/xx and 715/xx) * the power switch status is stored in Bit 0 ("the highest bit") * of CPU diagnose register 25. * Warning: Some machines never reset the DIAG flag, even if @@ -161,7 +136,7 @@ static int kpowerswd(void *param) /* - * powerfail interruption handler (irq IRQ_FROM_REGION(CPU_IRQ_REGION)+2) + * powerfail interruption handler (irq IRQ_FROM_REGION(CPU_IRQ_REGION)+2) */ #if 0 static void powerfail_interrupt(int code, void *x) @@ -222,14 +197,14 @@ static int __init power_init(void) ret = pdc_soft_power_button(1); if (ret != PDC_OK) soft_power_reg = -1UL; - + switch (soft_power_reg) { case 0: printk(KERN_INFO DRIVER_NAME ": Gecko-style soft power switch enabled.\n"); break; - + case -1UL: printk(KERN_INFO DRIVER_NAME ": Soft power switch support not available.\n"); return -ENODEV; - + default: printk(KERN_INFO DRIVER_NAME ": Soft power switch at 0x%08lx enabled.\n", soft_power_reg); } |