diff options
author | Jun Nakajima <jnakajim@gmail.com> | 2011-03-07 00:15:32 -0800 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2012-03-16 23:08:25 -0700 |
commit | c423bb86c5152ec7387d34c4a278c2616b04426a (patch) | |
tree | b256421762ddc81eb9bf8c7f82dbbf01758af4da | |
parent | 9c3b352a9ebef12d5a5e6ec27f641d0e507de2a4 (diff) | |
download | goldfish-linux-goldfish-3.0-wip.tar.gz |
x86: Add x86 support to the golfish framebuffer driver.linux-goldfish-3.0-wip
Change-Id: Idaf35a7ab39bf19468e3db757c12d346492f6bc2
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
-rw-r--r-- | arch/x86/configs/goldfish_defconfig | 2 | ||||
-rw-r--r-- | drivers/video/goldfishfb.c | 33 |
2 files changed, 32 insertions, 3 deletions
diff --git a/arch/x86/configs/goldfish_defconfig b/arch/x86/configs/goldfish_defconfig index 37a575b27fb9..91533cc8ac8a 100644 --- a/arch/x86/configs/goldfish_defconfig +++ b/arch/x86/configs/goldfish_defconfig @@ -1461,7 +1461,7 @@ CONFIG_FB_TILEBLITTING=y # CONFIG_FB_PM3 is not set # CONFIG_FB_CARMINE is not set # CONFIG_FB_GEODE is not set -# CONFIG_FB_GOLDFISH is not set +CONFIG_FB_GOLDFISH=y # CONFIG_FB_VIRTUAL is not set # CONFIG_FB_METRONOME is not set # CONFIG_FB_MB862XX is not set diff --git a/drivers/video/goldfishfb.c b/drivers/video/goldfishfb.c index 9090758f9363..45d1fe36a23c 100644 --- a/drivers/video/goldfishfb.c +++ b/drivers/video/goldfishfb.c @@ -30,7 +30,11 @@ #include <linux/android_power.h> #endif +#ifdef CONFIG_X86 +#include <asm/mtrr.h> +#else #include <mach/hardware.h> +#endif enum { FB_GET_WIDTH = 0x00, @@ -48,7 +52,7 @@ enum { }; struct goldfish_fb { - uint32_t reg_base; + void __iomem *reg_base; int irq; spinlock_t lock; wait_queue_head_t wait; @@ -208,7 +212,11 @@ static int goldfish_fb_probe(struct platform_device *pdev) ret = -ENODEV; goto err_no_io_base; } - fb->reg_base = IO_ADDRESS(r->start - IO_START); +#ifdef CONFIG_ARM + fb->reg_base = (void __iomem *)IO_ADDRESS(r->start - IO_START); +#elif CONFIG_X86 + fb->reg_base = ioremap(r->start, PAGE_SIZE); +#endif fb->irq = platform_get_irq(pdev, 0); if(fb->irq < 0) { @@ -237,6 +245,7 @@ static int goldfish_fb_probe(struct platform_device *pdev) fb->fb.var.activate = FB_ACTIVATE_NOW; fb->fb.var.height = readl(fb->reg_base + FB_GET_PHYS_HEIGHT); fb->fb.var.width = readl(fb->reg_base + FB_GET_PHYS_WIDTH); + fb->fb.var.pixclock = 10000; fb->fb.var.red.offset = 11; fb->fb.var.red.length = 5; @@ -246,13 +255,21 @@ static int goldfish_fb_probe(struct platform_device *pdev) fb->fb.var.blue.length = 5; framesize = width * height * 2 * 2; +#ifdef CONFIG_ARM fb->fb.screen_base = dma_alloc_writecombine(&pdev->dev, framesize, &fbpaddr, GFP_KERNEL); +#elif CONFIG_X86 + fb->fb.screen_base = dma_alloc_coherent(NULL, framesize, + &fbpaddr, GFP_KERNEL); +#endif printk("allocating frame buffer %d * %d, got %p\n", width, height, fb->fb.screen_base); if(fb->fb.screen_base == 0) { ret = -ENOMEM; goto err_alloc_screen_base_failed; } +#ifdef CONFIG_X86 + mtrr_add(fbpaddr, framesize, MTRR_TYPE_WRBACK, 1); +#endif fb->fb.fix.smem_start = fbpaddr; fb->fb.fix.smem_len = framesize; @@ -284,9 +301,16 @@ err_register_framebuffer_failed: free_irq(fb->irq, fb); err_request_irq_failed: err_fb_set_var_failed: +#ifdef CONFIG_ARM dma_free_writecombine(&pdev->dev, framesize, fb->fb.screen_base, fb->fb.fix.smem_start); +#elif CONFIG_X86 + dma_free_coherent(NULL, framesize, fb->fb.screen_base, fb->fb.fix.smem_start); +#endif err_alloc_screen_base_failed: err_no_irq: +#ifdef CONFIG_X86 + iounmap(fb->reg_base); +#endif err_no_io_base: kfree(fb); err_fb_alloc_failed: @@ -305,8 +329,13 @@ static int goldfish_fb_remove(struct platform_device *pdev) #endif unregister_framebuffer(&fb->fb); free_irq(fb->irq, fb); +#ifdef CONFIG_ARM dma_free_writecombine(&pdev->dev, framesize, fb->fb.screen_base, fb->fb.fix.smem_start); kfree(fb); +#elif CONFIG_X86 + dma_free_coherent(NULL, framesize, fb->fb.screen_base, fb->fb.fix.smem_start); + iounmap(fb->reg_base); +#endif return 0; } |