162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2016 Maxime Ripard
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Maxime Ripard <maxime.ripard@free-electrons.com>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef _SUN4I_HDMI_H_
962306a36Sopenharmony_ci#define _SUN4I_HDMI_H_
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <drm/drm_connector.h>
1262306a36Sopenharmony_ci#include <drm/drm_encoder.h>
1362306a36Sopenharmony_ci#include <linux/regmap.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#include <media/cec-pin.h>
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define SUN4I_HDMI_CTRL_REG		0x004
1862306a36Sopenharmony_ci#define SUN4I_HDMI_CTRL_ENABLE			BIT(31)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define SUN4I_HDMI_IRQ_REG		0x008
2162306a36Sopenharmony_ci#define SUN4I_HDMI_IRQ_STA_MASK			0x73
2262306a36Sopenharmony_ci#define SUN4I_HDMI_IRQ_STA_FIFO_OF		BIT(1)
2362306a36Sopenharmony_ci#define SUN4I_HDMI_IRQ_STA_FIFO_UF		BIT(0)
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define SUN4I_HDMI_HPD_REG		0x00c
2662306a36Sopenharmony_ci#define SUN4I_HDMI_HPD_HIGH			BIT(0)
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#define SUN4I_HDMI_VID_CTRL_REG		0x010
2962306a36Sopenharmony_ci#define SUN4I_HDMI_VID_CTRL_ENABLE		BIT(31)
3062306a36Sopenharmony_ci#define SUN4I_HDMI_VID_CTRL_HDMI_MODE		BIT(30)
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_ACT_REG	0x014
3362306a36Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_BP_REG	0x018
3462306a36Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_FP_REG	0x01c
3562306a36Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_SPW_REG	0x020
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_X(x)		((((x) - 1) & GENMASK(11, 0)))
3862306a36Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_Y(y)		((((y) - 1) & GENMASK(11, 0)) << 16)
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_POL_REG	0x024
4162306a36Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_POL_TX_CLK        (0x3e0 << 16)
4262306a36Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_POL_VSYNC		BIT(1)
4362306a36Sopenharmony_ci#define SUN4I_HDMI_VID_TIMING_POL_HSYNC		BIT(0)
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define SUN4I_HDMI_AVI_INFOFRAME_REG(n)	(0x080 + (n))
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_REG	0x200
4862306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_BIASEN		BIT(31)
4962306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_LDOCEN		BIT(30)
5062306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_LDODEN		BIT(29)
5162306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_PWENC		BIT(28)
5262306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_PWEND		BIT(27)
5362306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_PWENG		BIT(26)
5462306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_CKEN		BIT(25)
5562306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL0_TXEN		BIT(23)
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_REG	0x204
5862306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_UNKNOWN		BIT(24)	/* set on A31 */
5962306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_AMP_OPT		BIT(23)
6062306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_AMPCK_OPT		BIT(22)
6162306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_EMP_OPT		BIT(20)
6262306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_EMPCK_OPT		BIT(19)
6362306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_PWSCK		BIT(18)
6462306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_PWSDT		BIT(17)
6562306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_REG_DEN		BIT(15)
6662306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_REG_DENCK		BIT(14)
6762306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_REG_EMP(n)		(((n) & 7) << 10)
6862306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_HALVE_CLK		BIT(6)
6962306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_REG_AMP(n)		(((n) & 7) << 3)
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci/* These bits seem to invert the TMDS data channels */
7262306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_INVERT_R		BIT(2)
7362306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_INVERT_G		BIT(1)
7462306a36Sopenharmony_ci#define SUN4I_HDMI_PAD_CTRL1_INVERT_B		BIT(0)
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_REG		0x208
7762306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_PLL_EN		BIT(31)
7862306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_BWS			BIT(30)
7962306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_HV_IS_33		BIT(29)
8062306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_LDO1_EN		BIT(28)
8162306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_LDO2_EN		BIT(27)
8262306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_SDIV2		BIT(25)
8362306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_VCO_GAIN(n)		(((n) & 7) << 20)
8462306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_S(n)		(((n) & 7) << 17)
8562306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_CP_S(n)		(((n) & 0x1f) << 12)
8662306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_CS(n)		(((n) & 0xf) << 8)
8762306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_DIV(n)		(((n) & 0xf) << 4)
8862306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_DIV_MASK		GENMASK(7, 4)
8962306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_CTRL_VCO_S(n)		((n) & 0xf)
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_DBG0_REG		0x20c
9262306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_DBG0_TMDS_PARENT(n)	(((n) & 1) << 21)
9362306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_DBG0_TMDS_PARENT_MASK	BIT(21)
9462306a36Sopenharmony_ci#define SUN4I_HDMI_PLL_DBG0_TMDS_PARENT_SHIFT	21
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci#define SUN4I_HDMI_CEC			0x214
9762306a36Sopenharmony_ci#define SUN4I_HDMI_CEC_ENABLE			BIT(11)
9862306a36Sopenharmony_ci#define SUN4I_HDMI_CEC_TX			BIT(9)
9962306a36Sopenharmony_ci#define SUN4I_HDMI_CEC_RX			BIT(8)
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci#define SUN4I_HDMI_PKT_CTRL_REG(n)	(0x2f0 + (4 * (n)))
10262306a36Sopenharmony_ci#define SUN4I_HDMI_PKT_CTRL_TYPE(n, t)		((t) << (((n) % 4) * 4))
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci#define SUN4I_HDMI_UNKNOWN_REG		0x300
10562306a36Sopenharmony_ci#define SUN4I_HDMI_UNKNOWN_INPUT_SYNC		BIT(27)
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_REG		0x500
10862306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_ENABLE		BIT(31)
10962306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_START_CMD		BIT(30)
11062306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_MASK	BIT(8)
11162306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_WRITE	(1 << 8)
11262306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_READ	(0 << 8)
11362306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CTRL_RESET		BIT(0)
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_ADDR_REG		0x504
11662306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_ADDR_SEGMENT(seg)	(((seg) & 0xff) << 24)
11762306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_ADDR_EDDC(addr)		(((addr) & 0xff) << 16)
11862306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_ADDR_OFFSET(off)		(((off) & 0xff) << 8)
11962306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_ADDR_SLAVE(addr)		((addr) & 0xff)
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_REG		0x50c
12262306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_ILLEGAL_FIFO_OPERATION	BIT(7)
12362306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_DDC_RX_FIFO_UNDERFLOW		BIT(6)
12462306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_DDC_TX_FIFO_OVERFLOW		BIT(5)
12562306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_FIFO_REQUEST			BIT(4)
12662306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_ARBITRATION_ERROR		BIT(3)
12762306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_ACK_ERROR			BIT(2)
12862306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_BUS_ERROR			BIT(1)
12962306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_INT_STATUS_TRANSFER_COMPLETE		BIT(0)
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_REG	0x510
13262306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_CLEAR		BIT(31)
13362306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_RX_THRES(n)	(((n) & 0xf) << 4)
13462306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_RX_THRES_MASK	GENMASK(7, 4)
13562306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_RX_THRES_MAX	(BIT(4) - 1)
13662306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_TX_THRES(n)	((n) & 0xf)
13762306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_TX_THRES_MASK	GENMASK(3, 0)
13862306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_CTRL_TX_THRES_MAX	(BIT(4) - 1)
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_DATA_REG	0x518
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_BYTE_COUNT_REG	0x51c
14362306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_BYTE_COUNT_MAX		(BIT(10) - 1)
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CMD_REG		0x520
14662306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CMD_EXPLICIT_EDDC_READ	6
14762306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CMD_IMPLICIT_READ	5
14862306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CMD_IMPLICIT_WRITE	3
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CLK_REG		0x528
15162306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CLK_M(m)			(((m) & 0xf) << 3)
15262306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_CLK_N(n)			((n) & 0x7)
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_LINE_CTRL_REG	0x540
15562306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_LINE_CTRL_SDA_ENABLE	BIT(9)
15662306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_LINE_CTRL_SCL_ENABLE	BIT(8)
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#define SUN4I_HDMI_DDC_FIFO_SIZE	16
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci/* A31 specific */
16162306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_REG		0x500
16262306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_RESET		BIT(31)
16362306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_START_CMD		BIT(27)
16462306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_SDA_ENABLE		BIT(6)
16562306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_SCL_ENABLE		BIT(4)
16662306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_CTRL_ENABLE		BIT(0)
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_CMD_REG		0x508
16962306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_CMD_BYTE_COUNT(count)	((count) << 16)
17062306a36Sopenharmony_ci/* command types in lower 3 bits are the same as sun4i */
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_ADDR_REG		0x50c
17362306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_ADDR_SEGMENT(seg)	(((seg) & 0xff) << 24)
17462306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_ADDR_EDDC(addr)		(((addr) & 0xff) << 16)
17562306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_ADDR_OFFSET(off)		(((off) & 0xff) << 8)
17662306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_ADDR_SLAVE(addr)		(((addr) & 0xff) << 1)
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_INT_STATUS_REG	0x514
17962306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_INT_STATUS_TIMEOUT	BIT(8)
18062306a36Sopenharmony_ci/* lower 8 bits are the same as sun4i */
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_FIFO_CTRL_REG	0x518
18362306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_FIFO_CTRL_CLEAR		BIT(15)
18462306a36Sopenharmony_ci/* lower 9 bits are the same as sun4i */
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_CLK_REG		0x520
18762306a36Sopenharmony_ci/* DDC CLK bit fields are the same, but the formula is not */
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci#define SUN6I_HDMI_DDC_FIFO_DATA_REG	0x580
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_cienum sun4i_hdmi_pkt_type {
19262306a36Sopenharmony_ci	SUN4I_HDMI_PKT_AVI = 2,
19362306a36Sopenharmony_ci	SUN4I_HDMI_PKT_END = 15,
19462306a36Sopenharmony_ci};
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_cistruct sun4i_hdmi_variant {
19762306a36Sopenharmony_ci	bool has_ddc_parent_clk;
19862306a36Sopenharmony_ci	bool has_reset_control;
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci	u32 pad_ctrl0_init_val;
20162306a36Sopenharmony_ci	u32 pad_ctrl1_init_val;
20262306a36Sopenharmony_ci	u32 pll_ctrl_init_val;
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci	struct reg_field ddc_clk_reg;
20562306a36Sopenharmony_ci	u8 ddc_clk_pre_divider;
20662306a36Sopenharmony_ci	u8 ddc_clk_m_offset;
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci	u8 tmds_clk_div_offset;
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci	/* Register fields for I2C adapter */
21162306a36Sopenharmony_ci	struct reg_field	field_ddc_en;
21262306a36Sopenharmony_ci	struct reg_field	field_ddc_start;
21362306a36Sopenharmony_ci	struct reg_field	field_ddc_reset;
21462306a36Sopenharmony_ci	struct reg_field	field_ddc_addr_reg;
21562306a36Sopenharmony_ci	struct reg_field	field_ddc_slave_addr;
21662306a36Sopenharmony_ci	struct reg_field	field_ddc_int_mask;
21762306a36Sopenharmony_ci	struct reg_field	field_ddc_int_status;
21862306a36Sopenharmony_ci	struct reg_field	field_ddc_fifo_clear;
21962306a36Sopenharmony_ci	struct reg_field	field_ddc_fifo_rx_thres;
22062306a36Sopenharmony_ci	struct reg_field	field_ddc_fifo_tx_thres;
22162306a36Sopenharmony_ci	struct reg_field	field_ddc_byte_count;
22262306a36Sopenharmony_ci	struct reg_field	field_ddc_cmd;
22362306a36Sopenharmony_ci	struct reg_field	field_ddc_sda_en;
22462306a36Sopenharmony_ci	struct reg_field	field_ddc_sck_en;
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci	/* DDC FIFO register offset */
22762306a36Sopenharmony_ci	u32			ddc_fifo_reg;
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_ci	/*
23062306a36Sopenharmony_ci	 * DDC FIFO threshold boundary conditions
23162306a36Sopenharmony_ci	 *
23262306a36Sopenharmony_ci	 * This is used to cope with the threshold boundary condition
23362306a36Sopenharmony_ci	 * being slightly different on sun5i and sun6i.
23462306a36Sopenharmony_ci	 *
23562306a36Sopenharmony_ci	 * On sun5i the threshold is exclusive, i.e. does not include,
23662306a36Sopenharmony_ci	 * the value of the threshold. ( > for RX; < for TX )
23762306a36Sopenharmony_ci	 * On sun6i the threshold is inclusive, i.e. includes, the
23862306a36Sopenharmony_ci	 * value of the threshold. ( >= for RX; <= for TX )
23962306a36Sopenharmony_ci	 */
24062306a36Sopenharmony_ci	bool			ddc_fifo_thres_incl;
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci	bool			ddc_fifo_has_dir;
24362306a36Sopenharmony_ci};
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_cistruct sun4i_hdmi {
24662306a36Sopenharmony_ci	struct drm_connector	connector;
24762306a36Sopenharmony_ci	struct drm_encoder	encoder;
24862306a36Sopenharmony_ci	struct device		*dev;
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci	void __iomem		*base;
25162306a36Sopenharmony_ci	struct regmap		*regmap;
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci	/* Reset control */
25462306a36Sopenharmony_ci	struct reset_control	*reset;
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_ci	/* Parent clocks */
25762306a36Sopenharmony_ci	struct clk		*bus_clk;
25862306a36Sopenharmony_ci	struct clk		*mod_clk;
25962306a36Sopenharmony_ci	struct clk		*ddc_parent_clk;
26062306a36Sopenharmony_ci	struct clk		*pll0_clk;
26162306a36Sopenharmony_ci	struct clk		*pll1_clk;
26262306a36Sopenharmony_ci
26362306a36Sopenharmony_ci	/* And the clocks we create */
26462306a36Sopenharmony_ci	struct clk		*ddc_clk;
26562306a36Sopenharmony_ci	struct clk		*tmds_clk;
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci	struct i2c_adapter	*i2c;
26862306a36Sopenharmony_ci	struct i2c_adapter	*ddc_i2c;
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_ci	/* Regmap fields for I2C adapter */
27162306a36Sopenharmony_ci	struct regmap_field	*field_ddc_en;
27262306a36Sopenharmony_ci	struct regmap_field	*field_ddc_start;
27362306a36Sopenharmony_ci	struct regmap_field	*field_ddc_reset;
27462306a36Sopenharmony_ci	struct regmap_field	*field_ddc_addr_reg;
27562306a36Sopenharmony_ci	struct regmap_field	*field_ddc_slave_addr;
27662306a36Sopenharmony_ci	struct regmap_field	*field_ddc_int_mask;
27762306a36Sopenharmony_ci	struct regmap_field	*field_ddc_int_status;
27862306a36Sopenharmony_ci	struct regmap_field	*field_ddc_fifo_clear;
27962306a36Sopenharmony_ci	struct regmap_field	*field_ddc_fifo_rx_thres;
28062306a36Sopenharmony_ci	struct regmap_field	*field_ddc_fifo_tx_thres;
28162306a36Sopenharmony_ci	struct regmap_field	*field_ddc_byte_count;
28262306a36Sopenharmony_ci	struct regmap_field	*field_ddc_cmd;
28362306a36Sopenharmony_ci	struct regmap_field	*field_ddc_sda_en;
28462306a36Sopenharmony_ci	struct regmap_field	*field_ddc_sck_en;
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci	struct sun4i_drv	*drv;
28762306a36Sopenharmony_ci
28862306a36Sopenharmony_ci	struct cec_adapter	*cec_adap;
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci	const struct sun4i_hdmi_variant	*variant;
29162306a36Sopenharmony_ci};
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ciint sun4i_ddc_create(struct sun4i_hdmi *hdmi, struct clk *clk);
29462306a36Sopenharmony_ciint sun4i_tmds_create(struct sun4i_hdmi *hdmi);
29562306a36Sopenharmony_ciint sun4i_hdmi_i2c_create(struct device *dev, struct sun4i_hdmi *hdmi);
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci#endif /* _SUN4I_HDMI_H_ */
298