xref: /openbmc/linux/include/drm/bridge/dw_mipi_dsi.h (revision 4fc4dca8)
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 #include <linux/types.h>
14 
15 #include <drm/drm_modes.h>
16 
17 struct drm_display_mode;
18 struct drm_encoder;
19 struct dw_mipi_dsi;
20 struct mipi_dsi_device;
21 struct platform_device;
22 
23 struct dw_mipi_dsi_phy_ops {
24 	int (*init)(void *priv_data);
25 	int (*get_lane_mbps)(void *priv_data,
26 			     const struct drm_display_mode *mode,
27 			     unsigned long mode_flags, u32 lanes, u32 format,
28 			     unsigned int *lane_mbps);
29 };
30 
31 struct dw_mipi_dsi_host_ops {
32 	int (*attach)(void *priv_data,
33 		      struct mipi_dsi_device *dsi);
34 	int (*detach)(void *priv_data,
35 		      struct mipi_dsi_device *dsi);
36 };
37 
38 struct dw_mipi_dsi_plat_data {
39 	void __iomem *base;
40 	unsigned int max_data_lanes;
41 
42 	enum drm_mode_status (*mode_valid)(void *priv_data,
43 					   const struct drm_display_mode *mode);
44 
45 	const struct dw_mipi_dsi_phy_ops *phy_ops;
46 	const struct dw_mipi_dsi_host_ops *host_ops;
47 
48 	void *priv_data;
49 };
50 
51 struct dw_mipi_dsi *dw_mipi_dsi_probe(struct platform_device *pdev,
52 				      const struct dw_mipi_dsi_plat_data
53 				      *plat_data);
54 void dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi);
55 int dw_mipi_dsi_bind(struct dw_mipi_dsi *dsi, struct drm_encoder *encoder);
56 void dw_mipi_dsi_unbind(struct dw_mipi_dsi *dsi);
57 void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave);
58 
59 #endif /* __DW_MIPI_DSI__ */
60