changed Makefile and profiles, added patches for kernel 2.6.24
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1131-fix-jack-interrupt-debounce-loss-window.patch.patch
1 From 4c445577b8f471612389007e5265c7dbfb2c487b Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Sun, 13 Apr 2008 07:25:59 +0100
4 Subject: [PATCH] fix-jack-interrupt-debounce-loss-window.patch
5
6 Make sure we can't lose a jack interrupt in debounce, despite it is
7 a one-in-a-million thing that just needs replug to clear
8
9 Signed-off-by: Andy Green <andy@openmoko.com>
10 ---
11 drivers/input/keyboard/neo1973kbd.c | 50 +++++++++++++++++++++++-----------
12 1 files changed, 34 insertions(+), 16 deletions(-)
13
14 diff --git a/drivers/input/keyboard/neo1973kbd.c b/drivers/input/keyboard/neo1973kbd.c
15 index a1fc7a3..8b9a420 100644
16 --- a/drivers/input/keyboard/neo1973kbd.c
17 +++ b/drivers/input/keyboard/neo1973kbd.c
18 @@ -62,27 +62,45 @@ static irqreturn_t neo1973kbd_hold_irq(int irq, void *dev_id)
19 static void neo1973kbd_debounce_jack(struct work_struct *work)
20 {
21 struct neo1973kbd *kbd = container_of(work, struct neo1973kbd, work);
22 -
23 - /* we wait out any multiple interrupt stuttering in 100ms lumps */
24 + unsigned long flags;
25 + int loop = 0;
26
27 do {
28 - kbd->hp_irq_count_in_work = kbd->hp_irq_count;
29 - msleep(100);
30 - } while (kbd->hp_irq_count != kbd->hp_irq_count_in_work);
31 -
32 - /* no new interrupts on jack for 100ms... ok we will report it */
33 -
34 - input_report_switch(kbd->input,
35 - SW_HEADPHONE_INSERT,
36 - gpio_get_value(irq_to_gpio(kbd->jack_irq)));
37 - input_sync(kbd->input);
38 -
39 - /* next time we get an interrupt on jack we need new work action */
40 - kbd->work_in_progress = 0;
41 + /*
42 + * we wait out any multiple interrupt
43 + * stuttering in 100ms lumps
44 + */
45 + do {
46 + kbd->hp_irq_count_in_work = kbd->hp_irq_count;
47 + msleep(100);
48 + } while (kbd->hp_irq_count != kbd->hp_irq_count_in_work);
49 + /*
50 + * no new interrupts on jack for 100ms...
51 + * ok we will report it
52 + */
53 + input_report_switch(kbd->input, SW_HEADPHONE_INSERT,
54 + gpio_get_value(irq_to_gpio(kbd->jack_irq)));
55 + input_sync(kbd->input);
56 + /*
57 + * we go around the outer loop again if we detect that more
58 + * interrupts came while we are servicing here. But we have
59 + * to sequence it carefully with interrupts off
60 + */
61 + local_save_flags(flags);
62 + /* no interrupts during this work means we can exit the work */
63 + loop = !!(kbd->hp_irq_count != kbd->hp_irq_count_in_work);
64 + if (!loop)
65 + kbd->work_in_progress = 0;
66 + local_irq_restore(flags);
67 + /*
68 + * interrupt that comes here will either queue a new work action
69 + * since work_in_progress is cleared now, or be dealt with
70 + * when we loop.
71 + */
72 + } while (loop);
73 }
74
75
76 -
77 static irqreturn_t neo1973kbd_headphone_irq(int irq, void *dev_id)
78 {
79 struct neo1973kbd *neo1973kbd_data = dev_id;
80 --
81 1.5.6.5
82
This page took 0.05494 seconds and 5 git commands to generate.