]>
Commit | Line | Data |
---|---|---|
3b65ee34 SG |
1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | |
3 | * Test for power-management controller uclass (PMC) | |
4 | * | |
5 | * Copyright 2019 Google LLC | |
6 | */ | |
7 | ||
d678a59d | 8 | #include <common.h> |
3b65ee34 SG |
9 | #include <dm.h> |
10 | #include <power/acpi_pmc.h> | |
11 | #include <dm/test.h> | |
12 | #include <test/ut.h> | |
13 | ||
14 | /* Base test of the PMC uclass */ | |
15 | static int dm_test_pmc_base(struct unit_test_state *uts) | |
16 | { | |
17 | struct acpi_pmc_upriv *upriv; | |
18 | struct udevice *dev; | |
19 | ||
20 | ut_assertok(uclass_first_device_err(UCLASS_ACPI_PMC, &dev)); | |
21 | ||
22 | ut_assertok(pmc_disable_tco(dev)); | |
23 | ut_assertok(pmc_init(dev)); | |
24 | ut_assertok(pmc_prev_sleep_state(dev)); | |
25 | ||
26 | /* Check some values to see that I/O works */ | |
27 | upriv = dev_get_uclass_priv(dev); | |
28 | ut_asserteq(0x24, upriv->gpe0_sts[1]); | |
29 | ut_asserteq(0x64, upriv->tco1_sts); | |
30 | ||
31 | return 0; | |
32 | } | |
e180c2b1 | 33 | DM_TEST(dm_test_pmc_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); |