xref: /rk3399_rockchip-uboot/drivers/video/drm/rockchip_connector.h (revision d5f538dc02e53c7267fcd4a914104071fca889b5)
1 /*
2  * (C) Copyright 2008-2017 Fuzhou Rockchip Electronics Co., Ltd
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #ifndef _ROCKCHIP_CONNECTOR_H_
8 #define _ROCKCHIP_CONNECTOR_H_
9 
10 #include "rockchip_mipi_dsi.h"
11 
12 struct rockchip_connector {
13 	const struct rockchip_connector_funcs *funcs;
14 
15 	const void *data;
16 };
17 
18 struct rockchip_connector_funcs {
19 	/*
20 	 * init connector, prepare resource to ensure
21 	 * detect and get_timing can works
22 	 */
23 	int (*init)(struct display_state *state);
24 
25 	void (*deinit)(struct display_state *state);
26 	/*
27 	 * Optional, if connector not support hotplug,
28 	 * Returns:
29 	 *   0 means disconnected, else means connected
30 	 */
31 	int (*detect)(struct display_state *state);
32 	/*
33 	 * Optional, if implement it, need fill the timing data:
34 	 *     state->conn_state->mode
35 	 * you can refer to the rockchip_display: display_get_timing(),
36 	 * Returns:
37 	 *   0 means success, else means failed
38 	 */
39 	int (*get_timing)(struct display_state *state);
40 	/*
41 	 * Optional, if implement it, need fill the edid data:
42 	 *     state->conn_state->edid
43 	 * Returns:
44 	 *   0 means success, else means failed
45 	 */
46 	int (*get_edid)(struct display_state *state);
47 	/*
48 	 * call before crtc enable.
49 	 */
50 	int (*prepare)(struct display_state *state);
51 	/*
52 	 * call after crtc enable
53 	 */
54 	int (*enable)(struct display_state *state);
55 	int (*disable)(struct display_state *state);
56 	void (*unprepare)(struct display_state *state);
57 	/*
58 	 * Save data to dts, then you can share data to kernel space.
59 	 */
60 	int (*fixup_dts)(struct display_state *state, void *blob);
61 	/* transmit a DSI packet */
62 	ssize_t (*transfer)(struct display_state *state,
63 			    const struct mipi_dsi_msg *msg);
64 };
65 
66 const struct rockchip_connector *
67 rockchip_get_connector(const void *blob, int connector_node);
68 
69 #ifdef CONFIG_DRM_ROCKCHIP_ANALOGIX_DP
70 struct rockchip_dp_chip_data;
71 extern const struct rockchip_connector_funcs rockchip_analogix_dp_funcs;
72 extern const struct rockchip_dp_chip_data rk3399_analogix_edp_drv_data;
73 extern const struct rockchip_dp_chip_data rk3368_analogix_edp_drv_data;
74 extern const struct rockchip_dp_chip_data rk3288_analogix_dp_drv_data;
75 #endif
76 #endif
77