hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/gpu/drm/rockchip/cdn-dp-reg.h
....@@ -8,6 +8,7 @@
88 #define _CDN_DP_REG_H
99
1010 #include <linux/bitops.h>
11
+#include <linux/phy/phy.h>
1112
1213 #define ADDR_IMEM 0x10000
1314 #define ADDR_DMEM 0x20000
....@@ -129,7 +130,7 @@
129130 #define HPD_EVENT_MASK 0x211c
130131 #define HPD_EVENT_DET 0x2120
131132
132
-/* dpyx framer addr */
133
+/* dptx framer addr */
133134 #define DP_FRAMER_GLOBAL_CONFIG 0x2200
134135 #define DP_SW_RESET 0x2204
135136 #define DP_FRAMER_TU 0x2208
....@@ -320,6 +321,13 @@
320321 #define GENERAL_BUS_SETTINGS 0x03
321322 #define GENERAL_TEST_ACCESS 0x04
322323
324
+/* AUX status*/
325
+#define AUX_STATUS_ACK 0
326
+#define AUX_STATUS_NACK 1
327
+#define AUX_STATUS_DEFER 2
328
+#define AUX_STATUS_SINK_ERROR 3
329
+#define AUX_STATUS_BUS_ERROR 4
330
+
323331 #define DPTX_SET_POWER_MNG 0x00
324332 #define DPTX_SET_HOST_CAPABILITIES 0x01
325333 #define DPTX_GET_EDID 0x02
....@@ -416,6 +424,40 @@
416424 /* Reference cycles when using lane clock as reference */
417425 #define LANE_REF_CYC 0x8000
418426
427
+/* register CM_VID_CTRL */
428
+#define LANE_VID_REF_CYC(x) (((x) & (BIT(24) - 1)) << 0)
429
+#define NMVID_MEAS_TOLERANCE(x) (((x) & 0xf) << 24)
430
+
431
+/* register DP_TX_PHY_CONFIG_REG */
432
+#define DP_TX_PHY_TRAINING_ENABLE(x) ((x) & 1)
433
+#define DP_TX_PHY_TRAINING_TYPE_PRBS7 (0 << 1)
434
+#define DP_TX_PHY_TRAINING_TYPE_TPS1 (1 << 1)
435
+#define DP_TX_PHY_TRAINING_TYPE_TPS2 (2 << 1)
436
+#define DP_TX_PHY_TRAINING_TYPE_TPS3 (3 << 1)
437
+#define DP_TX_PHY_TRAINING_TYPE_TPS4 (4 << 1)
438
+#define DP_TX_PHY_TRAINING_TYPE_PLTPAT (5 << 1)
439
+#define DP_TX_PHY_TRAINING_TYPE_D10_2 (6 << 1)
440
+#define DP_TX_PHY_TRAINING_TYPE_HBR2CPAT (8 << 1)
441
+#define DP_TX_PHY_TRAINING_PATTERN(x) ((x) << 1)
442
+#define DP_TX_PHY_SCRAMBLER_BYPASS(x) (((x) & 1) << 5)
443
+#define DP_TX_PHY_ENCODER_BYPASS(x) (((x) & 1) << 6)
444
+#define DP_TX_PHY_SKEW_BYPASS(x) (((x) & 1) << 7)
445
+#define DP_TX_PHY_DISPARITY_RST(x) (((x) & 1) << 8)
446
+#define DP_TX_PHY_LANE0_SKEW(x) (((x) & 7) << 9)
447
+#define DP_TX_PHY_LANE1_SKEW(x) (((x) & 7) << 12)
448
+#define DP_TX_PHY_LANE2_SKEW(x) (((x) & 7) << 15)
449
+#define DP_TX_PHY_LANE3_SKEW(x) (((x) & 7) << 18)
450
+#define DP_TX_PHY_10BIT_ENABLE(x) (((x) & 1) << 21)
451
+
452
+/* register DP_FRAMER_GLOBAL_CONFIG */
453
+#define NUM_LANES(x) ((x) & 3)
454
+#define SST_MODE (0 << 2)
455
+#define RG_EN (0 << 4)
456
+#define GLOBAL_EN BIT(3)
457
+#define NO_VIDEO BIT(5)
458
+#define ENC_RST_DIS BIT(6)
459
+#define WR_VHSYNC_FALL BIT(7)
460
+
419461 enum voltage_swing_level {
420462 VOLTAGE_LEVEL_0,
421463 VOLTAGE_LEVEL_1,
....@@ -461,8 +503,12 @@
461503 int cdn_dp_event_config(struct cdn_dp_device *dp);
462504 u32 cdn_dp_get_event(struct cdn_dp_device *dp);
463505 int cdn_dp_get_hpd_status(struct cdn_dp_device *dp);
464
-int cdn_dp_dpcd_write(struct cdn_dp_device *dp, u32 addr, u8 value);
465
-int cdn_dp_dpcd_read(struct cdn_dp_device *dp, u32 addr, u8 *data, u16 len);
506
+int cdn_dp_reg_write(struct cdn_dp_device *dp, u16 addr, u32 val);
507
+ssize_t cdn_dp_dpcd_write(struct cdn_dp_device *dp, u32 addr,
508
+ u8 *data, u16 len);
509
+ssize_t cdn_dp_dpcd_read(struct cdn_dp_device *dp, u32 addr,
510
+ u8 *data, u16 len);
511
+int cdn_dp_get_aux_status(struct cdn_dp_device *dp);
466512 int cdn_dp_get_edid_block(void *dp, u8 *edid,
467513 unsigned int block, size_t length);
468514 int cdn_dp_train_link(struct cdn_dp_device *dp);
....@@ -471,4 +517,5 @@
471517 int cdn_dp_audio_stop(struct cdn_dp_device *dp, struct audio_info *audio);
472518 int cdn_dp_audio_mute(struct cdn_dp_device *dp, bool enable);
473519 int cdn_dp_audio_config(struct cdn_dp_device *dp, struct audio_info *audio);
520
+int cdn_dp_software_train_link(struct cdn_dp_device *dp);
474521 #endif /* _CDN_DP_REG_H */