diff options
author | Bryan Wu <cooloney@kernel.org> | 2008-03-28 17:16:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-03-28 17:45:22 -0400 |
commit | 7ef9861c7496185e96fb0a3b57ff0b4880876d0a (patch) | |
tree | 1d744f9abe12b807f75f84dbf26f8108b887ecd2 | |
parent | a99acc832de1104afaba02d7c2576fd9b9fd6422 (diff) |
blackfin video driver: update the BF52x EZKIT video framebuffer driver according to LKML review
- Allocate pseudo_palette together with fbinfo
- Code cleanup
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
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>
-rw-r--r-- | drivers/video/bfin-t350mcqb-fb.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c index a2bb2de9e020..f36ca7f6d8a0 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 | ||
96 | static int nocursor; | 97 | static int nocursor; |
@@ -182,13 +183,13 @@ static void bfin_t350mcqb_config_dma(struct bfin_t350mcqbfb_info *fbi) | |||
182 | 183 | ||
183 | } | 184 | } |
184 | 185 | ||
185 | static int bfin_t350mcqb_request_ports(int action) | 186 | static 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 | ||
191 | static 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"); |
@@ -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); |
585 | out6: | 577 | out6: |
586 | fb_dealloc_cmap(&fbinfo->cmap); | 578 | fb_dealloc_cmap(&fbinfo->cmap); |
587 | out5: | ||
588 | kfree(fbinfo->pseudo_palette); | ||
589 | out4: | 579 | out4: |
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; |