xref: /openbmc/linux/include/drm/bridge/dw_mipi_dsi.h (revision 0c7beb2d)
1 /*
2  * Copyright (C) STMicroelectronics SA 2017
3  *
4  * Authors: Philippe Cornu <philippe.cornu@st.com>
5  *          Yannick Fertre <yannick.fertre@st.com>
6  *
7  * License terms:  GNU General Public License (GPL), version 2
8  */
9 
10 #ifndef __DW_MIPI_DSI__
11 #define __DW_MIPI_DSI__
12 
13 struct dw_mipi_dsi;
14 
15 struct dw_mipi_dsi_phy_ops {
16 	int (*init)(void *priv_data);
17 	int (*get_lane_mbps)(void *priv_data,
18 			     const struct drm_display_mode *mode,
19 			     unsigned long mode_flags, u32 lanes, u32 format,
20 			     unsigned int *lane_mbps);
21 };
22 
23 struct dw_mipi_dsi_host_ops {
24 	int (*attach)(void *priv_data,
25 		      struct mipi_dsi_device *dsi);
26 	int (*detach)(void *priv_data,
27 		      struct mipi_dsi_device *dsi);
28 };
29 
30 struct dw_mipi_dsi_plat_data {
31 	void __iomem *base;
32 	unsigned int max_data_lanes;
33 
34 	enum drm_mode_status (*mode_valid)(void *priv_data,
35 					   const struct drm_display_mode *mode);
36 
37 	const struct dw_mipi_dsi_phy_ops *phy_ops;
38 	const struct dw_mipi_dsi_host_ops *host_ops;
39 
40 	void *priv_data;
41 };
42 
43 struct dw_mipi_dsi *dw_mipi_dsi_probe(struct platform_device *pdev,
44 				      const struct dw_mipi_dsi_plat_data
45 				      *plat_data);
46 void dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi);
47 int dw_mipi_dsi_bind(struct dw_mipi_dsi *dsi, struct drm_encoder *encoder);
48 void dw_mipi_dsi_unbind(struct dw_mipi_dsi *dsi);
49 void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave);
50 
51 #endif /* __DW_MIPI_DSI__ */
52