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

@@ -38,6 +38,16 @@ enum button_state_t button_get_state(struct udevice *dev)
return ops->get_state(dev);
}
int button_get_code(struct udevice *dev)
{
struct button_ops *ops = button_get_ops(dev);
if (!ops->get_code)
return -ENOSYS;
return ops->get_code(dev);
}
UCLASS_DRIVER(button) = {
.id = UCLASS_BUTTON,
.name = "button",