summaryrefslogtreecommitdiff
path: root/arch/arm/plat-mxc/include/mach/mipi_dsi.h
blob: 0dd1f0830dd0345bcede6228caee5d9b3063e589 (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*
 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef __INCLUDE_MIPI_DSI_H
#define __INCLUDE_MIPI_DSI_H

#define     MIPI_DSI_VERSION		(0x000)
#define     MIPI_DSI_PWR_UP		(0x004)
#define     MIPI_DSI_CLKMGR_CFG		(0x008)
#define     MIPI_DSI_DPI_CFG		(0x00c)
#define     MIPI_DSI_DBI_CFG		(0x010)
#define     MIPI_DSI_DBIS_CMDSIZE	(0x014)
#define     MIPI_DSI_PCKHDL_CFG		(0x018)
#define     MIPI_DSI_VID_MODE_CFG	(0x01c)
#define     MIPI_DSI_VID_PKT_CFG	(0x020)
#define     MIPI_DSI_CMD_MODE_CFG	(0x024)
#define     MIPI_DSI_TMR_LINE_CFG	(0x028)
#define     MIPI_DSI_VTIMING_CFG	(0x02c)
#define     MIPI_DSI_PHY_TMR_CFG	(0x030)
#define     MIPI_DSI_GEN_HDR		(0x034)
#define     MIPI_DSI_GEN_PLD_DATA	(0x038)
#define     MIPI_DSI_CMD_PKT_STATUS	(0x03c)
#define     MIPI_DSI_TO_CNT_CFG		(0x040)
#define     MIPI_DSI_ERROR_ST0		(0x044)
#define     MIPI_DSI_ERROR_ST1		(0x048)
#define     MIPI_DSI_ERROR_MSK0		(0x04c)
#define     MIPI_DSI_ERROR_MSK1		(0x050)
#define     MIPI_DSI_PHY_RSTZ		(0x054)
#define     MIPI_DSI_PHY_IF_CFG		(0x058)
#define     MIPI_DSI_PHY_IF_CTRL	(0x05c)
#define     MIPI_DSI_PHY_STATUS		(0x060)
#define     MIPI_DSI_PHY_TST_CTRL0	(0x064)
#define     MIPI_DSI_PHY_TST_CTRL1	(0x068)

#define		DSI_PWRUP_RESET					(0x0 << 0)
#define		DSI_PWRUP_POWERUP				(0x1 << 0)

#define		DSI_DPI_CFG_VID_SHIFT				(0)
#define		DSI_DPI_CFG_VID_MASK				(0x3)
#define		DSI_DPI_CFG_COLORCODE_SHIFT			(2)
#define		DSI_DPI_CFG_COLORCODE_MASK			(0x7)
#define		DSI_DPI_CFG_DATAEN_ACT_LOW			(0x1 << 5)
#define		DSI_DPI_CFG_DATAEN_ACT_HIGH			(0x0 << 5)
#define		DSI_DPI_CFG_VSYNC_ACT_LOW			(0x1 << 6)
#define		DSI_DPI_CFG_VSYNC_ACT_HIGH			(0x0 << 6)
#define		DSI_DPI_CFG_HSYNC_ACT_LOW			(0x1 << 7)
#define		DSI_DPI_CFG_HSYNC_ACT_HIGH			(0x0 << 7)
#define		DSI_DPI_CFG_SHUTD_ACT_LOW			(0x1 << 8)
#define		DSI_DPI_CFG_SHUTD_ACT_HIGH			(0x0 << 8)
#define		DSI_DPI_CFG_COLORMODE_ACT_LOW			(0x1 << 9)
#define		DSI_DPI_CFG_COLORMODE_ACT_HIGH			(0x0 << 9)
#define		DSI_DPI_CFG_EN18LOOSELY				(0x1 << 10)

#define		DSI_PCKHDL_CFG_EN_EOTP_TX			(0x1 << 0)
#define		DSI_PCKHDL_CFG_EN_EOTP_RX			(0x1 << 1)
#define		DSI_PCKHDL_CFG_EN_BTA				(0x1 << 2)
#define		DSI_PCKHDL_CFG_EN_ECC_RX			(0x1 << 3)
#define		DSI_PCKHDL_CFG_EN_CRC_RX			(0x1 << 4)
#define		DSI_PCKHDL_CFG_GEN_VID_RX_MASK			(0x3)
#define		DSI_PCKHDL_CFG_GEN_VID_RX_SHIFT			(5)

#define		DSI_VID_MODE_CFG_EN				(0x1 << 0)
#define		DSI_VID_MODE_CFG_EN_BURSTMODE			(0x3 << 1)
#define		DSI_VID_MODE_CFG_TYPE_MASK			(0x3)
#define		DSI_VID_MODE_CFG_TYPE_SHIFT			(1)
#define		DSI_VID_MODE_CFG_EN_LP_VSA			(0x1 << 3)
#define		DSI_VID_MODE_CFG_EN_LP_VBP			(0x1 << 4)
#define		DSI_VID_MODE_CFG_EN_LP_VFP			(0x1 << 5)
#define		DSI_VID_MODE_CFG_EN_LP_VACT			(0x1 << 6)
#define		DSI_VID_MODE_CFG_EN_LP_HBP			(0x1 << 7)
#define		DSI_VID_MODE_CFG_EN_LP_HFP			(0x1 << 8)
#define		DSI_VID_MODE_CFG_EN_MULTI_PKT			(0x1 << 9)
#define		DSI_VID_MODE_CFG_EN_NULL_PKT			(0x1 << 10)
#define		DSI_VID_MODE_CFG_EN_FRAME_ACK			(0x1 << 11)
#define		DSI_VID_MODE_CFG_EN_LP_MODE (DSI_VID_MODE_CFG_EN_LP_VSA | \
						 DSI_VID_MODE_CFG_EN_LP_VBP | \
						 DSI_VID_MODE_CFG_EN_LP_VFP | \
						 DSI_VID_MODE_CFG_EN_LP_HFP | \
						 DSI_VID_MODE_CFG_EN_LP_HBP | \
						 DSI_VID_MODE_CFG_EN_LP_VACT)



#define		DSI_VID_PKT_CFG_VID_PKT_SZ_MASK			(0x7ff)
#define		DSI_VID_PKT_CFG_VID_PKT_SZ_SHIFT		(0)
#define		DSI_VID_PKT_CFG_NUM_CHUNKS_MASK			(0x3ff)
#define		DSI_VID_PKT_CFG_NUM_CHUNKS_SHIFT		(11)
#define		DSI_VID_PKT_CFG_NULL_PKT_SZ_MASK		(0x3ff)
#define		DSI_VID_PKT_CFG_NULL_PKT_SZ_SHIFT		(21)

#define		MIPI_DSI_CMD_MODE_CFG_EN_LOWPOWER		(0x1FFF)
#define		MIPI_DSI_CMD_MODE_CFG_EN_CMD_MODE		(0x1 << 0)

#define		DSI_TME_LINE_CFG_HSA_TIME_MASK			(0x1ff)
#define		DSI_TME_LINE_CFG_HSA_TIME_SHIFT			(0)
#define		DSI_TME_LINE_CFG_HBP_TIME_MASK			(0x1ff)
#define		DSI_TME_LINE_CFG_HBP_TIME_SHIFT			(9)
#define		DSI_TME_LINE_CFG_HLINE_TIME_MASK		(0x3fff)
#define		DSI_TME_LINE_CFG_HLINE_TIME_SHIFT		(18)

#define		DSI_VTIMING_CFG_VSA_LINES_MASK			(0xf)
#define		DSI_VTIMING_CFG_VSA_LINES_SHIFT			(0)
#define		DSI_VTIMING_CFG_VBP_LINES_MASK			(0x3f)
#define		DSI_VTIMING_CFG_VBP_LINES_SHIFT			(4)
#define		DSI_VTIMING_CFG_VFP_LINES_MASK			(0x3f)
#define		DSI_VTIMING_CFG_VFP_LINES_SHIFT			(10)
#define		DSI_VTIMING_CFG_V_ACT_LINES_MASK		(0x7ff)
#define		DSI_VTIMING_CFG_V_ACT_LINES_SHIFT		(16)

#define		DSI_PHY_TMR_CFG_BTA_TIME_MASK			(0xfff)
#define		DSI_PHY_TMR_CFG_BTA_TIME_SHIFT			(0)
#define		DSI_PHY_TMR_CFG_LP2HS_TIME_MASK			(0xff)
#define		DSI_PHY_TMR_CFG_LP2HS_TIME_SHIFT		(12)
#define		DSI_PHY_TMR_CFG_HS2LP_TIME_MASK			(0xff)
#define		DSI_PHY_TMR_CFG_HS2LP_TIME_SHIFT		(20)

#define		DSI_PHY_IF_CFG_N_LANES_MASK			(0x3)
#define		DSI_PHY_IF_CFG_N_LANES_SHIFT			(0)
#define		DSI_PHY_IF_CFG_WAIT_TIME_MASK			(0xff)
#define		DSI_PHY_IF_CFG_WAIT_TIME_SHIFT			(2)

#define		DSI_PHY_RSTZ_EN_CLK				(0x1 << 2)
#define		DSI_PHY_RSTZ_DISABLE_RST			(0x1 << 1)
#define		DSI_PHY_RSTZ_DISABLE_SHUTDOWN			(0x1 << 0)
#define		DSI_PHY_RSTZ_RST				(0x0)

#define		DSI_PHY_STATUS_LOCK				(0x1 << 0)
#define		DSI_PHY_STATUS_STOPSTATE_CLK_LANE		(0x1 << 2)

#define		DSI_GEN_HDR_TYPE_MASK				(0xff)
#define		DSI_GEN_HDR_TYPE_SHIFT				(0)
#define		DSI_GEN_HDR_DATA_MASK				(0xffff)
#define		DSI_GEN_HDR_DATA_SHIFT				(8)

#define		DSI_CMD_PKT_STATUS_GEN_CMD_EMPTY		(0x1 << 0)
#define		DSI_CMD_PKT_STATUS_GEN_CMD_FULL			(0x1 << 1)
#define		DSI_CMD_PKT_STATUS_GEN_PLD_W_EMPTY		(0x1 << 2)
#define		DSI_CMD_PKT_STATUS_GEN_PLD_W_FULL		(0x1 << 3)
#define		DSI_CMD_PKT_STATUS_GEN_PLD_R_EMPTY		(0x1 << 4)
#define		DSI_CMD_PKT_STATUS_GEN_RD_CMD_BUSY		(0x1 << 6)

#define		DSI_ERROR_MSK0_ALL_MASK				(0x1fffff)
#define		DSI_ERROR_MSK1_ALL_MASK				(0x3ffff)

#define		DSI_PHY_IF_CTRL_RESET				(0x0)
#define		DSI_PHY_IF_CTRL_TX_REQ_CLK_HS			(0x1 << 0)
#define		DSI_PHY_IF_CTRL_TX_REQ_CLK_ULPS			(0x1 << 1)
#define		DSI_PHY_IF_CTRL_TX_EXIT_CLK_ULPS		(0x1 << 2)
#define		DSI_PHY_IF_CTRL_TX_REQ_DATA_ULPS		(0x1 << 3)
#define		DSI_PHY_IF_CTRL_TX_EXIT_DATA_ULPS		(0x1 << 4)
#define		DSI_PHY_IF_CTRL_TX_TRIG_MASK			(0xF)
#define		DSI_PHY_IF_CTRL_TX_TRIG_SHIFT			(5)

#define		DSI_PHY_CLK_INIT_COMMAND			(0x44)
#define		DSI_GEN_PLD_DATA_BUF_SIZE			(0x4)
/**
 * struct mipi_dsi_platform_data - MIPI DSI driver platform data.
 *
 * This structure communicates platform-specific information to the MIPI DSI
 * driver that can't be expressed as resources.
 *
 * @ipu_id:	 the id of IPUs on which this MIPI DSI works
 *
 * @disp_id:	 the id of IPU display interfaces
 *
 * @lcd_panel:	 the supported mipi LCD panel string
 *
 * @init:	 A pointer to a function the driver will call to
 *              initialize the platform (e.g., set up the pin mux).
 * @exit:         A pointer to a function the driver will call to
 *                           exit the platform (e.g., free pins).
 * @io_regulator:	 io regulator name for MIPI DSI display module
 *
 * @core_regulator:	 core regulator name for MIPI DSI display module
 *
 * @analog_regulator:	 analog regulator name for MIPI DSI display module
 *
 * @io_volt:	 io regulator voltage for MIPI DSI display module
 *
 * @core_volt:	 core regulator voltage for MIPI DSI display module
 *
 * @analog_volt:	 analog regulator voltage for MIPI DSI display module
 *
 * @reset:		 A pointer to a function the driver will call to
 *                           reset the MIPI DSI display module
 * @lcd_power:		 A pointer to a function the drvier will call to
 *                           configure the power of MIPI LCD panel
 * @backlight_power:         A pointer to a function the drvier will call to
 *                           configure the power of MIPI LCD backlight
 */
struct mipi_dsi_platform_data {
	/* SoC hardware information. */
	int	ipu_id;
	int	disp_id;
	char	*lcd_panel;
	int	(*init)(struct platform_device *);
	void	(*exit)(struct platform_device *);

	/* board related information. */
	char	 *io_regulator;
	char	 *core_regulator;
	char	 *analog_regulator;
	int	io_volt;
	int	core_volt;
	int	analog_volt;
	void	 (*reset) (void);
	void	 (*lcd_power)(int);
	void	 (*backlight_power)(int);
};
#endif