1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017 Google, Inc
12 /* Basic test of the pwm uclass */
13 static int dm_test_pwm_base(struct unit_test_state *uts)
17 ut_assertok(uclass_get_device(UCLASS_PWM, 0, &dev));
18 ut_assertnonnull(dev);
19 ut_assertok(pwm_set_config(dev, 0, 100, 50));
20 ut_assertok(pwm_set_enable(dev, 0, true));
21 ut_assertok(pwm_set_enable(dev, 1, true));
22 ut_assertok(pwm_set_enable(dev, 2, true));
23 ut_asserteq(-ENOSPC, pwm_set_enable(dev, 3, true));
24 ut_assertok(pwm_set_invert(dev, 0, true));
26 ut_assertok(uclass_get_device(UCLASS_PWM, 1, &dev));
27 ut_asserteq(-ENODEV, uclass_get_device(UCLASS_PWM, 2, &dev));
31 DM_TEST(dm_test_pwm_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);