staging: emgd: IVI display configuration
[profile/ivi/intel-emgd-kmod.git] / emgd / drm / user_config.c
1 /*
2  *-----------------------------------------------------------------------------
3  * Filename: user_config.c
4  * $Revision: 1.24 $
5  *-----------------------------------------------------------------------------
6  * Copyright (c) 2002-2010, Intel Corporation.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  *
26  *-----------------------------------------------------------------------------
27  * Description:
28  *  A file that contains the initial display configuration information of the
29  *  EMGD kernel module.  A user can edit this file in order to affect the way
30  *  that the kernel initially configures the displays.  This file is compiled
31  *  into the EMGD kernel module.
32  *-----------------------------------------------------------------------------
33  */
34 #include "user_config.h"
35
36 #warning ****
37 #warning **** This driver has NOT been configured for your system.  You are
38 #warning **** building with a sample user_config.c configuration that may or
39 #warning **** may not meet your needs.  It is recommended that you run CED to
40 #warning **** generate an appropriate configuration or see the User Guide
41 #warning **** for more information about driver configuration.
42 #warning ****
43
44
45 /*
46  * One array of igd_display_info_t structures should exist for each port that
47  * needs to provide a DTD list.  Each igd_display_info_t contains the DTD
48  * information for a given resolution/refresh-rate.  This is especially needed
49  * for analog/VGA ports.
50  */
51
52 /* Crossville 7' */
53 static igd_display_info_t dtd_config1_port4_dtdlist[] = {
54         {
55                 800,    /* Width */
56                 480,    /* Height */
57                 0,      /* Refresh Rate */
58                 31746,  /* Dot Clock */
59                 999,    /* Horizontal Total (horizontal synch end) */
60                 799,    /* Horizontal Blank Start (h_active-1) */
61                 999,    /* Horizontal Blank End (start + h_blank) */
62                 859,    /* Horizontal Sync Start (h_active+h_synch-1) */
63                 999,    /* Horizontal Sync End (start + h_syncp) */
64                 524,    /* Vertical Total (Vertical synch end) */
65                 479,    /* Vertical Blank Start (v_active-1) */
66                 524,    /* Vertical Blank End (start + v_blank) */
67                 507,    /* Vertical Sync Start (v_active+v_synch-1) */
68                 538,    /* Vertical Sync End (start + v_synchp) */
69                 0,      /* Mode Number */
70                 0x8020000,      /* Flags */
71                 0,      /* X Offset */
72                 0,      /* Y Offset */
73                 NULL,   /* pd extension pointer */
74                 0, 0   /* mode extension pointer */
75         },
76 };
77 static igd_param_attr_t attrs_config1_port4[] = {
78         {0x46, 100},
79         {0x1a, 24},
80         {0x47, 20300},
81 };
82
83 /* CrownBay 13' */
84 static igd_display_info_t dtd_config2_port4_dtdlist[] = {
85         {
86                 1366,   /* Width */
87                 768,    /* Height */
88                 60,     /* Refresh Rate */
89                 72300,  /* Dot Clock */
90                 1525,   /* Horizontal Total (horizontal synch end) */
91                 1365,   /* Horizontal Blank Start (h_active-1) */
92                 1525,   /* Horizontal Blank End (start + h_blank) */
93                 1413,   /* Horizontal Sync Start (h_active+h_synch-1) */
94                 1445,   /* Horizontal Sync End (start + h_syncp) */
95                 789,    /* Vertical Total (Vertical synch end) */
96                 767,    /* Vertical Blank Start (v_active-1) */
97                 789,    /* Vertical Blank End (start + v_blank) */
98                 770,    /* Vertical Sync Start (v_active+v_synch-1) */
99                 775,    /* Vertical Sync End (start + v_synchp) */
100                 0,  /* Mode Number */
101                 0x20000,    /* Flags */
102                 0,  /* X Offset */
103                 0,  /* Y Offset */
104                 NULL,   /* pd extension pointer */
105                 0, 0   /* mode extension pointer */
106         },
107 };
108 /* shares attributes with config1 */
109
110 /* NexCom VCT1000 7' */
111 static igd_display_info_t dtd_config3_port4_dtdlist[] = {
112         {
113                 800,    /* Width */
114                 480,    /* Height */
115                 0,      /* Refresh Rate */
116                 31746,  /* Dot Clock */
117                 999,    /* Horizontal Total (horizontal synch end) */
118                 799,    /* Horizontal Blank Start (h_active-1) */
119                 999,    /* Horizontal Blank End (start + h_blank) */
120                 859,    /* Horizontal Sync Start (h_active+h_synch-1) */
121                 999,    /* Horizontal Sync End (start + h_syncp) */
122                 524,    /* Vertical Total (Vertical synch end) */
123                 479,    /* Vertical Blank Start (v_active-1) */
124                 524,    /* Vertical Blank End (start + v_blank) */
125                 507,    /* Vertical Sync Start (v_active+v_synch-1) */
126                 538,    /* Vertical Sync End (start + v_synchp) */
127                 0,      /* Mode Number */
128                 0x8020000,      /* Flags */
129                 0,      /* X Offset */
130                 0,      /* Y Offset */
131                 NULL,   /* pd extension pointer */
132                 0, 0   /* mode extension pointer */
133         },
134 };
135 static igd_param_attr_t attrs_config3_port4[] = {
136         {0x46, 100},
137         {0x1a, 24},
138         {0x47, 20300},
139         {0x31, 1},
140 };
141
142 static emgd_drm_splash_screen_t splash_screen_data = {
143         0x000000,               /* bg_color */
144         0,                      /* x */
145         0,                      /* y */
146         0,                      /* width */
147         0,                      /* height */
148 };
149
150 static emgd_drm_splash_video_t splash_video_data = {
151         0,                      /* offset */
152         0,                      /* pixel_format */
153         0,                      /* src_width */
154         0,                      /* src_height */
155         0,                      /* src_pitch */
156         0,                      /* dst_x */
157         0,                      /* dst_y */
158         0,                      /* dst_width */
159         0,                      /* dst_height */
160 };
161
162 /* Config #1: Crossville 7' */
163 static igd_param_t config_params_config1 = {
164         1*256*1024,             /* Page request */
165         0,              /* Max frame buffer size */
166         1,              /* Preserve registers */
167         0x6,            /* Display flags */
168         { 4, 0, 0, 0, 0 },              /* Display port order */
169         {               /* Display Params */
170                 {               /* Port */
171                         4,              /* Display port number */
172                         0x180,          /* Parameters present */
173                         0x0,            /* EDID flag */
174                         0x0,            /* Flags when EDID is available */
175                         0x4,            /* Flags when EDID is not available */
176                         0,              /* DDC GPIO pins */
177                         0,              /* DDC speed */
178                         0,              /* DDC DAB */
179                         0,              /* I2C GPIO pins */
180                         0,              /* I2C speed */
181                         0,              /* I2C DAB */
182                         {               /* Flat Panel Info */
183                                 0,              /* Flat Panel width */
184                                 0,              /* Flat Panel height */
185                                 0,              /* Flat Panel power method */
186                                 0,              /* VDD active & DVO clock/data active */
187                                 0,              /* DVO clock/data active & backlight enable */
188                                 0,              /* backlight disable & DVO clock/data inactive */
189                                 0,              /* DVO clock/data inactive & VDD inactive */
190                                 0                       /* VDD inactive & VDD active */
191                         },
192                         {               /* DTD Info */
193                                 sizeof(dtd_config1_port4_dtdlist)/sizeof(igd_display_info_t),           /* Number of DTDs */
194                                 dtd_config1_port4_dtdlist               /* DTD name */
195                         },
196                         {               /* Attribute Info */
197                                 sizeof(attrs_config1_port4)/sizeof(igd_param_attr_t),           /* Number of attributes */
198                                 attrs_config1_port4             /* Attr name */
199                         }
200                 },
201                 {               /* Port */
202                         2,              /* Display port number */
203                         0x0,            /* Parameters present */
204                         0x0,            /* EDID flag */
205                         0x5,            /* Flags when EDID is available */
206                         0x5,            /* Flags when EDID is not available */
207                         0,              /* DDC GPIO pins */
208                         0,              /* DDC speed */
209                         0,              /* DDC DAB */
210                         0,              /* I2C GPIO pins */
211                         0,              /* I2C speed */
212                         0,              /* I2C DAB */
213                         {               /* Flat Panel Info */
214                                 0,              /* Flat Panel width */
215                                 0,              /* Flat Panel height */
216                                 0,              /* Flat Panel power method */
217                                 0,              /* VDD active & DVO clock/data active */
218                                 0,              /* DVO clock/data active & backlight enable */
219                                 0,              /* backlight disable & DVO clock/data inactive */
220                                 0,              /* DVO clock/data inactive & VDD inactive */
221                                 0                       /* VDD inactive & VDD active */
222                         },
223                         {               /* DTD Info */
224                         0, NULL
225                         },
226                         {               /* Attribute Info */
227                         0, NULL
228                         }
229                 },
230         },
231         0,                      /* 24-bit RGB color that framebuffer is cleared to */
232         1,                      /* Quickboot (1 = enabled) */
233         0,                      /* Quickboot seamless (1 = enabled) */
234         0,                      /* Quickboot video input (1 = enabled) */
235         0                       /* Polling (1 = override interrupt support and use polling) */
236 };
237
238 /* Config #2: CrownBay 13' */
239 static igd_param_t config_params_config2 = {
240         1*256*1024,             /* Page request */
241         0,              /* Max frame buffer size */
242         1,              /* Preserve registers */
243         0x6,            /* Display flags */
244         { 4, 0, 0, 0, 0 },              /* Display port order */
245         {               /* Display Params */
246                 {               /* Port */
247                         4,              /* Display port number */
248                         0x80,           /* Parameters present */
249                         0x0,            /* EDID flag */
250                         0x5,            /* Flags when EDID is available */
251                         0x5,            /* Flags when EDID is not available */
252                         0,              /* DDC GPIO pins */
253                         0,              /* DDC speed */
254                         0,              /* DDC DAB */
255                         0,              /* I2C GPIO pins */
256                         0,              /* I2C speed */
257                         0,              /* I2C DAB */
258                         {               /* Flat Panel Info */
259                                 0,              /* Flat Panel width */
260                                 0,              /* Flat Panel height */
261                                 0,              /* Flat Panel power method */
262                                 0,              /* VDD active & DVO clock/data active */
263                                 0,              /* DVO clock/data active & backlight enable */
264                                 0,              /* backlight disable & DVO clock/data inactive */
265                                 0,              /* DVO clock/data inactive & VDD inactive */
266                                 0                       /* VDD inactive & VDD active */
267                         },
268                         {               /* DTD Info */
269                                 sizeof(dtd_config2_port4_dtdlist)/sizeof(igd_display_info_t),           /* Number of DTDs */
270                                 dtd_config2_port4_dtdlist               /* DTD name */
271                         },
272                         {               /* Attribute Info */
273                                 sizeof(attrs_config1_port4)/sizeof(igd_param_attr_t),           /* Number of attributes */
274                                 attrs_config1_port4             /* Attr name */
275                         }
276                 },
277                 {               /* Port */
278                         2,              /* Display port number */
279                         0x0,            /* Parameters present */
280                         0x0,            /* EDID flag */
281                         0x5,            /* Flags when EDID is available */
282                         0x5,            /* Flags when EDID is not available */
283                         0,              /* DDC GPIO pins */
284                         0,              /* DDC speed */
285                         0,              /* DDC DAB */
286                         0,              /* I2C GPIO pins */
287                         0,              /* I2C speed */
288                         0,              /* I2C DAB */
289                         {               /* Flat Panel Info */
290                                 0,              /* Flat Panel width */
291                                 0,              /* Flat Panel height */
292                                 0,              /* Flat Panel power method */
293                                 0,              /* VDD active & DVO clock/data active */
294                                 0,              /* DVO clock/data active & backlight enable */
295                                 0,              /* backlight disable & DVO clock/data inactive */
296                                 0,              /* DVO clock/data inactive & VDD inactive */
297                                 0                       /* VDD inactive & VDD active */
298                         },
299                         {               /* DTD Info */
300                         0, NULL
301                         },
302                         {               /* Attribute Info */
303                         0, NULL
304                         }
305                 },
306         },
307         0,                      /* 24-bit RGB color that framebuffer is cleared to */
308         1,                      /* Quickboot (1 = enabled) */
309         0,                      /* Quickboot seamless (1 = enabled) */
310         0,                      /* Quickboot video input (1 = enabled) */
311         0                       /* Polling (1 = override interrupt support and use polling) */
312 };
313
314 /* Config #3: NexCom VCT1000 7' */
315 static igd_param_t config_params_config3 = {
316         1*256*1024,             /* Page request */
317         0,              /* Max frame buffer size */
318         1,              /* Preserve registers */
319         0x6,            /* Display flags */
320         { 4, 0, 0, 0, 0 },              /* Display port order */
321         {               /* Display Params */
322                 {               /* Port */
323                         4,              /* Display port number */
324                         0x180,          /* Parameters present */
325                         0x0,            /* EDID flag */
326                         0x0,            /* Flags when EDID is available */
327                         0x4,            /* Flags when EDID is not available */
328                         0,              /* DDC GPIO pins */
329                         0,              /* DDC speed */
330                         0,              /* DDC DAB */
331                         0,              /* I2C GPIO pins */
332                         0,              /* I2C speed */
333                         0,              /* I2C DAB */
334                         {               /* Flat Panel Info */
335                                 0,              /* Flat Panel width */
336                                 0,              /* Flat Panel height */
337                                 0,              /* Flat Panel power method */
338                                 0,              /* VDD active & DVO clock/data active */
339                                 0,              /* DVO clock/data active & backlight enable */
340                                 0,              /* backlight disable & DVO clock/data inactive */
341                                 0,              /* DVO clock/data inactive & VDD inactive */
342                                 0                       /* VDD inactive & VDD active */
343                         },
344                         {               /* DTD Info */
345                                 sizeof(dtd_config3_port4_dtdlist)/sizeof(igd_display_info_t),           /* Number of DTDs */
346                                 dtd_config3_port4_dtdlist               /* DTD name */
347                         },
348                         {               /* Attribute Info */
349                                 sizeof(attrs_config3_port4)/sizeof(igd_param_attr_t),           /* Number of attributes */
350                                 attrs_config3_port4             /* Attr name */
351                         }
352                 },
353                 {               /* Port */
354                         2,              /* Display port number */
355                         0x0,            /* Parameters present */
356                         0x0,            /* EDID flag */
357                         0x5,            /* Flags when EDID is available */
358                         0x5,            /* Flags when EDID is not available */
359                         0,              /* DDC GPIO pins */
360                         0,              /* DDC speed */
361                         0,              /* DDC DAB */
362                         0,              /* I2C GPIO pins */
363                         0,              /* I2C speed */
364                         0,              /* I2C DAB */
365                         {               /* Flat Panel Info */
366                                 0,              /* Flat Panel width */
367                                 0,              /* Flat Panel height */
368                                 0,              /* Flat Panel power method */
369                                 0,              /* VDD active & DVO clock/data active */
370                                 0,              /* DVO clock/data active & backlight enable */
371                                 0,              /* backlight disable & DVO clock/data inactive */
372                                 0,              /* DVO clock/data inactive & VDD inactive */
373                                 0                       /* VDD inactive & VDD active */
374                         },
375                         {               /* DTD Info */
376                         0, NULL
377                         },
378                         {               /* Attribute Info */
379                         0, NULL
380                         }
381                 },
382         },
383         0,                      /* 24-bit RGB color that framebuffer is cleared to */
384         1,                      /* Quickboot (1 = enabled) */
385         0,                      /* Quickboot seamless (1 = enabled) */
386         0,                      /* Quickboot video input (1 = enabled) */
387         0                       /* Polling (1 = override interrupt support and use polling) */
388 };
389
390 /*
391  * The emgd_drm_config_t structure is the main configuration structure
392  * for the EMGD kernel module.
393  */
394 emgd_drm_config_t config_drm = {
395         1,      /* Whether to initialize the display at EMGD module startup time
396                  * (corresponds to the "init" module parameter)
397                  */
398         1,      /* The display configuration to use if initializing the display
399                  * (corresponds to the "init" module parameter), where:
400                  * - 1 = Single port/display
401                  * - 2 = Cloned port/display (e.g. LVDS + CRT with different timings)
402                  * - 4 = Twin ports/displays (e.g. LVDS + CRT with same timings)
403                  *       Note: Twin is NOT CURRENTLY SUPPORTED
404                  * - 8 = Extended displays (e.g. LVDS + CRT displaying different images)
405                  */
406         800,/* Display width to use if initializing the display
407                  * (corresponds to the "width" module parameter)
408                  */
409         480,/* Display height to use if initializing the display
410                  * (corresponds to the "height" module parameter)
411                  */
412         60,     /* Display refresh rate to use if initializing the display
413                  * (corresponds to the "refresh" module parameter)
414                  */
415         1,  /* KMS */
416         0,      /* ovl_brightness */
417         0,      /* ovl_contrast */
418         0,      /* ovl_saturation */
419         0,      /* ovl_gamma_red */
420         0,      /* ovl_gamma_green */
421         0,      /* ovl_gamma_blue */
422         &splash_screen_data,
423         &splash_video_data,
424         {   /* driver parameters from above */
425                 &config_params_config1,
426                 &config_params_config2,
427                 &config_params_config3
428         }
429 };
430
431
432 /* type:  2:crownbay else:crossvile  */
433 void emgd_drm_override_user_config(int configid)
434 {
435    if ( configid == 1 )
436    {
437        /* Crossville 7inch */
438        config_drm.width = 800;
439        config_drm.height = 480;
440    }
441    else if ( configid == 2 )
442    {
443        /* CrownBay 13inch LVDS */
444        config_drm.width = 1366;
445        config_drm.height = 768;
446    }
447    else /* default */
448    {
449        /* NexCom VCT1000 7inch LVDS*/
450        config_drm.width = 800;
451        config_drm.height = 480;
452    }
453    return;
454 }