forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
....@@ -1,47 +1,60 @@
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>
4
- *
5
- * This software is licensed under the terms of the GNU General Public
6
- * License version 2, as published by the Free Software Foundation, and
7
- * may be copied, distributed, and modified under those terms.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
135 */
146
157 #ifndef _ROCKCHIP_DRM_VOP_H
168 #define _ROCKCHIP_DRM_VOP_H
9
+
10
+#include <drm/drm_plane.h>
11
+#include <drm/drm_modes.h>
12
+
1713 #include "rockchip_drm_drv.h"
1814
1915 /*
2016 * major: IP major version, used for IP structure
2117 * minor: big feature change under same structure
18
+ * build: RTL current SVN number
2219 */
2320 #define VOP_VERSION(major, minor) ((major) << 8 | (minor))
2421 #define VOP_MAJOR(version) ((version) >> 8)
2522 #define VOP_MINOR(version) ((version) & 0xff)
2623
27
-#define VOP_VERSION_RK3568 VOP_VERSION(0x40, 0x15)
28
-#define VOP_VERSION_RK3588 VOP_VERSION(0x40, 0x17)
24
+#define VOP2_VERSION(major, minor, build) ((major) << 24 | (minor) << 16 | (build))
25
+#define VOP2_MAJOR(version) (((version) >> 24) & 0xff)
26
+#define VOP2_MINOR(version) (((version) >> 16) & 0xff)
27
+#define VOP2_BUILD(version) ((version) & 0xffff)
28
+
29
+#define VOP_VERSION_RK3528 VOP2_VERSION(0x50, 0x17, 0x1263)
30
+#define VOP_VERSION_RK3562 VOP2_VERSION(0x50, 0x17, 0x4350)
31
+#define VOP_VERSION_RK3568 VOP2_VERSION(0x40, 0x15, 0x8023)
32
+#define VOP_VERSION_RK3588 VOP2_VERSION(0x40, 0x17, 0x6786)
2933
3034 #define ROCKCHIP_OUTPUT_DUAL_CHANNEL_LEFT_RIGHT_MODE BIT(0)
3135 #define ROCKCHIP_OUTPUT_DUAL_CHANNEL_ODD_EVEN_MODE BIT(1)
3236 #define ROCKCHIP_OUTPUT_DATA_SWAP BIT(2)
37
+/* MIPI DSI DataStream(cmd) mode on rk3588 */
38
+#define ROCKCHIP_OUTPUT_MIPI_DS_MODE BIT(3)
3339
3440 #define AFBDC_FMT_RGB565 0x0
3541 #define AFBDC_FMT_U8U8U8U8 0x5
3642 #define AFBDC_FMT_U8U8U8 0x4
37
-#define VOP_FEATURE_OUTPUT_10BIT BIT(0)
38
-#define VOP_FEATURE_AFBDC BIT(1)
43
+
44
+#define VOP_FEATURE_OUTPUT_RGB10 BIT(0)
45
+#define VOP_FEATURE_INTERNAL_RGB BIT(1)
3946 #define VOP_FEATURE_ALPHA_SCALE BIT(2)
4047 #define VOP_FEATURE_HDR10 BIT(3)
4148 #define VOP_FEATURE_NEXT_HDR BIT(4)
4249 /* a feature to splice two windows and two vps to support resolution > 4096 */
4350 #define VOP_FEATURE_SPLICE BIT(5)
4451 #define VOP_FEATURE_OVERSCAN BIT(6)
52
+#define VOP_FEATURE_VIVID_HDR BIT(7)
53
+#define VOP_FEATURE_POST_ACM BIT(8)
54
+#define VOP_FEATURE_POST_CSC BIT(9)
55
+
56
+#define VOP_FEATURE_OUTPUT_10BIT VOP_FEATURE_OUTPUT_RGB10
57
+
4558
4659 #define WIN_FEATURE_HDR2SDR BIT(0)
4760 #define WIN_FEATURE_SDR2HDR BIT(1)
....@@ -49,6 +62,8 @@
4962 #define WIN_FEATURE_AFBDC BIT(3)
5063 #define WIN_FEATURE_CLUSTER_MAIN BIT(4)
5164 #define WIN_FEATURE_CLUSTER_SUB BIT(5)
65
+/* Left win in splice mode */
66
+#define WIN_FEATURE_SPLICE_LEFT BIT(6)
5267 /* a mirror win can only get fb address
5368 * from source win:
5469 * Cluster1---->Cluster0
....@@ -62,6 +77,23 @@
6277
6378
6479 #define VOP2_SOC_VARIANT 4
80
+
81
+#define ROCKCHIP_DSC_PPS_SIZE_BYTE 88
82
+
83
+enum vop_vp_id {
84
+ ROCKCHIP_VOP_VP0 = 0,
85
+ ROCKCHIP_VOP_VP1,
86
+ ROCKCHIP_VOP_VP2,
87
+ ROCKCHIP_VOP_VP3,
88
+};
89
+
90
+enum vop_win_phy_id {
91
+ ROCKCHIP_VOP_WIN0 = 0,
92
+ ROCKCHIP_VOP_WIN1,
93
+ ROCKCHIP_VOP_WIN2,
94
+ ROCKCHIP_VOP_WIN3,
95
+ ROCKCHIP_VOP_PHY_ID_INVALID = -1,
96
+};
6597
6698 enum bcsh_out_mode {
6799 BCSH_OUT_MODE_BLACK,
....@@ -84,7 +116,7 @@
84116 /*
85117 * the delay number of a window in different mode.
86118 */
87
-enum win_dly_mode {
119
+enum vop2_win_dly_mode {
88120 VOP2_DLY_MODE_DEFAULT, /**< default mode */
89121 VOP2_DLY_MODE_HISO_S, /** HDR in SDR out mode, as a SDR window */
90122 VOP2_DLY_MODE_HIHO_H, /** HDR in HDR out mode, as a HDR window */
....@@ -92,11 +124,44 @@
92124 };
93125
94126 enum vop3_esmart_lb_mode {
95
- VOP3_ESMART_ONE_8K_MODE,
96
- VOP3_ESMART_TWO_4K_MODE,
97
- VOP3_ESMART_ONE_4K_AND_TWO_2K_MODE,
98
- VOP3_ESMART_FOUR_2K_MODE,
127
+ VOP3_ESMART_8K_MODE,
128
+ VOP3_ESMART_4K_4K_MODE,
129
+ VOP3_ESMART_4K_2K_2K_MODE,
130
+ VOP3_ESMART_2K_2K_2K_2K_MODE,
99131 };
132
+
133
+/*
134
+ * vop2 dsc id
135
+ */
136
+#define ROCKCHIP_VOP2_DSC_8K 0
137
+#define ROCKCHIP_VOP2_DSC_4K 1
138
+
139
+/*
140
+ * vop2 internal power domain id,
141
+ * should be all none zero, 0 will be
142
+ * treat as invalid;
143
+ */
144
+#define VOP2_PD_CLUSTER0 BIT(0)
145
+#define VOP2_PD_CLUSTER1 BIT(1)
146
+#define VOP2_PD_CLUSTER2 BIT(2)
147
+#define VOP2_PD_CLUSTER3 BIT(3)
148
+#define VOP2_PD_DSC_8K BIT(5)
149
+#define VOP2_PD_DSC_4K BIT(6)
150
+#define VOP2_PD_ESMART BIT(7)
151
+
152
+/*
153
+ * vop2 submem power gate,
154
+ * should be all none zero, 0 will be
155
+ * treat as invalid;
156
+ */
157
+#define VOP2_MEM_PG_VP0 BIT(0)
158
+#define VOP2_MEM_PG_VP1 BIT(1)
159
+#define VOP2_MEM_PG_VP2 BIT(2)
160
+#define VOP2_MEM_PG_VP3 BIT(3)
161
+#define VOP2_MEM_PG_DB0 BIT(4)
162
+#define VOP2_MEM_PG_DB1 BIT(5)
163
+#define VOP2_MEM_PG_DB2 BIT(6)
164
+#define VOP2_MEM_PG_WB BIT(7)
100165
101166 #define DSP_BG_SWAP 0x1
102167 #define DSP_RB_SWAP 0x2
....@@ -135,6 +200,13 @@
135200 VOP_FMT_YUV420SP = 4,
136201 VOP_FMT_YUV422SP,
137202 VOP_FMT_YUV444SP,
203
+};
204
+
205
+enum vop_dsc_interface_mode {
206
+ VOP_DSC_IF_DISABLE = 0,
207
+ VOP_DSC_IF_HDMI = 1,
208
+ VOP_DSC_IF_MIPI_DS_MODE = 2,
209
+ VOP_DSC_IF_MIPI_VIDEO_MODE = 3,
138210 };
139211
140212 struct vop_reg_data {
....@@ -187,6 +259,7 @@
187259 struct vop_reg post_scl_factor;
188260 struct vop_reg post_scl_ctrl;
189261 struct vop_reg dsp_interlace;
262
+ struct vop_reg dsp_interlace_pol;
190263 struct vop_reg global_regdone_en;
191264 struct vop_reg auto_gate_en;
192265 struct vop_reg post_lb_mode;
....@@ -232,6 +305,11 @@
232305 struct vop_reg sw_uv_offset_en;
233306 struct vop_reg dsp_out_yuv;
234307 struct vop_reg dsp_data_swap;
308
+ struct vop_reg dsp_bg_swap;
309
+ struct vop_reg dsp_rb_swap;
310
+ struct vop_reg dsp_rg_swap;
311
+ struct vop_reg dsp_delta_swap;
312
+ struct vop_reg dsp_dummy_swap;
235313 struct vop_reg yuv_clip;
236314 struct vop_reg dsp_ccir656_avg;
237315 struct vop_reg dsp_black;
....@@ -439,6 +517,135 @@
439517 const uint32_t *sdr2hdr_st2084oetf_xn;
440518 };
441519
520
+#define RK_HDRVIVID_TONE_SCA_TAB_LENGTH 257
521
+#define RK_HDRVIVID_GAMMA_CURVE_LENGTH 81
522
+#define RK_HDRVIVID_GAMMA_MDFVALUE_LENGTH 9
523
+#define RK_SDR2HDR_INVGAMMA_CURVE_LENGTH 69
524
+#define RK_SDR2HDR_INVGAMMA_S_IDX_LENGTH 6
525
+#define RK_SDR2HDR_INVGAMMA_C_IDX_LENGTH 6
526
+#define RK_SDR2HDR_SMGAIN_LENGTH 64
527
+#define RK_HDRVIVID_TONE_SCA_AXI_TAB_LENGTH 264
528
+
529
+struct hdrvivid_regs {
530
+ uint32_t sdr2hdr_ctrl;
531
+ uint32_t sdr2hdr_coe0;
532
+ uint32_t sdr2hdr_coe1;
533
+ uint32_t sdr2hdr_csc_coe00_01;
534
+ uint32_t sdr2hdr_csc_coe02_10;
535
+ uint32_t sdr2hdr_csc_coe11_12;
536
+ uint32_t sdr2hdr_csc_coe20_21;
537
+ uint32_t sdr2hdr_csc_coe22;
538
+ uint32_t hdrvivid_ctrl;
539
+ uint32_t hdr_pq_gamma;
540
+ uint32_t hlg_rfix_scalefac;
541
+ uint32_t hlg_maxluma;
542
+ uint32_t hlg_r_tm_lin2non;
543
+ uint32_t hdr_csc_coe00_01;
544
+ uint32_t hdr_csc_coe02_10;
545
+ uint32_t hdr_csc_coe11_12;
546
+ uint32_t hdr_csc_coe20_21;
547
+ uint32_t hdr_csc_coe22;
548
+ uint32_t hdr_tone_sca[RK_HDRVIVID_TONE_SCA_TAB_LENGTH];
549
+ uint32_t hdrgamma_curve[RK_HDRVIVID_GAMMA_CURVE_LENGTH];
550
+ uint32_t hdrgamma_mdfvalue[RK_HDRVIVID_GAMMA_MDFVALUE_LENGTH];
551
+ uint32_t sdrinvgamma_curve[RK_SDR2HDR_INVGAMMA_CURVE_LENGTH];
552
+ uint32_t sdrinvgamma_startidx[RK_SDR2HDR_INVGAMMA_S_IDX_LENGTH];
553
+ uint32_t sdrinvgamma_changeidx[RK_SDR2HDR_INVGAMMA_C_IDX_LENGTH];
554
+ uint32_t sdr_smgain[RK_SDR2HDR_SMGAIN_LENGTH];
555
+ uint32_t hdr_mode;
556
+ uint32_t tone_sca_axi_tab[RK_HDRVIVID_TONE_SCA_AXI_TAB_LENGTH];
557
+};
558
+
559
+struct hdr_extend {
560
+ uint32_t hdr_type;
561
+ uint32_t length;
562
+ union {
563
+ struct hdrvivid_regs hdrvivid_data;
564
+ };
565
+};
566
+
567
+enum _vop_hdrvivid_mode {
568
+ PQHDR2HDR_WITH_DYNAMIC = 0,
569
+ PQHDR2SDR_WITH_DYNAMIC,
570
+ HLG2PQHDR_WITH_DYNAMIC,
571
+ HLG2SDR_WITH_DYNAMIC,
572
+ HLG2PQHDR_WITHOUT_DYNAMIC,
573
+ HLG2SDR_WITHOUT_DYNAMIC,
574
+ HDR_BYPASS,
575
+ HDR102SDR,
576
+ SDR2HDR10,
577
+ SDR2HLG,
578
+ SDR2HDR10_USERSPACE = 100,
579
+ SDR2HLG_USERSPACE = 101,
580
+};
581
+
582
+enum vop_hdr_format {
583
+ HDR_NONE = 0,
584
+ HDR_HDR10 = 1,
585
+ HDR_HLGSTATIC = 2,
586
+ RESERVED3 = 3, /* reserved for more future static hdr format */
587
+ RESERVED4 = 4, /* reserved for more future static hdr format */
588
+ HDR_HDRVIVID = 5,
589
+ RESERVED6 = 6, /* reserved for hdr vivid */
590
+ RESERVED7 = 7, /* reserved for hdr vivid */
591
+ HDR_HDR10PLUS = 8,
592
+ RESERVED9 = 9, /* reserved for hdr hdr10+ */
593
+ RESERVED10 = 10, /* reserved for hdr hdr10+ */
594
+ HDR_NEXT = 11,
595
+ RESERVED12 = 12, /* reserved for other dynamic hdr format */
596
+ RESERVED13 = 13, /* reserved for other dynamic hdr format */
597
+ HDR_FORMAT_MAX,
598
+};
599
+
600
+#define ACM_GAIN_LUT_HY_LENGTH (9*17)
601
+#define ACM_GAIN_LUT_HY_TOTAL_LENGTH (ACM_GAIN_LUT_HY_LENGTH * 3)
602
+#define ACM_GAIN_LUT_HS_LENGTH (13*17)
603
+#define ACM_GAIN_LUT_HS_TOTAL_LENGTH (ACM_GAIN_LUT_HS_LENGTH * 3)
604
+#define ACM_DELTA_LUT_H_LENGTH 65
605
+#define ACM_DELTA_LUT_H_TOTAL_LENGTH (ACM_DELTA_LUT_H_LENGTH * 3)
606
+
607
+struct post_acm {
608
+ s16 delta_lut_h[ACM_DELTA_LUT_H_TOTAL_LENGTH];
609
+ s16 gain_lut_hy[ACM_GAIN_LUT_HY_TOTAL_LENGTH];
610
+ s16 gain_lut_hs[ACM_GAIN_LUT_HS_TOTAL_LENGTH];
611
+ u16 y_gain;
612
+ u16 h_gain;
613
+ u16 s_gain;
614
+ u16 acm_enable;
615
+};
616
+
617
+struct post_csc {
618
+ u16 hue;
619
+ u16 saturation;
620
+ u16 contrast;
621
+ u16 brightness;
622
+ u16 r_gain;
623
+ u16 g_gain;
624
+ u16 b_gain;
625
+ u16 r_offset;
626
+ u16 g_offset;
627
+ u16 b_offset;
628
+ u16 csc_enable;
629
+};
630
+
631
+struct post_csc_coef {
632
+ s32 csc_coef00;
633
+ s32 csc_coef01;
634
+ s32 csc_coef02;
635
+ s32 csc_coef10;
636
+ s32 csc_coef11;
637
+ s32 csc_coef12;
638
+ s32 csc_coef20;
639
+ s32 csc_coef21;
640
+ s32 csc_coef22;
641
+
642
+ s32 csc_dc0;
643
+ s32 csc_dc1;
644
+ s32 csc_dc2;
645
+
646
+ u32 range_type;
647
+};
648
+
442649 enum {
443650 VOP_CSC_Y2R_BT601,
444651 VOP_CSC_Y2R_BT709,
....@@ -480,6 +687,7 @@
480687 struct vop_reg gate;
481688 struct vop_reg enable;
482689 struct vop_reg format;
690
+ struct vop_reg interlace_read;
483691 struct vop_reg fmt_10;
484692 struct vop_reg fmt_yuyv;
485693 struct vop_reg csc_mode;
....@@ -505,10 +713,23 @@
505713 struct vop_reg color_key_en;
506714 };
507715
716
+struct vop_win_data {
717
+ uint32_t base;
718
+ enum drm_plane_type type;
719
+ const struct vop_win_phy *phy;
720
+ const struct vop_win_phy **area;
721
+ const uint64_t *format_modifiers;
722
+ const struct vop_csc *csc;
723
+ unsigned int area_size;
724
+ u64 feature;
725
+};
726
+
508727 struct vop2_cluster_regs {
509728 struct vop_reg enable;
510729 struct vop_reg afbc_enable;
511730 struct vop_reg lb_mode;
731
+ struct vop_reg scl_lb_mode;
732
+ struct vop_reg frm_reset_en;
512733
513734 struct vop_reg src_color_ctrl;
514735 struct vop_reg dst_color_ctrl;
....@@ -597,7 +818,9 @@
597818 struct vop_reg pre_scan_htiming;
598819 struct vop_reg htotal_pw;
599820 struct vop_reg hact_st_end;
600
- struct vop_reg vtotal_pw;
821
+ struct vop_reg dsp_vtotal;
822
+ struct vop_reg sw_dsp_vtotal_imd;
823
+ struct vop_reg dsp_vs_end;
601824 struct vop_reg vact_st_end;
602825 struct vop_reg vact_st_end_f1;
603826 struct vop_reg vs_st_end_f1;
....@@ -615,8 +838,8 @@
615838
616839 struct vop_reg core_dclk_div;
617840 struct vop_reg p2i_en;
618
- struct vop_reg mipi_dual_en;
619
- struct vop_reg mipi_dual_channel_swap;
841
+ struct vop_reg dual_channel_en;
842
+ struct vop_reg dual_channel_swap;
620843 struct vop_reg dsp_lut_en;
621844
622845 struct vop_reg dclk_div2;
....@@ -626,6 +849,13 @@
626849 struct vop_reg hdr_lut_update_en;
627850 struct vop_reg hdr_lut_mode;
628851 struct vop_reg hdr_lut_mst;
852
+ struct vop_reg hdr_lut_fetch_done;
853
+ struct vop_reg hdr_vivid_en;
854
+ struct vop_reg hdr_vivid_bypass_en;
855
+ struct vop_reg hdr_vivid_path_mode;
856
+ struct vop_reg hdr_vivid_dstgamut;
857
+ struct vop_reg sdr2hdr_en;
858
+ struct vop_reg sdr2hdr_dstmode;
629859 struct vop_reg sdr2hdr_eotf_en;
630860 struct vop_reg sdr2hdr_r2r_en;
631861 struct vop_reg sdr2hdr_r2r_mode;
....@@ -672,11 +902,108 @@
672902 struct vop_reg cubic_lut_update_en;
673903 struct vop_reg cubic_lut_mst;
674904
905
+ /* cru */
906
+ struct vop_reg dclk_core_div;
907
+ struct vop_reg dclk_out_div;
908
+ struct vop_reg dclk_src_sel;
909
+
910
+ struct vop_reg splice_en;
911
+
675912 struct vop_reg edpi_wms_hold_en;
676913 struct vop_reg edpi_te_en;
677914 struct vop_reg edpi_wms_fs;
678915 struct vop_reg gamma_update_en;
679916 struct vop_reg lut_dma_rid;
917
+
918
+ /* MCU output */
919
+ struct vop_reg mcu_pix_total;
920
+ struct vop_reg mcu_cs_pst;
921
+ struct vop_reg mcu_cs_pend;
922
+ struct vop_reg mcu_rw_pst;
923
+ struct vop_reg mcu_rw_pend;
924
+ struct vop_reg mcu_clk_sel;
925
+ struct vop_reg mcu_hold_mode;
926
+ struct vop_reg mcu_frame_st;
927
+ struct vop_reg mcu_rs;
928
+ struct vop_reg mcu_bypass;
929
+ struct vop_reg mcu_type;
930
+ struct vop_reg mcu_rw_bypass_port;
931
+
932
+ /* for DCF */
933
+ struct vop_reg line_flag_or_en;
934
+ struct vop_reg dsp_hold_or_en;
935
+ struct vop_reg almost_full_or_en;
936
+
937
+ /* CSC */
938
+ struct vop_reg acm_bypass_en;
939
+ struct vop_reg csc_en;
940
+ struct vop_reg acm_r2y_en;
941
+ struct vop_reg csc_mode;
942
+ struct vop_reg acm_r2y_mode;
943
+ struct vop_reg csc_coe00;
944
+ struct vop_reg csc_coe01;
945
+ struct vop_reg csc_coe02;
946
+ struct vop_reg csc_coe10;
947
+ struct vop_reg csc_coe11;
948
+ struct vop_reg csc_coe12;
949
+ struct vop_reg csc_coe20;
950
+ struct vop_reg csc_coe21;
951
+ struct vop_reg csc_coe22;
952
+ struct vop_reg csc_offset0;
953
+ struct vop_reg csc_offset1;
954
+ struct vop_reg csc_offset2;
955
+
956
+ /* color bar */
957
+ struct vop_reg color_bar_en;
958
+ struct vop_reg color_bar_mode;
959
+};
960
+
961
+struct vop2_power_domain_regs {
962
+ struct vop_reg pd;
963
+ struct vop_reg status;
964
+ struct vop_reg bisr_en_status;
965
+ struct vop_reg pmu_status;
966
+};
967
+
968
+struct vop2_dsc_regs {
969
+ /* DSC SYS CTRL */
970
+ struct vop_reg dsc_port_sel;
971
+ struct vop_reg dsc_man_mode;
972
+ struct vop_reg dsc_interface_mode;
973
+ struct vop_reg dsc_pixel_num;
974
+ struct vop_reg dsc_pxl_clk_div;
975
+ struct vop_reg dsc_cds_clk_div;
976
+ struct vop_reg dsc_txp_clk_div;
977
+ struct vop_reg dsc_init_dly_mode;
978
+ struct vop_reg dsc_scan_en;
979
+ struct vop_reg dsc_halt_en;
980
+ struct vop_reg rst_deassert;
981
+ struct vop_reg dsc_flush;
982
+ struct vop_reg dsc_cfg_done;
983
+ struct vop_reg dsc_init_dly_num;
984
+ struct vop_reg scan_timing_para_imd_en;
985
+ struct vop_reg dsc_htotal_pw;
986
+ struct vop_reg dsc_hact_st_end;
987
+ struct vop_reg dsc_vtotal;
988
+ struct vop_reg dsc_vs_end;
989
+ struct vop_reg dsc_vact_st_end;
990
+ struct vop_reg dsc_error_status;
991
+
992
+ /* DSC encoder */
993
+ struct vop_reg dsc_pps0_3;
994
+ struct vop_reg dsc_en;
995
+ struct vop_reg dsc_rbit;
996
+ struct vop_reg dsc_rbyt;
997
+ struct vop_reg dsc_flal;
998
+ struct vop_reg dsc_mer;
999
+ struct vop_reg dsc_epb;
1000
+ struct vop_reg dsc_epl;
1001
+ struct vop_reg dsc_nslc;
1002
+ struct vop_reg dsc_sbo;
1003
+ struct vop_reg dsc_ifep;
1004
+ struct vop_reg dsc_pps_upd;
1005
+ struct vop_reg dsc_status;
1006
+ struct vop_reg dsc_ecw;
6801007 };
6811008
6821009 struct vop2_wb_regs {
....@@ -695,23 +1022,42 @@
6951022 struct vop_reg axi_uv_id;
6961023 };
6971024
698
-struct vop_win_data {
699
- uint32_t base;
700
- enum drm_plane_type type;
701
- const struct vop_win_phy *phy;
702
- const struct vop_win_phy **area;
703
- const struct vop_csc *csc;
704
- unsigned int area_size;
705
- u64 feature;
1025
+struct vop2_power_domain_data {
1026
+ uint8_t id;
1027
+ uint8_t parent_id;
1028
+ /*
1029
+ * @module_id_mask: module id of which module this power domain is belongs to.
1030
+ * PD_CLUSTER0,1,2,3 only belongs to CLUSTER0/1/2/3, PD_Esmart0 shared by Esmart1/2/3
1031
+ */
1032
+ uint32_t module_id_mask;
1033
+
1034
+ const struct vop2_power_domain_regs *regs;
1035
+};
1036
+
1037
+/*
1038
+ * connector interface(RGB/HDMI/eDP/DP/MIPI) data
1039
+ */
1040
+struct vop2_connector_if_data {
1041
+ u32 id;
1042
+ const char *clk_src_name;
1043
+ const char *clk_parent_name;
1044
+ const char *pixclk_name;
1045
+ const char *dclk_name;
1046
+ u32 post_proc_div_shift;
1047
+ u32 if_div_shift;
1048
+ u32 if_div_yuv420_shift;
1049
+ u32 bus_div_shift;
1050
+ u32 pixel_clk_div_shift;
7061051 };
7071052
7081053 struct vop2_win_data {
7091054 const char *name;
7101055 uint8_t phys_id;
1056
+ uint8_t splice_win_id;
1057
+ uint8_t pd_id;
7111058 uint8_t axi_id;
7121059 uint8_t axi_yrgb_id;
7131060 uint8_t axi_uv_id;
714
- uint8_t scale_engine_num;
7151061 uint8_t possible_crtcs;
7161062
7171063 uint32_t base;
....@@ -746,6 +1092,24 @@
7461092 const uint8_t dly[VOP2_DLY_MODE_MAX];
7471093 };
7481094
1095
+struct dsc_error_info {
1096
+ u32 dsc_error_val;
1097
+ char dsc_error_info[50];
1098
+};
1099
+
1100
+struct vop2_dsc_data {
1101
+ uint8_t id;
1102
+ uint8_t pd_id;
1103
+ uint8_t max_slice_num;
1104
+ uint8_t max_linebuf_depth; /* used to generate the bitstream */
1105
+ uint8_t min_bits_per_pixel; /* bit num after encoder compress */
1106
+ const char *dsc_txp_clk_src_name;
1107
+ const char *dsc_txp_clk_name;
1108
+ const char *dsc_pxl_clk_name;
1109
+ const char *dsc_cds_clk_name;
1110
+ const struct vop2_dsc_regs *regs;
1111
+};
1112
+
7491113 struct vop2_wb_data {
7501114 uint32_t nformats;
7511115 const uint32_t *formats;
....@@ -768,13 +1132,20 @@
7681132
7691133 struct vop2_video_port_data {
7701134 char id;
1135
+ uint8_t splice_vp_id;
7711136 uint16_t lut_dma_rid;
7721137 uint32_t feature;
7731138 uint64_t soc_id[VOP2_SOC_VARIANT];
7741139 uint16_t gamma_lut_len;
7751140 uint16_t cubic_lut_len;
1141
+ unsigned long dclk_max;
7761142 struct vop_rect max_output;
7771143 const u8 pre_scan_max_dly[4];
1144
+ const u8 hdrvivid_dly[10];
1145
+ const u8 sdr2hdr_dly;
1146
+ const u8 layer_mix_dly;
1147
+ const u8 hdr_mix_dly;
1148
+ const u8 win_dly;
7781149 const struct vop_intr *intr;
7791150 const struct vop_hdr_table *hdr_table;
7801151 const struct vop2_video_port_regs *regs;
....@@ -818,6 +1189,14 @@
8181189 struct vop_reg grf_dclk_inv;
8191190 struct vop_reg grf_bt1120_clk_inv;
8201191 struct vop_reg grf_bt656_clk_inv;
1192
+ struct vop_reg grf_edp0_en;
1193
+ struct vop_reg grf_edp1_en;
1194
+ struct vop_reg grf_hdmi0_en;
1195
+ struct vop_reg grf_hdmi1_en;
1196
+ struct vop_reg grf_hdmi0_dsc_en;
1197
+ struct vop_reg grf_hdmi1_dsc_en;
1198
+ struct vop_reg grf_hdmi0_pin_pol;
1199
+ struct vop_reg grf_hdmi1_pin_pol;
8211200 };
8221201
8231202 struct vop_data {
....@@ -835,6 +1214,7 @@
8351214 struct vop_rect max_output;
8361215 u64 feature;
8371216 u64 soc_id;
1217
+ u8 vop_id;
8381218 };
8391219
8401220 struct vop2_ctrl {
....@@ -842,6 +1222,9 @@
8421222 struct vop_reg wb_cfg_done;
8431223 struct vop_reg auto_gating_en;
8441224 struct vop_reg aclk_pre_auto_gating_en;
1225
+ struct vop_reg dma_finish_mode;
1226
+ struct vop_reg axi_dma_finish_and_en;
1227
+ struct vop_reg wb_dma_finish_and_en;
8451228 struct vop_reg ovl_cfg_done_port;
8461229 struct vop_reg ovl_port_mux_cfg_done_imd;
8471230 struct vop_reg ovl_port_mux_cfg;
....@@ -849,6 +1232,7 @@
8491232 struct vop_reg version;
8501233 struct vop_reg standby;
8511234 struct vop_reg dma_stop;
1235
+ struct vop_reg dsp_vs_t_sel;
8521236 struct vop_reg lut_dma_en;
8531237 struct vop_reg axi_outstanding_max_num;
8541238 struct vop_reg axi_max_outstanding_en;
....@@ -880,9 +1264,12 @@
8801264 struct vop_reg edp_pin_pol;
8811265 struct vop_reg mipi_dclk_pol;
8821266 struct vop_reg mipi_pin_pol;
883
- struct vop_reg dp_dclk_pol;
884
- struct vop_reg dp_pin_pol;
1267
+ struct vop_reg dp0_dclk_pol;
1268
+ struct vop_reg dp0_pin_pol;
1269
+ struct vop_reg dp1_dclk_pol;
1270
+ struct vop_reg dp1_pin_pol;
8851271
1272
+ /* This will be reference by win_phy_id */
8861273 struct vop_reg win_vp_id[16];
8871274 struct vop_reg win_dly[16];
8881275
....@@ -903,10 +1290,25 @@
9031290 struct vop_reg lvds_dual_mode;
9041291 struct vop_reg lvds_dual_channel_swap;
9051292
906
- struct vop_reg cluster0_src_color_ctrl;
907
- struct vop_reg cluster0_dst_color_ctrl;
908
- struct vop_reg cluster0_src_alpha_ctrl;
909
- struct vop_reg cluster0_dst_alpha_ctrl;
1293
+ struct vop_reg dp_dual_en;
1294
+ struct vop_reg edp_dual_en;
1295
+ struct vop_reg hdmi_dual_en;
1296
+ struct vop_reg mipi_dual_en;
1297
+
1298
+ struct vop_reg hdmi0_dclk_div;
1299
+ struct vop_reg hdmi0_pixclk_div;
1300
+ struct vop_reg edp0_dclk_div;
1301
+ struct vop_reg edp0_pixclk_div;
1302
+
1303
+ struct vop_reg hdmi1_dclk_div;
1304
+ struct vop_reg hdmi1_pixclk_div;
1305
+ struct vop_reg edp1_dclk_div;
1306
+ struct vop_reg edp1_pixclk_div;
1307
+
1308
+ struct vop_reg mipi0_pixclk_div;
1309
+ struct vop_reg mipi1_pixclk_div;
1310
+ struct vop_reg mipi0_ds_mode;
1311
+ struct vop_reg mipi1_ds_mode;
9101312
9111313 struct vop_reg src_color_ctrl;
9121314 struct vop_reg dst_color_ctrl;
....@@ -916,6 +1318,7 @@
9161318 struct vop_reg bt1120_yc_swap;
9171319 struct vop_reg bt656_yc_swap;
9181320 struct vop_reg gamma_port_sel;
1321
+ struct vop_reg pd_off_imd;
9191322
9201323 struct vop_reg otp_en;
9211324 struct vop_reg esmart_lb_mode;
....@@ -930,6 +1333,12 @@
9301333 bool enable_state;
9311334 };
9321335
1336
+struct vop2_vp_plane_mask {
1337
+ u8 primary_plane_id;
1338
+ u8 attached_layers_nr;
1339
+ u8 attached_layers[ROCKCHIP_MAX_LAYER];
1340
+};
1341
+
9331342 /**
9341343 * VOP2 data structe
9351344 *
....@@ -939,25 +1348,43 @@
9391348 struct vop2_data {
9401349 uint32_t version;
9411350 uint32_t feature;
1351
+ uint8_t nr_dscs;
1352
+ uint8_t nr_dsc_ecw;
1353
+ uint8_t nr_dsc_buffer_flow;
9421354 uint8_t nr_vps;
9431355 uint8_t nr_mixers;
9441356 uint8_t nr_layers;
9451357 uint8_t nr_axi_intr;
9461358 uint8_t nr_gammas;
1359
+ uint8_t nr_conns;
1360
+ uint8_t nr_pds;
1361
+ uint8_t nr_mem_pgs;
9471362 uint8_t esmart_lb_mode;
1363
+ bool delayed_pd;
9481364 const struct vop_intr *axi_intr;
9491365 const struct vop2_ctrl *ctrl;
1366
+ const struct vop2_dsc_data *dsc;
1367
+ const struct dsc_error_info *dsc_error_ecw;
1368
+ const struct dsc_error_info *dsc_error_buffer_flow;
9501369 const struct vop2_win_data *win;
9511370 const struct vop2_video_port_data *vp;
1371
+ const struct vop2_connector_if_data *conn;
9521372 const struct vop2_wb_data *wb;
9531373 const struct vop2_layer_data *layer;
1374
+ const struct vop2_power_domain_data *pd;
1375
+ const struct vop2_power_domain_data *mem_pg;
9541376 const struct vop_csc_table *csc_table;
9551377 const struct vop_hdr_table *hdr_table;
956
- const struct vop_grf_ctrl *grf_ctrl;
1378
+ const struct vop_grf_ctrl *sys_grf;
1379
+ const struct vop_grf_ctrl *grf;
1380
+ const struct vop_grf_ctrl *vo0_grf;
1381
+ const struct vop_grf_ctrl *vo1_grf;
9571382 const struct vop_dump_regs *dump_regs;
9581383 uint32_t dump_regs_size;
9591384 struct vop_rect max_input;
9601385 struct vop_rect max_output;
1386
+ const struct vop2_vp_plane_mask *plane_mask;
1387
+ uint32_t plane_mask_base;
9611388
9621389 unsigned int win_size;
9631390 };
....@@ -1034,6 +1461,7 @@
10341461 #define ROCKCHIP_OUT_MODE_P565 2
10351462 #define ROCKCHIP_OUT_MODE_BT656 5
10361463 #define ROCKCHIP_OUT_MODE_S888 8
1464
+#define ROCKCHIP_OUT_MODE_YUV422 9
10371465 #define ROCKCHIP_OUT_MODE_S888_DUMMY 12
10381466 #define ROCKCHIP_OUT_MODE_YUV420 14
10391467 /* for use special outface */
....@@ -1150,6 +1578,7 @@
11501578 DCLK_INVERT = 3
11511579 };
11521580
1581
+
11531582 #define FRAC_16_16(mult, div) (((mult) << 16) / (div))
11541583 #define SCL_FT_DEFAULT_FIXPOINT_SHIFT 12
11551584 #define SCL_MAX_VSKIPLINES 4
....@@ -1234,7 +1663,6 @@
12341663 return y1 + (y2 - y1) * (x - x1) / (x2 - x1);
12351664 }
12361665
1237
-extern void vop2_standby(struct drm_crtc *crtc, bool standby);
12381666 extern const struct component_ops vop_component_ops;
12391667 extern const struct component_ops vop2_component_ops;
12401668 #endif /* _ROCKCHIP_DRM_VOP_H */