dm: Rename DM test flags to make them more generic
[platform/kernel/u-boot.git] / test / dm / irq.c
index 192d80d..51dd5e4 100644 (file)
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <irq.h>
+#include <acpi/acpi_device.h>
 #include <asm/test.h>
 #include <dm/test.h>
 #include <test/ut.h>
@@ -30,7 +31,7 @@ static int dm_test_irq_base(struct unit_test_state *uts)
 
        return 0;
 }
-DM_TEST(dm_test_irq_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+DM_TEST(dm_test_irq_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
 /* Test of irq_first_device_type() */
 static int dm_test_irq_type(struct unit_test_state *uts)
@@ -42,7 +43,7 @@ static int dm_test_irq_type(struct unit_test_state *uts)
 
        return 0;
 }
-DM_TEST(dm_test_irq_type, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+DM_TEST(dm_test_irq_type, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
 /* Test of irq_read_and_clear() */
 static int dm_test_read_and_clear(struct unit_test_state *uts)
@@ -59,7 +60,7 @@ static int dm_test_read_and_clear(struct unit_test_state *uts)
 
        return 0;
 }
-DM_TEST(dm_test_read_and_clear, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+DM_TEST(dm_test_read_and_clear, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
 /* Test of irq_request() */
 static int dm_test_request(struct unit_test_state *uts)
@@ -74,4 +75,26 @@ static int dm_test_request(struct unit_test_state *uts)
 
        return 0;
 }
-DM_TEST(dm_test_request, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+DM_TEST(dm_test_request, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
+/* Test of irq_get_acpi() */
+static int dm_test_irq_get_acpi(struct unit_test_state *uts)
+{
+       struct acpi_irq airq;
+       struct udevice *dev;
+       struct irq irq;
+
+       ut_assertok(uclass_first_device_err(UCLASS_TEST_FDT, &dev));
+       ut_assertok(irq_get_by_index(dev, 0, &irq));
+
+       /* see sandbox_get_acpi() */
+       ut_assertok(irq_get_acpi(&irq, &airq));
+       ut_asserteq(3, airq.pin);
+       ut_asserteq(ACPI_IRQ_LEVEL_TRIGGERED, airq.mode);
+       ut_asserteq(ACPI_IRQ_ACTIVE_HIGH, airq.polarity);
+       ut_asserteq(ACPI_IRQ_SHARED, airq.shared);
+       ut_asserteq(ACPI_IRQ_WAKE, airq.wake);
+
+       return 0;
+}
+DM_TEST(dm_test_irq_get_acpi, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);