blob: 59fcd5558f07e5cad2a67ac7005533dbf1b825cc [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>
13#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
58DM_TEST(dm_test_dsi_host, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);