1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef __ASM_ARCH_PXA27x_KEYPAD_H 3*4882a593Smuzhiyun #define __ASM_ARCH_PXA27x_KEYPAD_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <linux/input.h> 6*4882a593Smuzhiyun #include <linux/input/matrix_keypad.h> 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun #define MAX_MATRIX_KEY_ROWS (8) 9*4882a593Smuzhiyun #define MAX_MATRIX_KEY_COLS (8) 10*4882a593Smuzhiyun #define MATRIX_ROW_SHIFT (3) 11*4882a593Smuzhiyun #define MAX_DIRECT_KEY_NUM (8) 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun /* pxa3xx keypad platform specific parameters 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * NOTE: 16*4882a593Smuzhiyun * 1. direct_key_num indicates the number of keys in the direct keypad 17*4882a593Smuzhiyun * _plus_ the number of rotary-encoder sensor inputs, this can be 18*4882a593Smuzhiyun * left as 0 if only rotary encoders are enabled, the driver will 19*4882a593Smuzhiyun * automatically calculate this 20*4882a593Smuzhiyun * 21*4882a593Smuzhiyun * 2. direct_key_map is the key code map for the direct keys, if rotary 22*4882a593Smuzhiyun * encoder(s) are enabled, direct key 0/1(2/3) will be ignored 23*4882a593Smuzhiyun * 24*4882a593Smuzhiyun * 3. rotary can be either interpreted as a relative input event (e.g. 25*4882a593Smuzhiyun * REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT) 26*4882a593Smuzhiyun * 27*4882a593Smuzhiyun * 4. matrix key and direct key will use the same debounce_interval by 28*4882a593Smuzhiyun * default, which should be sufficient in most cases 29*4882a593Smuzhiyun * 30*4882a593Smuzhiyun * pxa168 keypad platform specific parameter 31*4882a593Smuzhiyun * 32*4882a593Smuzhiyun * NOTE: 33*4882a593Smuzhiyun * clear_wakeup_event callback is a workaround required to clear the 34*4882a593Smuzhiyun * keypad interrupt. The keypad wake must be cleared in addition to 35*4882a593Smuzhiyun * reading the MI/DI bits in the KPC register. 36*4882a593Smuzhiyun */ 37*4882a593Smuzhiyun struct pxa27x_keypad_platform_data { 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun /* code map for the matrix keys */ 40*4882a593Smuzhiyun const struct matrix_keymap_data *matrix_keymap_data; 41*4882a593Smuzhiyun unsigned int matrix_key_rows; 42*4882a593Smuzhiyun unsigned int matrix_key_cols; 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun /* direct keys */ 45*4882a593Smuzhiyun int direct_key_num; 46*4882a593Smuzhiyun unsigned int direct_key_map[MAX_DIRECT_KEY_NUM]; 47*4882a593Smuzhiyun /* the key output may be low active */ 48*4882a593Smuzhiyun int direct_key_low_active; 49*4882a593Smuzhiyun /* give board a chance to choose the start direct key */ 50*4882a593Smuzhiyun unsigned int direct_key_mask; 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun /* rotary encoders 0 */ 53*4882a593Smuzhiyun int enable_rotary0; 54*4882a593Smuzhiyun int rotary0_rel_code; 55*4882a593Smuzhiyun int rotary0_up_key; 56*4882a593Smuzhiyun int rotary0_down_key; 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun /* rotary encoders 1 */ 59*4882a593Smuzhiyun int enable_rotary1; 60*4882a593Smuzhiyun int rotary1_rel_code; 61*4882a593Smuzhiyun int rotary1_up_key; 62*4882a593Smuzhiyun int rotary1_down_key; 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun /* key debounce interval */ 65*4882a593Smuzhiyun unsigned int debounce_interval; 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun /* clear wakeup event requirement for pxa168 */ 68*4882a593Smuzhiyun void (*clear_wakeup_event)(void); 69*4882a593Smuzhiyun }; 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info); 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun #endif /* __ASM_ARCH_PXA27x_KEYPAD_H */ 74