mirror of
https://github.com/torvalds/linux.git
synced 2025-11-03 10:10:33 +02:00
parisc/power: Trivial whitespace cleanups and license update
Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
parent
d0c2194729
commit
fe0a9b8b22
1 changed files with 13 additions and 38 deletions
|
|
@ -1,38 +1,13 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||||
/*
|
/*
|
||||||
* linux/drivers/parisc/power.c
|
* HP PARISC soft power switch driver
|
||||||
* 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
|
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2001-2023 Helge Deller <deller@gmx.de>
|
||||||
*
|
*
|
||||||
* HINT:
|
* HINT:
|
||||||
* Support of the soft power switch button may be enabled or disabled at
|
* Support of the soft power switch button may be enabled or disabled at
|
||||||
* runtime through the "/proc/sys/kernel/power" procfs entry.
|
* runtime through the "/proc/sys/kernel/power" procfs entry.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
|
@ -62,12 +37,12 @@
|
||||||
|
|
||||||
#define MFCPU_X(rDiagReg, t_ch, t_th, code) \
|
#define MFCPU_X(rDiagReg, t_ch, t_th, code) \
|
||||||
(DIAG_CODE(code) + ((rDiagReg)<<21) + ((t_ch)<<16) + ((t_th)<<0) )
|
(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 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_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 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");\
|
register unsigned long __res asm("r28");\
|
||||||
__asm__ __volatile__ ( \
|
__asm__ __volatile__ ( \
|
||||||
".word %1" : "=&r" (__res) : "i" (MFCPU_T(dr,28) ) \
|
".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");
|
printk(KERN_ALERT KTHREAD_NAME ": Shutdown requested...\n");
|
||||||
|
|
||||||
shutdown_timer++;
|
shutdown_timer++;
|
||||||
|
|
||||||
/* wait until the button was pressed for 1 second */
|
/* wait until the button was pressed for 1 second */
|
||||||
if (shutdown_timer == (POWERSWITCH_DOWN_SEC*POWERSWITCH_POLL_PER_SEC)) {
|
if (shutdown_timer == (POWERSWITCH_DOWN_SEC*POWERSWITCH_POLL_PER_SEC)) {
|
||||||
static const char msg[] = "Shutting down...";
|
static const char msg[] = "Shutting down...";
|
||||||
|
|
@ -135,7 +110,7 @@ static int kpowerswd(void *param)
|
||||||
button_not_pressed = (gsc_readl(soft_power_reg) & 0x1);
|
button_not_pressed = (gsc_readl(soft_power_reg) & 0x1);
|
||||||
} else {
|
} 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")
|
* the power switch status is stored in Bit 0 ("the highest bit")
|
||||||
* of CPU diagnose register 25.
|
* of CPU diagnose register 25.
|
||||||
* Warning: Some machines never reset the DIAG flag, even if
|
* 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
|
#if 0
|
||||||
static void powerfail_interrupt(int code, void *x)
|
static void powerfail_interrupt(int code, void *x)
|
||||||
|
|
@ -222,14 +197,14 @@ static int __init power_init(void)
|
||||||
ret = pdc_soft_power_button(1);
|
ret = pdc_soft_power_button(1);
|
||||||
if (ret != PDC_OK)
|
if (ret != PDC_OK)
|
||||||
soft_power_reg = -1UL;
|
soft_power_reg = -1UL;
|
||||||
|
|
||||||
switch (soft_power_reg) {
|
switch (soft_power_reg) {
|
||||||
case 0: printk(KERN_INFO DRIVER_NAME ": Gecko-style soft power switch enabled.\n");
|
case 0: printk(KERN_INFO DRIVER_NAME ": Gecko-style soft power switch enabled.\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1UL: printk(KERN_INFO DRIVER_NAME ": Soft power switch support not available.\n");
|
case -1UL: printk(KERN_INFO DRIVER_NAME ": Soft power switch support not available.\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
default: printk(KERN_INFO DRIVER_NAME ": Soft power switch at 0x%08lx enabled.\n",
|
default: printk(KERN_INFO DRIVER_NAME ": Soft power switch at 0x%08lx enabled.\n",
|
||||||
soft_power_reg);
|
soft_power_reg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue