| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd |
|---|
| 3 | 4 | * Author: Chris Zhong <zyw@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. |
|---|
| 13 | 5 | */ |
|---|
| 14 | 6 | |
|---|
| 15 | 7 | #ifndef _CDN_DP_REG_H |
|---|
| 16 | 8 | #define _CDN_DP_REG_H |
|---|
| 17 | 9 | |
|---|
| 18 | 10 | #include <linux/bitops.h> |
|---|
| 19 | | -#include <linux/phy/phy.h> |
|---|
| 20 | | -#include <linux/phy/phy-rockchip-typec.h> |
|---|
| 21 | 11 | |
|---|
| 22 | 12 | #define ADDR_IMEM 0x10000 |
|---|
| 23 | 13 | #define ADDR_DMEM 0x20000 |
|---|
| .. | .. |
|---|
| 139 | 129 | #define HPD_EVENT_MASK 0x211c |
|---|
| 140 | 130 | #define HPD_EVENT_DET 0x2120 |
|---|
| 141 | 131 | |
|---|
| 142 | | -/* dptx framer addr */ |
|---|
| 132 | +/* dpyx framer addr */ |
|---|
| 143 | 133 | #define DP_FRAMER_GLOBAL_CONFIG 0x2200 |
|---|
| 144 | 134 | #define DP_SW_RESET 0x2204 |
|---|
| 145 | 135 | #define DP_FRAMER_TU 0x2208 |
|---|
| .. | .. |
|---|
| 330 | 320 | #define GENERAL_BUS_SETTINGS 0x03 |
|---|
| 331 | 321 | #define GENERAL_TEST_ACCESS 0x04 |
|---|
| 332 | 322 | |
|---|
| 333 | | -/* AUX status*/ |
|---|
| 334 | | -#define AUX_STATUS_ACK 0 |
|---|
| 335 | | -#define AUX_STATUS_NACK 1 |
|---|
| 336 | | -#define AUX_STATUS_DEFER 2 |
|---|
| 337 | | -#define AUX_STATUS_SINK_ERROR 3 |
|---|
| 338 | | -#define AUX_STATUS_BUS_ERROR 4 |
|---|
| 339 | | - |
|---|
| 340 | 323 | #define DPTX_SET_POWER_MNG 0x00 |
|---|
| 341 | 324 | #define DPTX_SET_HOST_CAPABILITIES 0x01 |
|---|
| 342 | 325 | #define DPTX_GET_EDID 0x02 |
|---|
| .. | .. |
|---|
| 430 | 413 | #define SPDIF_JITTER_THRSH(x) (((x) & 0xff) << 3) |
|---|
| 431 | 414 | #define SPDIF_JITTER_AVG_WIN(x) ((x) & 0x7) |
|---|
| 432 | 415 | |
|---|
| 433 | | -/* SOURCE_PIF_WR_REQ */ |
|---|
| 434 | | -#define HOST_WR BIT(0) |
|---|
| 435 | | - |
|---|
| 436 | | -/* SOURCE_PIF_PKT_ALLOC_REG */ |
|---|
| 437 | | -#define ACTIVE_IDLE_TYPE(x) (((x) & 0x1) << 17) |
|---|
| 438 | | -#define TYPE_VALID BIT(16) |
|---|
| 439 | | -#define PACKET_TYPE(x) (((x) & 0xff) << 8) |
|---|
| 440 | | -#define PKT_ALLOC_ADDRESS(x) (((x) & 0xf) << 0) |
|---|
| 441 | | - |
|---|
| 442 | | -/* SOURCE_PIF_PKT_ALLOC_WR_EN */ |
|---|
| 443 | | -#define PKT_ALLOC_WR_EN BIT(0) |
|---|
| 444 | | - |
|---|
| 445 | 416 | /* Reference cycles when using lane clock as reference */ |
|---|
| 446 | 417 | #define LANE_REF_CYC 0x8000 |
|---|
| 447 | | - |
|---|
| 448 | | -/* register CM_VID_CTRL */ |
|---|
| 449 | | -#define LANE_VID_REF_CYC(x) (((x) & (BIT(24) - 1)) << 0) |
|---|
| 450 | | -#define NMVID_MEAS_TOLERANCE(x) (((x) & 0xf) << 24) |
|---|
| 451 | | - |
|---|
| 452 | | -/* register DP_TX_PHY_CONFIG_REG */ |
|---|
| 453 | | -#define DP_TX_PHY_TRAINING_ENABLE(x) ((x) & 1) |
|---|
| 454 | | -#define DP_TX_PHY_TRAINING_TYPE_PRBS7 (0 << 1) |
|---|
| 455 | | -#define DP_TX_PHY_TRAINING_TYPE_TPS1 (1 << 1) |
|---|
| 456 | | -#define DP_TX_PHY_TRAINING_TYPE_TPS2 (2 << 1) |
|---|
| 457 | | -#define DP_TX_PHY_TRAINING_TYPE_TPS3 (3 << 1) |
|---|
| 458 | | -#define DP_TX_PHY_TRAINING_TYPE_TPS4 (4 << 1) |
|---|
| 459 | | -#define DP_TX_PHY_TRAINING_TYPE_PLTPAT (5 << 1) |
|---|
| 460 | | -#define DP_TX_PHY_TRAINING_TYPE_D10_2 (6 << 1) |
|---|
| 461 | | -#define DP_TX_PHY_TRAINING_TYPE_HBR2CPAT (8 << 1) |
|---|
| 462 | | -#define DP_TX_PHY_TRAINING_PATTERN(x) ((x) << 1) |
|---|
| 463 | | -#define DP_TX_PHY_SCRAMBLER_BYPASS(x) (((x) & 1) << 5) |
|---|
| 464 | | -#define DP_TX_PHY_ENCODER_BYPASS(x) (((x) & 1) << 6) |
|---|
| 465 | | -#define DP_TX_PHY_SKEW_BYPASS(x) (((x) & 1) << 7) |
|---|
| 466 | | -#define DP_TX_PHY_DISPARITY_RST(x) (((x) & 1) << 8) |
|---|
| 467 | | -#define DP_TX_PHY_LANE0_SKEW(x) (((x) & 7) << 9) |
|---|
| 468 | | -#define DP_TX_PHY_LANE1_SKEW(x) (((x) & 7) << 12) |
|---|
| 469 | | -#define DP_TX_PHY_LANE2_SKEW(x) (((x) & 7) << 15) |
|---|
| 470 | | -#define DP_TX_PHY_LANE3_SKEW(x) (((x) & 7) << 18) |
|---|
| 471 | | -#define DP_TX_PHY_10BIT_ENABLE(x) (((x) & 1) << 21) |
|---|
| 472 | | - |
|---|
| 473 | | -/* register DP_FRAMER_GLOBAL_CONFIG */ |
|---|
| 474 | | -#define NUM_LANES(x) ((x) & 3) |
|---|
| 475 | | -#define SST_MODE (0 << 2) |
|---|
| 476 | | -#define RG_EN (0 << 4) |
|---|
| 477 | | -#define GLOBAL_EN BIT(3) |
|---|
| 478 | | -#define NO_VIDEO BIT(5) |
|---|
| 479 | | -#define ENC_RST_DIS BIT(6) |
|---|
| 480 | | -#define WR_VHSYNC_FALL BIT(7) |
|---|
| 481 | 418 | |
|---|
| 482 | 419 | enum voltage_swing_level { |
|---|
| 483 | 420 | VOLTAGE_LEVEL_0, |
|---|
| .. | .. |
|---|
| 524 | 461 | int cdn_dp_event_config(struct cdn_dp_device *dp); |
|---|
| 525 | 462 | u32 cdn_dp_get_event(struct cdn_dp_device *dp); |
|---|
| 526 | 463 | int cdn_dp_get_hpd_status(struct cdn_dp_device *dp); |
|---|
| 527 | | -int cdn_dp_reg_write(struct cdn_dp_device *dp, u16 addr, u32 val); |
|---|
| 528 | | -ssize_t cdn_dp_dpcd_write(struct cdn_dp_device *dp, u32 addr, |
|---|
| 529 | | - u8 *data, u16 len); |
|---|
| 530 | | -ssize_t cdn_dp_dpcd_read(struct cdn_dp_device *dp, u32 addr, |
|---|
| 531 | | - u8 *data, u16 len); |
|---|
| 532 | | -int cdn_dp_get_aux_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); |
|---|
| 533 | 466 | int cdn_dp_get_edid_block(void *dp, u8 *edid, |
|---|
| 534 | 467 | unsigned int block, size_t length); |
|---|
| 535 | 468 | int cdn_dp_train_link(struct cdn_dp_device *dp); |
|---|
| .. | .. |
|---|
| 538 | 471 | int cdn_dp_audio_stop(struct cdn_dp_device *dp, struct audio_info *audio); |
|---|
| 539 | 472 | int cdn_dp_audio_mute(struct cdn_dp_device *dp, bool enable); |
|---|
| 540 | 473 | int cdn_dp_audio_config(struct cdn_dp_device *dp, struct audio_info *audio); |
|---|
| 541 | | -int cdn_dp_software_train_link(struct cdn_dp_device *dp); |
|---|
| 542 | | -void cdn_dp_infoframe_set(struct cdn_dp_device *dp, int entry_id, u8 *buf, |
|---|
| 543 | | - u32 len, int type); |
|---|
| 544 | 474 | #endif /* _CDN_DP_REG_H */ |
|---|