forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
....@@ -1,87 +1,120 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
34 * Author:Mark Yao <mark.yao@rock-chips.com>
45 *
56 * based on exynos_drm_drv.h
6
- *
7
- * This software is licensed under the terms of the GNU General Public
8
- * License version 2, as published by the Free Software Foundation, and
9
- * may be copied, distributed, and modified under those terms.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
157 */
168
179 #ifndef _ROCKCHIP_DRM_DRV_H
1810 #define _ROCKCHIP_DRM_DRV_H
1911
20
-#include <drm/drm_crtc.h>
21
-#include <drm/drm_fb_helper.h>
2212 #include <drm/drm_atomic_helper.h>
13
+#include <drm/drm_dsc.h>
14
+#include <drm/drm_fb_helper.h>
15
+#include <drm/drm_fourcc.h>
2316 #include <drm/drm_gem.h>
2417 #include <drm/rockchip_drm.h>
25
-
2618 #include <linux/module.h>
2719 #include <linux/component.h>
28
-#include <linux/dmabuf_page_pool.h>
20
+
21
+#include <soc/rockchip/rockchip_dmc.h>
22
+
23
+#include "../panel/panel-simple.h"
24
+
25
+#include "rockchip_drm_debugfs.h"
2926
3027 #define ROCKCHIP_MAX_FB_BUFFER 3
3128 #define ROCKCHIP_MAX_CONNECTOR 2
3229 #define ROCKCHIP_MAX_CRTC 4
3330 #define ROCKCHIP_MAX_LAYER 16
3431
32
+
3533 struct drm_device;
3634 struct drm_connector;
3735 struct iommu_domain;
36
+
37
+#define VOP_COLOR_KEY_NONE (0 << 31)
38
+#define VOP_COLOR_KEY_MASK (1 << 31)
39
+
40
+#define VOP_OUTPUT_IF_RGB BIT(0)
41
+#define VOP_OUTPUT_IF_BT1120 BIT(1)
42
+#define VOP_OUTPUT_IF_BT656 BIT(2)
43
+#define VOP_OUTPUT_IF_LVDS0 BIT(3)
44
+#define VOP_OUTPUT_IF_LVDS1 BIT(4)
45
+#define VOP_OUTPUT_IF_MIPI0 BIT(5)
46
+#define VOP_OUTPUT_IF_MIPI1 BIT(6)
47
+#define VOP_OUTPUT_IF_eDP0 BIT(7)
48
+#define VOP_OUTPUT_IF_eDP1 BIT(8)
49
+#define VOP_OUTPUT_IF_DP0 BIT(9)
50
+#define VOP_OUTPUT_IF_DP1 BIT(10)
51
+#define VOP_OUTPUT_IF_HDMI0 BIT(11)
52
+#define VOP_OUTPUT_IF_HDMI1 BIT(12)
53
+
54
+#ifndef DRM_FORMAT_NV20
55
+#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') /* 2x1 subsampled Cr:Cb plane */
56
+#endif
57
+
58
+#ifndef DRM_FORMAT_NV30
59
+#define DRM_FORMAT_NV30 fourcc_code('N', 'V', '3', '0') /* non-subsampled Cr:Cb plane */
60
+#endif
61
+
62
+#define RK_IF_PROP_COLOR_DEPTH "color_depth"
63
+#define RK_IF_PROP_COLOR_FORMAT "color_format"
64
+#define RK_IF_PROP_COLOR_DEPTH_CAPS "color_depth_caps"
65
+#define RK_IF_PROP_COLOR_FORMAT_CAPS "color_format_caps"
66
+#define RK_IF_PROP_ENCRYPTED "hdcp_encrypted"
67
+
68
+enum rockchip_drm_debug_category {
69
+ VOP_DEBUG_PLANE = BIT(0),
70
+ VOP_DEBUG_OVERLAY = BIT(1),
71
+ VOP_DEBUG_WB = BIT(2),
72
+ VOP_DEBUG_CFG_DONE = BIT(3),
73
+ VOP_DEBUG_VSYNC = BIT(7),
74
+};
75
+
76
+enum rk_if_color_depth {
77
+ RK_IF_DEPTH_8,
78
+ RK_IF_DEPTH_10,
79
+ RK_IF_DEPTH_12,
80
+ RK_IF_DEPTH_16,
81
+ RK_IF_DEPTH_420_10,
82
+ RK_IF_DEPTH_420_12,
83
+ RK_IF_DEPTH_420_16,
84
+ RK_IF_DEPTH_6,
85
+ RK_IF_DEPTH_MAX,
86
+};
87
+
88
+enum rk_if_color_format {
89
+ RK_IF_FORMAT_RGB, /* default RGB */
90
+ RK_IF_FORMAT_YCBCR444, /* YCBCR 444 */
91
+ RK_IF_FORMAT_YCBCR422, /* YCBCR 422 */
92
+ RK_IF_FORMAT_YCBCR420, /* YCBCR 420 */
93
+ RK_IF_FORMAT_YCBCR_HQ, /* Highest subsampled YUV */
94
+ RK_IF_FORMAT_YCBCR_LQ, /* Lowest subsampled YUV */
95
+ RK_IF_FORMAT_MAX,
96
+};
97
+
98
+enum rockchip_hdcp_encrypted {
99
+ RK_IF_HDCP_ENCRYPTED_NONE = 0,
100
+ RK_IF_HDCP_ENCRYPTED_LEVEL1,
101
+ RK_IF_HDCP_ENCRYPTED_LEVEL2,
102
+};
103
+
104
+enum rockchip_color_bar_mode {
105
+ ROCKCHIP_COLOR_BAR_OFF = 0,
106
+ ROCKCHIP_COLOR_BAR_HORIZONTAL = 1,
107
+ ROCKCHIP_COLOR_BAR_VERTICAL = 2,
108
+};
38109
39110 struct rockchip_drm_sub_dev {
40111 struct list_head list;
41112 struct drm_connector *connector;
42113 struct device_node *of_node;
43
-};
44
-
45
-/*
46
- * Rockchip drm private crtc funcs.
47
- * @loader_protect: protect loader logo crtc's power
48
- * @enable_vblank: enable crtc vblank irq.
49
- * @disable_vblank: disable crtc vblank irq.
50
- * @bandwidth: report present crtc bandwidth consume.
51
- */
52
-struct rockchip_crtc_funcs {
53
- int (*loader_protect)(struct drm_crtc *crtc, bool on);
54
- int (*enable_vblank)(struct drm_crtc *crtc);
55
- void (*disable_vblank)(struct drm_crtc *crtc);
56
- size_t (*bandwidth)(struct drm_crtc *crtc,
57
- struct drm_crtc_state *crtc_state,
58
- size_t *frame_bw_mbyte,
59
- unsigned int *plane_num_total);
60
- void (*cancel_pending_vblank)(struct drm_crtc *crtc,
61
- struct drm_file *file_priv);
62
- int (*debugfs_init)(struct drm_minor *minor, struct drm_crtc *crtc);
63
- int (*debugfs_dump)(struct drm_crtc *crtc, struct seq_file *s);
64
- void (*regs_dump)(struct drm_crtc *crtc, struct seq_file *s);
65
- void (*active_regs_dump)(struct drm_crtc *crtc, struct seq_file *s);
66
- enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc,
67
- const struct drm_display_mode *mode,
68
- int output_type);
69
- void (*crtc_close)(struct drm_crtc *crtc);
70
- void (*crtc_send_mcu_cmd)(struct drm_crtc *crtc, u32 type, u32 value);
71
- void (*te_handler)(struct drm_crtc *crtc);
72
-};
73
-
74
-struct rockchip_atomic_commit {
75
- struct drm_atomic_state *state;
76
- struct drm_device *dev;
77
- size_t line_bw_mbyte;
78
- size_t frame_bw_mbyte;
79
- unsigned int plane_num;
80
-};
81
-
82
-struct rockchip_dclk_pll {
83
- struct clk *pll;
84
- unsigned int use_count;
114
+ int (*loader_protect)(struct drm_encoder *encoder, bool on);
115
+ void (*oob_hotplug_event)(struct drm_connector *connector);
116
+ void (*update_vfp_for_vrr)(struct drm_connector *connector, struct drm_display_mode *mode,
117
+ int vfp);
85118 };
86119
87120 struct rockchip_sdr2hdr_state {
....@@ -104,9 +137,6 @@
104137 struct rockchip_sdr2hdr_state sdr2hdr_state;
105138 };
106139
107
-#define VOP_COLOR_KEY_NONE (0 << 31)
108
-#define VOP_COLOR_KEY_MASK (1 << 31)
109
-
110140 struct rockchip_bcsh_state {
111141 int brightness;
112142 int contrast;
....@@ -115,24 +145,57 @@
115145 int cos_hue;
116146 };
117147
118
-#define VOP_OUTPUT_IF_RGB BIT(0)
119
-#define VOP_OUTPUT_IF_BT1120 BIT(1)
120
-#define VOP_OUTPUT_IF_BT656 BIT(2)
121
-#define VOP_OUTPUT_IF_LVDS0 BIT(3)
122
-#define VOP_OUTPUT_IF_LVDS1 BIT(4)
123
-#define VOP_OUTPUT_IF_MIPI0 BIT(5)
124
-#define VOP_OUTPUT_IF_MIPI1 BIT(6)
125
-#define VOP_OUTPUT_IF_eDP0 BIT(7)
126
-#define VOP_OUTPUT_IF_eDP1 BIT(8)
127
-#define VOP_OUTPUT_IF_DP0 BIT(9)
128
-#define VOP_OUTPUT_IF_DP1 BIT(10)
129
-#define VOP_OUTPUT_IF_HDMI0 BIT(11)
130
-#define VOP_OUTPUT_IF_HDMI1 BIT(12)
148
+struct rockchip_crtc {
149
+ struct drm_crtc crtc;
150
+#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
151
+ /**
152
+ * @vop_dump_status the status of vop dump control
153
+ * @vop_dump_list_head the list head of vop dump list
154
+ * @vop_dump_list_init_flag init once
155
+ * @vop_dump_times control the dump times
156
+ * @frme_count the frame of dump buf
157
+ */
158
+ enum vop_dump_status vop_dump_status;
159
+ struct list_head vop_dump_list_head;
160
+ bool vop_dump_list_init_flag;
161
+ int vop_dump_times;
162
+ int frame_count;
163
+#endif
164
+};
165
+
166
+struct rockchip_dsc_sink_cap {
167
+ /**
168
+ * @slice_width: the number of pixel columns that comprise the slice width
169
+ * @slice_height: the number of pixel rows that comprise the slice height
170
+ * @block_pred: Does block prediction
171
+ * @native_420: Does sink support DSC with 4:2:0 compression
172
+ * @bpc_supported: compressed bpc supported by sink : 10, 12 or 16 bpc
173
+ * @version_major: DSC major version
174
+ * @version_minor: DSC minor version
175
+ * @target_bits_per_pixel_x16: bits num after compress and multiply 16
176
+ */
177
+ u16 slice_width;
178
+ u16 slice_height;
179
+ bool block_pred;
180
+ bool native_420;
181
+ u8 bpc_supported;
182
+ u8 version_major;
183
+ u8 version_minor;
184
+ u16 target_bits_per_pixel_x16;
185
+};
131186
132187 struct rockchip_crtc_state {
133188 struct drm_crtc_state base;
134
-
135189 int vp_id;
190
+ int output_type;
191
+ int output_mode;
192
+ int output_bpc;
193
+ int output_flags;
194
+ bool enable_afbc;
195
+ /**
196
+ * @splice_mode: enabled when display a hdisplay > 4096 on rk3588
197
+ */
198
+ bool splice_mode;
136199
137200 /**
138201 * @hold_mode: enabled when it's:
....@@ -163,10 +226,6 @@
163226 int afbdc_win_xoffset;
164227 int afbdc_win_yoffset;
165228 int dsp_layer_sel;
166
- int output_type;
167
- int output_mode;
168
- int output_bpc;
169
- int output_flags;
170229 u32 output_if;
171230 u32 bus_format;
172231 u32 bus_flags;
....@@ -180,8 +239,28 @@
180239 u32 background;
181240 u32 line_flag;
182241 u8 mode_update;
242
+ u8 dsc_id;
243
+ u8 dsc_enable;
244
+
245
+ u8 dsc_slice_num;
246
+ u8 dsc_pixel_num;
247
+
248
+ u64 dsc_txp_clk_rate;
249
+ u64 dsc_pxl_clk_rate;
250
+ u64 dsc_cds_clk_rate;
251
+
252
+ struct drm_dsc_picture_parameter_set pps;
253
+ struct rockchip_dsc_sink_cap dsc_sink_cap;
183254 struct rockchip_hdr_state hdr;
255
+ struct drm_property_blob *hdr_ext_data;
256
+ struct drm_property_blob *acm_lut_data;
257
+ struct drm_property_blob *post_csc_data;
258
+
259
+ int request_refresh_rate;
260
+ int max_refresh_rate;
261
+ int min_refresh_rate;
184262 };
263
+
185264 #define to_rockchip_crtc_state(s) \
186265 container_of(s, struct rockchip_crtc_state, base)
187266
....@@ -193,15 +272,159 @@
193272
194273 struct rockchip_logo {
195274 dma_addr_t dma_addr;
275
+ struct drm_mm_node logo_reserved_node;
196276 void *kvaddr;
197277 phys_addr_t start;
198278 phys_addr_t size;
199279 int count;
200280 };
201281
282
+struct rockchip_mcu_timing {
283
+ int mcu_pix_total;
284
+ int mcu_cs_pst;
285
+ int mcu_cs_pend;
286
+ int mcu_rw_pst;
287
+ int mcu_rw_pend;
288
+ int mcu_hold_mode;
289
+};
290
+
202291 struct loader_cubic_lut {
203292 bool enable;
204293 u32 offset;
294
+};
295
+
296
+struct rockchip_drm_dsc_cap {
297
+ bool v_1p2;
298
+ bool native_420;
299
+ bool all_bpp;
300
+ u8 bpc_supported;
301
+ u8 max_slices;
302
+ u8 max_lanes;
303
+ u8 max_frl_rate_per_lane;
304
+ u8 total_chunk_kbytes;
305
+ int clk_per_slice;
306
+};
307
+
308
+struct ver_26_v0 {
309
+ u8 yuv422_12bit;
310
+ u8 support_2160p_60;
311
+ u8 global_dimming;
312
+ u8 dm_major_ver;
313
+ u8 dm_minor_ver;
314
+ u16 t_min_pq;
315
+ u16 t_max_pq;
316
+ u16 rx;
317
+ u16 ry;
318
+ u16 gx;
319
+ u16 gy;
320
+ u16 bx;
321
+ u16 by;
322
+ u16 wx;
323
+ u16 wy;
324
+} __packed;
325
+
326
+struct ver_15_v1 {
327
+ u8 yuv422_12bit;
328
+ u8 support_2160p_60;
329
+ u8 global_dimming;
330
+ u8 dm_version;
331
+ u8 colorimetry;
332
+ u8 t_max_lum;
333
+ u8 t_min_lum;
334
+ u8 rx;
335
+ u8 ry;
336
+ u8 gx;
337
+ u8 gy;
338
+ u8 bx;
339
+ u8 by;
340
+} __packed;
341
+
342
+struct ver_12_v1 {
343
+ u8 yuv422_12bit;
344
+ u8 support_2160p_60;
345
+ u8 global_dimming;
346
+ u8 dm_version;
347
+ u8 colorimetry;
348
+ u8 low_latency;
349
+ u8 t_max_lum;
350
+ u8 t_min_lum;
351
+ u8 unique_rx;
352
+ u8 unique_ry;
353
+ u8 unique_gx;
354
+ u8 unique_gy;
355
+ u8 unique_bx;
356
+ u8 unique_by;
357
+} __packed;
358
+
359
+struct ver_12_v2 {
360
+ u8 yuv422_12bit;
361
+ u8 backlt_ctrl;
362
+ u8 global_dimming;
363
+ u8 dm_version;
364
+ u8 backlt_min_luma;
365
+ u8 interface;
366
+ u8 yuv444_10b_12b;
367
+ u8 t_min_pq_v2;
368
+ u8 t_max_pq_v2;
369
+ u8 unique_rx;
370
+ u8 unique_ry;
371
+ u8 unique_gx;
372
+ u8 unique_gy;
373
+ u8 unique_bx;
374
+ u8 unique_by;
375
+} __packed;
376
+
377
+struct next_hdr_sink_data {
378
+ u8 version;
379
+ struct ver_26_v0 ver_26_v0;
380
+ struct ver_15_v1 ver_15_v1;
381
+ struct ver_12_v1 ver_12_v1;
382
+ struct ver_12_v2 ver_12_v2;
383
+} __packed;
384
+
385
+/*
386
+ * Rockchip drm private crtc funcs.
387
+ * @loader_protect: protect loader logo crtc's power
388
+ * @enable_vblank: enable crtc vblank irq.
389
+ * @disable_vblank: disable crtc vblank irq.
390
+ * @bandwidth: report present crtc bandwidth consume.
391
+ * @cancel_pending_vblank: cancel pending vblank.
392
+ * @debugfs_init: init crtc debugfs.
393
+ * @debugfs_dump: debugfs to dump crtc and plane state.
394
+ * @regs_dump: dump vop current register config.
395
+ * @mode_valid: verify that the current mode is supported.
396
+ * @crtc_close: close vop.
397
+ * @crtc_send_mcu_cmd: send mcu panel init cmd.
398
+ * @te_handler: soft te hand for cmd mode panel.
399
+ * @wait_vact_end: wait the last active line.
400
+ */
401
+struct rockchip_crtc_funcs {
402
+ int (*loader_protect)(struct drm_crtc *crtc, bool on);
403
+ int (*enable_vblank)(struct drm_crtc *crtc);
404
+ void (*disable_vblank)(struct drm_crtc *crtc);
405
+ size_t (*bandwidth)(struct drm_crtc *crtc,
406
+ struct drm_crtc_state *crtc_state,
407
+ struct dmcfreq_vop_info *vop_bw_info);
408
+ void (*cancel_pending_vblank)(struct drm_crtc *crtc,
409
+ struct drm_file *file_priv);
410
+ int (*debugfs_init)(struct drm_minor *minor, struct drm_crtc *crtc);
411
+ int (*debugfs_dump)(struct drm_crtc *crtc, struct seq_file *s);
412
+ void (*regs_dump)(struct drm_crtc *crtc, struct seq_file *s);
413
+ void (*active_regs_dump)(struct drm_crtc *crtc, struct seq_file *s);
414
+ enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc,
415
+ const struct drm_display_mode *mode,
416
+ int output_type);
417
+ void (*crtc_close)(struct drm_crtc *crtc);
418
+ void (*crtc_send_mcu_cmd)(struct drm_crtc *crtc, u32 type, u32 value);
419
+ void (*te_handler)(struct drm_crtc *crtc);
420
+ int (*wait_vact_end)(struct drm_crtc *crtc, unsigned int mstimeout);
421
+ void (*crtc_standby)(struct drm_crtc *crtc, bool standby);
422
+ int (*crtc_set_color_bar)(struct drm_crtc *crtc, enum rockchip_color_bar_mode mode);
423
+};
424
+
425
+struct rockchip_dclk_pll {
426
+ struct clk *pll;
427
+ unsigned int use_count;
205428 };
206429
207430 /*
....@@ -213,42 +436,44 @@
213436 */
214437 struct rockchip_drm_private {
215438 struct rockchip_logo *logo;
216
- struct dmabuf_page_pool *page_pools;
217
- struct drm_property *eotf_prop;
218
- struct drm_property *color_space_prop;
219
- struct drm_property *global_alpha_prop;
220
- struct drm_property *blend_mode_prop;
221
- struct drm_property *alpha_scale_prop;
222
- struct drm_property *async_commit_prop;
223
- struct drm_property *share_id_prop;
224
- struct drm_property *connector_id_prop;
225439 struct drm_fb_helper *fbdev_helper;
226440 struct drm_gem_object *fbdev_bo;
227
- const struct rockchip_crtc_funcs *crtc_funcs[ROCKCHIP_MAX_CRTC];
228
- struct drm_atomic_state *state;
229
-
230
- struct rockchip_atomic_commit *commit;
231
- /* protect async commit */
441
+ struct iommu_domain *domain;
442
+ struct gen_pool *secure_buffer_pool;
443
+ struct mutex mm_lock;
444
+ struct drm_mm mm;
445
+ struct list_head psr_list;
446
+ struct mutex psr_list_lock;
232447 struct mutex commit_lock;
448
+
449
+ /* private crtc prop */
450
+ struct drm_property *soc_id_prop;
451
+ struct drm_property *port_id_prop;
452
+ struct drm_property *aclk_prop;
453
+ struct drm_property *bg_prop;
454
+ struct drm_property *line_flag_prop;
455
+
456
+ /* private plane prop */
457
+ struct drm_property *eotf_prop;
458
+ struct drm_property *color_space_prop;
459
+ struct drm_property *async_commit_prop;
460
+ struct drm_property *share_id_prop;
461
+
462
+ /* private connector prop */
463
+ struct drm_property *connector_id_prop;
464
+
465
+ const struct rockchip_crtc_funcs *crtc_funcs[ROCKCHIP_MAX_CRTC];
466
+
467
+ struct rockchip_dclk_pll default_pll;
468
+ struct rockchip_dclk_pll hdmi_pll;
469
+
233470 /*
234471 * protect some shared overlay resource
235472 * OVL_LAYER_SEL/OVL_PORT_SEL
236473 */
237474 struct mutex ovl_lock;
238
- struct work_struct commit_work;
239
- struct iommu_domain *domain;
240
- struct gen_pool *secure_buffer_pool;
241
- /* protect drm_mm on multi-threads */
242
- struct mutex mm_lock;
243
- struct drm_mm mm;
244
- struct rockchip_dclk_pll default_pll;
245
- struct rockchip_dclk_pll hdmi_pll;
246
- struct devfreq *devfreq;
247
- u8 dmc_support;
248
- struct list_head psr_list;
249
- struct mutex psr_list_lock;
250
- struct rockchip_drm_vcnt vcnt[ROCKCHIP_MAX_CRTC];
251475
476
+ struct rockchip_drm_vcnt vcnt[ROCKCHIP_MAX_CRTC];
252477 /**
253478 * @loader_protect
254479 * ignore restore_fbdev_mode_atomic when in logo on state
....@@ -257,58 +482,75 @@
257482
258483 dma_addr_t cubic_lut_dma_addr;
259484 void *cubic_lut_kvaddr;
485
+ struct drm_mm_node *clut_reserved_node;
260486 struct loader_cubic_lut cubic_lut[ROCKCHIP_MAX_CRTC];
261487 };
262488
263
-#ifndef MODULE
264
-void rockchip_free_loader_memory(struct drm_device *drm);
265
-#endif
266
-void rockchip_drm_atomic_work(struct work_struct *work);
489
+void rockchip_connector_update_vfp_for_vrr(struct drm_crtc *crtc, struct drm_display_mode *mode,
490
+ int vfp);
267491 int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
268492 struct device *dev);
269493 void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
270494 struct device *dev);
495
+int rockchip_drm_wait_vact_end(struct drm_crtc *crtc, unsigned int mstimeout);
271496 int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
272497 const struct rockchip_crtc_funcs *crtc_funcs);
273498 void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc);
274
-int rockchip_drm_wait_vact_end(struct drm_crtc *crtc, unsigned int mstimeout);
499
+void rockchip_drm_crtc_standby(struct drm_crtc *crtc, bool standby);
275500
276501 void rockchip_drm_register_sub_dev(struct rockchip_drm_sub_dev *sub_dev);
277502 void rockchip_drm_unregister_sub_dev(struct rockchip_drm_sub_dev *sub_dev);
278503 struct rockchip_drm_sub_dev *rockchip_drm_get_sub_dev(struct device_node *node);
279504 int rockchip_drm_add_modes_noedid(struct drm_connector *connector);
280505 void rockchip_drm_te_handle(struct drm_crtc *crtc);
281
-#if IS_ENABLED(CONFIG_DRM_ROCKCHIP)
506
+void drm_mode_convert_to_split_mode(struct drm_display_mode *mode);
507
+void drm_mode_convert_to_origin_mode(struct drm_display_mode *mode);
508
+u32 rockchip_drm_get_dclk_by_width(int width);
509
+#if IS_REACHABLE(CONFIG_DRM_ROCKCHIP)
282510 int rockchip_drm_get_sub_dev_type(void);
511
+u32 rockchip_drm_get_scan_line_time_ns(void);
283512 #else
284513 static inline int rockchip_drm_get_sub_dev_type(void)
285514 {
286515 return DRM_MODE_CONNECTOR_Unknown;
287516 }
288
-#endif
289517
290
-#if IS_ENABLED(CONFIG_DRM_ROCKCHIP)
291
-int rockchip_drm_crtc_send_mcu_cmd(struct drm_device *drm_dev,
292
- struct device_node *np_crtc,
293
- u32 type, u32 value);
294
-#else
295
-static inline int rockchip_drm_crtc_send_mcu_cmd(struct drm_device *drm_dev,
296
- struct device_node *np_crtc,
297
- u32 type, u32 value)
518
+static inline u32 rockchip_drm_get_scan_line_time_ns(void)
298519 {
299520 return 0;
300521 }
301522 #endif
302523
524
+int rockchip_drm_endpoint_is_subdriver(struct device_node *ep);
525
+uint32_t rockchip_drm_of_find_possible_crtcs(struct drm_device *dev,
526
+ struct device_node *port);
527
+uint32_t rockchip_drm_get_bpp(const struct drm_format_info *info);
528
+int rockchip_drm_get_yuv422_format(struct drm_connector *connector,
529
+ struct edid *edid);
530
+int rockchip_drm_parse_cea_ext(struct rockchip_drm_dsc_cap *dsc_cap,
531
+ u8 *max_frl_rate_per_lane, u8 *max_lanes, u8 *add_func,
532
+ const struct edid *edid);
533
+int rockchip_drm_parse_next_hdr(struct next_hdr_sink_data *sink_data,
534
+ const struct edid *edid);
535
+int rockchip_drm_parse_colorimetry_data_block(u8 *colorimetry, const struct edid *edid);
536
+
537
+__printf(3, 4)
538
+void rockchip_drm_dbg(const struct device *dev, enum rockchip_drm_debug_category category,
539
+ const char *format, ...);
540
+
303541 extern struct platform_driver cdn_dp_driver;
304542 extern struct platform_driver dw_hdmi_rockchip_pltfm_driver;
305
-extern struct platform_driver dw_mipi_dsi_driver;
543
+extern struct platform_driver dw_mipi_dsi_rockchip_driver;
544
+extern struct platform_driver dw_mipi_dsi2_rockchip_driver;
306545 extern struct platform_driver inno_hdmi_driver;
307546 extern struct platform_driver rockchip_dp_driver;
308547 extern struct platform_driver rockchip_lvds_driver;
309
-extern struct platform_driver rockchip_tve_driver;
310548 extern struct platform_driver vop_platform_driver;
311549 extern struct platform_driver vop2_platform_driver;
312
-extern struct platform_driver vvop_platform_driver;
550
+extern struct platform_driver rk3066_hdmi_driver;
313551 extern struct platform_driver rockchip_rgb_driver;
552
+extern struct platform_driver rockchip_tve_driver;
553
+extern struct platform_driver dw_dp_driver;
554
+extern struct platform_driver vconn_platform_driver;
555
+extern struct platform_driver vvop_platform_driver;
314556 #endif /* _ROCKCHIP_DRM_DRV_H_ */