reset.c (48a7afe314bfc4d7f50e1608632f503dbba7e013) | reset.c (e86169fffedc2f461be6f70817ae5ab201c12fd5) |
---|---|
1/* 2 * Cobalt Reset operations 3 * 4 * This file is subject to the terms and conditions of the GNU General Public 5 * License. See the file "COPYING" in the main directory of this archive 6 * for more details. 7 * 8 * Copyright (C) 1995, 1996, 1997 by Ralf Baechle 9 * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv) 10 */ | 1/* 2 * Cobalt Reset operations 3 * 4 * This file is subject to the terms and conditions of the GNU General Public 5 * License. See the file "COPYING" in the main directory of this archive 6 * for more details. 7 * 8 * Copyright (C) 1995, 1996, 1997 by Ralf Baechle 9 * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv) 10 */ |
11#include <linux/init.h> |
|
11#include <linux/jiffies.h> | 12#include <linux/jiffies.h> |
13#include <linux/leds.h> |
|
12 | 14 |
13#include <asm/io.h> 14#include <asm/reboot.h> 15 | |
16#include <cobalt.h> 17 | 15#include <cobalt.h> 16 |
17DEFINE_LED_TRIGGER(power_off_led_trigger); 18 19static int __init ledtrig_power_off_init(void) 20{ 21 led_trigger_register_simple("power-off", &power_off_led_trigger); 22 return 0; 23} 24device_initcall(ledtrig_power_off_init); 25 |
|
18void cobalt_machine_halt(void) 19{ 20 int state, last, diff; 21 unsigned long mark; 22 23 /* | 26void cobalt_machine_halt(void) 27{ 28 int state, last, diff; 29 unsigned long mark; 30 31 /* |
24 * turn off bar on Qube, flash power off LED on RaQ (0.5Hz) | 32 * turn on power off LED on RaQ |
25 * 26 * restart if ENTER and SELECT are pressed 27 */ 28 29 last = COBALT_KEY_PORT; 30 | 33 * 34 * restart if ENTER and SELECT are pressed 35 */ 36 37 last = COBALT_KEY_PORT; 38 |
31 for (state = 0;;) { | 39 led_trigger_event(power_off_led_trigger, LED_FULL); |
32 | 40 |
33 state ^= COBALT_LED_POWER_OFF; 34 COBALT_LED_PORT = state; 35 | 41 for (state = 0;;) { |
36 diff = COBALT_KEY_PORT ^ last; 37 last ^= diff; 38 39 if((diff & (COBALT_KEY_ENTER | COBALT_KEY_SELECT)) && !(~last & (COBALT_KEY_ENTER | COBALT_KEY_SELECT))) 40 COBALT_LED_PORT = COBALT_LED_RESET; 41 42 for (mark = jiffies; jiffies - mark < HZ;) 43 ; --- 19 unchanged lines hidden --- | 42 diff = COBALT_KEY_PORT ^ last; 43 last ^= diff; 44 45 if((diff & (COBALT_KEY_ENTER | COBALT_KEY_SELECT)) && !(~last & (COBALT_KEY_ENTER | COBALT_KEY_SELECT))) 46 COBALT_LED_PORT = COBALT_LED_RESET; 47 48 for (mark = jiffies; jiffies - mark < HZ;) 49 ; --- 19 unchanged lines hidden --- |