| .. | .. |
|---|
| 8 | 8 | #define _CDN_DP_REG_H |
|---|
| 9 | 9 | |
|---|
| 10 | 10 | #include <linux/bitops.h> |
|---|
| 11 | +#include <linux/phy/phy.h> |
|---|
| 11 | 12 | |
|---|
| 12 | 13 | #define ADDR_IMEM 0x10000 |
|---|
| 13 | 14 | #define ADDR_DMEM 0x20000 |
|---|
| .. | .. |
|---|
| 129 | 130 | #define HPD_EVENT_MASK 0x211c |
|---|
| 130 | 131 | #define HPD_EVENT_DET 0x2120 |
|---|
| 131 | 132 | |
|---|
| 132 | | -/* dpyx framer addr */ |
|---|
| 133 | +/* dptx framer addr */ |
|---|
| 133 | 134 | #define DP_FRAMER_GLOBAL_CONFIG 0x2200 |
|---|
| 134 | 135 | #define DP_SW_RESET 0x2204 |
|---|
| 135 | 136 | #define DP_FRAMER_TU 0x2208 |
|---|
| .. | .. |
|---|
| 320 | 321 | #define GENERAL_BUS_SETTINGS 0x03 |
|---|
| 321 | 322 | #define GENERAL_TEST_ACCESS 0x04 |
|---|
| 322 | 323 | |
|---|
| 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 | + |
|---|
| 323 | 331 | #define DPTX_SET_POWER_MNG 0x00 |
|---|
| 324 | 332 | #define DPTX_SET_HOST_CAPABILITIES 0x01 |
|---|
| 325 | 333 | #define DPTX_GET_EDID 0x02 |
|---|
| .. | .. |
|---|
| 416 | 424 | /* Reference cycles when using lane clock as reference */ |
|---|
| 417 | 425 | #define LANE_REF_CYC 0x8000 |
|---|
| 418 | 426 | |
|---|
| 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 | + |
|---|
| 419 | 461 | enum voltage_swing_level { |
|---|
| 420 | 462 | VOLTAGE_LEVEL_0, |
|---|
| 421 | 463 | VOLTAGE_LEVEL_1, |
|---|
| .. | .. |
|---|
| 461 | 503 | int cdn_dp_event_config(struct cdn_dp_device *dp); |
|---|
| 462 | 504 | u32 cdn_dp_get_event(struct cdn_dp_device *dp); |
|---|
| 463 | 505 | 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); |
|---|
| 466 | 512 | int cdn_dp_get_edid_block(void *dp, u8 *edid, |
|---|
| 467 | 513 | unsigned int block, size_t length); |
|---|
| 468 | 514 | int cdn_dp_train_link(struct cdn_dp_device *dp); |
|---|
| .. | .. |
|---|
| 471 | 517 | int cdn_dp_audio_stop(struct cdn_dp_device *dp, struct audio_info *audio); |
|---|
| 472 | 518 | int cdn_dp_audio_mute(struct cdn_dp_device *dp, bool enable); |
|---|
| 473 | 519 | 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); |
|---|
| 474 | 521 | #endif /* _CDN_DP_REG_H */ |
|---|