#include <linux/hrtimer.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
-#include <linux/wakelock.h>
struct gpio_kp {
struct gpio_event_input_devs *input_devs;
struct gpio_event_matrix_info *keypad_info;
struct hrtimer timer;
- struct wake_lock wake_lock;
+ struct wakeup_source wake_src;
int current_output;
unsigned int use_irq:1;
unsigned int key_state_changed:1;
}
for (in = 0; in < mi->ninputs; in++)
enable_irq(gpio_to_irq(mi->input_gpios[in]));
- wake_unlock(&kp->wake_lock);
+ __pm_relax(&kp->wake_src);
return HRTIMER_NORESTART;
}
else
gpio_direction_input(mi->output_gpios[i]);
}
- wake_lock(&kp->wake_lock);
+ __pm_stay_awake(&kp->wake_src);
hrtimer_start(&kp->timer, ktime_set(0, 0), HRTIMER_MODE_REL);
return IRQ_HANDLED;
}
hrtimer_init(&kp->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
kp->timer.function = gpio_keypad_timer_func;
- wake_lock_init(&kp->wake_lock, WAKE_LOCK_SUSPEND, "gpio_kp");
+ wakeup_source_init(&kp->wake_src, "gpio_kp");
err = gpio_keypad_request_irqs(kp);
kp->use_irq = err == 0;
kp->use_irq ? "interrupt" : "polling");
if (kp->use_irq)
- wake_lock(&kp->wake_lock);
+ __pm_stay_awake(&kp->wake_src);
hrtimer_start(&kp->timer, ktime_set(0, 0), HRTIMER_MODE_REL);
return 0;
free_irq(gpio_to_irq(mi->input_gpios[i]), kp);
hrtimer_cancel(&kp->timer);
- wake_lock_destroy(&kp->wake_lock);
+ wakeup_source_trash(&kp->wake_src);
for (i = mi->noutputs - 1; i >= 0; i--) {
err_gpio_direction_input_failed:
gpio_free(mi->input_gpios[i]);