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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
/*
* This file is part of the coreboot project.
*
* Copyright 2013 Google Inc.
* Copyright (C) 2012 Samsung Electronics
*
* 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; version 2 of the License.
*
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Header file for Samsung DP (Display Port) interface driver. */
#ifndef CPU_SAMSUNG_EXYNOS5250_DP_CORE_H
#define CPU_SAMSUNG_EXYNOS5250_DP_CORE_H
#define STREAM_ON_TIMEOUT 100
#define PLL_LOCK_TIMEOUT 10
#define DP_INIT_TRIES 10
#define MAX_CR_LOOP 5
#define MAX_EQ_LOOP 4
/* Link tare type */
enum link_rate {
LINK_RATE_1_62GBPS = 0x06,
LINK_RATE_2_70GBPS = 0x0a
};
/* Number of lanes supported */
enum link_lane_count {
LANE_COUNT1 = 1,
LANE_COUNT2 = 2,
LANE_COUNT4 = 4
};
/* Pre emphasis level */
enum pre_emphasis_level {
PRE_EMPHASIS_LEVEL_0,
PRE_EMPHASIS_LEVEL_1,
PRE_EMPHASIS_LEVEL_2,
PRE_EMPHASIS_LEVEL_3,
};
/* Type of color space */
enum color_space {
COLOR_RGB,
COLOR_YCBCR422,
COLOR_YCBCR444
};
/* Video input Bit Per Color */
enum color_depth {
COLOR_6,
COLOR_8,
COLOR_10,
COLOR_12
};
/* Type of YCbCr coefficient */
enum color_coefficient {
COLOR_YCBCR601,
COLOR_YCBCR709
};
/* Color range */
enum dynamic_range {
VESA,
CEA
};
/* Status of PLL clock */
enum pll_status {
PLL_UNLOCKED,
PLL_LOCKED
};
/* To choose type of m_value */
enum clock_recovery_m_value_type {
CALCULATED_M,
REGISTER_M
};
struct video_info {
enum color_space color_space;
enum dynamic_range dynamic_range;
enum color_coefficient ycbcr_coeff;
enum color_depth color_depth;
enum link_rate link_rate;
enum link_lane_count lane_count;
char *name;
unsigned int h_sync_polarity:1;
unsigned int v_sync_polarity:1;
unsigned int interlaced:1;
};
struct link_train {
u8 link_rate;
u8 lane_count;
};
struct s5p_dp_device {
unsigned int irq;
struct exynos5_dp *base;
struct video_info *video_info;
struct link_train link_train;
};
/* this struct is used by mainboards to pass mode info to the driver */
typedef struct vidinfo {
u16 vl_col;
u16 vl_row;
u8 vl_bpix;
u16 *cmap;
} vidinfo_t;
/* s5p_dp_reg.c */
/*
* Reset DP module
*
* param dp pointer to main s5p-dp structure
*/
void s5p_dp_reset(struct s5p_dp_device *dp);
/*
* Initialize DP to recieve video stream
*
* param dp pointer to main s5p-dp structure
*/
void s5p_dp_init_video(struct s5p_dp_device *dp);
/*
* Check whether PLL is locked
*
* param dp pointer to main s5p-dp structure
* return Lock status
*/
unsigned int s5p_dp_get_pll_lock_status(struct s5p_dp_device *dp);
/*
* Initialize analog functions of DP
*
* param dp pointer to main s5p-dp structure
* return 0 on success
*/
int s5p_dp_init_analog_func(struct s5p_dp_device *dp);
/*
* Initialize DP for AUX transaction
*
* param dp pointer to main s5p-dp structure
*/
void s5p_dp_init_aux(struct s5p_dp_device *dp);
/*
* Start an AUX transaction.
*
* param dp pointer to main s5p-dp structure
*/
int s5p_dp_start_aux_transaction(struct s5p_dp_device *dp);
/*
* Write a byte to DPCD register
*
* param dp pointer to main s5p-dp structure
* param reg_addr DPCD register to be written
* param data byte data to be written
* return write status
*/
int s5p_dp_write_byte_to_dpcd(struct s5p_dp_device *dp,
unsigned int reg_addr,
unsigned char data);
/*
* Read a byte from DPCD register
*
* param dp pointer to main s5p-dp structure
* param reg_addr DPCD register to read
* param data read byte data
* return read status
*/
int s5p_dp_read_byte_from_dpcd(struct s5p_dp_device *dp,
unsigned int reg_addr,
unsigned char *data);
/*
* Initialize DP video functions
*
* param dp pointer to main s5p-dp structure
*/
//void s5p_dp_init_video(struct s5p_dp_device *dp);
/*
* Set color parameters for display
*
* param dp pointer to main s5p-dp structure
* param color_depth Video input Bit Per Color
* param color_space Colorimetric format of input video
* param dynamic_range VESA range or CEA range
* param coeff YCbCr Coefficients of input video
*/
void s5p_dp_set_video_color_format(struct s5p_dp_device *dp,
unsigned int color_depth,
unsigned int color_space,
unsigned int dynamic_range,
unsigned int coeff);
/*
* Check whether video clock is on
*
* param dp pointer to main s5p-dp structure
* return clock status
*/
int s5p_dp_is_slave_video_stream_clock_on(struct s5p_dp_device *dp);
/*
* Check whether video clock is on
*
* param dp pointer to main s5p-dp structure
* param type clock_recovery_m_value_type
* param m_value to caluculate m_vid value
* param n_value to caluculate n_vid value
*/
void s5p_dp_set_video_cr_mn(struct s5p_dp_device *dp,
enum clock_recovery_m_value_type type,
unsigned int m_value,
unsigned int n_value);
/*
* Set DP to video slave mode thereby enabling video master
*
* param dp pointer to main s5p-dp structure
*/
void s5p_dp_enable_video_master(struct s5p_dp_device *dp);
/*
* Check whether video stream is on
*
* param dp pointer to main s5p-dp structure
* return video stream status
*/
int s5p_dp_is_video_stream_on(struct s5p_dp_device *dp);
/*
* Configure DP in slave mode
*
* param dp pointer to main s5p-dp structure
* param video_info pointer to main video_info structure.
*/
void s5p_dp_config_video_slave_mode(struct s5p_dp_device *dp,
struct video_info *video_info);
/*
* Wait unitl HW link training done
*
* param dp pointer to main s5p-dp structure
*/
void s5p_dp_wait_hw_link_training_done(struct s5p_dp_device *dp);
/* startup and init */
struct exynos5_fimd_panel;
void fb_init(vidinfo_t *panel_info, void *lcdbase,
struct exynos5_fimd_panel *pd);
int dp_controller_init(struct s5p_dp_device *dp_device);
int lcd_ctrl_init(vidinfo_t *panel_info,
struct exynos5_fimd_panel *panel_data, void *lcdbase);
#endif /* CPU_SAMSUNG_EXYNOS5250_DP_CORE_H */
|