aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/ps3fb.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>2008-02-06 04:39:29 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:17 -0500
commit084ffff29844a4bce69999d67809e6c00309ba58 (patch)
tree11c98d8c1c127edc227cb610ffcac4e7c321bcc3 /drivers/video/ps3fb.c
parent3c4f594a6da410789975dcde16b07b62c62fa564 (diff)
ps3: use symbolic names for video modes
Use symbolic names for video modes Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/ps3fb.c')
-rw-r--r--drivers/video/ps3fb.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 044a423a72cb..1f982bd6cc17 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -338,7 +338,7 @@ static int ps3fb_get_res_table(u32 xres, u32 yres, int mode)
338static unsigned int ps3fb_find_mode(const struct fb_var_screeninfo *var, 338static unsigned int ps3fb_find_mode(const struct fb_var_screeninfo *var,
339 u32 *ddr_line_length, u32 *xdr_line_length) 339 u32 *ddr_line_length, u32 *xdr_line_length)
340{ 340{
341 unsigned int i, mode; 341 unsigned int i, fi, mode;
342 342
343 for (i = 0; i < ARRAY_SIZE(ps3fb_modedb); i++) 343 for (i = 0; i < ARRAY_SIZE(ps3fb_modedb); i++)
344 if (var->xres == ps3fb_modedb[i].xres && 344 if (var->xres == ps3fb_modedb[i].xres &&
@@ -359,7 +359,8 @@ static unsigned int ps3fb_find_mode(const struct fb_var_screeninfo *var,
359 359
360found: 360found:
361 /* Cropped broadcast modes use the full line length */ 361 /* Cropped broadcast modes use the full line length */
362 *ddr_line_length = ps3fb_modedb[i < 10 ? i + 13 : i].xres * BPP; 362 fi = i < PS3AV_MODE_1080P50 ? i + PS3AV_MODE_WUXGA : i;
363 *ddr_line_length = ps3fb_modedb[fi].xres * BPP;
363 364
364 if (ps3_compare_firmware_version(1, 9, 0) >= 0) { 365 if (ps3_compare_firmware_version(1, 9, 0) >= 0) {
365 *xdr_line_length = GPU_ALIGN_UP(max(var->xres, 366 *xdr_line_length = GPU_ALIGN_UP(max(var->xres,
@@ -370,7 +371,9 @@ found:
370 *xdr_line_length = *ddr_line_length; 371 *xdr_line_length = *ddr_line_length;
371 372
372 /* Full broadcast modes have the full mode bit set */ 373 /* Full broadcast modes have the full mode bit set */
373 mode = i > 12 ? (i - 12) | PS3FB_FULL_MODE_BIT : i + 1; 374 mode = i+1;
375 if (mode > PS3AV_MODE_WUXGA)
376 mode = (mode - PS3AV_MODE_WUXGA) | PS3FB_FULL_MODE_BIT;
374 377
375 pr_debug("ps3fb_find_mode: mode %u\n", mode); 378 pr_debug("ps3fb_find_mode: mode %u\n", mode);
376 379
@@ -382,14 +385,14 @@ static const struct fb_videomode *ps3fb_default_mode(int id)
382 u32 mode = id & PS3AV_MODE_MASK; 385 u32 mode = id & PS3AV_MODE_MASK;
383 u32 flags; 386 u32 flags;
384 387
385 if (mode < 1 || mode > 13) 388 if (mode < PS3AV_MODE_480I || mode > PS3AV_MODE_WUXGA)
386 return NULL; 389 return NULL;
387 390
388 flags = id & ~PS3AV_MODE_MASK; 391 flags = id & ~PS3AV_MODE_MASK;
389 392
390 if (mode <= 10 && flags & PS3FB_FULL_MODE_BIT) { 393 if (mode <= PS3AV_MODE_1080P50 && flags & PS3FB_FULL_MODE_BIT) {
391 /* Full broadcast mode */ 394 /* Full broadcast mode */
392 return &ps3fb_modedb[mode + 12]; 395 return &ps3fb_modedb[mode + PS3AV_MODE_WUXGA - 1];
393 } 396 }
394 397
395 return &ps3fb_modedb[mode - 1]; 398 return &ps3fb_modedb[mode - 1];
@@ -1080,7 +1083,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1080 1083
1081 if (!ps3fb_mode) 1084 if (!ps3fb_mode)
1082 ps3fb_mode = ps3av_get_mode(); 1085 ps3fb_mode = ps3av_get_mode();
1083 dev_dbg(&dev->core, "ps3av_mode:%d\n", ps3fb_mode); 1086 dev_dbg(&dev->core, "ps3fb_mode: %d\n", ps3fb_mode);
1084 1087
1085 if (ps3fb_mode > 0 && 1088 if (ps3fb_mode > 0 &&
1086 !ps3av_video_mode2res(ps3fb_mode, &xres, &yres)) { 1089 !ps3av_video_mode2res(ps3fb_mode, &xres, &yres)) {