18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2016 Maxime Ripard 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Maxime Ripard <maxime.ripard@free-electrons.com> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _SUN4I_HDMI_H_ 98c2ecf20Sopenharmony_ci#define _SUN4I_HDMI_H_ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <drm/drm_connector.h> 128c2ecf20Sopenharmony_ci#include <drm/drm_encoder.h> 138c2ecf20Sopenharmony_ci#include <linux/regmap.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include <media/cec-pin.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define SUN4I_HDMI_CTRL_REG 0x004 188c2ecf20Sopenharmony_ci#define SUN4I_HDMI_CTRL_ENABLE BIT(31) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define SUN4I_HDMI_IRQ_REG 0x008 218c2ecf20Sopenharmony_ci#define SUN4I_HDMI_IRQ_STA_MASK 0x73 228c2ecf20Sopenharmony_ci#define SUN4I_HDMI_IRQ_STA_FIFO_OF BIT(1) 238c2ecf20Sopenharmony_ci#define SUN4I_HDMI_IRQ_STA_FIFO_UF BIT(0) 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define SUN4I_HDMI_HPD_REG 0x00c 268c2ecf20Sopenharmony_ci#define SUN4I_HDMI_HPD_HIGH BIT(0) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_CTRL_REG 0x010 298c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_CTRL_ENABLE BIT(31) 308c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_CTRL_HDMI_MODE BIT(30) 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_ACT_REG 0x014 338c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_BP_REG 0x018 348c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_FP_REG 0x01c 358c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_SPW_REG 0x020 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_X(x) ((((x) - 1) & GENMASK(11, 0))) 388c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_Y(y) ((((y) - 1) & GENMASK(11, 0)) << 16) 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_POL_REG 0x024 418c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_POL_TX_CLK (0x3e0 << 16) 428c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_POL_VSYNC BIT(1) 438c2ecf20Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_POL_HSYNC BIT(0) 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define SUN4I_HDMI_AVI_INFOFRAME_REG(n) (0x080 + (n)) 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_REG 0x200 488c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_BIASEN BIT(31) 498c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_LDOCEN BIT(30) 508c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_LDODEN BIT(29) 518c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_PWENC BIT(28) 528c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_PWEND BIT(27) 538c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_PWENG BIT(26) 548c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_CKEN BIT(25) 558c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_TXEN BIT(23) 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_REG 0x204 588c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_UNKNOWN BIT(24) /* set on A31 */ 598c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_AMP_OPT BIT(23) 608c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_AMPCK_OPT BIT(22) 618c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_EMP_OPT BIT(20) 628c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_EMPCK_OPT BIT(19) 638c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_PWSCK BIT(18) 648c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_PWSDT BIT(17) 658c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_REG_DEN BIT(15) 668c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_REG_DENCK BIT(14) 678c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_REG_EMP(n) (((n) & 7) << 10) 688c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_HALVE_CLK BIT(6) 698c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_REG_AMP(n) (((n) & 7) << 3) 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci/* These bits seem to invert the TMDS data channels */ 728c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_INVERT_R BIT(2) 738c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_INVERT_G BIT(1) 748c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_INVERT_B BIT(0) 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_REG 0x208 778c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_PLL_EN BIT(31) 788c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_BWS BIT(30) 798c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_HV_IS_33 BIT(29) 808c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_LDO1_EN BIT(28) 818c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_LDO2_EN BIT(27) 828c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_SDIV2 BIT(25) 838c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_VCO_GAIN(n) (((n) & 7) << 20) 848c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_S(n) (((n) & 7) << 17) 858c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_CP_S(n) (((n) & 0x1f) << 12) 868c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_CS(n) (((n) & 0xf) << 8) 878c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_DIV(n) (((n) & 0xf) << 4) 888c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_DIV_MASK GENMASK(7, 4) 898c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_VCO_S(n) ((n) & 0xf) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_DBG0_REG 0x20c 928c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_DBG0_TMDS_PARENT(n) (((n) & 1) << 21) 938c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_DBG0_TMDS_PARENT_MASK BIT(21) 948c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PLL_DBG0_TMDS_PARENT_SHIFT 21 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#define SUN4I_HDMI_CEC 0x214 978c2ecf20Sopenharmony_ci#define SUN4I_HDMI_CEC_ENABLE BIT(11) 988c2ecf20Sopenharmony_ci#define SUN4I_HDMI_CEC_TX BIT(9) 998c2ecf20Sopenharmony_ci#define SUN4I_HDMI_CEC_RX BIT(8) 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PKT_CTRL_REG(n) (0x2f0 + (4 * (n))) 1028c2ecf20Sopenharmony_ci#define SUN4I_HDMI_PKT_CTRL_TYPE(n, t) ((t) << (((n) % 4) * 4)) 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define SUN4I_HDMI_UNKNOWN_REG 0x300 1058c2ecf20Sopenharmony_ci#define SUN4I_HDMI_UNKNOWN_INPUT_SYNC BIT(27) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_REG 0x500 1088c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_ENABLE BIT(31) 1098c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_START_CMD BIT(30) 1108c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_MASK BIT(8) 1118c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_WRITE (1 << 8) 1128c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_READ (0 << 8) 1138c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_RESET BIT(0) 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_ADDR_REG 0x504 1168c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_ADDR_SEGMENT(seg) (((seg) & 0xff) << 24) 1178c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_ADDR_EDDC(addr) (((addr) & 0xff) << 16) 1188c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_ADDR_OFFSET(off) (((off) & 0xff) << 8) 1198c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_ADDR_SLAVE(addr) ((addr) & 0xff) 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_REG 0x50c 1228c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_ILLEGAL_FIFO_OPERATION BIT(7) 1238c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_DDC_RX_FIFO_UNDERFLOW BIT(6) 1248c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_DDC_TX_FIFO_OVERFLOW BIT(5) 1258c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_FIFO_REQUEST BIT(4) 1268c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_ARBITRATION_ERROR BIT(3) 1278c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_ACK_ERROR BIT(2) 1288c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_BUS_ERROR BIT(1) 1298c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_TRANSFER_COMPLETE BIT(0) 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_REG 0x510 1328c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_CLEAR BIT(31) 1338c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_RX_THRES(n) (((n) & 0xf) << 4) 1348c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_RX_THRES_MASK GENMASK(7, 4) 1358c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_RX_THRES_MAX (BIT(4) - 1) 1368c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_TX_THRES(n) ((n) & 0xf) 1378c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_TX_THRES_MASK GENMASK(3, 0) 1388c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_TX_THRES_MAX (BIT(4) - 1) 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_DATA_REG 0x518 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_BYTE_COUNT_REG 0x51c 1438c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_BYTE_COUNT_MAX (BIT(10) - 1) 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CMD_REG 0x520 1468c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CMD_EXPLICIT_EDDC_READ 6 1478c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CMD_IMPLICIT_READ 5 1488c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CMD_IMPLICIT_WRITE 3 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CLK_REG 0x528 1518c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CLK_M(m) (((m) & 0xf) << 3) 1528c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_CLK_N(n) ((n) & 0x7) 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_LINE_CTRL_REG 0x540 1558c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_LINE_CTRL_SDA_ENABLE BIT(9) 1568c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_LINE_CTRL_SCL_ENABLE BIT(8) 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_SIZE 16 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci/* A31 specific */ 1618c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_REG 0x500 1628c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_RESET BIT(31) 1638c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_START_CMD BIT(27) 1648c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_SDA_ENABLE BIT(6) 1658c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_SCL_ENABLE BIT(4) 1668c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_ENABLE BIT(0) 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_CMD_REG 0x508 1698c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_CMD_BYTE_COUNT(count) ((count) << 16) 1708c2ecf20Sopenharmony_ci/* command types in lower 3 bits are the same as sun4i */ 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_ADDR_REG 0x50c 1738c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_ADDR_SEGMENT(seg) (((seg) & 0xff) << 24) 1748c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_ADDR_EDDC(addr) (((addr) & 0xff) << 16) 1758c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_ADDR_OFFSET(off) (((off) & 0xff) << 8) 1768c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_ADDR_SLAVE(addr) (((addr) & 0xff) << 1) 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_INT_STATUS_REG 0x514 1798c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_INT_STATUS_TIMEOUT BIT(8) 1808c2ecf20Sopenharmony_ci/* lower 8 bits are the same as sun4i */ 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_FIFO_CTRL_REG 0x518 1838c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_FIFO_CTRL_CLEAR BIT(15) 1848c2ecf20Sopenharmony_ci/* lower 9 bits are the same as sun4i */ 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_CLK_REG 0x520 1878c2ecf20Sopenharmony_ci/* DDC CLK bit fields are the same, but the formula is not */ 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci#define SUN6I_HDMI_DDC_FIFO_DATA_REG 0x580 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_cienum sun4i_hdmi_pkt_type { 1928c2ecf20Sopenharmony_ci SUN4I_HDMI_PKT_AVI = 2, 1938c2ecf20Sopenharmony_ci SUN4I_HDMI_PKT_END = 15, 1948c2ecf20Sopenharmony_ci}; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_cistruct sun4i_hdmi_variant { 1978c2ecf20Sopenharmony_ci bool has_ddc_parent_clk; 1988c2ecf20Sopenharmony_ci bool has_reset_control; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci u32 pad_ctrl0_init_val; 2018c2ecf20Sopenharmony_ci u32 pad_ctrl1_init_val; 2028c2ecf20Sopenharmony_ci u32 pll_ctrl_init_val; 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci struct reg_field ddc_clk_reg; 2058c2ecf20Sopenharmony_ci u8 ddc_clk_pre_divider; 2068c2ecf20Sopenharmony_ci u8 ddc_clk_m_offset; 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci u8 tmds_clk_div_offset; 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci /* Register fields for I2C adapter */ 2118c2ecf20Sopenharmony_ci struct reg_field field_ddc_en; 2128c2ecf20Sopenharmony_ci struct reg_field field_ddc_start; 2138c2ecf20Sopenharmony_ci struct reg_field field_ddc_reset; 2148c2ecf20Sopenharmony_ci struct reg_field field_ddc_addr_reg; 2158c2ecf20Sopenharmony_ci struct reg_field field_ddc_slave_addr; 2168c2ecf20Sopenharmony_ci struct reg_field field_ddc_int_mask; 2178c2ecf20Sopenharmony_ci struct reg_field field_ddc_int_status; 2188c2ecf20Sopenharmony_ci struct reg_field field_ddc_fifo_clear; 2198c2ecf20Sopenharmony_ci struct reg_field field_ddc_fifo_rx_thres; 2208c2ecf20Sopenharmony_ci struct reg_field field_ddc_fifo_tx_thres; 2218c2ecf20Sopenharmony_ci struct reg_field field_ddc_byte_count; 2228c2ecf20Sopenharmony_ci struct reg_field field_ddc_cmd; 2238c2ecf20Sopenharmony_ci struct reg_field field_ddc_sda_en; 2248c2ecf20Sopenharmony_ci struct reg_field field_ddc_sck_en; 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci /* DDC FIFO register offset */ 2278c2ecf20Sopenharmony_ci u32 ddc_fifo_reg; 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci /* 2308c2ecf20Sopenharmony_ci * DDC FIFO threshold boundary conditions 2318c2ecf20Sopenharmony_ci * 2328c2ecf20Sopenharmony_ci * This is used to cope with the threshold boundary condition 2338c2ecf20Sopenharmony_ci * being slightly different on sun5i and sun6i. 2348c2ecf20Sopenharmony_ci * 2358c2ecf20Sopenharmony_ci * On sun5i the threshold is exclusive, i.e. does not include, 2368c2ecf20Sopenharmony_ci * the value of the threshold. ( > for RX; < for TX ) 2378c2ecf20Sopenharmony_ci * On sun6i the threshold is inclusive, i.e. includes, the 2388c2ecf20Sopenharmony_ci * value of the threshold. ( >= for RX; <= for TX ) 2398c2ecf20Sopenharmony_ci */ 2408c2ecf20Sopenharmony_ci bool ddc_fifo_thres_incl; 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci bool ddc_fifo_has_dir; 2438c2ecf20Sopenharmony_ci}; 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_cistruct sun4i_hdmi { 2468c2ecf20Sopenharmony_ci struct drm_connector connector; 2478c2ecf20Sopenharmony_ci struct drm_encoder encoder; 2488c2ecf20Sopenharmony_ci struct device *dev; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci void __iomem *base; 2518c2ecf20Sopenharmony_ci struct regmap *regmap; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci /* Reset control */ 2548c2ecf20Sopenharmony_ci struct reset_control *reset; 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci /* Parent clocks */ 2578c2ecf20Sopenharmony_ci struct clk *bus_clk; 2588c2ecf20Sopenharmony_ci struct clk *mod_clk; 2598c2ecf20Sopenharmony_ci struct clk *ddc_parent_clk; 2608c2ecf20Sopenharmony_ci struct clk *pll0_clk; 2618c2ecf20Sopenharmony_ci struct clk *pll1_clk; 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci /* And the clocks we create */ 2648c2ecf20Sopenharmony_ci struct clk *ddc_clk; 2658c2ecf20Sopenharmony_ci struct clk *tmds_clk; 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci struct i2c_adapter *i2c; 2688c2ecf20Sopenharmony_ci struct i2c_adapter *ddc_i2c; 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci /* Regmap fields for I2C adapter */ 2718c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_en; 2728c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_start; 2738c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_reset; 2748c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_addr_reg; 2758c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_slave_addr; 2768c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_int_mask; 2778c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_int_status; 2788c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_fifo_clear; 2798c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_fifo_rx_thres; 2808c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_fifo_tx_thres; 2818c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_byte_count; 2828c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_cmd; 2838c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_sda_en; 2848c2ecf20Sopenharmony_ci struct regmap_field *field_ddc_sck_en; 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ci struct sun4i_drv *drv; 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci bool hdmi_monitor; 2898c2ecf20Sopenharmony_ci struct cec_adapter *cec_adap; 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci const struct sun4i_hdmi_variant *variant; 2928c2ecf20Sopenharmony_ci}; 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ciint sun4i_ddc_create(struct sun4i_hdmi *hdmi, struct clk *clk); 2958c2ecf20Sopenharmony_ciint sun4i_tmds_create(struct sun4i_hdmi *hdmi); 2968c2ecf20Sopenharmony_ciint sun4i_hdmi_i2c_create(struct device *dev, struct sun4i_hdmi *hdmi); 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci#endif /* _SUN4I_HDMI_H_ */ 299