From 6a1c1977a74368b9a354b10d4d402a2ee120427f Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Thu, 27 Oct 2005 22:08:38 +0300 Subject: [PATCH] ARM: OMAP: [PATCH] fb clut fix (Re: console text problems...) I forgot that the fbconsole code is using a palette even though we are in true color mode, so we have to handle that case separately. --- drivers/video/omap/omapfb_main.c | 38 +++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c index 59b0f0f4517..bded2548b2a 100644 --- a/drivers/video/omap/omapfb_main.c +++ b/drivers/video/omap/omapfb_main.c @@ -260,18 +260,40 @@ static int _setcolreg(struct fb_info *info, u_int regno, u_int red, u_int green, u_int blue, u_int transp, int update_hw_pal) { struct omapfb_device *fbdev = (struct omapfb_device *)info->par; - u16 pal; int r = 0; - if (regno < 16) { - pal = ((red >> 11) << 11) | ((green >> 10) << 5) | (blue >> 11); - ((u32 *)(info->pseudo_palette))[regno] = pal; - } + switch (fbdev->color_mode) { + case OMAPFB_COLOR_YUV422: + case OMAPFB_COLOR_YUV420: + r = -EINVAL; + break; + case OMAPFB_COLOR_CLUT_8BPP: + case OMAPFB_COLOR_CLUT_4BPP: + case OMAPFB_COLOR_CLUT_2BPP: + case OMAPFB_COLOR_CLUT_1BPP: + if (fbdev->ctrl->setcolreg) + r = fbdev->ctrl->setcolreg(regno, red, green, blue, + transp, update_hw_pal); + /* Fallthrough */ + case OMAPFB_COLOR_RGB565: + if (r != 0) + break; - if (fbdev->ctrl->setcolreg) - r = fbdev->ctrl->setcolreg(regno, red, green, blue, transp, - update_hw_pal); + if (regno < 0) { + r = -EINVAL; + break; + } + if (regno < 16) { + u16 pal; + pal = ((red >> 11) << 11) | ((green >> 10) << 5) | + (blue >> 11); + ((u32 *)(info->pseudo_palette))[regno] = pal; + } + break; + default: + BUG(); + } return r; } -- 2.41.0