aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/bf54x-lq043fb.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-03-22 13:23:46 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-03-22 13:23:46 -0400
commit74511020dde10252f8b8e648690d99dba721de14 (patch)
tree04fc22bc7dd5d5b8d9294b2e57985b093858bd84 /drivers/video/bf54x-lq043fb.c
parent69266866a5790080d7fe80094b28d670ff8aa765 (diff)
parent3cc4e53f86dab635166929bfa47cc68d59b28c26 (diff)
Merge branch 'for-2.6.34' into for-2.6.35
Diffstat (limited to 'drivers/video/bf54x-lq043fb.c')
-rw-r--r--drivers/video/bf54x-lq043fb.c49
1 files changed, 14 insertions, 35 deletions
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c
index e49ae5edcc00..23b2a8c0dbfc 100644
--- a/drivers/video/bf54x-lq043fb.c
+++ b/drivers/video/bf54x-lq043fb.c
@@ -82,7 +82,6 @@ struct bfin_bf54xfb_info {
82 unsigned char *fb_buffer; /* RGB Buffer */ 82 unsigned char *fb_buffer; /* RGB Buffer */
83 83
84 dma_addr_t dma_handle; 84 dma_addr_t dma_handle;
85 int lq043_mmap;
86 int lq043_open_cnt; 85 int lq043_open_cnt;
87 int irq; 86 int irq;
88 spinlock_t lock; /* lock */ 87 spinlock_t lock; /* lock */
@@ -316,7 +315,6 @@ static int bfin_bf54x_fb_release(struct fb_info *info, int user)
316 spin_lock(&fbi->lock); 315 spin_lock(&fbi->lock);
317 316
318 fbi->lq043_open_cnt--; 317 fbi->lq043_open_cnt--;
319 fbi->lq043_mmap = 0;
320 318
321 if (fbi->lq043_open_cnt <= 0) { 319 if (fbi->lq043_open_cnt <= 0) {
322 320
@@ -374,33 +372,6 @@ static int bfin_bf54x_fb_check_var(struct fb_var_screeninfo *var,
374 return 0; 372 return 0;
375} 373}
376 374
377static int bfin_bf54x_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
378{
379
380 struct bfin_bf54xfb_info *fbi = info->par;
381
382 if (fbi->lq043_mmap)
383 return -1;
384
385 spin_lock(&fbi->lock);
386 fbi->lq043_mmap = 1;
387 spin_unlock(&fbi->lock);
388
389 vma->vm_start = (unsigned long)(fbi->fb_buffer);
390
391 vma->vm_end = vma->vm_start + info->fix.smem_len;
392 /* For those who don't understand how mmap works, go read
393 * Documentation/nommu-mmap.txt.
394 * For those that do, you will know that the VM_MAYSHARE flag
395 * must be set in the vma->vm_flags structure on noMMU
396 * Other flags can be set, and are documented in
397 * include/linux/mm.h
398 */
399 vma->vm_flags |= VM_MAYSHARE | VM_SHARED;
400
401 return 0;
402}
403
404int bfin_bf54x_fb_cursor(struct fb_info *info, struct fb_cursor *cursor) 375int bfin_bf54x_fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
405{ 376{
406 if (nocursor) 377 if (nocursor)
@@ -452,7 +423,6 @@ static struct fb_ops bfin_bf54x_fb_ops = {
452 .fb_fillrect = cfb_fillrect, 423 .fb_fillrect = cfb_fillrect,
453 .fb_copyarea = cfb_copyarea, 424 .fb_copyarea = cfb_copyarea,
454 .fb_imageblit = cfb_imageblit, 425 .fb_imageblit = cfb_imageblit,
455 .fb_mmap = bfin_bf54x_fb_mmap,
456 .fb_cursor = bfin_bf54x_fb_cursor, 426 .fb_cursor = bfin_bf54x_fb_cursor,
457 .fb_setcolreg = bfin_bf54x_fb_setcolreg, 427 .fb_setcolreg = bfin_bf54x_fb_setcolreg,
458}; 428};
@@ -463,7 +433,7 @@ static int bl_get_brightness(struct backlight_device *bd)
463 return 0; 433 return 0;
464} 434}
465 435
466static struct backlight_ops bfin_lq043fb_bl_ops = { 436static const struct backlight_ops bfin_lq043fb_bl_ops = {
467 .get_brightness = bl_get_brightness, 437 .get_brightness = bl_get_brightness,
468}; 438};
469 439
@@ -531,6 +501,7 @@ static irqreturn_t bfin_bf54x_irq_error(int irq, void *dev_id)
531 501
532static int __devinit bfin_bf54x_probe(struct platform_device *pdev) 502static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
533{ 503{
504 struct backlight_properties props;
534 struct bfin_bf54xfb_info *info; 505 struct bfin_bf54xfb_info *info;
535 struct fb_info *fbinfo; 506 struct fb_info *fbinfo;
536 int ret; 507 int ret;
@@ -675,10 +646,16 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
675 goto out8; 646 goto out8;
676 } 647 }
677#ifndef NO_BL_SUPPORT 648#ifndef NO_BL_SUPPORT
678 bl_dev = 649 memset(&props, 0, sizeof(struct backlight_properties));
679 backlight_device_register("bf54x-bl", NULL, NULL, 650 props.max_brightness = 255;
680 &bfin_lq043fb_bl_ops); 651 bl_dev = backlight_device_register("bf54x-bl", NULL, NULL,
681 bl_dev->props.max_brightness = 255; 652 &bfin_lq043fb_bl_ops, &props);
653 if (IS_ERR(bl_dev)) {
654 printk(KERN_ERR DRIVER_NAME
655 ": unable to register backlight.\n");
656 ret = -EINVAL;
657 goto out9;
658 }
682 659
683 lcd_dev = lcd_device_register(DRIVER_NAME, &pdev->dev, NULL, &bfin_lcd_ops); 660 lcd_dev = lcd_device_register(DRIVER_NAME, &pdev->dev, NULL, &bfin_lcd_ops);
684 lcd_dev->props.max_contrast = 255, printk(KERN_INFO "Done.\n"); 661 lcd_dev->props.max_contrast = 255, printk(KERN_INFO "Done.\n");
@@ -686,6 +663,8 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
686 663
687 return 0; 664 return 0;
688 665
666out9:
667 unregister_framebuffer(fbinfo);
689out8: 668out8:
690 free_irq(info->irq, info); 669 free_irq(info->irq, info);
691out7: 670out7: