diff options
author | Yannick Fertré <yannick.fertre@st.com> | 2019-10-07 16:29:05 +0300 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2019-10-14 00:34:43 +0300 |
commit | 23f965a4c611e5c2d2576b5f8d2aa2ea6fffb24c (patch) | |
tree | e22352952c3220fbb074c95dfab9873e2c3fc9ac /test/dm/dsi_host.c | |
parent | 66c37246567c04416780f2c2b87aa251470e0585 (diff) | |
download | u-boot-23f965a4c611e5c2d2576b5f8d2aa2ea6fffb24c.tar.xz |
dm: Add a dsi host uclass
Display Serial Interface (DSI) host can usefully be modelled
as their own uclass.
DSI defines a serial bus and a communication protocol
between the host and the device (panel, bridge).
Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Diffstat (limited to 'test/dm/dsi_host.c')
-rw-r--r-- | test/dm/dsi_host.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/dm/dsi_host.c b/test/dm/dsi_host.c new file mode 100644 index 0000000000..59fcd5558f --- /dev/null +++ b/test/dm/dsi_host.c @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +/* + * Copyright (C) 2019 STMicroelectronics - All Rights Reserved + * Author(s): Yannick Fertre <yannick.fertre@st.com> for STMicroelectronics. + */ + +#include <common.h> +#include <dm.h> +#include <dsi_host.h> +#include <asm/state.h> +#include <asm/test.h> +#include <dm/test.h> +#include <test/ut.h> + +static int dm_test_dsi_host_phy_init(void *priv_data) +{ + return 0; +} + +static void dm_test_dsi_host_phy_post_set_mode(void *priv_data, + unsigned long mode_flags) +{ +} + +static int dm_test_dsi_host_phy_get_lane_mbps(void *priv_data, + struct display_timing *timings, + u32 lanes, + u32 format, + unsigned int *lane_mbps) +{ + return 0; +} + +static const struct mipi_dsi_phy_ops dm_test_dsi_host_phy_ops = { + .init = dm_test_dsi_host_phy_init, + .get_lane_mbps = dm_test_dsi_host_phy_get_lane_mbps, + .post_set_mode = dm_test_dsi_host_phy_post_set_mode, +}; + +/* Test that dsi_host driver functions are called */ +static int dm_test_dsi_host(struct unit_test_state *uts) +{ + struct udevice *dev; + struct mipi_dsi_device device; + struct display_timing timings; + unsigned int max_data_lanes = 4; + + ut_assertok(uclass_first_device_err(UCLASS_DSI_HOST, &dev)); + + ut_assertok(dsi_host_init(dev, &device, &timings, max_data_lanes, + &dm_test_dsi_host_phy_ops)); + + ut_assertok(dsi_host_enable(dev)); + + return 0; +} + +DM_TEST(dm_test_dsi_host, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); |