2 * PROJECT: ReactOS Boot Loader
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: boot/armllb/hw/omap3-zoom2/hwsynkpd.c
5 * PURPOSE: LLB Synpatics Keypad Support for OMAP3 ZOOM 2
6 * PROGRAMMERS: ReactOS Portable Systems Group
11 /* FUNCTIONS ******************************************************************/
15 LlbHwOmap3SynKpdInitialize(VOID
)
17 /* Set GPIO pin 8 on the TWL4030 as an output pin */
18 LlbHwOmap3TwlWrite1(0x49, 0x9B, 0xC0);
20 /* Set GPIO pin 8 signal on the TWL4030 ON. This powers the keypad backlight */
21 LlbHwOmap3TwlWrite1(0x49, 0xA4, 0xC0);
23 /* Set PENDDIS and COR on the the keypad interrupt controller */
24 LlbHwOmap3TwlWrite1(0x4A, 0xE9, 0x06);
26 /* Only falling edge detection for key pressed */
27 LlbHwOmap3TwlWrite1(0x4A, 0xE8, 0x01);
29 /* Unmask key-pressed events */
30 LlbHwOmap3TwlWrite1(0x4A, 0xE4, 0x0E);
32 /* Set the keypad control register to turn hardware sequencing and turn it on */
33 LlbHwOmap3TwlWrite1(0x4A, 0xD2, 0x0);
34 LlbHwOmap3TwlRead1(0x4A, 0xE3);
35 LlbHwOmap3TwlWrite1(0x4A, 0xD2, 0x43);
38 UCHAR KeyboardMatrixStatus
[8];
39 BOOLEAN LastState
= FALSE
;
47 Value
= LlbHwOmap3TwlRead1(0x4A, 0xE3);
48 if (!Value
) return FALSE
;
51 if (!LastState
) return FALSE
;
53 /* Return whether or not an interrupt is pending */
61 UCHAR ActiveCol
= 0, ActiveRow
= 0, col
, coldata
, row
;
63 for (col
= 0; col
< 8; col
++)
65 coldata
= LlbHwOmap3TwlRead1(0x4A, 0xDB + col
);
68 for (row
= 0; row
< 8; row
++)
70 if (coldata
== (1 << row
))
80 return ((ActiveCol
<< 4) | ActiveRow
);