aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-09-09 08:53:02 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-09-20 17:04:13 -0400
commitafc3b79f5dbddd4ab210beb9cc6da102a1032b89 (patch)
tree61efa3cbc92c0535deed9f9c6ceaaeb1a2c836c9
parent7111f8780fcf770d8624d758fd240e585adf7d3c (diff)
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: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--arch/arm/mach-iop32x/n2100.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c
index 6bace5bc7ebb..bc40a97050a1 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -306,7 +306,7 @@ static struct timer_list power_button_poll_timer;
306 306
307static void power_button_poll(unsigned long dummy) 307static void power_button_poll(unsigned long dummy)
308{ 308{
309 if (gpio_line_get(N2100_POWER_BUTTON) == 0) { 309 if (gpio_get_value(N2100_POWER_BUTTON) == 0) {
310 ctrl_alt_del(); 310 ctrl_alt_del();
311 return; 311 return;
312 } 312 }
@@ -325,6 +325,20 @@ static int __init n2100_request_gpios(void)
325 ret = gpio_request(N2100_HARDWARE_RESET, "reset"); 325 ret = gpio_request(N2100_HARDWARE_RESET, "reset");
326 if (ret) 326 if (ret)
327 pr_err("could not request reset GPIO\n"); 327 pr_err("could not request reset GPIO\n");
328
329 ret = gpio_request(N2100_POWER_BUTTON, "power");
330 if (ret)
331 pr_err("could not request power GPIO\n");
332 else {
333 ret = gpio_direction_input(N2100_POWER_BUTTON);
334 if (ret)
335 pr_err("could not set power GPIO as input\n");
336 }
337 /* Set up power button poll timer */
338 init_timer(&power_button_poll_timer);
339 power_button_poll_timer.function = power_button_poll;
340 power_button_poll_timer.expires = jiffies + (HZ / 10);
341 add_timer(&power_button_poll_timer);
328 return 0; 342 return 0;
329} 343}
330device_initcall(n2100_request_gpios); 344device_initcall(n2100_request_gpios);
@@ -341,11 +355,6 @@ static void __init n2100_init_machine(void)
341 ARRAY_SIZE(n2100_i2c_devices)); 355 ARRAY_SIZE(n2100_i2c_devices));
342 356
343 pm_power_off = n2100_power_off; 357 pm_power_off = n2100_power_off;
344
345 init_timer(&power_button_poll_timer);
346 power_button_poll_timer.function = power_button_poll;
347 power_button_poll_timer.expires = jiffies + (HZ / 10);
348 add_timer(&power_button_poll_timer);
349} 358}
350 359
351MACHINE_START(N2100, "Thecus N2100") 360MACHINE_START(N2100, "Thecus N2100")