]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: dm: test-fdt: Add decode_panel_timing test
authorNikhil M Jain <n-jain1@ti.com>
Tue, 31 Jan 2023 10:05:15 +0000 (15:35 +0530)
committerAnatolij Gustschin <agust@denx.de>
Sat, 4 Feb 2023 17:15:14 +0000 (18:15 +0100)
To test decode_panel_timing add a panel-timings node
and a DM test for decode panel timingd by matching
the panel timing node parameters.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/sandbox/dts/test.dts
test/dm/test-fdt.c

index 8c0592767029fa63927bda49fbd466226e738875..f98f0152ee849be33b3be9bc8d6a08f15b694910 100644 (file)
                                vsync-len = <13>;
                        };
                };
+               panel-timings {
+                       clock-frequency = <6500000>;
+                       hactive = <240>;
+                       vactive = <320>;
+                       hfront-porch = <6>;
+                       hback-porch = <7>;
+                       hsync-len = <1>;
+                       vback-porch = <5>;
+                       vfront-porch = <8>;
+                       vsync-len = <2>;
+                       hsync-active = <1>;
+                       vsync-active = <0>;
+                       de-active = <1>;
+                       pixelclk-active = <1>;
+                       interlaced;
+                       doublescan;
+                       doubleclk;
+               };
        };
 
        junk {
index 7cd2d0461224902052da09dbbff42f5ac1174399..1d2af94f568153260b3fc84a6190274b6cc76925 100644 (file)
@@ -12,6 +12,7 @@
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <dm/test.h>
+#include <dm/read.h>
 #include <dm/root.h>
 #include <dm/device-internal.h>
 #include <dm/devres.h>
@@ -1157,6 +1158,41 @@ static int dm_test_decode_display_timing(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_decode_display_timing, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* Test dev_decode_panel_timing() */
+static int dm_test_decode_panel_timing(struct unit_test_state *uts)
+{
+       struct udevice *dev;
+       struct display_timing timing;
+
+       ut_assertok(uclass_first_device_err(UCLASS_TEST_FDT, &dev));
+       ut_asserteq_str("a-test", dev->name);
+
+       ut_assertok(dev_decode_panel_timing(dev, &timing));
+       ut_assert(timing.hactive.typ == 240);
+       ut_assert(timing.hback_porch.typ == 7);
+       ut_assert(timing.hfront_porch.typ == 6);
+       ut_assert(timing.hsync_len.typ == 1);
+       ut_assert(timing.vactive.typ == 320);
+       ut_assert(timing.vback_porch.typ == 5);
+       ut_assert(timing.vfront_porch.typ == 8);
+       ut_assert(timing.vsync_len.typ == 2);
+       ut_assert(timing.pixelclock.typ == 6500000);
+       ut_assert(timing.flags & DISPLAY_FLAGS_HSYNC_HIGH);
+       ut_assert(!(timing.flags & DISPLAY_FLAGS_HSYNC_LOW));
+       ut_assert(!(timing.flags & DISPLAY_FLAGS_VSYNC_HIGH));
+       ut_assert(timing.flags & DISPLAY_FLAGS_VSYNC_LOW);
+       ut_assert(timing.flags & DISPLAY_FLAGS_DE_HIGH);
+       ut_assert(!(timing.flags & DISPLAY_FLAGS_DE_LOW));
+       ut_assert(timing.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE);
+       ut_assert(!(timing.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE));
+       ut_assert(timing.flags & DISPLAY_FLAGS_INTERLACED);
+       ut_assert(timing.flags & DISPLAY_FLAGS_DOUBLESCAN);
+       ut_assert(timing.flags & DISPLAY_FLAGS_DOUBLECLK);
+
+       return 0;
+}
+DM_TEST(dm_test_decode_panel_timing, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
 /* Test read_resourcee() */
 static int dm_test_read_resource(struct unit_test_state *uts)
 {