blob: 68686a40d9f9a45ab42ed658613fa1d508931261 [file] [log] [blame]
Yannick Fertré9712c822019-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
Yannick Fertré9712c822019-10-07 15:29:05 +02007#include <dm.h>
8#include <dsi_host.h>
9#include <asm/state.h>
10#include <asm/test.h>
11#include <dm/test.h>
Simon Glass75c4d412020-07-19 10:15:37 -060012#include <test/test.h>
Yannick Fertré9712c822019-10-07 15:29:05 +020013#include <test/ut.h>
14
15static int dm_test_dsi_host_phy_init(void *priv_data)
16{
17 return 0;
18}
19
20static void dm_test_dsi_host_phy_post_set_mode(void *priv_data,
21 unsigned long mode_flags)
22{
23}
24
25static int dm_test_dsi_host_phy_get_lane_mbps(void *priv_data,
26 struct display_timing *timings,
27 u32 lanes,
28 u32 format,
29 unsigned int *lane_mbps)
30{
31 return 0;
32}
33
34static const struct mipi_dsi_phy_ops dm_test_dsi_host_phy_ops = {
35 .init = dm_test_dsi_host_phy_init,
36 .get_lane_mbps = dm_test_dsi_host_phy_get_lane_mbps,
37 .post_set_mode = dm_test_dsi_host_phy_post_set_mode,
38};
39
40/* Test that dsi_host driver functions are called */
41static int dm_test_dsi_host(struct unit_test_state *uts)
42{
43 struct udevice *dev;
44 struct mipi_dsi_device device;
45 struct display_timing timings;
46 unsigned int max_data_lanes = 4;
47
48 ut_assertok(uclass_first_device_err(UCLASS_DSI_HOST, &dev));
49
50 ut_assertok(dsi_host_init(dev, &device, &timings, max_data_lanes,
51 &dm_test_dsi_host_phy_ops));
52
53 ut_assertok(dsi_host_enable(dev));
54
55 return 0;
56}
57
Simon Glass974dccd2020-07-28 19:41:12 -060058DM_TEST(dm_test_dsi_host, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);