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