]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: [PATCH] fb clut fix (Re: console text problems...)
authorImre Deak <imre.deak@nokia.com>
Thu, 27 Oct 2005 19:08:38 +0000 (22:08 +0300)
committerTony Lindgren <tony@atomide.com>
Thu, 27 Oct 2005 19:08:38 +0000 (22:08 +0300)
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

index 59b0f0f4517d282e9d062a98f67938d082fb5b81..bded2548b2a7811ec9bff5808e368e05fc49b630 100644 (file)
@@ -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;
 }