diff options
Diffstat (limited to 'drivers/video/s3c2410fb.c')
-rw-r--r-- | drivers/video/s3c2410fb.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index f10310178e3e..f7a026fa5079 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -119,15 +119,14 @@ static int debug = 0; | |||
119 | * | 119 | * |
120 | * initialise lcd controller address pointers | 120 | * initialise lcd controller address pointers |
121 | */ | 121 | */ |
122 | static void s3c2410fb_set_lcdaddr(struct s3c2410fb_info *fbi) | 122 | static void s3c2410fb_set_lcdaddr(struct fb_info *info) |
123 | { | 123 | { |
124 | struct fb_var_screeninfo *var = &fbi->fb->var; | ||
125 | unsigned long saddr1, saddr2, saddr3; | 124 | unsigned long saddr1, saddr2, saddr3; |
126 | int line_length = var->xres * var->bits_per_pixel; | 125 | int line_length = info->var.xres * info->var.bits_per_pixel; |
127 | 126 | ||
128 | saddr1 = fbi->fb->fix.smem_start >> 1; | 127 | saddr1 = info->fix.smem_start >> 1; |
129 | saddr2 = fbi->fb->fix.smem_start; | 128 | saddr2 = info->fix.smem_start; |
130 | saddr2 += (line_length * var->yres) / 8; | 129 | saddr2 += (line_length * info->var.yres) / 8; |
131 | saddr2 >>= 1; | 130 | saddr2 >>= 1; |
132 | 131 | ||
133 | saddr3 = S3C2410_OFFSIZE(0) | | 132 | saddr3 = S3C2410_OFFSIZE(0) | |
@@ -275,9 +274,10 @@ static int s3c2410fb_check_var(struct fb_var_screeninfo *var, | |||
275 | * activate (set) the controller from the given framebuffer | 274 | * activate (set) the controller from the given framebuffer |
276 | * information | 275 | * information |
277 | */ | 276 | */ |
278 | static void s3c2410fb_activate_var(struct s3c2410fb_info *fbi, | 277 | static void s3c2410fb_activate_var(struct fb_info *info, |
279 | struct fb_var_screeninfo *var) | 278 | struct fb_var_screeninfo *var) |
280 | { | 279 | { |
280 | struct s3c2410fb_info *fbi = info->par; | ||
281 | int hs; | 281 | int hs; |
282 | 282 | ||
283 | fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_MODEMASK; | 283 | fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_MODEMASK; |
@@ -418,7 +418,7 @@ static void s3c2410fb_activate_var(struct s3c2410fb_info *fbi, | |||
418 | writel(fbi->regs.lcdcon5, S3C2410_LCDCON5); | 418 | writel(fbi->regs.lcdcon5, S3C2410_LCDCON5); |
419 | 419 | ||
420 | /* set lcd address pointers */ | 420 | /* set lcd address pointers */ |
421 | s3c2410fb_set_lcdaddr(fbi); | 421 | s3c2410fb_set_lcdaddr(info); |
422 | 422 | ||
423 | writel(fbi->regs.lcdcon1, S3C2410_LCDCON1); | 423 | writel(fbi->regs.lcdcon1, S3C2410_LCDCON1); |
424 | } | 424 | } |
@@ -430,7 +430,6 @@ static void s3c2410fb_activate_var(struct s3c2410fb_info *fbi, | |||
430 | */ | 430 | */ |
431 | static int s3c2410fb_set_par(struct fb_info *info) | 431 | static int s3c2410fb_set_par(struct fb_info *info) |
432 | { | 432 | { |
433 | struct s3c2410fb_info *fbi = info->par; | ||
434 | struct fb_var_screeninfo *var = &info->var; | 433 | struct fb_var_screeninfo *var = &info->var; |
435 | 434 | ||
436 | switch (var->bits_per_pixel) { | 435 | switch (var->bits_per_pixel) { |
@@ -449,7 +448,7 @@ static int s3c2410fb_set_par(struct fb_info *info) | |||
449 | 448 | ||
450 | /* activate this new configuration */ | 449 | /* activate this new configuration */ |
451 | 450 | ||
452 | s3c2410fb_activate_var(fbi, var); | 451 | s3c2410fb_activate_var(info, var); |
453 | return 0; | 452 | return 0; |
454 | } | 453 | } |
455 | 454 | ||
@@ -615,15 +614,17 @@ static struct fb_ops s3c2410fb_ops = { | |||
615 | * cache. Once this area is remapped, all virtual memory | 614 | * cache. Once this area is remapped, all virtual memory |
616 | * access to the video memory should occur at the new region. | 615 | * access to the video memory should occur at the new region. |
617 | */ | 616 | */ |
618 | static int __init s3c2410fb_map_video_memory(struct s3c2410fb_info *fbi) | 617 | static int __init s3c2410fb_map_video_memory(struct fb_info *info) |
619 | { | 618 | { |
619 | struct s3c2410fb_info *fbi = info->par; | ||
620 | |||
620 | dprintk("map_video_memory(fbi=%p)\n", fbi); | 621 | dprintk("map_video_memory(fbi=%p)\n", fbi); |
621 | 622 | ||
622 | fbi->map_size = PAGE_ALIGN(fbi->fb->fix.smem_len + PAGE_SIZE); | 623 | fbi->map_size = PAGE_ALIGN(info->fix.smem_len + PAGE_SIZE); |
623 | fbi->map_cpu = dma_alloc_writecombine(fbi->dev, fbi->map_size, | 624 | fbi->map_cpu = dma_alloc_writecombine(fbi->dev, fbi->map_size, |
624 | &fbi->map_dma, GFP_KERNEL); | 625 | &fbi->map_dma, GFP_KERNEL); |
625 | 626 | ||
626 | fbi->map_size = fbi->fb->fix.smem_len; | 627 | fbi->map_size = info->fix.smem_len; |
627 | 628 | ||
628 | if (fbi->map_cpu) { | 629 | if (fbi->map_cpu) { |
629 | /* prevent initial garbage on screen */ | 630 | /* prevent initial garbage on screen */ |
@@ -632,11 +633,11 @@ static int __init s3c2410fb_map_video_memory(struct s3c2410fb_info *fbi) | |||
632 | memset(fbi->map_cpu, 0xf0, fbi->map_size); | 633 | memset(fbi->map_cpu, 0xf0, fbi->map_size); |
633 | 634 | ||
634 | fbi->screen_dma = fbi->map_dma; | 635 | fbi->screen_dma = fbi->map_dma; |
635 | fbi->fb->screen_base = fbi->map_cpu; | 636 | info->screen_base = fbi->map_cpu; |
636 | fbi->fb->fix.smem_start = fbi->screen_dma; | 637 | info->fix.smem_start = fbi->screen_dma; |
637 | 638 | ||
638 | dprintk("map_video_memory: dma=%08x cpu=%p size=%08x\n", | 639 | dprintk("map_video_memory: dma=%08x cpu=%p size=%08x\n", |
639 | fbi->map_dma, fbi->map_cpu, fbi->fb->fix.smem_len); | 640 | fbi->map_dma, fbi->map_cpu, info->fix.smem_len); |
640 | } | 641 | } |
641 | 642 | ||
642 | return fbi->map_cpu ? 0 : -ENOMEM; | 643 | return fbi->map_cpu ? 0 : -ENOMEM; |
@@ -660,8 +661,9 @@ static inline void modify_gpio(void __iomem *reg, | |||
660 | /* | 661 | /* |
661 | * s3c2410fb_init_registers - Initialise all LCD-related registers | 662 | * s3c2410fb_init_registers - Initialise all LCD-related registers |
662 | */ | 663 | */ |
663 | static int s3c2410fb_init_registers(struct s3c2410fb_info *fbi) | 664 | static int s3c2410fb_init_registers(struct fb_info *info) |
664 | { | 665 | { |
666 | struct s3c2410fb_info *fbi = info->par; | ||
665 | unsigned long flags; | 667 | unsigned long flags; |
666 | void __iomem *regs = fbi->io; | 668 | void __iomem *regs = fbi->io; |
667 | 669 | ||
@@ -684,7 +686,7 @@ static int s3c2410fb_init_registers(struct s3c2410fb_info *fbi) | |||
684 | writel(fbi->regs.lcdcon4, regs + S3C2410_LCDCON4); | 686 | writel(fbi->regs.lcdcon4, regs + S3C2410_LCDCON4); |
685 | writel(fbi->regs.lcdcon5, regs + S3C2410_LCDCON5); | 687 | writel(fbi->regs.lcdcon5, regs + S3C2410_LCDCON5); |
686 | 688 | ||
687 | s3c2410fb_set_lcdaddr(fbi); | 689 | s3c2410fb_set_lcdaddr(info); |
688 | 690 | ||
689 | dprintk("LPCSEL = 0x%08lx\n", mach_info->lpcsel); | 691 | dprintk("LPCSEL = 0x%08lx\n", mach_info->lpcsel); |
690 | writel(mach_info->lpcsel, regs + S3C2410_LPCSEL); | 692 | writel(mach_info->lpcsel, regs + S3C2410_LPCSEL); |
@@ -777,7 +779,6 @@ static int __init s3c2410fb_probe(struct platform_device *pdev) | |||
777 | return -ENOMEM; | 779 | return -ENOMEM; |
778 | 780 | ||
779 | info = fbinfo->par; | 781 | info = fbinfo->par; |
780 | info->fb = fbinfo; | ||
781 | info->dev = &pdev->dev; | 782 | info->dev = &pdev->dev; |
782 | 783 | ||
783 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 784 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -890,7 +891,7 @@ static int __init s3c2410fb_probe(struct platform_device *pdev) | |||
890 | msleep(1); | 891 | msleep(1); |
891 | 892 | ||
892 | /* Initialize video memory */ | 893 | /* Initialize video memory */ |
893 | ret = s3c2410fb_map_video_memory(info); | 894 | ret = s3c2410fb_map_video_memory(fbinfo); |
894 | if (ret) { | 895 | if (ret) { |
895 | printk(KERN_ERR "Failed to allocate video RAM: %d\n", ret); | 896 | printk(KERN_ERR "Failed to allocate video RAM: %d\n", ret); |
896 | ret = -ENOMEM; | 897 | ret = -ENOMEM; |
@@ -899,7 +900,7 @@ static int __init s3c2410fb_probe(struct platform_device *pdev) | |||
899 | 900 | ||
900 | dprintk("got video memory\n"); | 901 | dprintk("got video memory\n"); |
901 | 902 | ||
902 | s3c2410fb_init_registers(info); | 903 | s3c2410fb_init_registers(fbinfo); |
903 | 904 | ||
904 | s3c2410fb_check_var(&fbinfo->var, fbinfo); | 905 | s3c2410fb_check_var(&fbinfo->var, fbinfo); |
905 | 906 | ||