Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbaee197 authored by Dmitry Shmidt's avatar Dmitry Shmidt Committed by Amit Pundir
Browse files

ANDROID: input: gpio_matrix: Remove wakelock.h dependencies



Change-Id: I228bcdebf28f5c67765002043d3f919718827316
Signed-off-by: default avatarDmitry Shmidt <dimitrysh@google.com>
parent a177fb10
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -19,13 +19,12 @@
#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;
@@ -215,7 +214,7 @@ static enum hrtimer_restart gpio_keypad_timer_func(struct hrtimer *timer)
	}
	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;
}

@@ -242,7 +241,7 @@ static irqreturn_t gpio_keypad_irq_handler(int irq_in, void *dev_id)
		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;
}
@@ -396,7 +395,7 @@ int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs,

		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;

@@ -406,7 +405,7 @@ int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs,
			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;
@@ -420,7 +419,7 @@ int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs,
			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]);