diff options
Diffstat (limited to 'drivers/video/kyro/fbdev.c')
-rw-r--r-- | drivers/video/kyro/fbdev.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c index 5eb4d5c177bd..bcd359b6d4ff 100644 --- a/drivers/video/kyro/fbdev.c +++ b/drivers/video/kyro/fbdev.c | |||
@@ -73,8 +73,6 @@ static struct fb_var_screeninfo kyro_var __devinitdata = { | |||
73 | .vmode = FB_VMODE_NONINTERLACED, | 73 | .vmode = FB_VMODE_NONINTERLACED, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | static struct kyrofb_info *currentpar; | ||
77 | |||
78 | typedef struct { | 76 | typedef struct { |
79 | STG4000REG __iomem *pSTGReg; /* Virtual address of PCI register region */ | 77 | STG4000REG __iomem *pSTGReg; /* Virtual address of PCI register region */ |
80 | u32 ulNextFreeVidMem; /* Offset from start of vid mem to next free region */ | 78 | u32 ulNextFreeVidMem; /* Offset from start of vid mem to next free region */ |
@@ -309,7 +307,7 @@ enum { | |||
309 | /* Accessors */ | 307 | /* Accessors */ |
310 | static int kyro_dev_video_mode_set(struct fb_info *info) | 308 | static int kyro_dev_video_mode_set(struct fb_info *info) |
311 | { | 309 | { |
312 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 310 | struct kyrofb_info *par = info->par; |
313 | 311 | ||
314 | /* Turn off display */ | 312 | /* Turn off display */ |
315 | StopVTG(deviceInfo.pSTGReg); | 313 | StopVTG(deviceInfo.pSTGReg); |
@@ -402,7 +400,7 @@ static inline unsigned long get_line_length(int x, int bpp) | |||
402 | 400 | ||
403 | static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 401 | static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
404 | { | 402 | { |
405 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 403 | struct kyrofb_info *par = info->par; |
406 | 404 | ||
407 | if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) { | 405 | if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) { |
408 | printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel); | 406 | printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel); |
@@ -478,7 +476,7 @@ static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
478 | 476 | ||
479 | static int kyrofb_set_par(struct fb_info *info) | 477 | static int kyrofb_set_par(struct fb_info *info) |
480 | { | 478 | { |
481 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 479 | struct kyrofb_info *par = info->par; |
482 | unsigned long lineclock; | 480 | unsigned long lineclock; |
483 | unsigned long frameclock; | 481 | unsigned long frameclock; |
484 | 482 | ||
@@ -536,20 +534,22 @@ static int kyrofb_set_par(struct fb_info *info) | |||
536 | static int kyrofb_setcolreg(u_int regno, u_int red, u_int green, | 534 | static int kyrofb_setcolreg(u_int regno, u_int red, u_int green, |
537 | u_int blue, u_int transp, struct fb_info *info) | 535 | u_int blue, u_int transp, struct fb_info *info) |
538 | { | 536 | { |
537 | struct kyrofb_info *par = info->par; | ||
538 | |||
539 | if (regno > 255) | 539 | if (regno > 255) |
540 | return 1; /* Invalid register */ | 540 | return 1; /* Invalid register */ |
541 | 541 | ||
542 | if (regno < 16) { | 542 | if (regno < 16) { |
543 | switch (info->var.bits_per_pixel) { | 543 | switch (info->var.bits_per_pixel) { |
544 | case 16: | 544 | case 16: |
545 | ((u16*)(info->pseudo_palette))[regno] = | 545 | par->palette[regno] = |
546 | (red & 0xf800) | | 546 | (red & 0xf800) | |
547 | ((green & 0xfc00) >> 5) | | 547 | ((green & 0xfc00) >> 5) | |
548 | ((blue & 0xf800) >> 11); | 548 | ((blue & 0xf800) >> 11); |
549 | break; | 549 | break; |
550 | case 32: | 550 | case 32: |
551 | red >>= 8; green >>= 8; blue >>= 8; transp >>= 8; | 551 | red >>= 8; green >>= 8; blue >>= 8; transp >>= 8; |
552 | ((u32*)(info->pseudo_palette))[regno] = | 552 | par->palette[regno] = |
553 | (transp << 24) | (red << 16) | (green << 8) | blue; | 553 | (transp << 24) | (red << 16) | (green << 8) | blue; |
554 | break; | 554 | break; |
555 | } | 555 | } |
@@ -675,6 +675,7 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
675 | const struct pci_device_id *ent) | 675 | const struct pci_device_id *ent) |
676 | { | 676 | { |
677 | struct fb_info *info; | 677 | struct fb_info *info; |
678 | struct kyrofb_info *currentpar; | ||
678 | unsigned long size; | 679 | unsigned long size; |
679 | int err; | 680 | int err; |
680 | 681 | ||
@@ -683,14 +684,11 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
683 | return err; | 684 | return err; |
684 | } | 685 | } |
685 | 686 | ||
686 | size = sizeof(struct fb_info) + sizeof(struct kyrofb_info) + 16 * sizeof(u32); | 687 | info = framebuffer_alloc(sizeof(struct kyrofb_info), &pdev->dev); |
687 | info = kmalloc(size, GFP_KERNEL); | ||
688 | if (!info) | 688 | if (!info) |
689 | return -ENOMEM; | 689 | return -ENOMEM; |
690 | 690 | ||
691 | memset(info, 0, size); | 691 | currentpar = info->par; |
692 | |||
693 | currentpar = (struct kyrofb_info *)(info + 1); | ||
694 | 692 | ||
695 | kyro_fix.smem_start = pci_resource_start(pdev, 0); | 693 | kyro_fix.smem_start = pci_resource_start(pdev, 0); |
696 | kyro_fix.smem_len = pci_resource_len(pdev, 0); | 694 | kyro_fix.smem_len = pci_resource_len(pdev, 0); |
@@ -716,8 +714,7 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
716 | 714 | ||
717 | info->fbops = &kyrofb_ops; | 715 | info->fbops = &kyrofb_ops; |
718 | info->fix = kyro_fix; | 716 | info->fix = kyro_fix; |
719 | info->par = currentpar; | 717 | info->pseudo_palette = currentpar->palette; |
720 | info->pseudo_palette = (void *)(currentpar + 1); | ||
721 | info->flags = FBINFO_DEFAULT; | 718 | info->flags = FBINFO_DEFAULT; |
722 | 719 | ||
723 | SetCoreClockPLL(deviceInfo.pSTGReg, pdev); | 720 | SetCoreClockPLL(deviceInfo.pSTGReg, pdev); |
@@ -741,7 +738,6 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
741 | 738 | ||
742 | fb_memset(info->screen_base, 0, size); | 739 | fb_memset(info->screen_base, 0, size); |
743 | 740 | ||
744 | info->device = &pdev->dev; | ||
745 | if (register_framebuffer(info) < 0) | 741 | if (register_framebuffer(info) < 0) |
746 | goto out_unmap; | 742 | goto out_unmap; |
747 | 743 | ||
@@ -757,7 +753,7 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
757 | out_unmap: | 753 | out_unmap: |
758 | iounmap(currentpar->regbase); | 754 | iounmap(currentpar->regbase); |
759 | iounmap(info->screen_base); | 755 | iounmap(info->screen_base); |
760 | kfree(info); | 756 | framebuffer_release(info); |
761 | 757 | ||
762 | return -EINVAL; | 758 | return -EINVAL; |
763 | } | 759 | } |
@@ -765,7 +761,7 @@ out_unmap: | |||
765 | static void __devexit kyrofb_remove(struct pci_dev *pdev) | 761 | static void __devexit kyrofb_remove(struct pci_dev *pdev) |
766 | { | 762 | { |
767 | struct fb_info *info = pci_get_drvdata(pdev); | 763 | struct fb_info *info = pci_get_drvdata(pdev); |
768 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 764 | struct kyrofb_info *par = info->par; |
769 | 765 | ||
770 | /* Reset the board */ | 766 | /* Reset the board */ |
771 | StopVTG(deviceInfo.pSTGReg); | 767 | StopVTG(deviceInfo.pSTGReg); |
@@ -789,7 +785,7 @@ static void __devexit kyrofb_remove(struct pci_dev *pdev) | |||
789 | 785 | ||
790 | unregister_framebuffer(info); | 786 | unregister_framebuffer(info); |
791 | pci_set_drvdata(pdev, NULL); | 787 | pci_set_drvdata(pdev, NULL); |
792 | kfree(info); | 788 | framebuffer_release(info); |
793 | } | 789 | } |
794 | 790 | ||
795 | static int __init kyrofb_init(void) | 791 | static int __init kyrofb_init(void) |