blob: 6e0a5df704f583724b58915ea49e045d8faec472 [file] [log] [blame]
Yannick Fertré23f965a2019-10-07 15:29:05 +02001// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
2/*
3 * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
4 * Author(s): Yannick Fertre <yannick.fertre@st.com> for STMicroelectronics.
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <dsi_host.h>
10#include <asm/state.h>
11#include <asm/test.h>
12#include <dm/test.h>
Simon Glass0e1fad42020-07-19 10:15:37 -060013#include <test/test.h>
Yannick Fertré23f965a2019-10-07 15:29:05 +020014#include <test/ut.h>
15
16static int dm_test_dsi_host_phy_init(void *priv_data)
17{
18 return 0;
19}
20
21static void dm_test_dsi_host_phy_post_set_mode(void *priv_data,
22 unsigned long mode_flags)
23{
24}
25
26static int dm_test_dsi_host_phy_get_lane_mbps(void *priv_data,
27 struct display_timing *timings,
28 u32 lanes,
29 u32 format,
30 unsigned int *lane_mbps)
31{
32 return 0;
33}
34
35static const struct mipi_dsi_phy_ops dm_test_dsi_host_phy_ops = {
36 .init = dm_test_dsi_host_phy_init,
37 .get_lane_mbps = dm_test_dsi_host_phy_get_lane_mbps,
38 .post_set_mode = dm_test_dsi_host_phy_post_set_mode,
39};
40
41/* Test that dsi_host driver functions are called */
42static int dm_test_dsi_host(struct unit_test_state *uts)
43{
44 struct udevice *dev;
45 struct mipi_dsi_device device;
46 struct display_timing timings;
47 unsigned int max_data_lanes = 4;
48
49 ut_assertok(uclass_first_device_err(UCLASS_DSI_HOST, &dev));
50
51 ut_assertok(dsi_host_init(dev, &device, &timings, max_data_lanes,
52 &dm_test_dsi_host_phy_ops));
53
54 ut_assertok(dsi_host_enable(dev));
55
56 return 0;
57}
58
Simon Glasse180c2b2020-07-28 19:41:12 -060059DM_TEST(dm_test_dsi_host, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);