Yannick Fertré | 23f965a | 2019-10-07 15:29:05 +0200 | [diff] [blame] | 1 | // 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 Glass | 0e1fad4 | 2020-07-19 10:15:37 -0600 | [diff] [blame] | 13 | #include <test/test.h> |
Yannick Fertré | 23f965a | 2019-10-07 15:29:05 +0200 | [diff] [blame] | 14 | #include <test/ut.h> |
| 15 | |
| 16 | static int dm_test_dsi_host_phy_init(void *priv_data) |
| 17 | { |
| 18 | return 0; |
| 19 | } |
| 20 | |
| 21 | static void dm_test_dsi_host_phy_post_set_mode(void *priv_data, |
| 22 | unsigned long mode_flags) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | static 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 | |
| 35 | static 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 */ |
| 42 | static 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 Glass | e180c2b | 2020-07-28 19:41:12 -0600 | [diff] [blame] | 59 | DM_TEST(dm_test_dsi_host, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); |