blob: e70227e7800bac539475a05abf8c53e77f2dceff [file] [log] [blame]
Simon Glass3b65ee32019-12-06 21:41:54 -07001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Test for power-management controller uclass (PMC)
4 *
5 * Copyright 2019 Google LLC
6 */
7
8#include <common.h>
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 */
15static 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}
Simon Glasse180c2b2020-07-28 19:41:12 -060033DM_TEST(dm_test_pmc_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);