1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef _EXYNOS_DRM_DRV_H_
16#define _EXYNOS_DRM_DRV_H_
17
18#include <drm/drmP.h>
19#include <linux/module.h>
20
21#define MAX_CRTC 3
22#define MAX_PLANE 5
23#define MAX_FB_BUFFER 4
24
25#define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc, base)
26#define to_exynos_plane(x) container_of(x, struct exynos_drm_plane, base)
27
28
29enum exynos_drm_output_type {
30 EXYNOS_DISPLAY_TYPE_NONE,
31
32 EXYNOS_DISPLAY_TYPE_LCD,
33
34 EXYNOS_DISPLAY_TYPE_HDMI,
35
36 EXYNOS_DISPLAY_TYPE_VIDI,
37};
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63struct exynos_drm_plane {
64 struct drm_plane base;
65 unsigned int src_x;
66 unsigned int src_y;
67 unsigned int src_w;
68 unsigned int src_h;
69 unsigned int crtc_x;
70 unsigned int crtc_y;
71 unsigned int crtc_w;
72 unsigned int crtc_h;
73 unsigned int h_ratio;
74 unsigned int v_ratio;
75 dma_addr_t dma_addr[MAX_FB_BUFFER];
76 unsigned int zpos;
77 struct drm_framebuffer *pending_fb;
78};
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101struct exynos_drm_crtc;
102struct exynos_drm_crtc_ops {
103 void (*enable)(struct exynos_drm_crtc *crtc);
104 void (*disable)(struct exynos_drm_crtc *crtc);
105 void (*commit)(struct exynos_drm_crtc *crtc);
106 int (*enable_vblank)(struct exynos_drm_crtc *crtc);
107 void (*disable_vblank)(struct exynos_drm_crtc *crtc);
108 void (*wait_for_vblank)(struct exynos_drm_crtc *crtc);
109 void (*atomic_begin)(struct exynos_drm_crtc *crtc,
110 struct exynos_drm_plane *plane);
111 void (*update_plane)(struct exynos_drm_crtc *crtc,
112 struct exynos_drm_plane *plane);
113 void (*disable_plane)(struct exynos_drm_crtc *crtc,
114 struct exynos_drm_plane *plane);
115 void (*atomic_flush)(struct exynos_drm_crtc *crtc,
116 struct exynos_drm_plane *plane);
117 void (*te_handler)(struct exynos_drm_crtc *crtc);
118 void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable);
119};
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140struct exynos_drm_crtc {
141 struct drm_crtc base;
142 enum exynos_drm_output_type type;
143 unsigned int pipe;
144 struct drm_pending_vblank_event *event;
145 wait_queue_head_t wait_update;
146 atomic_t pending_update;
147 const struct exynos_drm_crtc_ops *ops;
148 void *ctx;
149};
150
151struct exynos_drm_g2d_private {
152 struct device *dev;
153 struct list_head inuse_cmdlist;
154 struct list_head event_list;
155 struct list_head userptr_list;
156};
157
158struct drm_exynos_file_private {
159 struct exynos_drm_g2d_private *g2d_priv;
160 struct device *ipp_dev;
161};
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176struct exynos_drm_private {
177 struct drm_fb_helper *fb_helper;
178
179
180
181
182
183 struct drm_crtc *crtc[MAX_CRTC];
184 struct drm_property *plane_zpos_property;
185
186 unsigned long da_start;
187 unsigned long da_space_size;
188
189 unsigned int pipe;
190
191
192 u32 pending;
193 spinlock_t lock;
194 wait_queue_head_t wait;
195};
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211struct exynos_drm_subdrv {
212 struct list_head list;
213 struct device *dev;
214 struct drm_device *drm_dev;
215
216 int (*probe)(struct drm_device *drm_dev, struct device *dev);
217 void (*remove)(struct drm_device *drm_dev, struct device *dev);
218 int (*open)(struct drm_device *drm_dev, struct device *dev,
219 struct drm_file *file);
220 void (*close)(struct drm_device *drm_dev, struct device *dev,
221 struct drm_file *file);
222};
223
224
225int exynos_drm_subdrv_register(struct exynos_drm_subdrv *drm_subdrv);
226
227
228int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *drm_subdrv);
229
230int exynos_drm_device_subdrv_probe(struct drm_device *dev);
231int exynos_drm_device_subdrv_remove(struct drm_device *dev);
232int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file);
233void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file);
234
235#ifdef CONFIG_DRM_EXYNOS_DPI
236struct drm_encoder *exynos_dpi_probe(struct device *dev);
237int exynos_dpi_remove(struct drm_encoder *encoder);
238int exynos_dpi_bind(struct drm_device *dev, struct drm_encoder *encoder);
239#else
240static inline struct drm_encoder *
241exynos_dpi_probe(struct device *dev) { return NULL; }
242static inline int exynos_dpi_remove(struct drm_encoder *encoder)
243{
244 return 0;
245}
246static inline int exynos_dpi_bind(struct drm_device *dev,
247 struct drm_encoder *encoder)
248{
249 return 0;
250}
251#endif
252
253int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
254 bool async);
255
256
257extern struct platform_driver fimd_driver;
258extern struct platform_driver exynos5433_decon_driver;
259extern struct platform_driver decon_driver;
260extern struct platform_driver dp_driver;
261extern struct platform_driver dsi_driver;
262extern struct platform_driver mixer_driver;
263extern struct platform_driver hdmi_driver;
264extern struct platform_driver exynos_drm_common_hdmi_driver;
265extern struct platform_driver vidi_driver;
266extern struct platform_driver g2d_driver;
267extern struct platform_driver fimc_driver;
268extern struct platform_driver rotator_driver;
269extern struct platform_driver gsc_driver;
270extern struct platform_driver ipp_driver;
271extern struct platform_driver mic_driver;
272#endif
273