diff options
author | Dzmitry Sankouski <dsankouski@gmail.com> | 2023-01-22 18:21:24 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-02-10 20:50:01 +0300 |
commit | ea6fdc135954186ada5df9cca3f063a9a785d1b2 (patch) | |
tree | 7da52a5aafa491db923bb77352acaf08f268cd97 /test | |
parent | 298ffdd5d65c4d67b958080c1a712f8f1c923af3 (diff) | |
download | u-boot-ea6fdc135954186ada5df9cca3f063a9a785d1b2.tar.xz |
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>
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/button.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/dm/button.c b/test/dm/button.c index e76c1ad030..3318668df2 100644 --- a/test/dm/button.c +++ b/test/dm/button.c @@ -13,6 +13,7 @@ #include <power/sandbox_pmic.h> #include <asm/gpio.h> #include <dm/test.h> +#include <dt-bindings/input/input.h> #include <test/ut.h> /* Base test of the button uclass */ @@ -85,6 +86,18 @@ static int dm_test_button_label(struct unit_test_state *uts) } DM_TEST(dm_test_button_label, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +/* Test button has linux,code */ +static int dm_test_button_linux_code(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_get_device(UCLASS_BUTTON, 1, &dev)); + ut_asserteq(BTN_1, button_get_code(dev)); + + return 0; +} +DM_TEST(dm_test_button_linux_code, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + /* Test adc-keys driver */ static int dm_test_button_keys_adc(struct unit_test_state *uts) { |