diff options
Diffstat (limited to 'drivers/video/via/lcd.c')
-rw-r--r-- | drivers/video/via/lcd.c | 83 |
1 files changed, 18 insertions, 65 deletions
diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c index 3425c3969806..64bc7e763103 100644 --- a/drivers/video/via/lcd.c +++ b/drivers/video/via/lcd.c | |||
@@ -26,10 +26,12 @@ | |||
26 | 26 | ||
27 | /* CLE266 Software Power Sequence */ | 27 | /* CLE266 Software Power Sequence */ |
28 | /* {Mask}, {Data}, {Delay} */ | 28 | /* {Mask}, {Data}, {Delay} */ |
29 | int PowerSequenceOn[3][3] = { {0x10, 0x08, 0x06}, {0x10, 0x08, 0x06}, | 29 | static const int PowerSequenceOn[3][3] = { |
30 | {0x19, 0x1FE, 0x01} }; | 30 | {0x10, 0x08, 0x06}, {0x10, 0x08, 0x06}, {0x19, 0x1FE, 0x01} |
31 | int PowerSequenceOff[3][3] = { {0x06, 0x08, 0x10}, {0x00, 0x00, 0x00}, | 31 | }; |
32 | {0xD2, 0x19, 0x01} }; | 32 | static const int PowerSequenceOff[3][3] = { |
33 | {0x06, 0x08, 0x10}, {0x00, 0x00, 0x00}, {0xD2, 0x19, 0x01} | ||
34 | }; | ||
33 | 35 | ||
34 | static struct _lcd_scaling_factor lcd_scaling_factor = { | 36 | static struct _lcd_scaling_factor lcd_scaling_factor = { |
35 | /* LCD Horizontal Scaling Factor Register */ | 37 | /* LCD Horizontal Scaling Factor Register */ |
@@ -95,8 +97,6 @@ void __devinit viafb_init_lcd_size(void) | |||
95 | DEBUG_MSG(KERN_INFO "viafb_init_lcd_size()\n"); | 97 | DEBUG_MSG(KERN_INFO "viafb_init_lcd_size()\n"); |
96 | 98 | ||
97 | fp_id_to_vindex(viafb_lcd_panel_id); | 99 | fp_id_to_vindex(viafb_lcd_panel_id); |
98 | viaparinfo->lvds_setting_info2->lcd_panel_id = | ||
99 | viaparinfo->lvds_setting_info->lcd_panel_id; | ||
100 | viaparinfo->lvds_setting_info2->lcd_panel_hres = | 100 | viaparinfo->lvds_setting_info2->lcd_panel_hres = |
101 | viaparinfo->lvds_setting_info->lcd_panel_hres; | 101 | viaparinfo->lvds_setting_info->lcd_panel_hres; |
102 | viaparinfo->lvds_setting_info2->lcd_panel_vres = | 102 | viaparinfo->lvds_setting_info2->lcd_panel_vres = |
@@ -203,176 +203,132 @@ static void __devinit fp_id_to_vindex(int panel_id) | |||
203 | case 0x0: | 203 | case 0x0: |
204 | viaparinfo->lvds_setting_info->lcd_panel_hres = 640; | 204 | viaparinfo->lvds_setting_info->lcd_panel_hres = 640; |
205 | viaparinfo->lvds_setting_info->lcd_panel_vres = 480; | 205 | viaparinfo->lvds_setting_info->lcd_panel_vres = 480; |
206 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
207 | LCD_PANEL_ID0_640X480; | ||
208 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 206 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
209 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 207 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
210 | break; | 208 | break; |
211 | case 0x1: | 209 | case 0x1: |
212 | viaparinfo->lvds_setting_info->lcd_panel_hres = 800; | 210 | viaparinfo->lvds_setting_info->lcd_panel_hres = 800; |
213 | viaparinfo->lvds_setting_info->lcd_panel_vres = 600; | 211 | viaparinfo->lvds_setting_info->lcd_panel_vres = 600; |
214 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
215 | LCD_PANEL_ID1_800X600; | ||
216 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 212 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
217 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 213 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
218 | break; | 214 | break; |
219 | case 0x2: | 215 | case 0x2: |
220 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; | 216 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; |
221 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; | 217 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; |
222 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
223 | LCD_PANEL_ID2_1024X768; | ||
224 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 218 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
225 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 219 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
226 | break; | 220 | break; |
227 | case 0x3: | 221 | case 0x3: |
228 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; | 222 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; |
229 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; | 223 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; |
230 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
231 | LCD_PANEL_ID3_1280X768; | ||
232 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 224 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
233 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 225 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
234 | break; | 226 | break; |
235 | case 0x4: | 227 | case 0x4: |
236 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; | 228 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; |
237 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1024; | 229 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1024; |
238 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
239 | LCD_PANEL_ID4_1280X1024; | ||
240 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; | 230 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; |
241 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 231 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
242 | break; | 232 | break; |
243 | case 0x5: | 233 | case 0x5: |
244 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1400; | 234 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1400; |
245 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1050; | 235 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1050; |
246 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
247 | LCD_PANEL_ID5_1400X1050; | ||
248 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; | 236 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; |
249 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 237 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
250 | break; | 238 | break; |
251 | case 0x6: | 239 | case 0x6: |
252 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1600; | 240 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1600; |
253 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1200; | 241 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1200; |
254 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
255 | LCD_PANEL_ID6_1600X1200; | ||
256 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; | 242 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; |
257 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 243 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
258 | break; | 244 | break; |
259 | case 0x8: | 245 | case 0x8: |
260 | viaparinfo->lvds_setting_info->lcd_panel_hres = 800; | 246 | viaparinfo->lvds_setting_info->lcd_panel_hres = 800; |
261 | viaparinfo->lvds_setting_info->lcd_panel_vres = 480; | 247 | viaparinfo->lvds_setting_info->lcd_panel_vres = 480; |
262 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
263 | LCD_PANEL_IDA_800X480; | ||
264 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 248 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
265 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 249 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
266 | break; | 250 | break; |
267 | case 0x9: | 251 | case 0x9: |
268 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; | 252 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; |
269 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; | 253 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; |
270 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
271 | LCD_PANEL_ID2_1024X768; | ||
272 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; | 254 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; |
273 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 255 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
274 | break; | 256 | break; |
275 | case 0xA: | 257 | case 0xA: |
276 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; | 258 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; |
277 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; | 259 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; |
278 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
279 | LCD_PANEL_ID2_1024X768; | ||
280 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 260 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
281 | viaparinfo->lvds_setting_info->LCDDithering = 0; | 261 | viaparinfo->lvds_setting_info->LCDDithering = 0; |
282 | break; | 262 | break; |
283 | case 0xB: | 263 | case 0xB: |
284 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; | 264 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; |
285 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; | 265 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; |
286 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
287 | LCD_PANEL_ID2_1024X768; | ||
288 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; | 266 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; |
289 | viaparinfo->lvds_setting_info->LCDDithering = 0; | 267 | viaparinfo->lvds_setting_info->LCDDithering = 0; |
290 | break; | 268 | break; |
291 | case 0xC: | 269 | case 0xC: |
292 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; | 270 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; |
293 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; | 271 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; |
294 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
295 | LCD_PANEL_ID3_1280X768; | ||
296 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 272 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
297 | viaparinfo->lvds_setting_info->LCDDithering = 0; | 273 | viaparinfo->lvds_setting_info->LCDDithering = 0; |
298 | break; | 274 | break; |
299 | case 0xD: | 275 | case 0xD: |
300 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; | 276 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; |
301 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1024; | 277 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1024; |
302 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
303 | LCD_PANEL_ID4_1280X1024; | ||
304 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; | 278 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; |
305 | viaparinfo->lvds_setting_info->LCDDithering = 0; | 279 | viaparinfo->lvds_setting_info->LCDDithering = 0; |
306 | break; | 280 | break; |
307 | case 0xE: | 281 | case 0xE: |
308 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1400; | 282 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1400; |
309 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1050; | 283 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1050; |
310 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
311 | LCD_PANEL_ID5_1400X1050; | ||
312 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; | 284 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; |
313 | viaparinfo->lvds_setting_info->LCDDithering = 0; | 285 | viaparinfo->lvds_setting_info->LCDDithering = 0; |
314 | break; | 286 | break; |
315 | case 0xF: | 287 | case 0xF: |
316 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1600; | 288 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1600; |
317 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1200; | 289 | viaparinfo->lvds_setting_info->lcd_panel_vres = 1200; |
318 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
319 | LCD_PANEL_ID6_1600X1200; | ||
320 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; | 290 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; |
321 | viaparinfo->lvds_setting_info->LCDDithering = 0; | 291 | viaparinfo->lvds_setting_info->LCDDithering = 0; |
322 | break; | 292 | break; |
323 | case 0x10: | 293 | case 0x10: |
324 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1366; | 294 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1366; |
325 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; | 295 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; |
326 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
327 | LCD_PANEL_ID7_1366X768; | ||
328 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 296 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
329 | viaparinfo->lvds_setting_info->LCDDithering = 0; | 297 | viaparinfo->lvds_setting_info->LCDDithering = 0; |
330 | break; | 298 | break; |
331 | case 0x11: | 299 | case 0x11: |
332 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; | 300 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; |
333 | viaparinfo->lvds_setting_info->lcd_panel_vres = 600; | 301 | viaparinfo->lvds_setting_info->lcd_panel_vres = 600; |
334 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
335 | LCD_PANEL_ID8_1024X600; | ||
336 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 302 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
337 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 303 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
338 | break; | 304 | break; |
339 | case 0x12: | 305 | case 0x12: |
340 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; | 306 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; |
341 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; | 307 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; |
342 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
343 | LCD_PANEL_ID3_1280X768; | ||
344 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; | 308 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; |
345 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 309 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
346 | break; | 310 | break; |
347 | case 0x13: | 311 | case 0x13: |
348 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; | 312 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; |
349 | viaparinfo->lvds_setting_info->lcd_panel_vres = 800; | 313 | viaparinfo->lvds_setting_info->lcd_panel_vres = 800; |
350 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
351 | LCD_PANEL_ID9_1280X800; | ||
352 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 314 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
353 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 315 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
354 | break; | 316 | break; |
355 | case 0x14: | 317 | case 0x14: |
356 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1360; | 318 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1360; |
357 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; | 319 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; |
358 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
359 | LCD_PANEL_IDB_1360X768; | ||
360 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 320 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
361 | viaparinfo->lvds_setting_info->LCDDithering = 0; | 321 | viaparinfo->lvds_setting_info->LCDDithering = 0; |
362 | break; | 322 | break; |
363 | case 0x15: | 323 | case 0x15: |
364 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; | 324 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; |
365 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; | 325 | viaparinfo->lvds_setting_info->lcd_panel_vres = 768; |
366 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
367 | LCD_PANEL_ID3_1280X768; | ||
368 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; | 326 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; |
369 | viaparinfo->lvds_setting_info->LCDDithering = 0; | 327 | viaparinfo->lvds_setting_info->LCDDithering = 0; |
370 | break; | 328 | break; |
371 | case 0x16: | 329 | case 0x16: |
372 | viaparinfo->lvds_setting_info->lcd_panel_hres = 480; | 330 | viaparinfo->lvds_setting_info->lcd_panel_hres = 480; |
373 | viaparinfo->lvds_setting_info->lcd_panel_vres = 640; | 331 | viaparinfo->lvds_setting_info->lcd_panel_vres = 640; |
374 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
375 | LCD_PANEL_IDC_480X640; | ||
376 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 332 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
377 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 333 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
378 | break; | 334 | break; |
@@ -380,16 +336,12 @@ static void __devinit fp_id_to_vindex(int panel_id) | |||
380 | /* OLPC XO-1.5 panel */ | 336 | /* OLPC XO-1.5 panel */ |
381 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1200; | 337 | viaparinfo->lvds_setting_info->lcd_panel_hres = 1200; |
382 | viaparinfo->lvds_setting_info->lcd_panel_vres = 900; | 338 | viaparinfo->lvds_setting_info->lcd_panel_vres = 900; |
383 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
384 | LCD_PANEL_IDD_1200X900; | ||
385 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 339 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
386 | viaparinfo->lvds_setting_info->LCDDithering = 0; | 340 | viaparinfo->lvds_setting_info->LCDDithering = 0; |
387 | break; | 341 | break; |
388 | default: | 342 | default: |
389 | viaparinfo->lvds_setting_info->lcd_panel_hres = 800; | 343 | viaparinfo->lvds_setting_info->lcd_panel_hres = 800; |
390 | viaparinfo->lvds_setting_info->lcd_panel_vres = 600; | 344 | viaparinfo->lvds_setting_info->lcd_panel_vres = 600; |
391 | viaparinfo->lvds_setting_info->lcd_panel_id = | ||
392 | LCD_PANEL_ID1_800X600; | ||
393 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; | 345 | viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; |
394 | viaparinfo->lvds_setting_info->LCDDithering = 1; | 346 | viaparinfo->lvds_setting_info->LCDDithering = 1; |
395 | } | 347 | } |
@@ -610,7 +562,7 @@ void viafb_lcd_set_mode(struct crt_mode_table *mode_crt_table, | |||
610 | int set_vres = plvds_setting_info->v_active; | 562 | int set_vres = plvds_setting_info->v_active; |
611 | int panel_hres = plvds_setting_info->lcd_panel_hres; | 563 | int panel_hres = plvds_setting_info->lcd_panel_hres; |
612 | int panel_vres = plvds_setting_info->lcd_panel_vres; | 564 | int panel_vres = plvds_setting_info->lcd_panel_vres; |
613 | u32 pll_D_N; | 565 | u32 pll_D_N, clock; |
614 | struct display_timing mode_crt_reg, panel_crt_reg; | 566 | struct display_timing mode_crt_reg, panel_crt_reg; |
615 | struct crt_mode_table *panel_crt_table = NULL; | 567 | struct crt_mode_table *panel_crt_table = NULL; |
616 | struct VideoModeTable *vmode_tbl = viafb_get_mode(panel_hres, | 568 | struct VideoModeTable *vmode_tbl = viafb_get_mode(panel_hres, |
@@ -625,7 +577,9 @@ void viafb_lcd_set_mode(struct crt_mode_table *mode_crt_table, | |||
625 | DEBUG_MSG(KERN_INFO "bellow viafb_lcd_set_mode!!\n"); | 577 | DEBUG_MSG(KERN_INFO "bellow viafb_lcd_set_mode!!\n"); |
626 | if (VT1636_LVDS == plvds_chip_info->lvds_chip_name) | 578 | if (VT1636_LVDS == plvds_chip_info->lvds_chip_name) |
627 | viafb_init_lvds_vt1636(plvds_setting_info, plvds_chip_info); | 579 | viafb_init_lvds_vt1636(plvds_setting_info, plvds_chip_info); |
628 | plvds_setting_info->vclk = panel_crt_table->clk; | 580 | clock = panel_crt_reg.hor_total * panel_crt_reg.ver_total |
581 | * panel_crt_table->refresh_rate; | ||
582 | plvds_setting_info->vclk = clock; | ||
629 | if (set_iga == IGA1) { | 583 | if (set_iga == IGA1) { |
630 | /* IGA1 doesn't have LCD scaling, so set it as centering. */ | 584 | /* IGA1 doesn't have LCD scaling, so set it as centering. */ |
631 | viafb_load_crtc_timing(lcd_centering_timging | 585 | viafb_load_crtc_timing(lcd_centering_timging |
@@ -660,7 +614,7 @@ void viafb_lcd_set_mode(struct crt_mode_table *mode_crt_table, | |||
660 | 614 | ||
661 | fill_lcd_format(); | 615 | fill_lcd_format(); |
662 | 616 | ||
663 | pll_D_N = viafb_get_clk_value(panel_crt_table[0].clk); | 617 | pll_D_N = viafb_get_clk_value(clock); |
664 | DEBUG_MSG(KERN_INFO "PLL=0x%x", pll_D_N); | 618 | DEBUG_MSG(KERN_INFO "PLL=0x%x", pll_D_N); |
665 | viafb_set_vclock(pll_D_N, set_iga); | 619 | viafb_set_vclock(pll_D_N, set_iga); |
666 | lcd_patch_skew(plvds_setting_info, plvds_chip_info); | 620 | lcd_patch_skew(plvds_setting_info, plvds_chip_info); |
@@ -1064,34 +1018,33 @@ static struct display_timing lcd_centering_timging(struct display_timing | |||
1064 | 1018 | ||
1065 | bool viafb_lcd_get_mobile_state(bool *mobile) | 1019 | bool viafb_lcd_get_mobile_state(bool *mobile) |
1066 | { | 1020 | { |
1067 | unsigned char *romptr, *tableptr; | 1021 | unsigned char __iomem *romptr, *tableptr, *biosptr; |
1068 | u8 core_base; | 1022 | u8 core_base; |
1069 | unsigned char *biosptr; | ||
1070 | /* Rom address */ | 1023 | /* Rom address */ |
1071 | u32 romaddr = 0x000C0000; | 1024 | const u32 romaddr = 0x000C0000; |
1072 | u16 start_pattern = 0; | 1025 | u16 start_pattern; |
1073 | 1026 | ||
1074 | biosptr = ioremap(romaddr, 0x10000); | 1027 | biosptr = ioremap(romaddr, 0x10000); |
1028 | start_pattern = readw(biosptr); | ||
1075 | 1029 | ||
1076 | memcpy(&start_pattern, biosptr, 2); | ||
1077 | /* Compare pattern */ | 1030 | /* Compare pattern */ |
1078 | if (start_pattern == 0xAA55) { | 1031 | if (start_pattern == 0xAA55) { |
1079 | /* Get the start of Table */ | 1032 | /* Get the start of Table */ |
1080 | /* 0x1B means BIOS offset position */ | 1033 | /* 0x1B means BIOS offset position */ |
1081 | romptr = biosptr + 0x1B; | 1034 | romptr = biosptr + 0x1B; |
1082 | tableptr = biosptr + *((u16 *) romptr); | 1035 | tableptr = biosptr + readw(romptr); |
1083 | 1036 | ||
1084 | /* Get the start of biosver structure */ | 1037 | /* Get the start of biosver structure */ |
1085 | /* 18 means BIOS version position. */ | 1038 | /* 18 means BIOS version position. */ |
1086 | romptr = tableptr + 18; | 1039 | romptr = tableptr + 18; |
1087 | romptr = biosptr + *((u16 *) romptr); | 1040 | romptr = biosptr + readw(romptr); |
1088 | 1041 | ||
1089 | /* The offset should be 44, but the | 1042 | /* The offset should be 44, but the |
1090 | actual image is less three char. */ | 1043 | actual image is less three char. */ |
1091 | /* pRom += 44; */ | 1044 | /* pRom += 44; */ |
1092 | romptr += 41; | 1045 | romptr += 41; |
1093 | 1046 | ||
1094 | core_base = *romptr++; | 1047 | core_base = readb(romptr); |
1095 | 1048 | ||
1096 | if (core_base & 0x8) | 1049 | if (core_base & 0x8) |
1097 | *mobile = false; | 1050 | *mobile = false; |