Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_ARCH_PXA27x_KEYPAD_H
0003 #define __ASM_ARCH_PXA27x_KEYPAD_H
0004 
0005 #include <linux/input.h>
0006 #include <linux/input/matrix_keypad.h>
0007 
0008 #define MAX_MATRIX_KEY_ROWS (8)
0009 #define MAX_MATRIX_KEY_COLS (8)
0010 #define MATRIX_ROW_SHIFT    (3)
0011 #define MAX_DIRECT_KEY_NUM  (8)
0012 
0013 /* pxa3xx keypad platform specific parameters
0014  *
0015  * NOTE:
0016  * 1. direct_key_num indicates the number of keys in the direct keypad
0017  *    _plus_ the number of rotary-encoder sensor inputs,  this can be
0018  *    left as 0 if only rotary encoders are enabled,  the driver will
0019  *    automatically calculate this
0020  *
0021  * 2. direct_key_map is the key code map for the direct keys, if rotary
0022  *    encoder(s) are enabled, direct key 0/1(2/3) will be ignored
0023  *
0024  * 3. rotary can be either interpreted as a relative input event (e.g.
0025  *    REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT)
0026  *
0027  * 4. matrix key and direct key will use the same debounce_interval by
0028  *    default, which should be sufficient in most cases
0029  *
0030  * pxa168 keypad platform specific parameter
0031  *
0032  * NOTE:
0033  * clear_wakeup_event callback is a workaround required to clear the
0034  * keypad interrupt. The keypad wake must be cleared in addition to
0035  * reading the MI/DI bits in the KPC register.
0036  */
0037 struct pxa27x_keypad_platform_data {
0038 
0039     /* code map for the matrix keys */
0040     const struct matrix_keymap_data *matrix_keymap_data;
0041     unsigned int    matrix_key_rows;
0042     unsigned int    matrix_key_cols;
0043 
0044     /* direct keys */
0045     int     direct_key_num;
0046     unsigned int    direct_key_map[MAX_DIRECT_KEY_NUM];
0047     /* the key output may be low active */
0048     int     direct_key_low_active;
0049     /* give board a chance to choose the start direct key */
0050     unsigned int    direct_key_mask;
0051 
0052     /* rotary encoders 0 */
0053     int     enable_rotary0;
0054     int     rotary0_rel_code;
0055     int     rotary0_up_key;
0056     int     rotary0_down_key;
0057 
0058     /* rotary encoders 1 */
0059     int     enable_rotary1;
0060     int     rotary1_rel_code;
0061     int     rotary1_up_key;
0062     int     rotary1_down_key;
0063 
0064     /* key debounce interval */
0065     unsigned int    debounce_interval;
0066 
0067     /* clear wakeup event requirement for pxa168 */
0068     void        (*clear_wakeup_event)(void);
0069 };
0070 
0071 extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);
0072 
0073 #endif /* __ASM_ARCH_PXA27x_KEYPAD_H */