summaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-02-10 08:11:32 -0500
committerTom Rini <trini@konsulko.com>2019-02-10 08:11:32 -0500
commit151b8339ccd33428d249e75bd036bd7eb33c1ef6 (patch)
tree956862276c1a927bd1feea1d8f455047e267a92b /test/dm
parent2e8560797fc69a34c330a875da4f5d2992452f1e (diff)
parentafcd64579486e1745a3cb964bfe36267d90b4c3e (diff)
Merge tag 'dm-pull-10feb19' of git://git.denx.de/u-boot-dm
Samsung sound patches (applied for Samsung maintainer) Common sound support buildman environment support of-platdata documentation improvements
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/regulator.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/dm/regulator.c b/test/dm/regulator.c
index 5d11e946b2..e510539542 100644
--- a/test/dm/regulator.c
+++ b/test/dm/regulator.c
@@ -175,6 +175,27 @@ static int dm_test_power_regulator_set_get_enable(struct unit_test_state *uts)
}
DM_TEST(dm_test_power_regulator_set_get_enable, DM_TESTF_SCAN_FDT);
+/* Test regulator set and get enable if allowed method */
+static
+int dm_test_power_regulator_set_enable_if_allowed(struct unit_test_state *uts)
+{
+ const char *platname;
+ struct udevice *dev, *dev_autoset;
+ bool val_set = false;
+
+ /* Get BUCK1 - always on regulator */
+ platname = regulator_names[BUCK1][PLATNAME];
+ ut_assertok(regulator_autoset_by_name(platname, &dev_autoset));
+ ut_assertok(regulator_get_by_platname(platname, &dev));
+
+ /* Try disabling always-on regulator */
+ ut_assertok(regulator_set_enable_if_allowed(dev, val_set));
+ ut_asserteq(regulator_get_enable(dev), !val_set);
+
+ return 0;
+}
+DM_TEST(dm_test_power_regulator_set_enable_if_allowed, DM_TESTF_SCAN_FDT);
+
/* Test regulator set and get mode method */
static int dm_test_power_regulator_set_get_mode(struct unit_test_state *uts)
{