diff options
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/Makefile | 8 | ||||
-rw-r--r-- | test/dm/led.c | 72 | ||||
-rw-r--r-- | test/dm/ofnode.c | 9 | ||||
-rw-r--r-- | test/dm/panel.c | 2 | ||||
-rw-r--r-- | test/dm/regulator.c | 4 |
5 files changed, 89 insertions, 6 deletions
diff --git a/test/dm/Makefile b/test/dm/Makefile index c12589d487c..bcb52ef1067 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -7,7 +7,7 @@ obj-$(CONFIG_UT_DM) += test-dm.o # Tests for particular subsystems - when enabling driver model for a new # subsystem you must add sandbox tests here. -ifeq ($(CONFIG_SPL_BUILD),y) +ifeq ($(CONFIG_XPL_BUILD),y) obj-$(CONFIG_SPL_OF_PLATDATA) += of_platdata.o else obj-$(CONFIG_UT_DM) += bus.o @@ -42,13 +42,15 @@ obj-$(CONFIG_CLK) += clk.o clk_ccf.o obj-$(CONFIG_CPU) += cpu.o obj-$(CONFIG_CROS_EC) += cros_ec.o obj-$(CONFIG_PWM_CROS_EC) += cros_ec_pwm.o -obj-$(CONFIG_$(SPL_TPL_)DEVRES) += devres.o +obj-$(CONFIG_$(PHASE_)DEVRES) += devres.o obj-$(CONFIG_DMA) += dma.o obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi_host.o obj-$(CONFIG_DM_DSA) += dsa.o obj-$(CONFIG_ECDSA_VERIFY) += ecdsa.o obj-$(CONFIG_EFI_MEDIA_SANDBOX) += efi_media.o +ifdef CONFIG_NET obj-$(CONFIG_DM_ETH) += eth.o +endif obj-$(CONFIG_EXTCON) += extcon.o ifneq ($(CONFIG_EFI_PARTITION),) obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o @@ -102,7 +104,7 @@ obj-$(CONFIG_DM_RESET) += reset.o obj-$(CONFIG_SYSRESET) += sysreset.o obj-$(CONFIG_DM_REGULATOR) += regulator.o obj-$(CONFIG_CMD_RKMTD) += rkmtd.o -obj-$(CONFIG_$(SPL_TPL_)DM_RNG) += rng.o +obj-$(CONFIG_$(PHASE_)DM_RNG) += rng.o obj-$(CONFIG_DM_RTC) += rtc.o obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o obj-$(CONFIG_SCSI) += scsi.o diff --git a/test/dm/led.c b/test/dm/led.c index e1509c397d8..884f6410b70 100644 --- a/test/dm/led.c +++ b/test/dm/led.c @@ -137,3 +137,75 @@ static int dm_test_led_blink(struct unit_test_state *uts) } DM_TEST(dm_test_led_blink, UTF_SCAN_PDATA | UTF_SCAN_FDT); #endif + +/* Test LED boot */ +#ifdef CONFIG_LED_BOOT +static int dm_test_led_boot(struct unit_test_state *uts) +{ + struct udevice *dev + + /* options/u-boot/boot-led is set to "sandbox:green" */ + ut_assertok(led_get_by_label("sandbox:green", &dev)); + ut_asserteq(LEDST_OFF, led_get_state(dev)); + ut_assertok(led_boot_on()); + ut_asserteq(LEDST_ON, led_get_state(dev)); + ut_assertok(led_boot_off()); + ut_asserteq(LEDST_OFF, led_get_state(dev)); + + return 0; +} + +/* Test LED boot blink fallback */ +#ifndef CONFIG_LED_BLINK +static int dm_test_led_boot(struct unit_test_state *uts) +{ + struct udevice *dev + + /* options/u-boot/boot-led is set to "sandbox:green" */ + ut_assertok(led_get_by_label("sandbox:green", &dev)); + ut_asserteq(LEDST_OFF, led_get_state(dev)); + ut_assertok(led_boot_blink()); + ut_asserteq(LEDST_ON, led_get_state(dev)); + ut_assertok(led_boot_off()); + ut_asserteq(LEDST_OFF, led_get_state(dev)); + + return 0; +} +#endif +#endif + +/* Test LED activity */ +#ifdef CONFIG_LED_ACTIVITY +static int dm_test_led_boot(struct unit_test_state *uts) +{ + struct udevice *dev + + /* options/u-boot/activity-led is set to "sandbox:red" */ + ut_assertok(led_get_by_label("sandbox:red", &dev)); + ut_asserteq(LEDST_OFF, led_get_state(dev)); + ut_assertok(led_activity_on()); + ut_asserteq(LEDST_ON, led_get_state(dev)); + ut_assertok(led_activity_off()); + ut_asserteq(LEDST_OFF, led_get_state(dev)); + + return 0; +} + +/* Test LED activity blink fallback */ +#ifndef CONFIG_LED_BLINK +static int dm_test_led_boot(struct unit_test_state *uts) +{ + struct udevice *dev + + /* options/u-boot/activity-led is set to "sandbox:red" */ + ut_assertok(led_get_by_label("sandbox:red", &dev)); + ut_asserteq(LEDST_OFF, led_get_state(dev)); + ut_assertok(led_activity_blink()); + ut_asserteq(LEDST_ON, led_get_state(dev)); + ut_assertok(led_activity_off()); + ut_asserteq(LEDST_OFF, led_get_state(dev)); + + return 0; +} +#endif +#endif diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 859fc3ae0d0..ce996567c3c 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -614,6 +614,15 @@ static int dm_test_ofnode_options(struct unit_test_state *uts) u64 bootscr_address, bootscr_offset; u64 bootscr_flash_offset, bootscr_flash_size; + ut_assert(!ofnode_options_read_bool("missing")); + ut_assert(ofnode_options_read_bool("testing-bool")); + + ut_asserteq(123, ofnode_options_read_int("testing-int", 0)); + ut_asserteq(6, ofnode_options_read_int("missing", 6)); + + ut_assertnull(ofnode_options_read_str("missing")); + ut_asserteq_str("testing", ofnode_options_read_str("testing-str")); + ut_assertok(ofnode_read_bootscript_address(&bootscr_address, &bootscr_offset)); ut_asserteq_64(0, bootscr_address); diff --git a/test/dm/panel.c b/test/dm/panel.c index ce835c96ed0..ec85a9b1e6e 100644 --- a/test/dm/panel.c +++ b/test/dm/panel.c @@ -33,7 +33,7 @@ static int dm_test_panel(struct unit_test_state *uts) ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns, &enable, &polarity)); ut_asserteq(false, enable); - ut_asserteq(false, regulator_get_enable(reg)); + ut_asserteq(true, regulator_get_enable(reg)); ut_assertok(panel_enable_backlight(dev)); ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns, diff --git a/test/dm/regulator.c b/test/dm/regulator.c index 532bbd82376..449748ad52f 100644 --- a/test/dm/regulator.c +++ b/test/dm/regulator.c @@ -186,7 +186,7 @@ int dm_test_power_regulator_set_enable_if_allowed(struct unit_test_state *uts) /* Get BUCK1 - always on regulator */ platname = regulator_names[BUCK1][PLATNAME]; - ut_assertok(regulator_autoset_by_name(platname, &dev_autoset)); + ut_asserteq(-EALREADY, regulator_autoset_by_name(platname, &dev_autoset)); ut_assertok(regulator_get_by_platname(platname, &dev)); /* Try disabling always-on regulator */ @@ -288,7 +288,7 @@ static int dm_test_power_regulator_autoset(struct unit_test_state *uts) * Expected output state: uV=1200000; uA=200000; output enabled */ platname = regulator_names[BUCK1][PLATNAME]; - ut_assertok(regulator_autoset_by_name(platname, &dev_autoset)); + ut_asserteq(-EALREADY, regulator_autoset_by_name(platname, &dev_autoset)); /* Check, that the returned device is proper */ ut_assertok(regulator_get_by_platname(platname, &dev)); |