mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-25 06:46:00 +00:00
test: dm: add video bridge tests
Add tests for video bridge ops. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
897b63d58c
commit
da1eb50ca1
4 changed files with 116 additions and 0 deletions
|
@ -1047,6 +1047,31 @@
|
|||
};
|
||||
};
|
||||
|
||||
lvds-encoder {
|
||||
compatible = "lvds-encoder";
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
|
||||
bridge_input: endpoint {
|
||||
/* link to output */
|
||||
};
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
|
||||
bridge_output: endpoint {
|
||||
remote-endpoint = <&panel_input>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
wdt-gpio-toggle {
|
||||
gpios = <&gpio_a 8 0>;
|
||||
compatible = "linux,wdt-gpio";
|
||||
|
@ -1402,6 +1427,27 @@
|
|||
panel {
|
||||
compatible = "simple-panel";
|
||||
backlight = <&backlight 0 100>;
|
||||
|
||||
display-timings {
|
||||
timing@0 {
|
||||
/* 1280x800@60Hz */
|
||||
clock-frequency = <68000000>;
|
||||
hactive = <1280>;
|
||||
hfront-porch = <48>;
|
||||
hback-porch = <18>;
|
||||
hsync-len = <30>;
|
||||
vactive = <800>;
|
||||
vfront-porch = <3>;
|
||||
vback-porch = <12>;
|
||||
vsync-len = <5>;
|
||||
};
|
||||
};
|
||||
|
||||
port {
|
||||
panel_input: endpoint {
|
||||
remote-endpoint = <&bridge_output>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
scsi {
|
||||
|
|
|
@ -328,6 +328,8 @@ CONFIG_USB_ETH_CDC=y
|
|||
CONFIG_VIDEO=y
|
||||
CONFIG_VIDEO_FONT_SUN12X22=y
|
||||
CONFIG_VIDEO_COPY=y
|
||||
CONFIG_VIDEO_BRIDGE=y
|
||||
CONFIG_VIDEO_BRIDGE_LVDS_CODEC=y
|
||||
CONFIG_CONSOLE_ROTATION=y
|
||||
CONFIG_CONSOLE_TRUETYPE=y
|
||||
CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y
|
||||
|
|
|
@ -63,6 +63,7 @@ obj-$(CONFIG_SOUND) += i2s.o
|
|||
obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
|
||||
obj-$(CONFIG_IOMMU) += iommu.o
|
||||
obj-$(CONFIG_LED) += led.o
|
||||
obj-$(CONFIG_VIDEO_BRIDGE_LVDS_CODEC) += video_bridge.o
|
||||
obj-$(CONFIG_DM_MAILBOX) += mailbox.o
|
||||
obj-$(CONFIG_DM_MDIO) += mdio.o
|
||||
obj-$(CONFIG_DM_MDIO_MUX) += mdio_mux.o
|
||||
|
|
67
test/dm/video_bridge.c
Normal file
67
test/dm/video_bridge.c
Normal file
|
@ -0,0 +1,67 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Test for video bridge uclass
|
||||
*
|
||||
* Copyright (c) 2025 Svyatoslav Ryhel <clamor95@gmail.com>
|
||||
*/
|
||||
|
||||
#include <backlight.h>
|
||||
#include <dm.h>
|
||||
#include <panel.h>
|
||||
#include <video.h>
|
||||
#include <video_bridge.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/test.h>
|
||||
#include <dm/test.h>
|
||||
#include <power/regulator.h>
|
||||
#include <test/test.h>
|
||||
#include <test/ut.h>
|
||||
|
||||
/* Basic test of the video uclass, test is based on driven panel */
|
||||
static int dm_test_video_bridge(struct unit_test_state *uts)
|
||||
{
|
||||
struct udevice *dev, *pwm, *gpio, *reg;
|
||||
uint period_ns, duty_ns;
|
||||
bool enable, polarity;
|
||||
struct display_timing timing;
|
||||
|
||||
ut_assertok(uclass_first_device_err(UCLASS_VIDEO_BRIDGE, &dev));
|
||||
ut_assertok(uclass_get_device_by_name(UCLASS_PWM, "pwm", &pwm));
|
||||
ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio));
|
||||
ut_assertok(regulator_get_by_platname("VDD_EMMC_1.8V", ®));
|
||||
ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns,
|
||||
&enable, &polarity));
|
||||
ut_asserteq(false, enable);
|
||||
ut_asserteq(true, regulator_get_enable(reg));
|
||||
|
||||
/* bridge calls panel_enable_backlight() of panel */
|
||||
ut_assertok(video_bridge_attach(dev));
|
||||
ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns,
|
||||
&enable, &polarity));
|
||||
ut_asserteq(1000, period_ns);
|
||||
ut_asserteq(170 * 1000 / 255, duty_ns);
|
||||
ut_asserteq(true, enable);
|
||||
ut_asserteq(false, polarity);
|
||||
ut_asserteq(1, sandbox_gpio_get_value(gpio, 1));
|
||||
ut_asserteq(true, regulator_get_enable(reg));
|
||||
|
||||
/* bridge calls panel_set_backlight() of panel */
|
||||
ut_assertok(video_bridge_set_backlight(dev, BACKLIGHT_DEFAULT));
|
||||
ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns,
|
||||
&enable, &polarity));
|
||||
ut_asserteq(true, enable);
|
||||
ut_asserteq(170 * 1000 / 255, duty_ns);
|
||||
|
||||
/* bridge should be active */
|
||||
ut_assertok(video_bridge_set_active(dev, true));
|
||||
|
||||
/* bridge is internal and has no hotplug gpio */
|
||||
ut_asserteq(-ENOENT, video_bridge_check_attached(dev));
|
||||
|
||||
/* check passing timings and EDID */
|
||||
ut_assertok(video_bridge_get_display_timing(dev, &timing));
|
||||
ut_assertok(video_bridge_read_edid(dev, NULL, 0));
|
||||
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_video_bridge, UTF_SCAN_PDATA | UTF_SCAN_FDT);
|
Loading…
Add table
Reference in a new issue