diff options
author | Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> | 2007-10-16 04:29:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:21 -0400 |
commit | 535da7ffe68dfdf70c7aecade21864a573035b75 (patch) | |
tree | e18038823aa383164d80a6e7b39b46d3c3d9ceaf /drivers | |
parent | 9da505d1f9d8facbb688d28dfb6d9fc8edfd5c4a (diff) |
ps3fb: convert from printk()/DPRINTK() to dev_*()/pr_*()
Convert ps3fb from printk()/DPRINTK() to dev_*()/pr_*()
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')
-rw-r--r-- | drivers/video/ps3fb.c | 183 |
1 files changed, 96 insertions, 87 deletions
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 07fdad1604af..eb8afc7ace03 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -48,12 +48,6 @@ | |||
48 | 48 | ||
49 | #define DEVICE_NAME "ps3fb" | 49 | #define DEVICE_NAME "ps3fb" |
50 | 50 | ||
51 | #ifdef PS3FB_DEBUG | ||
52 | #define DPRINTK(fmt, args...) printk("%s: " fmt, __func__ , ##args) | ||
53 | #else | ||
54 | #define DPRINTK(fmt, args...) | ||
55 | #endif | ||
56 | |||
57 | #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC 0x101 | 51 | #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC 0x101 |
58 | #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP 0x102 | 52 | #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP 0x102 |
59 | #define L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP 0x600 | 53 | #define L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP 0x600 |
@@ -316,7 +310,7 @@ static int ps3fb_get_res_table(u32 xres, u32 yres, int mode) | |||
316 | f = ps3fb_res[i].type; | 310 | f = ps3fb_res[i].type; |
317 | 311 | ||
318 | if (!x) { | 312 | if (!x) { |
319 | DPRINTK("ERROR: ps3fb_get_res_table()\n"); | 313 | pr_debug("ERROR: ps3fb_get_res_table()\n"); |
320 | return -1; | 314 | return -1; |
321 | } | 315 | } |
322 | 316 | ||
@@ -357,11 +351,11 @@ static unsigned int ps3fb_find_mode(const struct fb_var_screeninfo *var, | |||
357 | /* Full broadcast modes have the full mode bit set */ | 351 | /* Full broadcast modes have the full mode bit set */ |
358 | mode = i > 12 ? (i - 12) | PS3FB_FULL_MODE_BIT : i + 1; | 352 | mode = i > 12 ? (i - 12) | PS3FB_FULL_MODE_BIT : i + 1; |
359 | 353 | ||
360 | DPRINTK("ps3fb_find_mode: mode %u\n", mode); | 354 | pr_debug("ps3fb_find_mode: mode %u\n", mode); |
361 | return mode; | 355 | return mode; |
362 | } | 356 | } |
363 | 357 | ||
364 | DPRINTK("ps3fb_find_mode: mode not found\n"); | 358 | pr_debug("ps3fb_find_mode: mode not found\n"); |
365 | return 0; | 359 | return 0; |
366 | 360 | ||
367 | } | 361 | } |
@@ -384,7 +378,7 @@ static const struct fb_videomode *ps3fb_default_mode(void) | |||
384 | return &ps3fb_modedb[mode - 1]; | 378 | return &ps3fb_modedb[mode - 1]; |
385 | } | 379 | } |
386 | 380 | ||
387 | static int ps3fb_sync(u32 frame) | 381 | static int ps3fb_sync(struct fb_info *info, u32 frame) |
388 | { | 382 | { |
389 | int i, status; | 383 | int i, status; |
390 | u32 xres, yres; | 384 | u32 xres, yres; |
@@ -395,8 +389,8 @@ static int ps3fb_sync(u32 frame) | |||
395 | yres = ps3fb_res[i].yres; | 389 | yres = ps3fb_res[i].yres; |
396 | 390 | ||
397 | if (frame > ps3fb.num_frames - 1) { | 391 | if (frame > ps3fb.num_frames - 1) { |
398 | printk(KERN_WARNING "%s: invalid frame number (%u)\n", | 392 | dev_warn(info->device, "%s: invalid frame number (%u)\n", |
399 | __func__, frame); | 393 | __func__, frame); |
400 | return -EINVAL; | 394 | return -EINVAL; |
401 | } | 395 | } |
402 | offset = xres * yres * BPP * frame; | 396 | offset = xres * yres * BPP * frame; |
@@ -409,26 +403,26 @@ static int ps3fb_sync(u32 frame) | |||
409 | (xres << 16) | yres, | 403 | (xres << 16) | yres, |
410 | xres * BPP); /* line_length */ | 404 | xres * BPP); /* line_length */ |
411 | if (status) | 405 | if (status) |
412 | printk(KERN_ERR | 406 | dev_err(info->device, |
413 | "%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n", | 407 | "%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n", |
414 | __func__, status); | 408 | __func__, status); |
415 | #ifdef HEAD_A | 409 | #ifdef HEAD_A |
416 | status = lv1_gpu_context_attribute(ps3fb.context_handle, | 410 | status = lv1_gpu_context_attribute(ps3fb.context_handle, |
417 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, | 411 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, |
418 | 0, offset, 0, 0); | 412 | 0, offset, 0, 0); |
419 | if (status) | 413 | if (status) |
420 | printk(KERN_ERR | 414 | dev_err(info->device, |
421 | "%s: lv1_gpu_context_attribute FLIP failed: %d\n", | 415 | "%s: lv1_gpu_context_attribute FLIP failed: %d\n", |
422 | __func__, status); | 416 | __func__, status); |
423 | #endif | 417 | #endif |
424 | #ifdef HEAD_B | 418 | #ifdef HEAD_B |
425 | status = lv1_gpu_context_attribute(ps3fb.context_handle, | 419 | status = lv1_gpu_context_attribute(ps3fb.context_handle, |
426 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, | 420 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, |
427 | 1, offset, 0, 0); | 421 | 1, offset, 0, 0); |
428 | if (status) | 422 | if (status) |
429 | printk(KERN_ERR | 423 | dev_err(info->device, |
430 | "%s: lv1_gpu_context_attribute FLIP failed: %d\n", | 424 | "%s: lv1_gpu_context_attribute FLIP failed: %d\n", |
431 | __func__, status); | 425 | __func__, status); |
432 | #endif | 426 | #endif |
433 | return 0; | 427 | return 0; |
434 | } | 428 | } |
@@ -445,7 +439,7 @@ static int ps3fb_release(struct fb_info *info, int user) | |||
445 | if (atomic_dec_and_test(&ps3fb.f_count)) { | 439 | if (atomic_dec_and_test(&ps3fb.f_count)) { |
446 | if (atomic_read(&ps3fb.ext_flip)) { | 440 | if (atomic_read(&ps3fb.ext_flip)) { |
447 | atomic_set(&ps3fb.ext_flip, 0); | 441 | atomic_set(&ps3fb.ext_flip, 0); |
448 | ps3fb_sync(0); /* single buffer */ | 442 | ps3fb_sync(info, 0); /* single buffer */ |
449 | } | 443 | } |
450 | } | 444 | } |
451 | return 0; | 445 | return 0; |
@@ -465,8 +459,10 @@ static int ps3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
465 | int mode; | 459 | int mode; |
466 | int i; | 460 | int i; |
467 | 461 | ||
468 | DPRINTK("var->xres:%u info->var.xres:%u\n", var->xres, info->var.xres); | 462 | dev_dbg(info->device, "var->xres:%u info->var.xres:%u\n", var->xres, |
469 | DPRINTK("var->yres:%u info->var.yres:%u\n", var->yres, info->var.yres); | 463 | info->var.xres); |
464 | dev_dbg(info->device, "var->yres:%u info->var.yres:%u\n", var->yres, | ||
465 | info->var.yres); | ||
470 | 466 | ||
471 | /* FIXME For now we do exact matches only */ | 467 | /* FIXME For now we do exact matches only */ |
472 | mode = ps3fb_find_mode(var, &line_length); | 468 | mode = ps3fb_find_mode(var, &line_length); |
@@ -487,7 +483,8 @@ static int ps3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
487 | /* Virtual screen and panning are not supported */ | 483 | /* Virtual screen and panning are not supported */ |
488 | if (var->xres_virtual > var->xres || var->yres_virtual > var->yres || | 484 | if (var->xres_virtual > var->xres || var->yres_virtual > var->yres || |
489 | var->xoffset || var->yoffset) { | 485 | var->xoffset || var->yoffset) { |
490 | DPRINTK("Virtual screen and panning are not supported\n"); | 486 | dev_dbg(info->device, |
487 | "Virtual screen and panning are not supported\n"); | ||
491 | return -EINVAL; | 488 | return -EINVAL; |
492 | } | 489 | } |
493 | 490 | ||
@@ -502,7 +499,7 @@ static int ps3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
502 | var->blue.length > 8 || var->transp.length > 8 || | 499 | var->blue.length > 8 || var->transp.length > 8 || |
503 | var->red.msb_right || var->green.msb_right || | 500 | var->red.msb_right || var->green.msb_right || |
504 | var->blue.msb_right || var->transp.msb_right || var->nonstd) { | 501 | var->blue.msb_right || var->transp.msb_right || var->nonstd) { |
505 | DPRINTK("We support ARGB8888 only\n"); | 502 | dev_dbg(info->device, "We support ARGB8888 only\n"); |
506 | return -EINVAL; | 503 | return -EINVAL; |
507 | } | 504 | } |
508 | 505 | ||
@@ -522,14 +519,14 @@ static int ps3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
522 | 519 | ||
523 | /* Rotation is not supported */ | 520 | /* Rotation is not supported */ |
524 | if (var->rotate) { | 521 | if (var->rotate) { |
525 | DPRINTK("Rotation is not supported\n"); | 522 | dev_dbg(info->device, "Rotation is not supported\n"); |
526 | return -EINVAL; | 523 | return -EINVAL; |
527 | } | 524 | } |
528 | 525 | ||
529 | /* Memory limit */ | 526 | /* Memory limit */ |
530 | i = ps3fb_get_res_table(var->xres, var->yres, mode); | 527 | i = ps3fb_get_res_table(var->xres, var->yres, mode); |
531 | if (ps3fb_res[i].xres*ps3fb_res[i].yres*BPP > ps3fb_videomemory.size) { | 528 | if (ps3fb_res[i].xres*ps3fb_res[i].yres*BPP > ps3fb_videomemory.size) { |
532 | DPRINTK("Not enough memory\n"); | 529 | dev_dbg(info->device, "Not enough memory\n"); |
533 | return -ENOMEM; | 530 | return -ENOMEM; |
534 | } | 531 | } |
535 | 532 | ||
@@ -549,7 +546,7 @@ static int ps3fb_set_par(struct fb_info *info) | |||
549 | int i; | 546 | int i; |
550 | unsigned long offset; | 547 | unsigned long offset; |
551 | 548 | ||
552 | DPRINTK("xres:%d xv:%d yres:%d yv:%d clock:%d\n", | 549 | dev_dbg(info->device, "xres:%d xv:%d yres:%d yv:%d clock:%d\n", |
553 | info->var.xres, info->var.xres_virtual, | 550 | info->var.xres, info->var.xres_virtual, |
554 | info->var.yres, info->var.yres_virtual, info->var.pixclock); | 551 | info->var.yres, info->var.yres_virtual, info->var.pixclock); |
555 | 552 | ||
@@ -623,8 +620,8 @@ static int ps3fb_mmap(struct fb_info *info, struct vm_area_struct *vma) | |||
623 | size, vma->vm_page_prot)) | 620 | size, vma->vm_page_prot)) |
624 | return -EAGAIN; | 621 | return -EAGAIN; |
625 | 622 | ||
626 | printk(KERN_DEBUG "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n", offset, | 623 | dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n", |
627 | vma->vm_start); | 624 | offset, vma->vm_start); |
628 | return 0; | 625 | return 0; |
629 | } | 626 | } |
630 | 627 | ||
@@ -636,7 +633,7 @@ static int ps3fb_blank(int blank, struct fb_info *info) | |||
636 | { | 633 | { |
637 | int retval; | 634 | int retval; |
638 | 635 | ||
639 | DPRINTK("%s: blank:%d\n", __func__, blank); | 636 | dev_dbg(info->device, "%s: blank:%d\n", __func__, blank); |
640 | switch (blank) { | 637 | switch (blank) { |
641 | case FB_BLANK_POWERDOWN: | 638 | case FB_BLANK_POWERDOWN: |
642 | case FB_BLANK_HSYNC_SUSPEND: | 639 | case FB_BLANK_HSYNC_SUSPEND: |
@@ -705,7 +702,7 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
705 | case FBIOGET_VBLANK: | 702 | case FBIOGET_VBLANK: |
706 | { | 703 | { |
707 | struct fb_vblank vblank; | 704 | struct fb_vblank vblank; |
708 | DPRINTK("FBIOGET_VBLANK:\n"); | 705 | dev_dbg(info->device, "FBIOGET_VBLANK:\n"); |
709 | retval = ps3fb_get_vblank(&vblank); | 706 | retval = ps3fb_get_vblank(&vblank); |
710 | if (retval) | 707 | if (retval) |
711 | break; | 708 | break; |
@@ -718,7 +715,7 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
718 | case FBIO_WAITFORVSYNC: | 715 | case FBIO_WAITFORVSYNC: |
719 | { | 716 | { |
720 | u32 crt; | 717 | u32 crt; |
721 | DPRINTK("FBIO_WAITFORVSYNC:\n"); | 718 | dev_dbg(info->device, "FBIO_WAITFORVSYNC:\n"); |
722 | if (get_user(crt, (u32 __user *) arg)) | 719 | if (get_user(crt, (u32 __user *) arg)) |
723 | break; | 720 | break; |
724 | 721 | ||
@@ -739,7 +736,7 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
739 | if (id > 0) | 736 | if (id > 0) |
740 | val = (val & ~PS3AV_MODE_MASK) | id; | 737 | val = (val & ~PS3AV_MODE_MASK) | id; |
741 | } | 738 | } |
742 | DPRINTK("PS3FB_IOCTL_SETMODE:%x\n", val); | 739 | dev_dbg(info->device, "PS3FB_IOCTL_SETMODE:%x\n", val); |
743 | retval = -EINVAL; | 740 | retval = -EINVAL; |
744 | old_mode = ps3fb_mode; | 741 | old_mode = ps3fb_mode; |
745 | ps3fb_mode = val; | 742 | ps3fb_mode = val; |
@@ -762,7 +759,7 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
762 | 759 | ||
763 | case PS3FB_IOCTL_GETMODE: | 760 | case PS3FB_IOCTL_GETMODE: |
764 | val = ps3av_get_mode(); | 761 | val = ps3av_get_mode(); |
765 | DPRINTK("PS3FB_IOCTL_GETMODE:%x\n", val); | 762 | dev_dbg(info->device, "PS3FB_IOCTL_GETMODE:%x\n", val); |
766 | if (!copy_to_user(argp, &val, sizeof(val))) | 763 | if (!copy_to_user(argp, &val, sizeof(val))) |
767 | retval = 0; | 764 | retval = 0; |
768 | break; | 765 | break; |
@@ -771,7 +768,7 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
771 | { | 768 | { |
772 | struct ps3fb_ioctl_res res; | 769 | struct ps3fb_ioctl_res res; |
773 | int i = ps3fb.res_index; | 770 | int i = ps3fb.res_index; |
774 | DPRINTK("PS3FB_IOCTL_SCREENINFO:\n"); | 771 | dev_dbg(info->device, "PS3FB_IOCTL_SCREENINFO:\n"); |
775 | res.xres = ps3fb_res[i].xres; | 772 | res.xres = ps3fb_res[i].xres; |
776 | res.yres = ps3fb_res[i].yres; | 773 | res.yres = ps3fb_res[i].yres; |
777 | res.xoff = ps3fb_res[i].xoff; | 774 | res.xoff = ps3fb_res[i].xoff; |
@@ -783,13 +780,13 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
783 | } | 780 | } |
784 | 781 | ||
785 | case PS3FB_IOCTL_ON: | 782 | case PS3FB_IOCTL_ON: |
786 | DPRINTK("PS3FB_IOCTL_ON:\n"); | 783 | dev_dbg(info->device, "PS3FB_IOCTL_ON:\n"); |
787 | atomic_inc(&ps3fb.ext_flip); | 784 | atomic_inc(&ps3fb.ext_flip); |
788 | retval = 0; | 785 | retval = 0; |
789 | break; | 786 | break; |
790 | 787 | ||
791 | case PS3FB_IOCTL_OFF: | 788 | case PS3FB_IOCTL_OFF: |
792 | DPRINTK("PS3FB_IOCTL_OFF:\n"); | 789 | dev_dbg(info->device, "PS3FB_IOCTL_OFF:\n"); |
793 | atomic_dec_if_positive(&ps3fb.ext_flip); | 790 | atomic_dec_if_positive(&ps3fb.ext_flip); |
794 | retval = 0; | 791 | retval = 0; |
795 | break; | 792 | break; |
@@ -798,8 +795,8 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
798 | if (copy_from_user(&val, argp, sizeof(val))) | 795 | if (copy_from_user(&val, argp, sizeof(val))) |
799 | break; | 796 | break; |
800 | 797 | ||
801 | DPRINTK("PS3FB_IOCTL_FSEL:%d\n", val); | 798 | dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val); |
802 | retval = ps3fb_sync(val); | 799 | retval = ps3fb_sync(info, val); |
803 | break; | 800 | break; |
804 | 801 | ||
805 | default: | 802 | default: |
@@ -811,13 +808,15 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
811 | 808 | ||
812 | static int ps3fbd(void *arg) | 809 | static int ps3fbd(void *arg) |
813 | { | 810 | { |
811 | struct fb_info *info = arg; | ||
812 | |||
814 | set_freezable(); | 813 | set_freezable(); |
815 | while (!kthread_should_stop()) { | 814 | while (!kthread_should_stop()) { |
816 | try_to_freeze(); | 815 | try_to_freeze(); |
817 | set_current_state(TASK_INTERRUPTIBLE); | 816 | set_current_state(TASK_INTERRUPTIBLE); |
818 | if (ps3fb.is_kicked) { | 817 | if (ps3fb.is_kicked) { |
819 | ps3fb.is_kicked = 0; | 818 | ps3fb.is_kicked = 0; |
820 | ps3fb_sync(0); /* single buffer */ | 819 | ps3fb_sync(info, 0); /* single buffer */ |
821 | } | 820 | } |
822 | schedule(); | 821 | schedule(); |
823 | } | 822 | } |
@@ -826,14 +825,15 @@ static int ps3fbd(void *arg) | |||
826 | 825 | ||
827 | static irqreturn_t ps3fb_vsync_interrupt(int irq, void *ptr) | 826 | static irqreturn_t ps3fb_vsync_interrupt(int irq, void *ptr) |
828 | { | 827 | { |
828 | struct device *dev = ptr; | ||
829 | u64 v1; | 829 | u64 v1; |
830 | int status; | 830 | int status; |
831 | struct display_head *head = &ps3fb.dinfo->display_head[1]; | 831 | struct display_head *head = &ps3fb.dinfo->display_head[1]; |
832 | 832 | ||
833 | status = lv1_gpu_context_intr(ps3fb.context_handle, &v1); | 833 | status = lv1_gpu_context_intr(ps3fb.context_handle, &v1); |
834 | if (status) { | 834 | if (status) { |
835 | printk(KERN_ERR "%s: lv1_gpu_context_intr failed: %d\n", | 835 | dev_err(dev, "%s: lv1_gpu_context_intr failed: %d\n", __func__, |
836 | __func__, status); | 836 | status); |
837 | return IRQ_NONE; | 837 | return IRQ_NONE; |
838 | } | 838 | } |
839 | 839 | ||
@@ -853,35 +853,35 @@ static irqreturn_t ps3fb_vsync_interrupt(int irq, void *ptr) | |||
853 | 853 | ||
854 | 854 | ||
855 | static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, | 855 | static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, |
856 | struct ps3_system_bus_device *dev) | 856 | struct device *dev) |
857 | { | 857 | { |
858 | int error; | 858 | int error; |
859 | 859 | ||
860 | DPRINTK("version_driver:%x\n", dinfo->version_driver); | 860 | dev_dbg(dev, "version_driver:%x\n", dinfo->version_driver); |
861 | DPRINTK("irq outlet:%x\n", dinfo->irq.irq_outlet); | 861 | dev_dbg(dev, "irq outlet:%x\n", dinfo->irq.irq_outlet); |
862 | DPRINTK("version_gpu:%x memory_size:%x ch:%x core_freq:%d mem_freq:%d\n", | 862 | dev_dbg(dev, |
863 | "version_gpu: %x memory_size: %x ch: %x core_freq: %d " | ||
864 | "mem_freq:%d\n", | ||
863 | dinfo->version_gpu, dinfo->memory_size, dinfo->hardware_channel, | 865 | dinfo->version_gpu, dinfo->memory_size, dinfo->hardware_channel, |
864 | dinfo->nvcore_frequency/1000000, dinfo->memory_frequency/1000000); | 866 | dinfo->nvcore_frequency/1000000, dinfo->memory_frequency/1000000); |
865 | 867 | ||
866 | if (dinfo->version_driver != GPU_DRIVER_INFO_VERSION) { | 868 | if (dinfo->version_driver != GPU_DRIVER_INFO_VERSION) { |
867 | printk(KERN_ERR "%s: version_driver err:%x\n", __func__, | 869 | dev_err(dev, "%s: version_driver err:%x\n", __func__, |
868 | dinfo->version_driver); | 870 | dinfo->version_driver); |
869 | return -EINVAL; | 871 | return -EINVAL; |
870 | } | 872 | } |
871 | 873 | ||
872 | error = ps3_irq_plug_setup(PS3_BINDING_CPU_ANY, dinfo->irq.irq_outlet, | 874 | error = ps3_irq_plug_setup(PS3_BINDING_CPU_ANY, dinfo->irq.irq_outlet, |
873 | &ps3fb.irq_no); | 875 | &ps3fb.irq_no); |
874 | if (error) { | 876 | if (error) { |
875 | printk(KERN_ERR "%s: ps3_alloc_irq failed %d\n", __func__, | 877 | dev_err(dev, "%s: ps3_alloc_irq failed %d\n", __func__, error); |
876 | error); | ||
877 | return error; | 878 | return error; |
878 | } | 879 | } |
879 | 880 | ||
880 | error = request_irq(ps3fb.irq_no, ps3fb_vsync_interrupt, IRQF_DISABLED, | 881 | error = request_irq(ps3fb.irq_no, ps3fb_vsync_interrupt, IRQF_DISABLED, |
881 | DEVICE_NAME, dev); | 882 | DEVICE_NAME, dev); |
882 | if (error) { | 883 | if (error) { |
883 | printk(KERN_ERR "%s: request_irq failed %d\n", __func__, | 884 | dev_err(dev, "%s: request_irq failed %d\n", __func__, error); |
884 | error); | ||
885 | ps3_irq_plug_destroy(ps3fb.irq_no); | 885 | ps3_irq_plug_destroy(ps3fb.irq_no); |
886 | return error; | 886 | return error; |
887 | } | 887 | } |
@@ -891,18 +891,19 @@ static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, | |||
891 | return 0; | 891 | return 0; |
892 | } | 892 | } |
893 | 893 | ||
894 | static int ps3fb_xdr_settings(u64 xdr_lpar) | 894 | static int ps3fb_xdr_settings(u64 xdr_lpar, struct device *dev) |
895 | { | 895 | { |
896 | int status; | 896 | int status; |
897 | 897 | ||
898 | status = lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF, | 898 | status = lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF, |
899 | xdr_lpar, ps3fb_videomemory.size, 0); | 899 | xdr_lpar, ps3fb_videomemory.size, 0); |
900 | if (status) { | 900 | if (status) { |
901 | printk(KERN_ERR "%s: lv1_gpu_context_iomap failed: %d\n", | 901 | dev_err(dev, "%s: lv1_gpu_context_iomap failed: %d\n", |
902 | __func__, status); | 902 | __func__, status); |
903 | return -ENXIO; | 903 | return -ENXIO; |
904 | } | 904 | } |
905 | DPRINTK("video:%p xdr_ea:%p ioif:%lx lpar:%lx phys:%lx size:%lx\n", | 905 | dev_dbg(dev, |
906 | "video:%p xdr_ea:%p ioif:%lx lpar:%lx phys:%lx size:%lx\n", | ||
906 | ps3fb_videomemory.address, ps3fb.xdr_ea, GPU_IOIF, xdr_lpar, | 907 | ps3fb_videomemory.address, ps3fb.xdr_ea, GPU_IOIF, xdr_lpar, |
907 | virt_to_abs(ps3fb.xdr_ea), ps3fb_videomemory.size); | 908 | virt_to_abs(ps3fb.xdr_ea), ps3fb_videomemory.size); |
908 | 909 | ||
@@ -911,9 +912,9 @@ static int ps3fb_xdr_settings(u64 xdr_lpar) | |||
911 | xdr_lpar, ps3fb_videomemory.size, | 912 | xdr_lpar, ps3fb_videomemory.size, |
912 | GPU_IOIF, 0); | 913 | GPU_IOIF, 0); |
913 | if (status) { | 914 | if (status) { |
914 | printk(KERN_ERR | 915 | dev_err(dev, |
915 | "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", | 916 | "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", |
916 | __func__, status); | 917 | __func__, status); |
917 | return -ENXIO; | 918 | return -ENXIO; |
918 | } | 919 | } |
919 | return 0; | 920 | return 0; |
@@ -943,7 +944,7 @@ static struct fb_fix_screeninfo ps3fb_fix __initdata = { | |||
943 | .accel = FB_ACCEL_NONE, | 944 | .accel = FB_ACCEL_NONE, |
944 | }; | 945 | }; |
945 | 946 | ||
946 | static int ps3fb_set_sync(void) | 947 | static int ps3fb_set_sync(struct device *dev) |
947 | { | 948 | { |
948 | int status; | 949 | int status; |
949 | 950 | ||
@@ -952,8 +953,10 @@ static int ps3fb_set_sync(void) | |||
952 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC, | 953 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC, |
953 | 0, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0); | 954 | 0, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0); |
954 | if (status) { | 955 | if (status) { |
955 | printk(KERN_ERR "%s: lv1_gpu_context_attribute DISPLAY_SYNC " | 956 | dev_err(dev, |
956 | "failed: %d\n", __func__, status); | 957 | "%s: lv1_gpu_context_attribute DISPLAY_SYNC failed: " |
958 | "%d\n", | ||
959 | __func__, status); | ||
957 | return -1; | 960 | return -1; |
958 | } | 961 | } |
959 | #endif | 962 | #endif |
@@ -963,8 +966,10 @@ static int ps3fb_set_sync(void) | |||
963 | 1, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0); | 966 | 1, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0); |
964 | 967 | ||
965 | if (status) { | 968 | if (status) { |
966 | printk(KERN_ERR "%s: lv1_gpu_context_attribute DISPLAY_MODE " | 969 | dev_err(dev, |
967 | "failed: %d\n", __func__, status); | 970 | "%s: lv1_gpu_context_attribute DISPLAY_SYNC failed: " |
971 | "%d\n", | ||
972 | __func__, status); | ||
968 | return -1; | 973 | return -1; |
969 | } | 974 | } |
970 | #endif | 975 | #endif |
@@ -988,18 +993,19 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
988 | 993 | ||
989 | status = ps3_open_hv_device(dev); | 994 | status = ps3_open_hv_device(dev); |
990 | if (status) { | 995 | if (status) { |
991 | printk(KERN_ERR "%s: ps3_open_hv_device failed\n", __func__); | 996 | dev_err(&dev->core, "%s: ps3_open_hv_device failed\n", |
997 | __func__); | ||
992 | goto err; | 998 | goto err; |
993 | } | 999 | } |
994 | 1000 | ||
995 | if (!ps3fb_mode) | 1001 | if (!ps3fb_mode) |
996 | ps3fb_mode = ps3av_get_mode(); | 1002 | ps3fb_mode = ps3av_get_mode(); |
997 | DPRINTK("ps3av_mode:%d\n", ps3fb_mode); | 1003 | dev_dbg(&dev->core, "ps3av_mode:%d\n", ps3fb_mode); |
998 | 1004 | ||
999 | if (ps3fb_mode > 0 && | 1005 | if (ps3fb_mode > 0 && |
1000 | !ps3av_video_mode2res(ps3fb_mode, &xres, &yres)) { | 1006 | !ps3av_video_mode2res(ps3fb_mode, &xres, &yres)) { |
1001 | ps3fb.res_index = ps3fb_get_res_table(xres, yres, ps3fb_mode); | 1007 | ps3fb.res_index = ps3fb_get_res_table(xres, yres, ps3fb_mode); |
1002 | DPRINTK("res_index:%d\n", ps3fb.res_index); | 1008 | dev_dbg(&dev->core, "res_index:%d\n", ps3fb.res_index); |
1003 | } else | 1009 | } else |
1004 | ps3fb.res_index = GPU_RES_INDEX; | 1010 | ps3fb.res_index = GPU_RES_INDEX; |
1005 | 1011 | ||
@@ -1008,43 +1014,44 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1008 | init_waitqueue_head(&ps3fb.wait_vsync); | 1014 | init_waitqueue_head(&ps3fb.wait_vsync); |
1009 | ps3fb.num_frames = 1; | 1015 | ps3fb.num_frames = 1; |
1010 | 1016 | ||
1011 | ps3fb_set_sync(); | 1017 | ps3fb_set_sync(&dev->core); |
1012 | 1018 | ||
1013 | /* get gpu context handle */ | 1019 | /* get gpu context handle */ |
1014 | status = lv1_gpu_memory_allocate(DDR_SIZE, 0, 0, 0, 0, | 1020 | status = lv1_gpu_memory_allocate(DDR_SIZE, 0, 0, 0, 0, |
1015 | &ps3fb.memory_handle, &ddr_lpar); | 1021 | &ps3fb.memory_handle, &ddr_lpar); |
1016 | if (status) { | 1022 | if (status) { |
1017 | printk(KERN_ERR "%s: lv1_gpu_memory_allocate failed: %d\n", | 1023 | dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n", |
1018 | __func__, status); | 1024 | __func__, status); |
1019 | goto err; | 1025 | goto err; |
1020 | } | 1026 | } |
1021 | DPRINTK("ddr:lpar:0x%lx\n", ddr_lpar); | 1027 | dev_dbg(&dev->core, "ddr:lpar:0x%lx\n", ddr_lpar); |
1022 | 1028 | ||
1023 | status = lv1_gpu_context_allocate(ps3fb.memory_handle, 0, | 1029 | status = lv1_gpu_context_allocate(ps3fb.memory_handle, 0, |
1024 | &ps3fb.context_handle, | 1030 | &ps3fb.context_handle, |
1025 | &lpar_dma_control, &lpar_driver_info, | 1031 | &lpar_dma_control, &lpar_driver_info, |
1026 | &lpar_reports, &lpar_reports_size); | 1032 | &lpar_reports, &lpar_reports_size); |
1027 | if (status) { | 1033 | if (status) { |
1028 | printk(KERN_ERR "%s: lv1_gpu_context_attribute failed: %d\n", | 1034 | dev_err(&dev->core, |
1029 | __func__, status); | 1035 | "%s: lv1_gpu_context_attribute failed: %d\n", __func__, |
1036 | status); | ||
1030 | goto err_gpu_memory_free; | 1037 | goto err_gpu_memory_free; |
1031 | } | 1038 | } |
1032 | 1039 | ||
1033 | /* vsync interrupt */ | 1040 | /* vsync interrupt */ |
1034 | ps3fb.dinfo = ioremap(lpar_driver_info, 128 * 1024); | 1041 | ps3fb.dinfo = ioremap(lpar_driver_info, 128 * 1024); |
1035 | if (!ps3fb.dinfo) { | 1042 | if (!ps3fb.dinfo) { |
1036 | printk(KERN_ERR "%s: ioremap failed\n", __func__); | 1043 | dev_err(&dev->core, "%s: ioremap failed\n", __func__); |
1037 | goto err_gpu_context_free; | 1044 | goto err_gpu_context_free; |
1038 | } | 1045 | } |
1039 | 1046 | ||
1040 | retval = ps3fb_vsync_settings(ps3fb.dinfo, dev); | 1047 | retval = ps3fb_vsync_settings(ps3fb.dinfo, &dev->core); |
1041 | if (retval) | 1048 | if (retval) |
1042 | goto err_iounmap_dinfo; | 1049 | goto err_iounmap_dinfo; |
1043 | 1050 | ||
1044 | /* xdr frame buffer */ | 1051 | /* xdr frame buffer */ |
1045 | ps3fb.xdr_ea = ps3fb_videomemory.address; | 1052 | ps3fb.xdr_ea = ps3fb_videomemory.address; |
1046 | xdr_lpar = ps3_mm_phys_to_lpar(__pa(ps3fb.xdr_ea)); | 1053 | xdr_lpar = ps3_mm_phys_to_lpar(__pa(ps3fb.xdr_ea)); |
1047 | retval = ps3fb_xdr_settings(xdr_lpar); | 1054 | retval = ps3fb_xdr_settings(xdr_lpar, &dev->core); |
1048 | if (retval) | 1055 | if (retval) |
1049 | goto err_free_irq; | 1056 | goto err_free_irq; |
1050 | 1057 | ||
@@ -1087,9 +1094,9 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1087 | 1094 | ||
1088 | dev->core.driver_data = info; | 1095 | dev->core.driver_data = info; |
1089 | 1096 | ||
1090 | printk(KERN_INFO | 1097 | dev_info(info->device, "%s %s, using %lu KiB of video memory\n", |
1091 | "fb%d: PS3 frame buffer device, using %ld KiB of video memory\n", | 1098 | dev_driver_string(info->dev), info->dev->bus_id, |
1092 | info->node, ps3fb_videomemory.size >> 10); | 1099 | ps3fb_videomemory.size >> 10); |
1093 | 1100 | ||
1094 | task = kthread_run(ps3fbd, info, DEVICE_NAME); | 1101 | task = kthread_run(ps3fbd, info, DEVICE_NAME); |
1095 | if (IS_ERR(task)) { | 1102 | if (IS_ERR(task)) { |
@@ -1126,7 +1133,7 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev) | |||
1126 | int status; | 1133 | int status; |
1127 | struct fb_info *info = dev->core.driver_data; | 1134 | struct fb_info *info = dev->core.driver_data; |
1128 | 1135 | ||
1129 | DPRINTK(" -> %s:%d\n", __func__, __LINE__); | 1136 | dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__); |
1130 | 1137 | ||
1131 | ps3fb_flip_ctl(0, &ps3fb); /* flip off */ | 1138 | ps3fb_flip_ctl(0, &ps3fb); /* flip off */ |
1132 | ps3fb.dinfo->irq.mask = 0; | 1139 | ps3fb.dinfo->irq.mask = 0; |
@@ -1151,14 +1158,16 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev) | |||
1151 | 1158 | ||
1152 | status = lv1_gpu_context_free(ps3fb.context_handle); | 1159 | status = lv1_gpu_context_free(ps3fb.context_handle); |
1153 | if (status) | 1160 | if (status) |
1154 | DPRINTK("lv1_gpu_context_free failed: %d\n", status); | 1161 | dev_dbg(&dev->core, "lv1_gpu_context_free failed: %d\n", |
1162 | status); | ||
1155 | 1163 | ||
1156 | status = lv1_gpu_memory_free(ps3fb.memory_handle); | 1164 | status = lv1_gpu_memory_free(ps3fb.memory_handle); |
1157 | if (status) | 1165 | if (status) |
1158 | DPRINTK("lv1_gpu_memory_free failed: %d\n", status); | 1166 | dev_dbg(&dev->core, "lv1_gpu_memory_free failed: %d\n", |
1167 | status); | ||
1159 | 1168 | ||
1160 | ps3_close_hv_device(dev); | 1169 | ps3_close_hv_device(dev); |
1161 | DPRINTK(" <- %s:%d\n", __func__, __LINE__); | 1170 | dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__); |
1162 | 1171 | ||
1163 | return 0; | 1172 | return 0; |
1164 | } | 1173 | } |
@@ -1211,9 +1220,9 @@ static int __init ps3fb_init(void) | |||
1211 | 1220 | ||
1212 | static void __exit ps3fb_exit(void) | 1221 | static void __exit ps3fb_exit(void) |
1213 | { | 1222 | { |
1214 | DPRINTK(" -> %s:%d\n", __func__, __LINE__); | 1223 | pr_debug(" -> %s:%d\n", __func__, __LINE__); |
1215 | ps3_system_bus_driver_unregister(&ps3fb_driver); | 1224 | ps3_system_bus_driver_unregister(&ps3fb_driver); |
1216 | DPRINTK(" <- %s:%d\n", __func__, __LINE__); | 1225 | pr_debug(" <- %s:%d\n", __func__, __LINE__); |
1217 | } | 1226 | } |
1218 | 1227 | ||
1219 | module_init(ps3fb_init); | 1228 | module_init(ps3fb_init); |