diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-03 17:31:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-03 17:31:24 -0400 |
commit | be82ae0238b0453afcf4a76f0512b7dde34ba500 (patch) | |
tree | aaa3f5f11fd51fd73365ee1a2164aad9a03de060 /drivers/video | |
parent | 4b4fd27c0b5ec638a1f06ced9226fd95229dbbf0 (diff) | |
parent | 7b70c4275f28702b76b273c8534c38f8313812e9 (diff) |
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (291 commits)
ARM: AMBA: Add pclk support to AMBA bus infrastructure
ARM: 6278/2: fix regression in RealView after the introduction of pclk
ARM: 6277/1: mach-shmobile: Allow users to select HZ, default to 128
ARM: 6276/1: mach-shmobile: remove duplicate NR_IRQS_LEGACY
ARM: 6246/1: mmci: support larger MMCIDATALENGTH register
ARM: 6245/1: mmci: enable hardware flow control on Ux500 variants
ARM: 6244/1: mmci: add variant data and default MCICLOCK support
ARM: 6243/1: mmci: pass power_mode to the translate_vdd callback
ARM: 6274/1: add global control registers definition header file for nuc900
mx2_camera: fix type of dma buffer virtual address pointer
mx2_camera: Add soc_camera support for i.MX25/i.MX27
arm/imx/gpio: add spinlock protection
ARM: Add support for the LPC32XX arch
ARM: LPC32XX: Arch config menu supoport and makefiles
ARM: LPC32XX: Phytec 3250 platform support
ARM: LPC32XX: Misc support functions
ARM: LPC32XX: Serial support code
ARM: LPC32XX: System suspend support
ARM: LPC32XX: GPIO, timer, and IRQ drivers
ARM: LPC32XX: Clock driver
...
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/imxfb.c | 72 | ||||
-rw-r--r-- | drivers/video/omap2/vram.c | 33 |
2 files changed, 86 insertions, 19 deletions
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index b4b6deceed15..43f0639b1c10 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -175,6 +175,7 @@ struct imxfb_info { | |||
175 | 175 | ||
176 | struct imx_fb_videomode *mode; | 176 | struct imx_fb_videomode *mode; |
177 | int num_modes; | 177 | int num_modes; |
178 | struct backlight_device *bl; | ||
178 | 179 | ||
179 | void (*lcd_power)(int); | 180 | void (*lcd_power)(int); |
180 | void (*backlight_power)(int); | 181 | void (*backlight_power)(int); |
@@ -449,6 +450,73 @@ static int imxfb_set_par(struct fb_info *info) | |||
449 | return 0; | 450 | return 0; |
450 | } | 451 | } |
451 | 452 | ||
453 | |||
454 | |||
455 | static int imxfb_bl_get_brightness(struct backlight_device *bl) | ||
456 | { | ||
457 | struct imxfb_info *fbi = bl_get_data(bl); | ||
458 | |||
459 | return readl(fbi->regs + LCDC_PWMR) & 0xFF; | ||
460 | } | ||
461 | |||
462 | static int imxfb_bl_update_status(struct backlight_device *bl) | ||
463 | { | ||
464 | struct imxfb_info *fbi = bl_get_data(bl); | ||
465 | int brightness = bl->props.brightness; | ||
466 | |||
467 | if (bl->props.power != FB_BLANK_UNBLANK) | ||
468 | brightness = 0; | ||
469 | if (bl->props.fb_blank != FB_BLANK_UNBLANK) | ||
470 | brightness = 0; | ||
471 | |||
472 | fbi->pwmr = (fbi->pwmr & ~0xFF) | brightness; | ||
473 | |||
474 | if (bl->props.fb_blank != FB_BLANK_UNBLANK) | ||
475 | clk_enable(fbi->clk); | ||
476 | writel(fbi->pwmr, fbi->regs + LCDC_PWMR); | ||
477 | if (bl->props.fb_blank != FB_BLANK_UNBLANK) | ||
478 | clk_disable(fbi->clk); | ||
479 | |||
480 | return 0; | ||
481 | } | ||
482 | |||
483 | static const struct backlight_ops imxfb_lcdc_bl_ops = { | ||
484 | .update_status = imxfb_bl_update_status, | ||
485 | .get_brightness = imxfb_bl_get_brightness, | ||
486 | }; | ||
487 | |||
488 | static void imxfb_init_backlight(struct imxfb_info *fbi) | ||
489 | { | ||
490 | struct backlight_properties props; | ||
491 | struct backlight_device *bl; | ||
492 | |||
493 | if (fbi->bl) | ||
494 | return; | ||
495 | |||
496 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
497 | props.max_brightness = 0xff; | ||
498 | writel(fbi->pwmr, fbi->regs + LCDC_PWMR); | ||
499 | |||
500 | bl = backlight_device_register("imxfb-bl", &fbi->pdev->dev, fbi, | ||
501 | &imxfb_lcdc_bl_ops, &props); | ||
502 | if (IS_ERR(bl)) { | ||
503 | dev_err(&fbi->pdev->dev, "error %ld on backlight register\n", | ||
504 | PTR_ERR(bl)); | ||
505 | return; | ||
506 | } | ||
507 | |||
508 | fbi->bl = bl; | ||
509 | bl->props.power = FB_BLANK_UNBLANK; | ||
510 | bl->props.fb_blank = FB_BLANK_UNBLANK; | ||
511 | bl->props.brightness = imxfb_bl_get_brightness(bl); | ||
512 | } | ||
513 | |||
514 | static void imxfb_exit_backlight(struct imxfb_info *fbi) | ||
515 | { | ||
516 | if (fbi->bl) | ||
517 | backlight_device_unregister(fbi->bl); | ||
518 | } | ||
519 | |||
452 | static void imxfb_enable_controller(struct imxfb_info *fbi) | 520 | static void imxfb_enable_controller(struct imxfb_info *fbi) |
453 | { | 521 | { |
454 | pr_debug("Enabling LCD controller\n"); | 522 | pr_debug("Enabling LCD controller\n"); |
@@ -579,7 +647,6 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf | |||
579 | fbi->regs + LCDC_SIZE); | 647 | fbi->regs + LCDC_SIZE); |
580 | 648 | ||
581 | writel(fbi->pcr, fbi->regs + LCDC_PCR); | 649 | writel(fbi->pcr, fbi->regs + LCDC_PCR); |
582 | writel(fbi->pwmr, fbi->regs + LCDC_PWMR); | ||
583 | writel(fbi->lscr1, fbi->regs + LCDC_LSCR1); | 650 | writel(fbi->lscr1, fbi->regs + LCDC_LSCR1); |
584 | writel(fbi->dmacr, fbi->regs + LCDC_DMACR); | 651 | writel(fbi->dmacr, fbi->regs + LCDC_DMACR); |
585 | 652 | ||
@@ -779,6 +846,8 @@ static int __init imxfb_probe(struct platform_device *pdev) | |||
779 | } | 846 | } |
780 | 847 | ||
781 | imxfb_enable_controller(fbi); | 848 | imxfb_enable_controller(fbi); |
849 | fbi->pdev = pdev; | ||
850 | imxfb_init_backlight(fbi); | ||
782 | 851 | ||
783 | return 0; | 852 | return 0; |
784 | 853 | ||
@@ -816,6 +885,7 @@ static int __devexit imxfb_remove(struct platform_device *pdev) | |||
816 | 885 | ||
817 | imxfb_disable_controller(fbi); | 886 | imxfb_disable_controller(fbi); |
818 | 887 | ||
888 | imxfb_exit_backlight(fbi); | ||
819 | unregister_framebuffer(info); | 889 | unregister_framebuffer(info); |
820 | 890 | ||
821 | pdata = pdev->dev.platform_data; | 891 | pdata = pdev->dev.platform_data; |
diff --git a/drivers/video/omap2/vram.c b/drivers/video/omap2/vram.c index 3b1237ad85ed..f6fdc2085f3e 100644 --- a/drivers/video/omap2/vram.c +++ b/drivers/video/omap2/vram.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/list.h> | 25 | #include <linux/list.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
28 | #include <linux/bootmem.h> | 28 | #include <linux/memblock.h> |
29 | #include <linux/completion.h> | 29 | #include <linux/completion.h> |
30 | #include <linux/debugfs.h> | 30 | #include <linux/debugfs.h> |
31 | #include <linux/jiffies.h> | 31 | #include <linux/jiffies.h> |
@@ -525,10 +525,8 @@ early_param("vram", omap_vram_early_vram); | |||
525 | * Called from map_io. We need to call to this early enough so that we | 525 | * Called from map_io. We need to call to this early enough so that we |
526 | * can reserve the fixed SDRAM regions before VM could get hold of them. | 526 | * can reserve the fixed SDRAM regions before VM could get hold of them. |
527 | */ | 527 | */ |
528 | void __init omap_vram_reserve_sdram(void) | 528 | void __init omap_vram_reserve_sdram_memblock(void) |
529 | { | 529 | { |
530 | struct bootmem_data *bdata; | ||
531 | unsigned long sdram_start, sdram_size; | ||
532 | u32 paddr; | 530 | u32 paddr; |
533 | u32 size = 0; | 531 | u32 size = 0; |
534 | 532 | ||
@@ -555,29 +553,28 @@ void __init omap_vram_reserve_sdram(void) | |||
555 | 553 | ||
556 | size = PAGE_ALIGN(size); | 554 | size = PAGE_ALIGN(size); |
557 | 555 | ||
558 | bdata = NODE_DATA(0)->bdata; | ||
559 | sdram_start = bdata->node_min_pfn << PAGE_SHIFT; | ||
560 | sdram_size = (bdata->node_low_pfn << PAGE_SHIFT) - sdram_start; | ||
561 | |||
562 | if (paddr) { | 556 | if (paddr) { |
563 | if ((paddr & ~PAGE_MASK) || paddr < sdram_start || | 557 | struct memblock_property res; |
564 | paddr + size > sdram_start + sdram_size) { | 558 | |
559 | res.base = paddr; | ||
560 | res.size = size; | ||
561 | if ((paddr & ~PAGE_MASK) || memblock_find(&res) || | ||
562 | res.base != paddr || res.size != size) { | ||
565 | pr_err("Illegal SDRAM region for VRAM\n"); | 563 | pr_err("Illegal SDRAM region for VRAM\n"); |
566 | return; | 564 | return; |
567 | } | 565 | } |
568 | 566 | ||
569 | if (reserve_bootmem(paddr, size, BOOTMEM_EXCLUSIVE) < 0) { | 567 | if (memblock_is_region_reserved(paddr, size)) { |
570 | pr_err("FB: failed to reserve VRAM\n"); | 568 | pr_err("FB: failed to reserve VRAM - busy\n"); |
571 | return; | 569 | return; |
572 | } | 570 | } |
573 | } else { | 571 | |
574 | if (size > sdram_size) { | 572 | if (memblock_reserve(paddr, size) < 0) { |
575 | pr_err("Illegal SDRAM size for VRAM\n"); | 573 | pr_err("FB: failed to reserve VRAM - no memory\n"); |
576 | return; | 574 | return; |
577 | } | 575 | } |
578 | 576 | } else { | |
579 | paddr = virt_to_phys(alloc_bootmem_pages(size)); | 577 | paddr = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_REAL_LIMIT); |
580 | BUG_ON(paddr & ~PAGE_MASK); | ||
581 | } | 578 | } |
582 | 579 | ||
583 | omap_vram_add_region(paddr, size); | 580 | omap_vram_add_region(paddr, size); |