Commit afc3b79f authored by Linus Walleij's avatar Linus Walleij

ARM: iop32x: read N2100 power key using gpiolib

Refrain from using the custom gpio_line_get() to read the power
key on the N2100, use the gpiolib function gpio_get() instead.
Also request the line in the GPIOs initicall, and move the poll
timer setup to that inicall so the gpio chip is available before
we request this GPIO and start to poll it.

Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Mikael Pettersson <mikpe@it.uu.se>
Tested-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 7111f878
...@@ -306,7 +306,7 @@ static struct timer_list power_button_poll_timer; ...@@ -306,7 +306,7 @@ static struct timer_list power_button_poll_timer;
static void power_button_poll(unsigned long dummy) static void power_button_poll(unsigned long dummy)
{ {
if (gpio_line_get(N2100_POWER_BUTTON) == 0) { if (gpio_get_value(N2100_POWER_BUTTON) == 0) {
ctrl_alt_del(); ctrl_alt_del();
return; return;
} }
...@@ -325,6 +325,20 @@ static int __init n2100_request_gpios(void) ...@@ -325,6 +325,20 @@ static int __init n2100_request_gpios(void)
ret = gpio_request(N2100_HARDWARE_RESET, "reset"); ret = gpio_request(N2100_HARDWARE_RESET, "reset");
if (ret) if (ret)
pr_err("could not request reset GPIO\n"); pr_err("could not request reset GPIO\n");
ret = gpio_request(N2100_POWER_BUTTON, "power");
if (ret)
pr_err("could not request power GPIO\n");
else {
ret = gpio_direction_input(N2100_POWER_BUTTON);
if (ret)
pr_err("could not set power GPIO as input\n");
}
/* Set up power button poll timer */
init_timer(&power_button_poll_timer);
power_button_poll_timer.function = power_button_poll;
power_button_poll_timer.expires = jiffies + (HZ / 10);
add_timer(&power_button_poll_timer);
return 0; return 0;
} }
device_initcall(n2100_request_gpios); device_initcall(n2100_request_gpios);
...@@ -341,11 +355,6 @@ static void __init n2100_init_machine(void) ...@@ -341,11 +355,6 @@ static void __init n2100_init_machine(void)
ARRAY_SIZE(n2100_i2c_devices)); ARRAY_SIZE(n2100_i2c_devices));
pm_power_off = n2100_power_off; pm_power_off = n2100_power_off;
init_timer(&power_button_poll_timer);
power_button_poll_timer.function = power_button_poll;
power_button_poll_timer.expires = jiffies + (HZ / 10);
add_timer(&power_button_poll_timer);
} }
MACHINE_START(N2100, "Thecus N2100") MACHINE_START(N2100, "Thecus N2100")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment