xref: /openbmc/linux/drivers/gpu/drm/sun4i/sun4i_tcon.h (revision a08fc7c8056e75b08285a2ad955228002dcd86bc)
19026e0d1SMaxime Ripard /*
29026e0d1SMaxime Ripard  * Copyright (C) 2015 Free Electrons
39026e0d1SMaxime Ripard  * Copyright (C) 2015 NextThing Co
49026e0d1SMaxime Ripard  *
59026e0d1SMaxime Ripard  * Boris Brezillon <boris.brezillon@free-electrons.com>
69026e0d1SMaxime Ripard  * Maxime Ripard <maxime.ripard@free-electrons.com>
79026e0d1SMaxime Ripard  *
89026e0d1SMaxime Ripard  * This program is free software; you can redistribute it and/or
99026e0d1SMaxime Ripard  * modify it under the terms of the GNU General Public License as
109026e0d1SMaxime Ripard  * published by the Free Software Foundation; either version 2 of
119026e0d1SMaxime Ripard  * the License, or (at your option) any later version.
129026e0d1SMaxime Ripard  */
139026e0d1SMaxime Ripard 
149026e0d1SMaxime Ripard #ifndef __SUN4I_TCON_H__
159026e0d1SMaxime Ripard #define __SUN4I_TCON_H__
169026e0d1SMaxime Ripard 
179026e0d1SMaxime Ripard #include <drm/drm_crtc.h>
189026e0d1SMaxime Ripard 
199026e0d1SMaxime Ripard #include <linux/kernel.h>
2080a58240SChen-Yu Tsai #include <linux/list.h>
219026e0d1SMaxime Ripard #include <linux/reset.h>
229026e0d1SMaxime Ripard 
239026e0d1SMaxime Ripard #define SUN4I_TCON_GCTL_REG			0x0
249026e0d1SMaxime Ripard #define SUN4I_TCON_GCTL_TCON_ENABLE			BIT(31)
259026e0d1SMaxime Ripard #define SUN4I_TCON_GCTL_IOMAP_MASK			BIT(0)
269026e0d1SMaxime Ripard #define SUN4I_TCON_GCTL_IOMAP_TCON1			(1 << 0)
279026e0d1SMaxime Ripard #define SUN4I_TCON_GCTL_IOMAP_TCON0			(0 << 0)
289026e0d1SMaxime Ripard 
299026e0d1SMaxime Ripard #define SUN4I_TCON_GINT0_REG			0x4
309026e0d1SMaxime Ripard #define SUN4I_TCON_GINT0_VBLANK_ENABLE(pipe)		BIT(31 - (pipe))
31a493ceaeSMaxime Ripard #define SUN4I_TCON_GINT0_TCON0_TRI_FINISH_ENABLE	BIT(27)
32a493ceaeSMaxime Ripard #define SUN4I_TCON_GINT0_TCON0_TRI_COUNTER_ENABLE	BIT(26)
339026e0d1SMaxime Ripard #define SUN4I_TCON_GINT0_VBLANK_INT(pipe)		BIT(15 - (pipe))
34a493ceaeSMaxime Ripard #define SUN4I_TCON_GINT0_TCON0_TRI_FINISH_INT		BIT(11)
35a493ceaeSMaxime Ripard #define SUN4I_TCON_GINT0_TCON0_TRI_COUNTER_INT		BIT(10)
369026e0d1SMaxime Ripard 
379026e0d1SMaxime Ripard #define SUN4I_TCON_GINT1_REG			0x8
38*a08fc7c8SMaxime Ripard 
399026e0d1SMaxime Ripard #define SUN4I_TCON_FRM_CTL_REG			0x10
40*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_CTL_EN				BIT(31)
41*a08fc7c8SMaxime Ripard 
42*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_SEED_PR_REG		0x14
43*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_SEED_PG_REG		0x18
44*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_SEED_PB_REG		0x1c
45*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_SEED_LR_REG		0x20
46*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_SEED_LG_REG		0x24
47*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_SEED_LB_REG		0x28
48*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_TBL0_REG			0x2c
49*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_TBL1_REG			0x30
50*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_TBL2_REG			0x34
51*a08fc7c8SMaxime Ripard #define SUN4I_TCON_FRM_TBL3_REG			0x38
529026e0d1SMaxime Ripard 
539026e0d1SMaxime Ripard #define SUN4I_TCON0_CTL_REG			0x40
549026e0d1SMaxime Ripard #define SUN4I_TCON0_CTL_TCON_ENABLE			BIT(31)
55*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CTL_IF_MASK				GENMASK(25, 24)
56*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CTL_IF_8080				(1 << 24)
579026e0d1SMaxime Ripard #define SUN4I_TCON0_CTL_CLK_DELAY_MASK			GENMASK(8, 4)
589026e0d1SMaxime Ripard #define SUN4I_TCON0_CTL_CLK_DELAY(delay)		((delay << 4) & SUN4I_TCON0_CTL_CLK_DELAY_MASK)
5927e18de7SChen-Yu Tsai #define SUN4I_TCON0_CTL_SRC_SEL_MASK			GENMASK(2, 0)
609026e0d1SMaxime Ripard 
619026e0d1SMaxime Ripard #define SUN4I_TCON0_DCLK_REG			0x44
629026e0d1SMaxime Ripard #define SUN4I_TCON0_DCLK_GATE_BIT			(31)
639026e0d1SMaxime Ripard #define SUN4I_TCON0_DCLK_DIV_SHIFT			(0)
649026e0d1SMaxime Ripard #define SUN4I_TCON0_DCLK_DIV_WIDTH			(7)
659026e0d1SMaxime Ripard 
669026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC0_REG			0x48
679026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC0_X(width)			((((width) - 1) & 0xfff) << 16)
689026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC0_Y(height)			(((height) - 1) & 0xfff)
699026e0d1SMaxime Ripard 
709026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC1_REG			0x4c
719026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC1_H_TOTAL(total)		((((total) - 1) & 0x1fff) << 16)
729026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC1_H_BACKPORCH(bp)		(((bp) - 1) & 0xfff)
739026e0d1SMaxime Ripard 
749026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC2_REG			0x50
75a88cbbd4SMaxime Ripard #define SUN4I_TCON0_BASIC2_V_TOTAL(total)		(((total) & 0x1fff) << 16)
769026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC2_V_BACKPORCH(bp)		(((bp) - 1) & 0xfff)
779026e0d1SMaxime Ripard 
789026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC3_REG			0x54
799026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC3_H_SYNC(width)		((((width) - 1) & 0x7ff) << 16)
809026e0d1SMaxime Ripard #define SUN4I_TCON0_BASIC3_V_SYNC(height)		(((height) - 1) & 0x7ff)
819026e0d1SMaxime Ripard 
829026e0d1SMaxime Ripard #define SUN4I_TCON0_HV_IF_REG			0x58
83*a08fc7c8SMaxime Ripard 
849026e0d1SMaxime Ripard #define SUN4I_TCON0_CPU_IF_REG			0x60
85*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_IF_MODE_MASK			GENMASK(31, 28)
86*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_IF_MODE_DSI			(1 << 28)
87*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_IF_TRI_FIFO_FLUSH		BIT(16)
88*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_IF_TRI_FIFO_EN			BIT(2)
89*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_IF_TRI_EN			BIT(0)
90*a08fc7c8SMaxime Ripard 
919026e0d1SMaxime Ripard #define SUN4I_TCON0_CPU_WR_REG			0x64
929026e0d1SMaxime Ripard #define SUN4I_TCON0_CPU_RD0_REG			0x68
939026e0d1SMaxime Ripard #define SUN4I_TCON0_CPU_RDA_REG			0x6c
949026e0d1SMaxime Ripard #define SUN4I_TCON0_TTL0_REG			0x70
959026e0d1SMaxime Ripard #define SUN4I_TCON0_TTL1_REG			0x74
969026e0d1SMaxime Ripard #define SUN4I_TCON0_TTL2_REG			0x78
979026e0d1SMaxime Ripard #define SUN4I_TCON0_TTL3_REG			0x7c
989026e0d1SMaxime Ripard #define SUN4I_TCON0_TTL4_REG			0x80
99a0c1214eSMaxime Ripard 
1009026e0d1SMaxime Ripard #define SUN4I_TCON0_LVDS_IF_REG			0x84
101a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_EN				BIT(31)
102a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_BITWIDTH_MASK		BIT(26)
103a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_BITWIDTH_18BITS		(1 << 26)
104a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_BITWIDTH_24BITS		(0 << 26)
105a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_CLK_SEL_MASK		BIT(20)
106a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_CLK_SEL_TCON0		(1 << 20)
107a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_CLK_POL_MASK		BIT(4)
108a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_CLK_POL_NORMAL		(1 << 4)
109a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_CLK_POL_INV			(0 << 4)
110a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_DATA_POL_MASK		GENMASK(3, 0)
111a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_DATA_POL_NORMAL		(0xf)
112a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_IF_DATA_POL_INV		(0)
113a0c1214eSMaxime Ripard 
1149026e0d1SMaxime Ripard #define SUN4I_TCON0_IO_POL_REG			0x88
1159026e0d1SMaxime Ripard #define SUN4I_TCON0_IO_POL_DCLK_PHASE(phase)		((phase & 3) << 28)
1169026e0d1SMaxime Ripard #define SUN4I_TCON0_IO_POL_HSYNC_POSITIVE		BIT(25)
1179026e0d1SMaxime Ripard #define SUN4I_TCON0_IO_POL_VSYNC_POSITIVE		BIT(24)
1189026e0d1SMaxime Ripard 
1199026e0d1SMaxime Ripard #define SUN4I_TCON0_IO_TRI_REG			0x8c
1209026e0d1SMaxime Ripard #define SUN4I_TCON0_IO_TRI_HSYNC_DISABLE		BIT(25)
1219026e0d1SMaxime Ripard #define SUN4I_TCON0_IO_TRI_VSYNC_DISABLE		BIT(24)
1229026e0d1SMaxime Ripard #define SUN4I_TCON0_IO_TRI_DATA_PINS_DISABLE(pins)	GENMASK(pins, 0)
1239026e0d1SMaxime Ripard 
1249026e0d1SMaxime Ripard #define SUN4I_TCON1_CTL_REG			0x90
1259026e0d1SMaxime Ripard #define SUN4I_TCON1_CTL_TCON_ENABLE			BIT(31)
1269026e0d1SMaxime Ripard #define SUN4I_TCON1_CTL_INTERLACE_ENABLE		BIT(20)
1279026e0d1SMaxime Ripard #define SUN4I_TCON1_CTL_CLK_DELAY_MASK			GENMASK(8, 4)
1289026e0d1SMaxime Ripard #define SUN4I_TCON1_CTL_CLK_DELAY(delay)		((delay << 4) & SUN4I_TCON1_CTL_CLK_DELAY_MASK)
12927e18de7SChen-Yu Tsai #define SUN4I_TCON1_CTL_SRC_SEL_MASK			GENMASK(1, 0)
1309026e0d1SMaxime Ripard 
1319026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC0_REG			0x94
1329026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC0_X(width)			((((width) - 1) & 0xfff) << 16)
1339026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC0_Y(height)			(((height) - 1) & 0xfff)
1349026e0d1SMaxime Ripard 
1359026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC1_REG			0x98
1369026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC1_X(width)			((((width) - 1) & 0xfff) << 16)
1379026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC1_Y(height)			(((height) - 1) & 0xfff)
1389026e0d1SMaxime Ripard 
1399026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC2_REG			0x9c
1409026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC2_X(width)			((((width) - 1) & 0xfff) << 16)
1419026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC2_Y(height)			(((height) - 1) & 0xfff)
1429026e0d1SMaxime Ripard 
1439026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC3_REG			0xa0
1449026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC3_H_TOTAL(total)		((((total) - 1) & 0x1fff) << 16)
1459026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC3_H_BACKPORCH(bp)		(((bp) - 1) & 0xfff)
1469026e0d1SMaxime Ripard 
1479026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC4_REG			0xa4
1489026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC4_V_TOTAL(total)		(((total) & 0x1fff) << 16)
1499026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC4_V_BACKPORCH(bp)		(((bp) - 1) & 0xfff)
1509026e0d1SMaxime Ripard 
1519026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC5_REG			0xa8
1529026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC5_H_SYNC(width)		((((width) - 1) & 0x3ff) << 16)
1539026e0d1SMaxime Ripard #define SUN4I_TCON1_BASIC5_V_SYNC(height)		(((height) - 1) & 0x3ff)
1549026e0d1SMaxime Ripard 
1559026e0d1SMaxime Ripard #define SUN4I_TCON1_IO_POL_REG			0xf0
1569026e0d1SMaxime Ripard #define SUN4I_TCON1_IO_TRI_REG			0xf4
157*a08fc7c8SMaxime Ripard 
158*a08fc7c8SMaxime Ripard #define SUN4I_TCON_ECC_FIFO_REG			0xf8
159*a08fc7c8SMaxime Ripard #define SUN4I_TCON_ECC_FIFO_EN				BIT(3)
160*a08fc7c8SMaxime Ripard 
1619026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_CTL_REG			0x100
1629026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_MUL_RR_REG		0x110
1639026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_MUL_RG_REG		0x114
1649026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_MUL_RB_REG		0x118
1659026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_ADD_RC_REG		0x11c
1669026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_MUL_GR_REG		0x120
1679026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_MUL_GG_REG		0x124
1689026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_MUL_GB_REG		0x128
1699026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_ADD_GC_REG		0x12c
1709026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_MUL_BR_REG		0x130
1719026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_MUL_BG_REG		0x134
1729026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_MUL_BB_REG		0x138
1739026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_ADD_BC_REG		0x13c
1749026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_RANGE_R_REG		0x140
1759026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_RANGE_G_REG		0x144
1769026e0d1SMaxime Ripard #define SUN4I_TCON_CEU_RANGE_B_REG		0x148
177*a08fc7c8SMaxime Ripard 
178*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_TRI0_REG		0x160
179*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_TRI0_BLOCK_SPACE(space)		((((space) - 1) & 0xfff) << 16)
180*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_TRI0_BLOCK_SIZE(size)		(((size) - 1) & 0xfff)
181*a08fc7c8SMaxime Ripard 
182*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_TRI1_REG		0x164
183*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_TRI1_BLOCK_NUM(num)		(((num) - 1) & 0xffff)
184*a08fc7c8SMaxime Ripard 
185*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_TRI2_REG		0x168
186*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_TRI2_START_DELAY(delay)		(((delay) & 0xffff) << 16)
187*a08fc7c8SMaxime Ripard #define SUN4I_TCON0_CPU_TRI2_TRANS_START_SET(set)	((set) & 0xfff)
188*a08fc7c8SMaxime Ripard 
189*a08fc7c8SMaxime Ripard #define SUN4I_TCON_SAFE_PERIOD_REG		0x1f0
190*a08fc7c8SMaxime Ripard #define SUN4I_TCON_SAFE_PERIOD_NUM(num)			(((num) & 0xfff) << 16)
191*a08fc7c8SMaxime Ripard #define SUN4I_TCON_SAFE_PERIOD_MODE(mode)		((mode) & 0x3)
192*a08fc7c8SMaxime Ripard 
1939026e0d1SMaxime Ripard #define SUN4I_TCON_MUX_CTRL_REG			0x200
194a0c1214eSMaxime Ripard 
195a0c1214eSMaxime Ripard #define SUN4I_TCON0_LVDS_ANA0_REG		0x220
196a0c1214eSMaxime Ripard #define SUN6I_TCON0_LVDS_ANA0_EN_MB			BIT(31)
197a0c1214eSMaxime Ripard #define SUN6I_TCON0_LVDS_ANA0_EN_LDO			BIT(30)
198a0c1214eSMaxime Ripard #define SUN6I_TCON0_LVDS_ANA0_EN_DRVC			BIT(24)
199a0c1214eSMaxime Ripard #define SUN6I_TCON0_LVDS_ANA0_EN_DRVD(x)		(((x) & 0xf) << 20)
200a0c1214eSMaxime Ripard #define SUN6I_TCON0_LVDS_ANA0_C(x)			(((x) & 3) << 17)
201a0c1214eSMaxime Ripard #define SUN6I_TCON0_LVDS_ANA0_V(x)			(((x) & 3) << 8)
202a0c1214eSMaxime Ripard #define SUN6I_TCON0_LVDS_ANA0_PD(x)			(((x) & 3) << 4)
203a0c1214eSMaxime Ripard 
2049026e0d1SMaxime Ripard #define SUN4I_TCON1_FILL_CTL_REG		0x300
2059026e0d1SMaxime Ripard #define SUN4I_TCON1_FILL_BEG0_REG		0x304
2069026e0d1SMaxime Ripard #define SUN4I_TCON1_FILL_END0_REG		0x308
2079026e0d1SMaxime Ripard #define SUN4I_TCON1_FILL_DATA0_REG		0x30c
2089026e0d1SMaxime Ripard #define SUN4I_TCON1_FILL_BEG1_REG		0x310
2099026e0d1SMaxime Ripard #define SUN4I_TCON1_FILL_END1_REG		0x314
2109026e0d1SMaxime Ripard #define SUN4I_TCON1_FILL_DATA1_REG		0x318
2119026e0d1SMaxime Ripard #define SUN4I_TCON1_FILL_BEG2_REG		0x31c
2129026e0d1SMaxime Ripard #define SUN4I_TCON1_FILL_END2_REG		0x320
2139026e0d1SMaxime Ripard #define SUN4I_TCON1_FILL_DATA2_REG		0x324
2149026e0d1SMaxime Ripard #define SUN4I_TCON1_GAMMA_TABLE_REG		0x400
2159026e0d1SMaxime Ripard 
2169026e0d1SMaxime Ripard #define SUN4I_TCON_MAX_CHANNELS		2
2179026e0d1SMaxime Ripard 
218ad537fb2SChen-Yu Tsai struct sun4i_tcon;
219ad537fb2SChen-Yu Tsai 
22091ea2f29SChen-Yu Tsai struct sun4i_tcon_quirks {
22134d698f6SJernej Skrabec 	bool	has_channel_0;	/* a83t does not have channel 0 on second TCON */
22291ea2f29SChen-Yu Tsai 	bool	has_channel_1;	/* a33 does not have channel 1 */
223a0c1214eSMaxime Ripard 	bool	has_lvds_alt;	/* Does the LVDS clock have a parent other than the TCON clock? */
22427e18de7SChen-Yu Tsai 	bool	needs_de_be_mux; /* sun6i needs mux to select backend */
2256664e9dcSChen-Yu Tsai 	bool    needs_edp_reset; /* a80 edp reset needed for tcon0 access */
226e742a17cSMaxime Ripard 	bool	supports_lvds;   /* Does the TCON support an LVDS output? */
227ad537fb2SChen-Yu Tsai 
228ad537fb2SChen-Yu Tsai 	/* callback to handle tcon muxing options */
229abcb8766SMaxime Ripard 	int	(*set_mux)(struct sun4i_tcon *, const struct drm_encoder *);
23091ea2f29SChen-Yu Tsai };
23191ea2f29SChen-Yu Tsai 
2329026e0d1SMaxime Ripard struct sun4i_tcon {
233ae558110SMaxime Ripard 	struct device			*dev;
2349026e0d1SMaxime Ripard 	struct drm_device		*drm;
2359026e0d1SMaxime Ripard 	struct regmap			*regs;
2369026e0d1SMaxime Ripard 
2379026e0d1SMaxime Ripard 	/* Main bus clock */
2389026e0d1SMaxime Ripard 	struct clk			*clk;
2399026e0d1SMaxime Ripard 
2409026e0d1SMaxime Ripard 	/* Clocks for the TCON channels */
2419026e0d1SMaxime Ripard 	struct clk			*sclk0;
2429026e0d1SMaxime Ripard 	struct clk			*sclk1;
2439026e0d1SMaxime Ripard 
244a0c1214eSMaxime Ripard 	/* Possible mux for the LVDS clock */
245a0c1214eSMaxime Ripard 	struct clk			*lvds_pll;
246a0c1214eSMaxime Ripard 
2479026e0d1SMaxime Ripard 	/* Pixel clock */
2489026e0d1SMaxime Ripard 	struct clk			*dclk;
249ec08d596SMaxime Ripard 	u8				dclk_max_div;
250ec08d596SMaxime Ripard 	u8				dclk_min_div;
2519026e0d1SMaxime Ripard 
2529026e0d1SMaxime Ripard 	/* Reset control */
2539026e0d1SMaxime Ripard 	struct reset_control		*lcd_rst;
254a0c1214eSMaxime Ripard 	struct reset_control		*lvds_rst;
2559026e0d1SMaxime Ripard 
25629e57fabSMaxime Ripard 	struct drm_panel		*panel;
2578e924047SMaxime Ripard 
25891ea2f29SChen-Yu Tsai 	/* Platform adjustments */
25991ea2f29SChen-Yu Tsai 	const struct sun4i_tcon_quirks	*quirks;
26046cce6daSChen-Yu Tsai 
26146cce6daSChen-Yu Tsai 	/* Associated crtc */
26246cce6daSChen-Yu Tsai 	struct sun4i_crtc		*crtc;
26380a58240SChen-Yu Tsai 
264d281c862SChen-Yu Tsai 	int				id;
265d281c862SChen-Yu Tsai 
26680a58240SChen-Yu Tsai 	/* TCON list management */
26780a58240SChen-Yu Tsai 	struct list_head		list;
2689026e0d1SMaxime Ripard };
2699026e0d1SMaxime Ripard 
270894f5a9fSMaxime Ripard struct drm_bridge *sun4i_tcon_find_bridge(struct device_node *node);
271a8444c7eSMaxime Ripard struct drm_panel *sun4i_tcon_find_panel(struct device_node *node);
272a8444c7eSMaxime Ripard 
2739026e0d1SMaxime Ripard void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable);
2745b8f0910SMaxime Ripard void sun4i_tcon_mode_set(struct sun4i_tcon *tcon,
2755b8f0910SMaxime Ripard 			 const struct drm_encoder *encoder,
2765b8f0910SMaxime Ripard 			 const struct drm_display_mode *mode);
27745e88f99SMaxime Ripard void sun4i_tcon_set_status(struct sun4i_tcon *crtc,
27845e88f99SMaxime Ripard 			   const struct drm_encoder *encoder, bool enable);
2799026e0d1SMaxime Ripard 
280ff71c2cfSChen-Yu Tsai extern const struct of_device_id sun4i_tcon_of_table[];
281ff71c2cfSChen-Yu Tsai 
2829026e0d1SMaxime Ripard #endif /* __SUN4I_TCON_H__ */
283