18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright(c) 2016, Analogix Semiconductor. All rights reserved. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#ifndef __ANX78xx_H 78c2ecf20Sopenharmony_ci#define __ANX78xx_H 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include "analogix-i2c-dptx.h" 108c2ecf20Sopenharmony_ci#include "analogix-i2c-txcommon.h" 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci/***************************************************************/ 138c2ecf20Sopenharmony_ci/* Register definitions for RX_PO */ 148c2ecf20Sopenharmony_ci/***************************************************************/ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* 178c2ecf20Sopenharmony_ci * System Control and Status 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* Software Reset Register 1 */ 218c2ecf20Sopenharmony_ci#define SP_SOFTWARE_RESET1_REG 0x11 228c2ecf20Sopenharmony_ci#define SP_VIDEO_RST BIT(4) 238c2ecf20Sopenharmony_ci#define SP_HDCP_MAN_RST BIT(2) 248c2ecf20Sopenharmony_ci#define SP_TMDS_RST BIT(1) 258c2ecf20Sopenharmony_ci#define SP_SW_MAN_RST BIT(0) 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* System Status Register */ 288c2ecf20Sopenharmony_ci#define SP_SYSTEM_STATUS_REG 0x14 298c2ecf20Sopenharmony_ci#define SP_TMDS_CLOCK_DET BIT(1) 308c2ecf20Sopenharmony_ci#define SP_TMDS_DE_DET BIT(0) 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* HDMI Status Register */ 338c2ecf20Sopenharmony_ci#define SP_HDMI_STATUS_REG 0x15 348c2ecf20Sopenharmony_ci#define SP_HDMI_AUD_LAYOUT BIT(3) 358c2ecf20Sopenharmony_ci#define SP_HDMI_DET BIT(0) 368c2ecf20Sopenharmony_ci# define SP_DVI_MODE 0 378c2ecf20Sopenharmony_ci# define SP_HDMI_MODE 1 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci/* HDMI Mute Control Register */ 408c2ecf20Sopenharmony_ci#define SP_HDMI_MUTE_CTRL_REG 0x16 418c2ecf20Sopenharmony_ci#define SP_AUD_MUTE BIT(1) 428c2ecf20Sopenharmony_ci#define SP_VID_MUTE BIT(0) 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci/* System Power Down Register 1 */ 458c2ecf20Sopenharmony_ci#define SP_SYSTEM_POWER_DOWN1_REG 0x18 468c2ecf20Sopenharmony_ci#define SP_PWDN_CTRL BIT(0) 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/* 498c2ecf20Sopenharmony_ci * Audio and Video Auto Control 508c2ecf20Sopenharmony_ci */ 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* Auto Audio and Video Control register */ 538c2ecf20Sopenharmony_ci#define SP_AUDVID_CTRL_REG 0x20 548c2ecf20Sopenharmony_ci#define SP_AVC_OE BIT(7) 558c2ecf20Sopenharmony_ci#define SP_AAC_OE BIT(6) 568c2ecf20Sopenharmony_ci#define SP_AVC_EN BIT(1) 578c2ecf20Sopenharmony_ci#define SP_AAC_EN BIT(0) 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci/* Audio Exception Enable Registers */ 608c2ecf20Sopenharmony_ci#define SP_AUD_EXCEPTION_ENABLE_BASE (0x24 - 1) 618c2ecf20Sopenharmony_ci/* Bits for Audio Exception Enable Register 3 */ 628c2ecf20Sopenharmony_ci#define SP_AEC_EN21 BIT(5) 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* 658c2ecf20Sopenharmony_ci * Interrupt 668c2ecf20Sopenharmony_ci */ 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/* Interrupt Status Register 1 */ 698c2ecf20Sopenharmony_ci#define SP_INT_STATUS1_REG 0x31 708c2ecf20Sopenharmony_ci/* Bits for Interrupt Status Register 1 */ 718c2ecf20Sopenharmony_ci#define SP_HDMI_DVI BIT(7) 728c2ecf20Sopenharmony_ci#define SP_CKDT_CHG BIT(6) 738c2ecf20Sopenharmony_ci#define SP_SCDT_CHG BIT(5) 748c2ecf20Sopenharmony_ci#define SP_PCLK_CHG BIT(4) 758c2ecf20Sopenharmony_ci#define SP_PLL_UNLOCK BIT(3) 768c2ecf20Sopenharmony_ci#define SP_CABLE_PLUG_CHG BIT(2) 778c2ecf20Sopenharmony_ci#define SP_SET_MUTE BIT(1) 788c2ecf20Sopenharmony_ci#define SP_SW_INTR BIT(0) 798c2ecf20Sopenharmony_ci/* Bits for Interrupt Status Register 2 */ 808c2ecf20Sopenharmony_ci#define SP_HDCP_ERR BIT(5) 818c2ecf20Sopenharmony_ci#define SP_AUDIO_SAMPLE_CHG BIT(0) /* undocumented */ 828c2ecf20Sopenharmony_ci/* Bits for Interrupt Status Register 3 */ 838c2ecf20Sopenharmony_ci#define SP_AUD_MODE_CHG BIT(0) 848c2ecf20Sopenharmony_ci/* Bits for Interrupt Status Register 5 */ 858c2ecf20Sopenharmony_ci#define SP_AUDIO_RCV BIT(0) 868c2ecf20Sopenharmony_ci/* Bits for Interrupt Status Register 6 */ 878c2ecf20Sopenharmony_ci#define SP_INT_STATUS6_REG 0x36 888c2ecf20Sopenharmony_ci#define SP_CTS_RCV BIT(7) 898c2ecf20Sopenharmony_ci#define SP_NEW_AUD_PKT BIT(4) 908c2ecf20Sopenharmony_ci#define SP_NEW_AVI_PKT BIT(1) 918c2ecf20Sopenharmony_ci#define SP_NEW_CP_PKT BIT(0) 928c2ecf20Sopenharmony_ci/* Bits for Interrupt Status Register 7 */ 938c2ecf20Sopenharmony_ci#define SP_NO_VSI BIT(7) 948c2ecf20Sopenharmony_ci#define SP_NEW_VS BIT(4) 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci/* Interrupt Mask 1 Status Registers */ 978c2ecf20Sopenharmony_ci#define SP_INT_MASK1_REG 0x41 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci/* HDMI US TIMER Control Register */ 1008c2ecf20Sopenharmony_ci#define SP_HDMI_US_TIMER_CTRL_REG 0x49 1018c2ecf20Sopenharmony_ci#define SP_MS_TIMER_MARGIN_10_8_MASK 0x07 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci/* 1048c2ecf20Sopenharmony_ci * TMDS Control 1058c2ecf20Sopenharmony_ci */ 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci/* TMDS Control Registers */ 1088c2ecf20Sopenharmony_ci#define SP_TMDS_CTRL_BASE (0x50 - 1) 1098c2ecf20Sopenharmony_ci/* Bits for TMDS Control Register 7 */ 1108c2ecf20Sopenharmony_ci#define SP_PD_RT BIT(0) 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci/* 1138c2ecf20Sopenharmony_ci * Video Control 1148c2ecf20Sopenharmony_ci */ 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci/* Video Status Register */ 1178c2ecf20Sopenharmony_ci#define SP_VIDEO_STATUS_REG 0x70 1188c2ecf20Sopenharmony_ci#define SP_COLOR_DEPTH_MASK 0xf0 1198c2ecf20Sopenharmony_ci#define SP_COLOR_DEPTH_SHIFT 4 1208c2ecf20Sopenharmony_ci# define SP_COLOR_DEPTH_MODE_LEGACY 0x00 1218c2ecf20Sopenharmony_ci# define SP_COLOR_DEPTH_MODE_24BIT 0x04 1228c2ecf20Sopenharmony_ci# define SP_COLOR_DEPTH_MODE_30BIT 0x05 1238c2ecf20Sopenharmony_ci# define SP_COLOR_DEPTH_MODE_36BIT 0x06 1248c2ecf20Sopenharmony_ci# define SP_COLOR_DEPTH_MODE_48BIT 0x07 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci/* Video Data Range Control Register */ 1278c2ecf20Sopenharmony_ci#define SP_VID_DATA_RANGE_CTRL_REG 0x83 1288c2ecf20Sopenharmony_ci#define SP_R2Y_INPUT_LIMIT BIT(1) 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci/* Pixel Clock High Resolution Counter Registers */ 1318c2ecf20Sopenharmony_ci#define SP_PCLK_HIGHRES_CNT_BASE (0x8c - 1) 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci/* 1348c2ecf20Sopenharmony_ci * Audio Control 1358c2ecf20Sopenharmony_ci */ 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci/* Number of Audio Channels Status Registers */ 1388c2ecf20Sopenharmony_ci#define SP_AUD_CH_STATUS_REG_NUM 6 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci/* Audio IN S/PDIF Channel Status Registers */ 1418c2ecf20Sopenharmony_ci#define SP_AUD_SPDIF_CH_STATUS_BASE 0xc7 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci/* Audio IN S/PDIF Channel Status Register 4 */ 1448c2ecf20Sopenharmony_ci#define SP_FS_FREQ_MASK 0x0f 1458c2ecf20Sopenharmony_ci# define SP_FS_FREQ_44100HZ 0x00 1468c2ecf20Sopenharmony_ci# define SP_FS_FREQ_48000HZ 0x02 1478c2ecf20Sopenharmony_ci# define SP_FS_FREQ_32000HZ 0x03 1488c2ecf20Sopenharmony_ci# define SP_FS_FREQ_88200HZ 0x08 1498c2ecf20Sopenharmony_ci# define SP_FS_FREQ_96000HZ 0x0a 1508c2ecf20Sopenharmony_ci# define SP_FS_FREQ_176400HZ 0x0c 1518c2ecf20Sopenharmony_ci# define SP_FS_FREQ_192000HZ 0x0e 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci/* 1548c2ecf20Sopenharmony_ci * Micellaneous Control Block 1558c2ecf20Sopenharmony_ci */ 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci/* CHIP Control Register */ 1588c2ecf20Sopenharmony_ci#define SP_CHIP_CTRL_REG 0xe3 1598c2ecf20Sopenharmony_ci#define SP_MAN_HDMI5V_DET BIT(3) 1608c2ecf20Sopenharmony_ci#define SP_PLLLOCK_CKDT_EN BIT(2) 1618c2ecf20Sopenharmony_ci#define SP_ANALOG_CKDT_EN BIT(1) 1628c2ecf20Sopenharmony_ci#define SP_DIGITAL_CKDT_EN BIT(0) 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci/* Packet Receiving Status Register */ 1658c2ecf20Sopenharmony_ci#define SP_PACKET_RECEIVING_STATUS_REG 0xf3 1668c2ecf20Sopenharmony_ci#define SP_AVI_RCVD BIT(5) 1678c2ecf20Sopenharmony_ci#define SP_VSI_RCVD BIT(1) 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci/***************************************************************/ 1708c2ecf20Sopenharmony_ci/* Register definitions for RX_P1 */ 1718c2ecf20Sopenharmony_ci/***************************************************************/ 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci/* HDCP BCAPS Shadow Register */ 1748c2ecf20Sopenharmony_ci#define SP_HDCP_BCAPS_SHADOW_REG 0x2a 1758c2ecf20Sopenharmony_ci#define SP_BCAPS_REPEATER BIT(5) 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci/* HDCP Status Register */ 1788c2ecf20Sopenharmony_ci#define SP_RX_HDCP_STATUS_REG 0x3f 1798c2ecf20Sopenharmony_ci#define SP_AUTH_EN BIT(4) 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci/* 1828c2ecf20Sopenharmony_ci * InfoFrame and Control Packet Registers 1838c2ecf20Sopenharmony_ci */ 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci/* AVI InfoFrame packet checksum */ 1868c2ecf20Sopenharmony_ci#define SP_AVI_INFOFRAME_CHECKSUM 0xa3 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci/* AVI InfoFrame Registers */ 1898c2ecf20Sopenharmony_ci#define SP_AVI_INFOFRAME_DATA_BASE 0xa4 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci#define SP_AVI_COLOR_F_MASK 0x60 1928c2ecf20Sopenharmony_ci#define SP_AVI_COLOR_F_SHIFT 5 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ci/* Audio InfoFrame Registers */ 1958c2ecf20Sopenharmony_ci#define SP_AUD_INFOFRAME_DATA_BASE 0xc4 1968c2ecf20Sopenharmony_ci#define SP_AUD_INFOFRAME_LAYOUT_MASK 0x0f 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci/* MPEG/HDMI Vendor Specific InfoFrame Packet type code */ 1998c2ecf20Sopenharmony_ci#define SP_MPEG_VS_INFOFRAME_TYPE_REG 0xe0 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci/* MPEG/HDMI Vendor Specific InfoFrame Packet length */ 2028c2ecf20Sopenharmony_ci#define SP_MPEG_VS_INFOFRAME_LEN_REG 0xe2 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci/* MPEG/HDMI Vendor Specific InfoFrame Packet version number */ 2058c2ecf20Sopenharmony_ci#define SP_MPEG_VS_INFOFRAME_VER_REG 0xe1 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci/* MPEG/HDMI Vendor Specific InfoFrame Packet content */ 2088c2ecf20Sopenharmony_ci#define SP_MPEG_VS_INFOFRAME_DATA_BASE 0xe4 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci/* General Control Packet Register */ 2118c2ecf20Sopenharmony_ci#define SP_GENERAL_CTRL_PACKET_REG 0x9f 2128c2ecf20Sopenharmony_ci#define SP_CLEAR_AVMUTE BIT(4) 2138c2ecf20Sopenharmony_ci#define SP_SET_AVMUTE BIT(0) 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci/***************************************************************/ 2168c2ecf20Sopenharmony_ci/* Register definitions for TX_P1 */ 2178c2ecf20Sopenharmony_ci/***************************************************************/ 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci/* DP TX Link Training Control Register */ 2208c2ecf20Sopenharmony_ci#define SP_DP_TX_LT_CTRL0_REG 0x30 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci/* PD 1.2 Lint Training 80bit Pattern Register */ 2238c2ecf20Sopenharmony_ci#define SP_DP_LT_80BIT_PATTERN0_REG 0x80 2248c2ecf20Sopenharmony_ci#define SP_DP_LT_80BIT_PATTERN_REG_NUM 10 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci/* Audio Interface Control Register 0 */ 2278c2ecf20Sopenharmony_ci#define SP_AUD_INTERFACE_CTRL0_REG 0x5f 2288c2ecf20Sopenharmony_ci#define SP_AUD_INTERFACE_DISABLE 0x80 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci/* Audio Interface Control Register 2 */ 2318c2ecf20Sopenharmony_ci#define SP_AUD_INTERFACE_CTRL2_REG 0x60 2328c2ecf20Sopenharmony_ci#define SP_M_AUD_ADJUST_ST 0x04 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci/* Audio Interface Control Register 3 */ 2358c2ecf20Sopenharmony_ci#define SP_AUD_INTERFACE_CTRL3_REG 0x62 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci/* Audio Interface Control Register 4 */ 2388c2ecf20Sopenharmony_ci#define SP_AUD_INTERFACE_CTRL4_REG 0x67 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci/* Audio Interface Control Register 5 */ 2418c2ecf20Sopenharmony_ci#define SP_AUD_INTERFACE_CTRL5_REG 0x68 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci/* Audio Interface Control Register 6 */ 2448c2ecf20Sopenharmony_ci#define SP_AUD_INTERFACE_CTRL6_REG 0x69 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci/* Firmware Version Register */ 2478c2ecf20Sopenharmony_ci#define SP_FW_VER_REG 0xb7 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci#endif 250