printf: Remove unused 'bprintf'
[drm/drm-misc.git] / include / linux / input / matrix_keypad.h
blob90867f44ab4d464571a0e71d2f57fad949af32e7
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _MATRIX_KEYPAD_H
3 #define _MATRIX_KEYPAD_H
5 #include <linux/types.h>
7 struct device;
8 struct input_dev;
10 #define MATRIX_MAX_ROWS 32
11 #define MATRIX_MAX_COLS 32
13 #define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
14 (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
15 ((val) & 0xffff))
17 #define KEY_ROW(k) (((k) >> 24) & 0xff)
18 #define KEY_COL(k) (((k) >> 16) & 0xff)
19 #define KEY_VAL(k) ((k) & 0xffff)
21 #define MATRIX_SCAN_CODE(row, col, row_shift) (((row) << (row_shift)) + (col))
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
29 * This structure is supposed to be used by platform code to supply
30 * keymaps to drivers that implement matrix-like keypads/keyboards.
32 struct matrix_keymap_data {
33 const uint32_t *keymap;
34 unsigned int keymap_size;
37 int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
38 const char *keymap_name,
39 unsigned int rows, unsigned int cols,
40 unsigned short *keymap,
41 struct input_dev *input_dev);
42 int matrix_keypad_parse_properties(struct device *dev,
43 unsigned int *rows, unsigned int *cols);
45 #endif /* _MATRIX_KEYPAD_H */