summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm/arch-sunxi/display2.h
blob: b5875f96050df6b3041058fb2f20af48a1afeeb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
 * Sunxi platform display controller register and constant defines
 *
 * (C) Copyright 2017 Jernej Skrabec <jernej.skrabec@siol.net>
 *
 * Based on out of tree Linux DRM driver defines:
 * Copyright (C) 2016 Jean-Francois Moine <moinejf@free.fr>
 * Copyright (c) 2016 Allwinnertech Co., Ltd.
*
 * SPDX-License-Identifier:	GPL-2.0+
 */

#ifndef _SUNXI_DISPLAY2_H
#define _SUNXI_DISPLAY2_H

/* internal clock settings */
struct de_clk {
	u32 gate_cfg;
	u32 bus_cfg;
	u32 rst_cfg;
	u32 div_cfg;
	u32 sel_cfg;
};

/* global control */
struct de_glb {
	u32 ctl;
	u32 status;
	u32 dbuff;
	u32 size;
};

/* alpha blending */
struct de_bld {
	u32 fcolor_ctl;
	struct {
		u32 fcolor;
		u32 insize;
		u32 offset;
		u32 dum;
	} attr[4];
	u32 dum0[15];
	u32 route;
	u32 premultiply;
	u32 bkcolor;
	u32 output_size;
	u32 bld_mode[4];
	u32 dum1[4];
	u32 ck_ctl;
	u32 ck_cfg;
	u32 dum2[2];
	u32 ck_max[4];
	u32 dum3[4];
	u32 ck_min[4];
	u32 dum4[3];
	u32 out_ctl;
};

/* VI channel */
struct de_vi {
	struct {
		u32 attr;
		u32 size;
		u32 coord;
		u32 pitch[3];
		u32 top_laddr[3];
		u32 bot_laddr[3];
	} cfg[4];
	u32 fcolor[4];
	u32 top_haddr[3];
	u32 bot_haddr[3];
	u32 ovl_size[2];
	u32 hori[2];
	u32 vert[2];
};

struct de_ui {
	struct {
		u32 attr;
		u32 size;
		u32 coord;
		u32 pitch;
		u32 top_laddr;
		u32 bot_laddr;
		u32 fcolor;
		u32 dum;
	} cfg[4];
	u32 top_haddr;
	u32 bot_haddr;
	u32 ovl_size;
};

/*
 * DE register constants.
 */
#define SUNXI_DE2_MUX0_BASE			(SUNXI_DE2_BASE + 0x100000)
#define SUNXI_DE2_MUX1_BASE			(SUNXI_DE2_BASE + 0x200000)

#define SUNXI_DE2_MUX_GLB_REGS			0x00000
#define SUNXI_DE2_MUX_BLD_REGS			0x01000
#define SUNXI_DE2_MUX_CHAN_REGS			0x02000
#define SUNXI_DE2_MUX_CHAN_SZ			0x1000
#define SUNXI_DE2_MUX_VSU_REGS			0x20000
#define SUNXI_DE2_MUX_GSU1_REGS			0x30000
#define SUNXI_DE2_MUX_GSU2_REGS			0x40000
#define SUNXI_DE2_MUX_GSU3_REGS			0x50000
#define SUNXI_DE2_MUX_FCE_REGS			0xa0000
#define SUNXI_DE2_MUX_BWS_REGS			0xa2000
#define SUNXI_DE2_MUX_LTI_REGS			0xa4000
#define SUNXI_DE2_MUX_PEAK_REGS			0xa6000
#define SUNXI_DE2_MUX_ASE_REGS			0xa8000
#define SUNXI_DE2_MUX_FCC_REGS			0xaa000
#define SUNXI_DE2_MUX_DCSC_REGS			0xb0000

#define SUNXI_DE2_FORMAT_XRGB_8888		4
#define SUNXI_DE2_FORMAT_RGB_565		10

#define SUNXI_DE2_MUX_GLB_CTL_EN		(1 << 0)
#define SUNXI_DE2_UI_CFG_ATTR_EN		(1 << 0)
#define SUNXI_DE2_UI_CFG_ATTR_FMT(f)		((f & 0xf) << 8)

#define SUNXI_DE2_WH(w, h)			(((h - 1) << 16) | (w - 1))

#endif /* _SUNXI_DISPLAY2_H */