xref: /rk3399_rockchip-uboot/drivers/video/drm/rockchip_connector.h (revision c7de5349c9abcd4e28cc34f9eb02efdc19b877b3)
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 struct rockchip_connector {
11 	const struct rockchip_connector_funcs *funcs;
12 
13 	const void *data;
14 };
15 
16 struct rockchip_connector_funcs {
17 	/*
18 	 * pre init connector, prepare some parameter out_if, this will be
19 	 * used by rockchip_display.c and vop
20 	 */
21 	int (*pre_init)(struct display_state *state);
22 
23 	/*
24 	 * init connector, prepare resource to ensure
25 	 * detect and get_timing can works
26 	 */
27 	int (*init)(struct display_state *state);
28 
29 	void (*deinit)(struct display_state *state);
30 	/*
31 	 * Optional, if connector not support hotplug,
32 	 * Returns:
33 	 *   0 means disconnected, else means connected
34 	 */
35 	int (*detect)(struct display_state *state);
36 	/*
37 	 * Optional, if implement it, need fill the timing data:
38 	 *     state->conn_state->mode
39 	 * you can refer to the rockchip_display: display_get_timing(),
40 	 * Returns:
41 	 *   0 means success, else means failed
42 	 */
43 	int (*get_timing)(struct display_state *state);
44 	/*
45 	 * Optional, if implement it, need fill the edid data:
46 	 *     state->conn_state->edid
47 	 * Returns:
48 	 *   0 means success, else means failed
49 	 */
50 	int (*get_edid)(struct display_state *state);
51 	/*
52 	 * call before crtc enable.
53 	 */
54 	int (*prepare)(struct display_state *state);
55 	/*
56 	 * call after crtc enable
57 	 */
58 	int (*enable)(struct display_state *state);
59 	int (*disable)(struct display_state *state);
60 	void (*unprepare)(struct display_state *state);
61 	/*
62 	 * Save data to dts, then you can share data to kernel space.
63 	 */
64 	int (*fixup_dts)(struct display_state *state, void *blob);
65 };
66 
67 const struct rockchip_connector *
68 rockchip_get_connector(const void *blob, int connector_node);
69 
70 #ifdef CONFIG_DRM_ROCKCHIP_ANALOGIX_DP
71 struct rockchip_dp_chip_data;
72 extern const struct rockchip_connector_funcs rockchip_analogix_dp_funcs;
73 extern const struct rockchip_dp_chip_data rk3399_analogix_edp_drv_data;
74 extern const struct rockchip_dp_chip_data rk3368_analogix_edp_drv_data;
75 extern const struct rockchip_dp_chip_data rk3288_analogix_dp_drv_data;
76 #endif
77 #endif
78