diff options
author | Simon Glass <sjg@chromium.org> | 2021-01-16 14:52:28 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-01-30 14:25:41 -0700 |
commit | 3a6c994f3896d66e617acdf9bb58ffc4def08b71 (patch) | |
tree | d8b222358a56ab098e8a66a3f09a5b2b0d0066ee /test | |
parent | 2b4b65339110e11b4a859fceeb1eec82b2ebb5f1 (diff) | |
download | u-boot-3a6c994f3896d66e617acdf9bb58ffc4def08b71.zip u-boot-3a6c994f3896d66e617acdf9bb58ffc4def08b71.tar.gz u-boot-3a6c994f3896d66e617acdf9bb58ffc4def08b71.tar.bz2 |
cros_ec: Add support for switches
On x86 platforms the EC provides a way to read 'switches', which are
on/off values determined by the EC.
Add a new driver method for this and implement it for LPC.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/cros_ec.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/dm/cros_ec.c b/test/dm/cros_ec.c index a1ec9fc..4377440 100644 --- a/test/dm/cros_ec.c +++ b/test/dm/cros_ec.c @@ -75,3 +75,29 @@ static int dm_test_cros_ec_features(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_cros_ec_features, UT_TESTF_SCAN_FDT); + +static int dm_test_cros_ec_switches(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_first_device_err(UCLASS_CROS_EC, &dev)); + ut_asserteq(0, cros_ec_get_switches(dev)); + + /* try the command */ + console_record_reset(); + ut_assertok(run_command("crosec switches", 0)); + ut_assert_console_end(); + + /* Open the lid and check the switch changes */ + sandbox_cros_ec_set_test_flags(dev, CROSECT_LID_OPEN); + ut_asserteq(EC_SWITCH_LID_OPEN, cros_ec_get_switches(dev)); + + /* try the command */ + console_record_reset(); + ut_assertok(run_command("crosec switches", 0)); + ut_assert_nextline("lid open"); + ut_assert_console_end(); + + return 0; +} +DM_TEST(dm_test_cros_ec_switches, UT_TESTF_SCAN_FDT); |