/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _MATRIX_KEYPAD_H #define _MATRIX_KEYPAD_H #include <linux/types.h> struct device; struct input_dev; #define MATRIX_MAX_ROWS … #define MATRIX_MAX_COLS … #define KEY(row, col, val) … #define KEY_ROW(k) … #define KEY_COL(k) … #define KEY_VAL(k) … #define MATRIX_SCAN_CODE(row, col, row_shift) … /** * struct matrix_keymap_data - keymap for matrix keyboards * @keymap: pointer to array of uint32 values encoded with KEY() macro * representing keymap * @keymap_size: number of entries (initialized) in this keymap * * This structure is supposed to be used by platform code to supply * keymaps to drivers that implement matrix-like keypads/keyboards. */ struct matrix_keymap_data { … }; /** * struct matrix_keypad_platform_data - platform-dependent keypad data * @keymap_data: pointer to &matrix_keymap_data * @row_gpios: pointer to array of gpio numbers representing rows * @col_gpios: pointer to array of gpio numbers reporesenting colums * @num_row_gpios: actual number of row gpios used by device * @num_col_gpios: actual number of col gpios used by device * @col_scan_delay_us: delay, measured in microseconds, that is * needed before we can keypad after activating column gpio * @debounce_ms: debounce interval in milliseconds * @clustered_irq: may be specified if interrupts of all row/column GPIOs * are bundled to one single irq * @clustered_irq_flags: flags that are needed for the clustered irq * @active_low: gpio polarity * @wakeup: controls whether the device should be set up as wakeup * source * @no_autorepeat: disable key autorepeat * @drive_inactive_cols: drive inactive columns during scan, rather than * making them inputs. * * This structure represents platform-specific data that use used by * matrix_keypad driver to perform proper initialization. */ struct matrix_keypad_platform_data { … }; int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, const char *keymap_name, unsigned int rows, unsigned int cols, unsigned short *keymap, struct input_dev *input_dev); int matrix_keypad_parse_properties(struct device *dev, unsigned int *rows, unsigned int *cols); #define matrix_keypad_parse_of_params … #endif /* _MATRIX_KEYPAD_H */