aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/bfin-t350mcqb-fb.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-04-19 12:17:29 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-19 12:17:29 -0400
commitadf6d34e460387ee3e8f1e1875d52bff51212c7d (patch)
tree88ef100143e6184103a608f82dfd232bf6376eaf /drivers/video/bfin-t350mcqb-fb.c
parentd1964dab60ce7c104dd21590e987a8787db18051 (diff)
parent3760d31f11bfbd0ead9eaeb8573e0602437a9d7c (diff)
Merge branch 'omap2-upstream' into devel
Diffstat (limited to 'drivers/video/bfin-t350mcqb-fb.c')
-rw-r--r--drivers/video/bfin-t350mcqb-fb.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c
index a2bb2de9e020..135d6dd7e672 100644
--- a/drivers/video/bfin-t350mcqb-fb.c
+++ b/drivers/video/bfin-t350mcqb-fb.c
@@ -91,6 +91,7 @@ struct bfin_t350mcqbfb_info {
91 int lq043_open_cnt; 91 int lq043_open_cnt;
92 int irq; 92 int irq;
93 spinlock_t lock; /* lock */ 93 spinlock_t lock; /* lock */
94 u32 pseudo_pal[16];
94}; 95};
95 96
96static int nocursor; 97static int nocursor;
@@ -182,13 +183,13 @@ static void bfin_t350mcqb_config_dma(struct bfin_t350mcqbfb_info *fbi)
182 183
183} 184}
184 185
185static int bfin_t350mcqb_request_ports(int action) 186static u16 ppi0_req_8[] = {P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
186{
187 u16 ppi0_req_8[] = {P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
188 P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, 187 P_PPI0_D0, P_PPI0_D1, P_PPI0_D2,
189 P_PPI0_D3, P_PPI0_D4, P_PPI0_D5, 188 P_PPI0_D3, P_PPI0_D4, P_PPI0_D5,
190 P_PPI0_D6, P_PPI0_D7, 0}; 189 P_PPI0_D6, P_PPI0_D7, 0};
191 190
191static int bfin_t350mcqb_request_ports(int action)
192{
192 if (action) { 193 if (action) {
193 if (peripheral_request_list(ppi0_req_8, DRIVER_NAME)) { 194 if (peripheral_request_list(ppi0_req_8, DRIVER_NAME)) {
194 printk(KERN_ERR "Requesting Peripherals faild\n"); 195 printk(KERN_ERR "Requesting Peripherals faild\n");
@@ -301,7 +302,7 @@ static int bfin_t350mcqb_fb_mmap(struct fb_info *info, struct vm_area_struct *vm
301 * Other flags can be set, and are documented in 302 * Other flags can be set, and are documented in
302 * include/linux/mm.h 303 * include/linux/mm.h
303 */ 304 */
304 vma->vm_flags |= VM_MAYSHARE; 305 vma->vm_flags |= VM_MAYSHARE | VM_SHARED;
305 306
306 return 0; 307 return 0;
307} 308}
@@ -520,16 +521,7 @@ static int __init bfin_t350mcqb_probe(struct platform_device *pdev)
520 521
521 fbinfo->fbops = &bfin_t350mcqb_fb_ops; 522 fbinfo->fbops = &bfin_t350mcqb_fb_ops;
522 523
523 fbinfo->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); 524 fbinfo->pseudo_palette = &info->pseudo_pal;
524 if (!fbinfo->pseudo_palette) {
525 printk(KERN_ERR DRIVER_NAME
526 "Fail to allocate pseudo_palette\n");
527
528 ret = -ENOMEM;
529 goto out4;
530 }
531
532 memset(fbinfo->pseudo_palette, 0, sizeof(u32) * 16);
533 525
534 if (fb_alloc_cmap(&fbinfo->cmap, BFIN_LCD_NBR_PALETTE_ENTRIES, 0) 526 if (fb_alloc_cmap(&fbinfo->cmap, BFIN_LCD_NBR_PALETTE_ENTRIES, 0)
535 < 0) { 527 < 0) {
@@ -537,7 +529,7 @@ static int __init bfin_t350mcqb_probe(struct platform_device *pdev)
537 "Fail to allocate colormap (%d entries)\n", 529 "Fail to allocate colormap (%d entries)\n",
538 BFIN_LCD_NBR_PALETTE_ENTRIES); 530 BFIN_LCD_NBR_PALETTE_ENTRIES);
539 ret = -EFAULT; 531 ret = -EFAULT;
540 goto out5; 532 goto out4;
541 } 533 }
542 534
543 if (bfin_t350mcqb_request_ports(1)) { 535 if (bfin_t350mcqb_request_ports(1)) {
@@ -552,11 +544,11 @@ static int __init bfin_t350mcqb_probe(struct platform_device *pdev)
552 goto out7; 544 goto out7;
553 } 545 }
554 546
555 if (request_irq(info->irq, (void *)bfin_t350mcqb_irq_error, IRQF_DISABLED, 547 ret = request_irq(info->irq, bfin_t350mcqb_irq_error, IRQF_DISABLED,
556 "PPI ERROR", info) < 0) { 548 "PPI ERROR", info);
549 if (ret < 0) {
557 printk(KERN_ERR DRIVER_NAME 550 printk(KERN_ERR DRIVER_NAME
558 ": unable to request PPI ERROR IRQ\n"); 551 ": unable to request PPI ERROR IRQ\n");
559 ret = -EFAULT;
560 goto out7; 552 goto out7;
561 } 553 }
562 554
@@ -584,8 +576,6 @@ out7:
584 bfin_t350mcqb_request_ports(0); 576 bfin_t350mcqb_request_ports(0);
585out6: 577out6:
586 fb_dealloc_cmap(&fbinfo->cmap); 578 fb_dealloc_cmap(&fbinfo->cmap);
587out5:
588 kfree(fbinfo->pseudo_palette);
589out4: 579out4:
590 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, 580 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer,
591 info->dma_handle); 581 info->dma_handle);
@@ -605,6 +595,8 @@ static int bfin_t350mcqb_remove(struct platform_device *pdev)
605 struct fb_info *fbinfo = platform_get_drvdata(pdev); 595 struct fb_info *fbinfo = platform_get_drvdata(pdev);
606 struct bfin_t350mcqbfb_info *info = fbinfo->par; 596 struct bfin_t350mcqbfb_info *info = fbinfo->par;
607 597
598 unregister_framebuffer(fbinfo);
599
608 free_dma(CH_PPI); 600 free_dma(CH_PPI);
609 free_irq(info->irq, info); 601 free_irq(info->irq, info);
610 602
@@ -612,7 +604,6 @@ static int bfin_t350mcqb_remove(struct platform_device *pdev)
612 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, 604 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer,
613 info->dma_handle); 605 info->dma_handle);
614 606
615 kfree(fbinfo->pseudo_palette);
616 fb_dealloc_cmap(&fbinfo->cmap); 607 fb_dealloc_cmap(&fbinfo->cmap);
617 608
618#ifndef NO_BL_SUPPORT 609#ifndef NO_BL_SUPPORT
@@ -620,10 +611,11 @@ static int bfin_t350mcqb_remove(struct platform_device *pdev)
620 backlight_device_unregister(bl_dev); 611 backlight_device_unregister(bl_dev);
621#endif 612#endif
622 613
623 unregister_framebuffer(fbinfo);
624
625 bfin_t350mcqb_request_ports(0); 614 bfin_t350mcqb_request_ports(0);
626 615
616 platform_set_drvdata(pdev, NULL);
617 framebuffer_release(fbinfo);
618
627 printk(KERN_INFO DRIVER_NAME ": Unregister LCD driver.\n"); 619 printk(KERN_INFO DRIVER_NAME ": Unregister LCD driver.\n");
628 620
629 return 0; 621 return 0;