forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/gpu/drm/sun4i/sun4i_tcon.h
....@@ -1,14 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Copyright (C) 2015 Free Electrons
34 * Copyright (C) 2015 NextThing Co
45 *
56 * Boris Brezillon <boris.brezillon@free-electrons.com>
67 * Maxime Ripard <maxime.ripard@free-electrons.com>
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License as
10
- * published by the Free Software Foundation; either version 2 of
11
- * the License, or (at your option) any later version.
128 */
139
1410 #ifndef __SUN4I_TCON_H__
....@@ -37,18 +33,21 @@
3733 #define SUN4I_TCON_GINT1_REG 0x8
3834
3935 #define SUN4I_TCON_FRM_CTL_REG 0x10
40
-#define SUN4I_TCON_FRM_CTL_EN BIT(31)
36
+#define SUN4I_TCON0_FRM_CTL_EN BIT(31)
37
+#define SUN4I_TCON0_FRM_CTL_MODE_R BIT(6)
38
+#define SUN4I_TCON0_FRM_CTL_MODE_G BIT(5)
39
+#define SUN4I_TCON0_FRM_CTL_MODE_B BIT(4)
4140
42
-#define SUN4I_TCON_FRM_SEED_PR_REG 0x14
43
-#define SUN4I_TCON_FRM_SEED_PG_REG 0x18
44
-#define SUN4I_TCON_FRM_SEED_PB_REG 0x1c
45
-#define SUN4I_TCON_FRM_SEED_LR_REG 0x20
46
-#define SUN4I_TCON_FRM_SEED_LG_REG 0x24
47
-#define SUN4I_TCON_FRM_SEED_LB_REG 0x28
48
-#define SUN4I_TCON_FRM_TBL0_REG 0x2c
49
-#define SUN4I_TCON_FRM_TBL1_REG 0x30
50
-#define SUN4I_TCON_FRM_TBL2_REG 0x34
51
-#define SUN4I_TCON_FRM_TBL3_REG 0x38
41
+#define SUN4I_TCON0_FRM_SEED_PR_REG 0x14
42
+#define SUN4I_TCON0_FRM_SEED_PG_REG 0x18
43
+#define SUN4I_TCON0_FRM_SEED_PB_REG 0x1c
44
+#define SUN4I_TCON0_FRM_SEED_LR_REG 0x20
45
+#define SUN4I_TCON0_FRM_SEED_LG_REG 0x24
46
+#define SUN4I_TCON0_FRM_SEED_LB_REG 0x28
47
+#define SUN4I_TCON0_FRM_TBL0_REG 0x2c
48
+#define SUN4I_TCON0_FRM_TBL1_REG 0x30
49
+#define SUN4I_TCON0_FRM_TBL2_REG 0x34
50
+#define SUN4I_TCON0_FRM_TBL3_REG 0x38
5251
5352 #define SUN4I_TCON0_CTL_REG 0x40
5453 #define SUN4I_TCON0_CTL_TCON_ENABLE BIT(31)
....@@ -113,6 +112,8 @@
113112
114113 #define SUN4I_TCON0_IO_POL_REG 0x88
115114 #define SUN4I_TCON0_IO_POL_DCLK_PHASE(phase) ((phase & 3) << 28)
115
+#define SUN4I_TCON0_IO_POL_DE_NEGATIVE BIT(27)
116
+#define SUN4I_TCON0_IO_POL_DCLK_DRIVE_NEGEDGE BIT(26)
116117 #define SUN4I_TCON0_IO_POL_HSYNC_POSITIVE BIT(25)
117118 #define SUN4I_TCON0_IO_POL_VSYNC_POSITIVE BIT(24)
118119
....@@ -153,6 +154,11 @@
153154 #define SUN4I_TCON1_BASIC5_V_SYNC(height) (((height) - 1) & 0x3ff)
154155
155156 #define SUN4I_TCON1_IO_POL_REG 0xf0
157
+/* there is no documentation about this bit */
158
+#define SUN4I_TCON1_IO_POL_UNKNOWN BIT(26)
159
+#define SUN4I_TCON1_IO_POL_HSYNC_POSITIVE BIT(25)
160
+#define SUN4I_TCON1_IO_POL_VSYNC_POSITIVE BIT(24)
161
+
156162 #define SUN4I_TCON1_IO_TRI_REG 0xf4
157163
158164 #define SUN4I_TCON_ECC_FIFO_REG 0xf8
....@@ -193,6 +199,13 @@
193199 #define SUN4I_TCON_MUX_CTRL_REG 0x200
194200
195201 #define SUN4I_TCON0_LVDS_ANA0_REG 0x220
202
+#define SUN4I_TCON0_LVDS_ANA0_DCHS BIT(16)
203
+#define SUN4I_TCON0_LVDS_ANA0_PD (BIT(20) | BIT(21))
204
+#define SUN4I_TCON0_LVDS_ANA0_EN_MB BIT(22)
205
+#define SUN4I_TCON0_LVDS_ANA0_REG_C (BIT(24) | BIT(25))
206
+#define SUN4I_TCON0_LVDS_ANA0_REG_V (BIT(26) | BIT(27))
207
+#define SUN4I_TCON0_LVDS_ANA0_CK_EN (BIT(29) | BIT(28))
208
+
196209 #define SUN6I_TCON0_LVDS_ANA0_EN_MB BIT(31)
197210 #define SUN6I_TCON0_LVDS_ANA0_EN_LDO BIT(30)
198211 #define SUN6I_TCON0_LVDS_ANA0_EN_DRVC BIT(24)
....@@ -200,6 +213,10 @@
200213 #define SUN6I_TCON0_LVDS_ANA0_C(x) (((x) & 3) << 17)
201214 #define SUN6I_TCON0_LVDS_ANA0_V(x) (((x) & 3) << 8)
202215 #define SUN6I_TCON0_LVDS_ANA0_PD(x) (((x) & 3) << 4)
216
+
217
+#define SUN4I_TCON0_LVDS_ANA1_REG 0x224
218
+#define SUN4I_TCON0_LVDS_ANA1_INIT (0x1f << 26 | 0x1f << 10)
219
+#define SUN4I_TCON0_LVDS_ANA1_UPDATE (0x1f << 16 | 0x1f << 00)
203220
204221 #define SUN4I_TCON1_FILL_CTL_REG 0x300
205222 #define SUN4I_TCON1_FILL_BEG0_REG 0x304
....@@ -224,10 +241,14 @@
224241 bool needs_de_be_mux; /* sun6i needs mux to select backend */
225242 bool needs_edp_reset; /* a80 edp reset needed for tcon0 access */
226243 bool supports_lvds; /* Does the TCON support an LVDS output? */
244
+ bool polarity_in_ch0; /* some tcon1 channels have polarity bits in tcon0 pol register */
227245 u8 dclk_min_div; /* minimum divider for TCON0 DCLK */
228246
229247 /* callback to handle tcon muxing options */
230248 int (*set_mux)(struct sun4i_tcon *, const struct drm_encoder *);
249
+ /* handler for LVDS setup routine */
250
+ void (*setup_lvds_phy)(struct sun4i_tcon *tcon,
251
+ const struct drm_encoder *encoder);
231252 };
232253
233254 struct sun4i_tcon {
....@@ -253,8 +274,6 @@
253274 /* Reset control */
254275 struct reset_control *lcd_rst;
255276 struct reset_control *lvds_rst;
256
-
257
- struct drm_panel *panel;
258277
259278 /* Platform adjustments */
260279 const struct sun4i_tcon_quirks *quirks;