1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
4  * Author(s): Yannick Fertre <yannick.fertre@st.com> for STMicroelectronics.
5  *
6  */
7 
8 #ifndef _DSI_HOST_H
9 #define _DSI_HOST_H
10 
11 #include <mipi_dsi.h>
12 
13 struct dsi_host_ops {
14 	/**
15 	 * init() - initialized the dsi_host
16 	 *
17 	 * @dev: dsi host device
18 	 * @device: DSI peripheral device
19 	 * @timing: Display timings
20 	 * @max_data_lanes: maximum number of data lines
21 	 * @phy_ops: set of function pointers for performing physical operations
22 	 * @return 0 if OK, -ve on error
23 	 */
24 	int (*init)(struct udevice *dev,
25 		    struct mipi_dsi_device *device,
26 		    struct display_timing *timings,
27 		    unsigned int max_data_lanes,
28 		    const struct mipi_dsi_phy_ops *phy_ops);
29 
30 	/**
31 	 * enable() - Enable the dsi_host
32 	 *
33 	 * @dev: dsi host device
34 	 * @return 0 if OK, -ve on error
35 	 */
36 	int (*enable)(struct udevice *dev);
37 
38 	/**
39 	 * disable() - Disable the dsi_host
40 	 *
41 	 * @dev: dsi host device
42 	 * @return 0 if OK, -ve on error
43 	 */
44 	int (*disable)(struct udevice *dev);
45 };
46 
47 #define dsi_host_get_ops(dev)	((struct dsi_host_ops *)(dev)->driver->ops)
48 
49 /**
50  * dsi_host_init
51  *
52  * @dev: dsi host device
53  * @device: DSI peripheral device
54  * @timing: Display timings
55  * @max_data_lanes: maximum number of data lines
56  * @phy_ops: set of function pointers for performing physical operations
57  * @return 0 if OK, -ve on error
58  */
59 int dsi_host_init(struct udevice *dev,
60 		  struct mipi_dsi_device *device,
61 		  struct display_timing *timings,
62 		  unsigned int max_data_lanes,
63 		  const struct mipi_dsi_phy_ops *phy_ops);
64 
65 /**
66  * dsi_host_enable
67  *
68  * @dev:	dsi host device
69  * @return 0 if OK, -ve on error
70  */
71 int dsi_host_enable(struct udevice *dev);
72 
73 #endif
74