~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/input/matrix_keypad.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _MATRIX_KEYPAD_H
  3 #define _MATRIX_KEYPAD_H
  4 
  5 #include <linux/types.h>
  6 
  7 struct device;
  8 struct input_dev;
  9 
 10 #define MATRIX_MAX_ROWS         32
 11 #define MATRIX_MAX_COLS         32
 12 
 13 #define KEY(row, col, val)      ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
 14                                  (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
 15                                  ((val) & 0xffff))
 16 
 17 #define KEY_ROW(k)              (((k) >> 24) & 0xff)
 18 #define KEY_COL(k)              (((k) >> 16) & 0xff)
 19 #define KEY_VAL(k)              ((k) & 0xffff)
 20 
 21 #define MATRIX_SCAN_CODE(row, col, row_shift)   (((row) << (row_shift)) + (col))
 22 
 23 /**
 24  * struct matrix_keymap_data - keymap for matrix keyboards
 25  * @keymap: pointer to array of uint32 values encoded with KEY() macro
 26  *      representing keymap
 27  * @keymap_size: number of entries (initialized) in this keymap
 28  *
 29  * This structure is supposed to be used by platform code to supply
 30  * keymaps to drivers that implement matrix-like keypads/keyboards.
 31  */
 32 struct matrix_keymap_data {
 33         const uint32_t *keymap;
 34         unsigned int    keymap_size;
 35 };
 36 
 37 /**
 38  * struct matrix_keypad_platform_data - platform-dependent keypad data
 39  * @keymap_data: pointer to &matrix_keymap_data
 40  * @row_gpios: pointer to array of gpio numbers representing rows
 41  * @col_gpios: pointer to array of gpio numbers reporesenting colums
 42  * @num_row_gpios: actual number of row gpios used by device
 43  * @num_col_gpios: actual number of col gpios used by device
 44  * @col_scan_delay_us: delay, measured in microseconds, that is
 45  *      needed before we can keypad after activating column gpio
 46  * @debounce_ms: debounce interval in milliseconds
 47  * @clustered_irq: may be specified if interrupts of all row/column GPIOs
 48  *      are bundled to one single irq
 49  * @clustered_irq_flags: flags that are needed for the clustered irq
 50  * @active_low: gpio polarity
 51  * @wakeup: controls whether the device should be set up as wakeup
 52  *      source
 53  * @no_autorepeat: disable key autorepeat
 54  * @drive_inactive_cols: drive inactive columns during scan, rather than
 55  *      making them inputs.
 56  *
 57  * This structure represents platform-specific data that use used by
 58  * matrix_keypad driver to perform proper initialization.
 59  */
 60 struct matrix_keypad_platform_data {
 61         const struct matrix_keymap_data *keymap_data;
 62 
 63         const unsigned int *row_gpios;
 64         const unsigned int *col_gpios;
 65 
 66         unsigned int    num_row_gpios;
 67         unsigned int    num_col_gpios;
 68 
 69         unsigned int    col_scan_delay_us;
 70 
 71         /* key debounce interval in milli-second */
 72         unsigned int    debounce_ms;
 73 
 74         unsigned int    clustered_irq;
 75         unsigned int    clustered_irq_flags;
 76 
 77         bool            active_low;
 78         bool            wakeup;
 79         bool            no_autorepeat;
 80         bool            drive_inactive_cols;
 81 };
 82 
 83 int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
 84                                const char *keymap_name,
 85                                unsigned int rows, unsigned int cols,
 86                                unsigned short *keymap,
 87                                struct input_dev *input_dev);
 88 int matrix_keypad_parse_properties(struct device *dev,
 89                                    unsigned int *rows, unsigned int *cols);
 90 
 91 #define matrix_keypad_parse_of_params matrix_keypad_parse_properties
 92 
 93 #endif /* _MATRIX_KEYPAD_H */
 94 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php