diff options
author | Thomas White <taw@bitwiz.org.uk> | 2009-08-04 21:34:34 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2009-08-04 21:34:34 +0100 |
commit | f3f88c9cd448361f2e96023894fe2b4701488dd4 (patch) | |
tree | c6f41b4af62d9f3d36dc7b4ee0760e319b3bdb3e /drivers | |
parent | 8bb0c5afa71d38dbc823b30aa9e75371becc2c31 (diff) |
Keep glamo-kms-fb off the hardware registers
This removes the last remaining instance of glamo-kms-fb touching Glamo's
registers directly.
Signed-off-by: Thomas White <taw@bitwiz.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/glamo/glamo-display.c | 16 | ||||
-rw-r--r-- | drivers/mfd/glamo/glamo-drm-private.h | 8 | ||||
-rw-r--r-- | drivers/mfd/glamo/glamo-kms-fb.c | 22 | ||||
-rw-r--r-- | drivers/mfd/glamo/glamo-kms-fb.h | 2 |
4 files changed, 28 insertions, 20 deletions
diff --git a/drivers/mfd/glamo/glamo-display.c b/drivers/mfd/glamo/glamo-display.c index 5e0e9434146..969e8fb1dcb 100644 --- a/drivers/mfd/glamo/glamo-display.c +++ b/drivers/mfd/glamo/glamo-display.c @@ -837,8 +837,20 @@ int glamo_display_init(struct drm_device *dev) ARRAY_SIZE(lcd_init_script)); if (list_empty(&dev->mode_config.fb_kernel_list)) { - int ret; - ret = glamofb_create(dev, 480, 640, 480, 640, &glamo_fb); + int ret, cols, cols_g; + cols_g = reg_read_lcd(gdrm, GLAMO_REG_LCD_MODE3) & 0xc000; + switch ( cols_g ) { + case GLAMO_LCD_SRC_RGB565 : + cols = GLAMO_FB_RGB565; break; + case GLAMO_LCD_SRC_ARGB1555 : + cols = GLAMO_FB_ARGB1555; break; + case GLAMO_LCD_SRC_ARGB4444 : + cols = GLAMO_FB_ARGB4444; break; + default : + printk(KERN_WARNING "Unrecognised LCD colour mode\n"); + cols = GLAMO_FB_RGB565; break; /* Take a guess */ + } + ret = glamofb_create(dev, 480, 640, 480, 640, cols, &glamo_fb); if (ret) return -EINVAL; } diff --git a/drivers/mfd/glamo/glamo-drm-private.h b/drivers/mfd/glamo/glamo-drm-private.h index e87c333aa6d..91c8a2b4993 100644 --- a/drivers/mfd/glamo/glamo-drm-private.h +++ b/drivers/mfd/glamo/glamo-drm-private.h @@ -123,6 +123,14 @@ struct glamo_output { }; +/* Colour mode for KMS framebuffer */ +enum { + GLAMO_FB_RGB565, + GLAMO_FB_ARGB1555, + GLAMO_FB_ARGB4444 +}; + + #define to_glamo_crtc(x) container_of(x, struct glamo_crtc, base) #define to_glamo_output(x) container_of(x, struct glamo_output, base) #define enc_to_glamo_output(x) container_of(x, struct glamo_output, enc) diff --git a/drivers/mfd/glamo/glamo-kms-fb.c b/drivers/mfd/glamo/glamo-kms-fb.c index 4d3e8977d47..3f28134dd99 100644 --- a/drivers/mfd/glamo/glamo-kms-fb.c +++ b/drivers/mfd/glamo/glamo-kms-fb.c @@ -60,7 +60,6 @@ #include "glamo-core.h" #include "glamo-drm-private.h" -#include "glamo-regs.h" #include "glamo-display.h" #include "glamo-buffer.h" @@ -75,17 +74,6 @@ struct glamofb_par { }; -static int reg_read(struct glamodrm_handle *gdrm, u_int16_t reg) -{ - int i = 0; - - for (i = 0; i != 2; i++) - nop(); - - return ioread16(gdrm->lcd_base + reg); -} - - static int glamofb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) @@ -371,7 +359,7 @@ static struct fb_ops glamofb_ops = { * /dev/fbX so that the kernel can put a console on it. */ int glamofb_create(struct drm_device *dev, uint32_t fb_width, uint32_t fb_height, uint32_t surface_width, - uint32_t surface_height, + uint32_t surface_height, int colour_mode, struct glamo_framebuffer **glamo_fb_p) { struct fb_info *info; @@ -481,8 +469,8 @@ int glamofb_create(struct drm_device *dev, uint32_t fb_width, switch (fb->depth) { case 16: - switch (reg_read(gdrm, GLAMO_REG_LCD_MODE3) & 0xc000) { /* FIXME */ - case GLAMO_LCD_SRC_RGB565: + switch ( colour_mode ) { + case GLAMO_FB_RGB565: info->var.red.offset = 11; info->var.green.offset = 5; info->var.blue.offset = 0; @@ -491,7 +479,7 @@ int glamofb_create(struct drm_device *dev, uint32_t fb_width, info->var.blue.length = 5; info->var.transp.length = 0; break; - case GLAMO_LCD_SRC_ARGB1555: + case GLAMO_FB_ARGB1555: info->var.transp.offset = 15; info->var.red.offset = 10; info->var.green.offset = 5; @@ -501,7 +489,7 @@ int glamofb_create(struct drm_device *dev, uint32_t fb_width, info->var.green.length = 5; info->var.blue.length = 5; break; - case GLAMO_LCD_SRC_ARGB4444: + case GLAMO_FB_ARGB4444: info->var.transp.offset = 12; info->var.red.offset = 8; info->var.green.offset = 4; diff --git a/drivers/mfd/glamo/glamo-kms-fb.h b/drivers/mfd/glamo/glamo-kms-fb.h index 9ae597bd366..1960e766fe1 100644 --- a/drivers/mfd/glamo/glamo-kms-fb.h +++ b/drivers/mfd/glamo/glamo-kms-fb.h @@ -32,7 +32,7 @@ extern int glamofb_create(struct drm_device *dev, uint32_t fb_width, uint32_t fb_height, uint32_t surface_width, - uint32_t surface_height, + uint32_t surface_height, int colour_mode, struct glamo_framebuffer **glamo_fb_p); extern void glamo_kmsfb_suspend(struct glamodrm_handle *gdrm); |