xref: /rk3399_rockchip-uboot/drivers/video/drm/rockchip_display.h (revision 15a7587bba2ffa33a2e08d02a707fe54b7e24d94)
1 /*
2  * (C) Copyright 2008-2017 Fuzhou Rockchip Electronics Co., Ltd
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #ifndef _ROCKCHIP_DISPLAY_H
8 #define _ROCKCHIP_DISPLAY_H
9 
10 #include <bmp_layout.h>
11 #include <drm_modes.h>
12 #include <edid.h>
13 #include <dm/ofnode.h>
14 
15 #define ROCKCHIP_OUTPUT_DSI_DUAL_CHANNEL	BIT(0)
16 #define ROCKCHIP_OUTPUT_DSI_DUAL_LINK		BIT(1)
17 
18 enum data_format {
19 	ROCKCHIP_FMT_ARGB8888 = 0,
20 	ROCKCHIP_FMT_RGB888,
21 	ROCKCHIP_FMT_RGB565,
22 	ROCKCHIP_FMT_YUV420SP = 4,
23 	ROCKCHIP_FMT_YUV422SP,
24 	ROCKCHIP_FMT_YUV444SP,
25 };
26 
27 enum display_mode {
28 	ROCKCHIP_DISPLAY_FULLSCREEN,
29 	ROCKCHIP_DISPLAY_CENTER,
30 };
31 
32 /*
33  * display output interface supported by rockchip lcdc
34  */
35 #define ROCKCHIP_OUT_MODE_P888	0
36 #define ROCKCHIP_OUT_MODE_P666	1
37 #define ROCKCHIP_OUT_MODE_P565	2
38 /* for use special outface */
39 #define ROCKCHIP_OUT_MODE_AAAA	15
40 
41 struct crtc_state {
42 	struct udevice *dev;
43 	const struct rockchip_crtc *crtc;
44 	void *private;
45 	ofnode node;
46 	int crtc_id;
47 
48 	int format;
49 	u32 dma_addr;
50 	int ymirror;
51 	int rb_swap;
52 	int xvir;
53 	int src_x;
54 	int src_y;
55 	int src_w;
56 	int src_h;
57 	int crtc_x;
58 	int crtc_y;
59 	int crtc_w;
60 	int crtc_h;
61 };
62 
63 struct panel_state {
64 	struct udevice *dev;
65 	ofnode node;
66 	ofnode dsp_lut_node;
67 
68 	const struct rockchip_panel *panel;
69 	void *private;
70 };
71 
72 struct connector_state {
73 	struct udevice *dev;
74 	const struct rockchip_connector *connector;
75 	struct udevice *phy_dev;
76 	const struct rockchip_phy *phy;
77 	ofnode node;
78 	ofnode phy_node;
79 
80 	void *private;
81 	void *phy_private;
82 
83 	struct drm_display_mode mode;
84 	u8 edid[EDID_SIZE * 4];
85 	int bus_format;
86 	int output_mode;
87 	int type;
88 	int output_type;
89 
90 	struct {
91 		u32 *lut;
92 		int size;
93 	} gamma;
94 };
95 
96 struct logo_info {
97 	int mode;
98 	char *mem;
99 	bool ymirror;
100 	u32 offset;
101 	u32 width;
102 	u32 height;
103 	u32 bpp;
104 };
105 
106 struct rockchip_logo_cache {
107 	struct list_head head;
108 	char name[20];
109 	struct logo_info logo;
110 };
111 
112 struct display_state {
113 	struct list_head head;
114 
115 	const void *blob;
116 	ofnode node;
117 
118 	struct crtc_state crtc_state;
119 	struct connector_state conn_state;
120 	struct panel_state panel_state;
121 
122 	const char *ulogo_name;
123 	const char *klogo_name;
124 
125 	struct logo_info logo;
126 	int logo_mode;
127 	int charge_logo_mode;
128 	void *mem_base;
129 	int mem_size;
130 
131 	int enable;
132 	int is_init;
133 	int is_enable;
134 };
135 
136 int drm_mode_vrefresh(const struct drm_display_mode *mode);
137 
138 #endif
139