Date:2011-07-08 13:52:41 (12 years 8 months ago)
Author:Maarten ter Huurne
Commit:ce0911ac6890026c777723e9a86f90533bd7dbb8
Message:MIPS: JZ4740: A320: Debounce microswitch buttons.

On the microswitch buttons of the Dingoo A320 (L/R/select/start), it often
happens that multiple presses are detected for one actual button press.
Specifying a 5 ms debounce interval fixes that issue. I am not sure what
the optimum interval length would be, but 5 ms is short enough to not cause
problems for gamers and long enough to filter out the glitches.
Files: arch/mips/jz4740/board-a320.c (1 diff)

Change Details

arch/mips/jz4740/board-a320.c
257257    },
258258};
259259
260    /* TODO(CongoZombie): Figure out a way to reimplement power slider functionality
261                          so that existing apps won't break. (Possible that an SDL
262                          remapping would fix this, but it is unclear how many apps
263                          use other interfaces)
264                          Original Dingux used SysRq keys to perform different tasks
265                          (restart, backlight, volume etc.)
266    */
267    /* TODO(CongoZombie): Confirm power slider pin (Booboo's docs seem unsure) */
268
260/* Note that the microswitch buttons need debounce while the rubber buttons
261 * do not need it.
262 */
269263static struct gpio_keys_button a320_buttons[] = {
270264    /* D-pad up */ {
271        .gpio = JZ_GPIO_PORTD(6),
272        .active_low = 1,
273        .code = KEY_UP
265        .gpio = JZ_GPIO_PORTD(6),
266        .active_low = 1,
267        .code = KEY_UP,
274268    },
275269    /* D-pad down */ {
276        .gpio = JZ_GPIO_PORTD(27),
277        .active_low = 1,
278        .code = KEY_DOWN
270        .gpio = JZ_GPIO_PORTD(27),
271        .active_low = 1,
272        .code = KEY_DOWN,
279273    },
280274    /* D-pad left */ {
281        .gpio = JZ_GPIO_PORTD(5),
282        .active_low = 1,
283        .code = KEY_LEFT
275        .gpio = JZ_GPIO_PORTD(5),
276        .active_low = 1,
277        .code = KEY_LEFT,
284278    },
285279    /* D-pad right */ {
286        .gpio = JZ_GPIO_PORTD(18),
287        .active_low = 1,
288        .code = KEY_RIGHT
280        .gpio = JZ_GPIO_PORTD(18),
281        .active_low = 1,
282        .code = KEY_RIGHT,
289283    },
290284    /* A button */ {
291        .gpio = JZ_GPIO_PORTD(0),
292        .active_low = 1,
293        .code = KEY_LEFTCTRL
285        .gpio = JZ_GPIO_PORTD(0),
286        .active_low = 1,
287        .code = KEY_LEFTCTRL,
294288    },
295289    /* B button */ {
296        .gpio = JZ_GPIO_PORTD(1),
297        .active_low = 1,
298        .code = KEY_LEFTALT
290        .gpio = JZ_GPIO_PORTD(1),
291        .active_low = 1,
292        .code = KEY_LEFTALT,
299293    },
300294    /* X button */ {
301        .gpio = JZ_GPIO_PORTD(19),
302        .active_low = 1,
303        .code = KEY_SPACE
295        .gpio = JZ_GPIO_PORTD(19),
296        .active_low = 1,
297        .code = KEY_SPACE,
304298    },
305299    /* Y button */ {
306        .gpio = JZ_GPIO_PORTD(2),
307        .active_low = 1,
308        .code = KEY_LEFTSHIFT
300        .gpio = JZ_GPIO_PORTD(2),
301        .active_low = 1,
302        .code = KEY_LEFTSHIFT,
309303    },
310304    /* Left shoulder button */ {
311        .gpio = JZ_GPIO_PORTD(14),
312        .active_low = 1,
313        .code = KEY_TAB
305        .gpio = JZ_GPIO_PORTD(14),
306        .active_low = 1,
307        .code = KEY_TAB,
308        .debounce_interval = 5,
314309    },
315310    /* Right shoulder button */ {
316        .gpio = JZ_GPIO_PORTD(15),
317        .active_low = 1,
318        .code = KEY_BACKSPACE
311        .gpio = JZ_GPIO_PORTD(15),
312        .active_low = 1,
313        .code = KEY_BACKSPACE,
314        .debounce_interval = 5,
319315    },
320316    /* START button */ {
321        .gpio = JZ_GPIO_PORTC(17),
322        .active_low = 1,
323        .code = KEY_ENTER
317        .gpio = JZ_GPIO_PORTC(17),
318        .active_low = 1,
319        .code = KEY_ENTER,
320        .debounce_interval = 5,
324321    },
325322    /* SELECT button */ {
326        .gpio = JZ_GPIO_PORTD(17),
327        .active_low = 1,
328        .code = KEY_ESC
323        .gpio = JZ_GPIO_PORTD(17),
324        .active_low = 1,
325        .code = KEY_ESC,
326        .debounce_interval = 5,
329327    },
330328    /* POWER slider */ {
331        .gpio = JZ_GPIO_PORTD(29),
332        .active_low = 1,
333        .code = KEY_POWER,
334        .wakeup = 1,
329        .gpio = JZ_GPIO_PORTD(29),
330        .active_low = 1,
331        .code = KEY_POWER,
332        .wakeup = 1,
335333    },
336334    /* POWER hold */ {
337        .gpio = JZ_GPIO_PORTD(22),
338        .active_low = 1,
339        .code = KEY_PAUSE
335        .gpio = JZ_GPIO_PORTD(22),
336        .active_low = 1,
337        .code = KEY_PAUSE,
340338    },
341339};
342340

Archive Download the corresponding diff file



interactive