1 Upgrade the power and reset button handling for the DSMG600:
2 * Remove the superfluous declaration of ctrl_alt_del().
3 * Convert GPIO and IRQ handling to use the <asm/gpio.h> api.
4 * Perform the reset on the release of the power button, so that
5 NAS devices which have been set to auto-power-on (by bridging
6 the power button) do not continuously power cycle.
7 * Remove all superflous constants from dsmg600.h
9 Signed-off-by: Rod Whitby <rod@whitby.id.au>
12 arch/arm/mach-ixp4xx/dsmg600-power.c | 24 ++++++++++++++----------
13 include/asm-arm/arch-ixp4xx/dsmg600.h | 7 +------
14 2 files changed, 15 insertions(+), 16 deletions(-)
16 Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/dsmg600-power.c
17 ===================================================================
18 --- linux-2.6.23.12-armeb.orig/arch/arm/mach-ixp4xx/dsmg600-power.c 2008-01-11 16:20:26.000000000 +1030
19 +++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/dsmg600-power.c 2008-01-11 16:20:30.000000000 +1030
21 #include <linux/jiffies.h>
22 #include <linux/timer.h>
24 +#include <asm/gpio.h>
25 #include <asm/mach-types.h>
27 -extern void ctrl_alt_del(void);
29 /* This is used to make sure the power-button pusher is serious. The button
30 * must be held until the value of this counter reaches zero.
33 * state of the power button.
36 - if (*IXP4XX_GPIO_GPINR & DSMG600_PB_BM) {
37 + if (gpio_get_value(DSMG600_PB_GPIO)) {
39 /* IO Pin is 1 (button pushed) */
40 + if (power_button_countdown > 0) {
41 + power_button_countdown--;
46 + /* Done on button release, to allow for auto-power-on mods. */
47 if (power_button_countdown == 0) {
48 /* Signal init to do the ctrlaltdel action, this will bypass
49 * init if it hasn't started and do a kernel_restart.
52 /* Change the state of the power LED to "blink" */
53 gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW);
55 + power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
57 - power_button_countdown--;
60 - power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
63 mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
65 if (!(machine_is_dsmg600()))
68 - if (request_irq(DSMG600_RB_IRQ, &dsmg600_reset_handler,
69 + if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler,
70 IRQF_DISABLED | IRQF_TRIGGER_LOW, "DSM-G600 reset button",
73 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
75 + gpio_to_irq(DSMG600_RB_GPIO));
81 del_timer_sync(&dsmg600_power_timer);
83 - free_irq(DSMG600_RB_IRQ, NULL);
84 + free_irq(gpio_to_irq(DSMG600_RB_GPIO), NULL);
87 module_init(dsmg600_power_init);
88 Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/dsmg600.h
89 ===================================================================
90 --- linux-2.6.23.12-armeb.orig/include/asm-arm/arch-ixp4xx/dsmg600.h 2008-01-11 16:20:26.000000000 +1030
91 +++ linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/dsmg600.h 2008-01-11 16:20:30.000000000 +1030
95 #define DSMG600_PB_GPIO 15 /* power button */
96 -#define DSMG600_PB_BM (1L << DSMG600_PB_GPIO)
98 #define DSMG600_RB_GPIO 3 /* reset button */
100 -#define DSMG600_RB_IRQ IRQ_IXP4XX_GPIO3
103 #define DSMG600_PO_GPIO 2 /* power off */
107 #define DSMG600_LED_PWR_GPIO 0
108 -#define DSMG600_LED_PWR_BM (1L << DSMG600_LED_PWR_GPIO)
110 #define DSMG600_LED_WLAN_GPIO 14
111 -#define DSMG600_LED_WLAN_BM (1L << DSMG600_LED_WLAN_GPIO)