dm: button: add support for linux_code in button-gpio.c driver

Linux event code must be used in input devices, using buttons.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Dzmitry Sankouski
2023-01-22 18:21:24 +03:00
committed by Tom Rini
parent 298ffdd5d6
commit ea6fdc1359
5 changed files with 57 additions and 1 deletions

View File

@@ -37,6 +37,14 @@ struct button_ops {
* @return button state button_state_t, or -ve on error
*/
enum button_state_t (*get_state)(struct udevice *dev);
/**
* get_code() - get linux event code of a button
*
* @dev: button device to change
* @return button code, or -ENODATA on error
*/
int (*get_code)(struct udevice *dev);
};
#define button_get_ops(dev) ((struct button_ops *)(dev)->driver->ops)
@@ -58,4 +66,12 @@ int button_get_by_label(const char *label, struct udevice **devp);
*/
enum button_state_t button_get_state(struct udevice *dev);
/**
* button_get_code() - get linux event code of a button
*
* @dev: button device to change
* @return button code, or -ve on error
*/
int button_get_code(struct udevice *dev);
#endif