Lines Matching +full:lcd +full:- +full:controller

3  *	Au1200 LCD Driver.
5 * Copyright 2004-2005 AMD
9 * linux/drivers/video/skeletonfb.c -- Skeleton for a frame buffer device
44 #include <linux/dma-mapping.h>
48 #include <asm/mach-au1x00/au1000.h>
49 #include <asm/mach-au1x00/au1200fb.h> /* platform_data */
53 #define DRIVER_DESC "LCD controller driver for AU1200 processors"
146 /* Private, per-framebuffer management information (independent of the panel itself) */
160 /* LCD controller restrictions */
179 static struct au1200_lcd *lcd = (struct au1200_lcd *) AU1200_LCD_ADDR; variable
214 "0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx",
248 "0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx",
281 "0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx",
318 * Controller configurations for various panels.
347 /* fixme: Maybe a modedb for the CRT ? otherwise panels should be as-is */
349 /* List of panels known to work with the AU1200 LCD controller.
352 * with the controller restrictions. Restrictions are:
699 return -1; in fbinfo2index()
710 winctrl0 = lcd->window[plane].winctrl0; in au1200_setlocation()
711 winctrl1 = lcd->window[plane].winctrl1; in au1200_setlocation()
715 /* Check for off-screen adjustments */ in au1200_setlocation()
716 xsz = win->w[plane].xres; in au1200_setlocation()
717 ysz = win->w[plane].yres; in au1200_setlocation()
718 if ((xpos + win->w[plane].xres) > panel->Xres) { in au1200_setlocation()
719 /* Off-screen to the right */ in au1200_setlocation()
720 xsz = panel->Xres - xpos; /* off by 1 ??? */ in au1200_setlocation()
724 if ((ypos + win->w[plane].yres) > panel->Yres) { in au1200_setlocation()
725 /* Off-screen to the bottom */ in au1200_setlocation()
726 ysz = panel->Yres - ypos; /* off by 1 ??? */ in au1200_setlocation()
731 /* Off-screen to the left */ in au1200_setlocation()
732 xsz = win->w[plane].xres + xpos; in au1200_setlocation()
733 fb_offset += (((0 - xpos) * winbpp(lcd->window[plane].winctrl1))/8); in au1200_setlocation()
739 /* Off-screen to the top */ in au1200_setlocation()
740 ysz = win->w[plane].yres + ypos; in au1200_setlocation()
741 /* fixme: fb_offset += ((0-ypos)*fb_pars[plane].line_length); */ in au1200_setlocation()
747 win->w[plane].xpos = xpos; in au1200_setlocation()
748 win->w[plane].ypos = ypos; in au1200_setlocation()
750 xsz -= 1; in au1200_setlocation()
751 ysz -= 1; in au1200_setlocation()
758 winenable = lcd->winenable & (1 << plane); in au1200_setlocation()
760 lcd->winenable &= ~(1 << plane); in au1200_setlocation()
761 lcd->window[plane].winctrl0 = winctrl0; in au1200_setlocation()
762 lcd->window[plane].winctrl1 = winctrl1; in au1200_setlocation()
763 lcd->window[plane].winbuf0 = in au1200_setlocation()
764 lcd->window[plane].winbuf1 = fbdev->fb_phys; in au1200_setlocation()
765 lcd->window[plane].winbufctrl = 0; /* select winbuf0 */ in au1200_setlocation()
766 lcd->winenable |= winenable; in au1200_setlocation()
776 * Perform global setup/init of LCD controller in au1200_setpanel()
781 winenable = lcd->winenable; in au1200_setpanel()
782 lcd->winenable = 0; in au1200_setpanel()
787 if (lcd->screen & LCD_SCREEN_SEN) { in au1200_setpanel()
789 lcd->intstatus = LCD_INT_SS; in au1200_setpanel()
790 while ((lcd->intstatus & LCD_INT_SS) == 0) in au1200_setpanel()
793 lcd->screen &= ~LCD_SCREEN_SEN; /*disable the controller*/ in au1200_setpanel()
796 lcd->intstatus = lcd->intstatus; /*clear interrupts*/ in au1200_setpanel()
798 /*wait for controller to shut down*/ in au1200_setpanel()
799 } while ((lcd->intstatus & LCD_INT_SD) == 0); in au1200_setpanel()
803 the controller, the clock cannot be turned off before first in au1200_setpanel()
804 shutting down the controller. in au1200_setpanel()
806 if (pd->panel_shutdown) in au1200_setpanel()
807 pd->panel_shutdown(); in au1200_setpanel()
816 printk("Panel(%s), %dx%d\n", panel->name, panel->Xres, panel->Yres); in au1200_setpanel()
819 * Setup clocking if internal LCD clock source (assumes sys_auxpll valid) in au1200_setpanel()
821 if (!(panel->mode_clkcontrol & LCD_CLKCONTROL_EXT)) in au1200_setpanel()
824 long r, pc = panel->lcdclk * 1000000; in au1200_setpanel()
828 if ((pc - r) < (pc / 10)) { /* 10% slack */ in au1200_setpanel()
839 lcd->screen = panel->mode_screen; in au1200_setpanel()
840 lcd->horztiming = panel->mode_horztiming; in au1200_setpanel()
841 lcd->verttiming = panel->mode_verttiming; in au1200_setpanel()
842 lcd->clkcontrol = panel->mode_clkcontrol; in au1200_setpanel()
843 lcd->pwmdiv = panel->mode_pwmdiv; in au1200_setpanel()
844 lcd->pwmhi = panel->mode_pwmhi; in au1200_setpanel()
845 lcd->outmask = panel->mode_outmask; in au1200_setpanel()
846 lcd->fifoctrl = panel->mode_fifoctrl; in au1200_setpanel()
852 au1200_setlocation(fbdev, 0, win->w[0].xpos, win->w[0].ypos); in au1200_setpanel()
853 au1200_setlocation(fbdev, 1, win->w[1].xpos, win->w[1].ypos); in au1200_setpanel()
854 au1200_setlocation(fbdev, 2, win->w[2].xpos, win->w[2].ypos); in au1200_setpanel()
855 au1200_setlocation(fbdev, 3, win->w[3].xpos, win->w[3].ypos); in au1200_setpanel()
857 lcd->winenable = winenable; in au1200_setpanel()
860 * Re-enable screen now that it is configured in au1200_setpanel()
862 lcd->screen |= LCD_SCREEN_SEN; in au1200_setpanel()
866 if (pd->panel_init) in au1200_setpanel()
867 pd->panel_init(); in au1200_setpanel()
870 lcd->intenable = 0; in au1200_setpanel()
871 lcd->intstatus = ~0; in au1200_setpanel()
872 lcd->backcolor = win->mode_backcolor; in au1200_setpanel()
874 /* Setup Color Key - FIX!!! */ in au1200_setpanel()
875 lcd->colorkey = win->mode_colorkey; in au1200_setpanel()
876 lcd->colorkeymsk = win->mode_colorkeymsk; in au1200_setpanel()
878 /* Setup HWCursor - FIX!!! Need to support this eventually */ in au1200_setpanel()
879 lcd->hwc.cursorctrl = 0; in au1200_setpanel()
880 lcd->hwc.cursorpos = 0; in au1200_setpanel()
881 lcd->hwc.cursorcolor0 = 0; in au1200_setpanel()
882 lcd->hwc.cursorcolor1 = 0; in au1200_setpanel()
883 lcd->hwc.cursorcolor2 = 0; in au1200_setpanel()
884 lcd->hwc.cursorcolor3 = 0; in au1200_setpanel()
889 D(lcd->screen); in au1200_setpanel()
890 D(lcd->horztiming); in au1200_setpanel()
891 D(lcd->verttiming); in au1200_setpanel()
892 D(lcd->clkcontrol); in au1200_setpanel()
893 D(lcd->pwmdiv); in au1200_setpanel()
894 D(lcd->pwmhi); in au1200_setpanel()
895 D(lcd->outmask); in au1200_setpanel()
896 D(lcd->fifoctrl); in au1200_setpanel()
897 D(lcd->window[0].winctrl0); in au1200_setpanel()
898 D(lcd->window[0].winctrl1); in au1200_setpanel()
899 D(lcd->window[0].winctrl2); in au1200_setpanel()
900 D(lcd->window[0].winbuf0); in au1200_setpanel()
901 D(lcd->window[0].winbuf1); in au1200_setpanel()
902 D(lcd->window[0].winbufctrl); in au1200_setpanel()
903 D(lcd->window[1].winctrl0); in au1200_setpanel()
904 D(lcd->window[1].winctrl1); in au1200_setpanel()
905 D(lcd->window[1].winctrl2); in au1200_setpanel()
906 D(lcd->window[1].winbuf0); in au1200_setpanel()
907 D(lcd->window[1].winbuf1); in au1200_setpanel()
908 D(lcd->window[1].winbufctrl); in au1200_setpanel()
909 D(lcd->window[2].winctrl0); in au1200_setpanel()
910 D(lcd->window[2].winctrl1); in au1200_setpanel()
911 D(lcd->window[2].winctrl2); in au1200_setpanel()
912 D(lcd->window[2].winbuf0); in au1200_setpanel()
913 D(lcd->window[2].winbuf1); in au1200_setpanel()
914 D(lcd->window[2].winbufctrl); in au1200_setpanel()
915 D(lcd->window[3].winctrl0); in au1200_setpanel()
916 D(lcd->window[3].winctrl1); in au1200_setpanel()
917 D(lcd->window[3].winctrl2); in au1200_setpanel()
918 D(lcd->window[3].winbuf0); in au1200_setpanel()
919 D(lcd->window[3].winbuf1); in au1200_setpanel()
920 D(lcd->window[3].winbufctrl); in au1200_setpanel()
921 D(lcd->winenable); in au1200_setpanel()
922 D(lcd->intenable); in au1200_setpanel()
923 D(lcd->intstatus); in au1200_setpanel()
924 D(lcd->backcolor); in au1200_setpanel()
925 D(lcd->winenable); in au1200_setpanel()
926 D(lcd->colorkey); in au1200_setpanel()
927 D(lcd->colorkeymsk); in au1200_setpanel()
928 D(lcd->hwc.cursorctrl); in au1200_setpanel()
929 D(lcd->hwc.cursorpos); in au1200_setpanel()
930 D(lcd->hwc.cursorcolor0); in au1200_setpanel()
931 D(lcd->hwc.cursorcolor1); in au1200_setpanel()
932 D(lcd->hwc.cursorcolor2); in au1200_setpanel()
933 D(lcd->hwc.cursorcolor3); in au1200_setpanel()
939 int plane = fbdev->plane; in au1200_setmode()
941 lcd->window[plane].winctrl1 = ( 0 in au1200_setmode()
943 | win->w[plane].mode_winctrl1 /* FRM,CCO,PO,PIPE */ in au1200_setmode()
946 au1200_setlocation(fbdev, plane, win->w[plane].xpos, win->w[plane].ypos); in au1200_setmode()
948 lcd->window[plane].winctrl2 = ( 0 in au1200_setmode()
951 | LCD_WINCTRL2_BX_N(fbdev->fb_info->fix.line_length) in au1200_setmode()
955 lcd->winenable |= win->w[plane].mode_winenable; in au1200_setmode()
962 /*#define panel_is_dual(panel) ((panel->mode_screen & LCD_SCREEN_PT) == LCD_SCREEN_PT_010)*/
963 /*#define panel_is_active(panel)((panel->mode_screen & LCD_SCREEN_PT) == LCD_SCREEN_PT_010)*/
965 #define panel_is_color(panel) ((panel->mode_screen & LCD_SCREEN_PT) <= LCD_SCREEN_PT_CDSTN)
967 /* Bitfields format supported by the controller. */
998 /*-------------------------------------------------------------------------*/
1006 /* Update var-dependent FB info */ in au1200fb_update_fbinfo()
1008 if (fbi->var.bits_per_pixel <= 8) { in au1200fb_update_fbinfo()
1010 fbi->fix.visual = FB_VISUAL_PSEUDOCOLOR; in au1200fb_update_fbinfo()
1011 fbi->fix.line_length = fbi->var.xres_virtual / in au1200fb_update_fbinfo()
1012 (8/fbi->var.bits_per_pixel); in au1200fb_update_fbinfo()
1014 /* non-palettized */ in au1200fb_update_fbinfo()
1015 fbi->fix.visual = FB_VISUAL_TRUECOLOR; in au1200fb_update_fbinfo()
1016 fbi->fix.line_length = fbi->var.xres_virtual * (fbi->var.bits_per_pixel / 8); in au1200fb_update_fbinfo()
1020 fbi->fix.visual = FB_VISUAL_MONO10; in au1200fb_update_fbinfo()
1021 fbi->fix.line_length = fbi->var.xres_virtual / 8; in au1200fb_update_fbinfo()
1024 fbi->screen_size = fbi->fix.line_length * fbi->var.yres_virtual; in au1200fb_update_fbinfo()
1025 print_dbg("line length: %d\n", fbi->fix.line_length); in au1200fb_update_fbinfo()
1026 print_dbg("bits_per_pixel: %d\n", fbi->var.bits_per_pixel); in au1200fb_update_fbinfo()
1029 /*-------------------------------------------------------------------------*/
1039 struct au1200fb_device *fbdev = fbi->par; in au1200fb_fb_check_var()
1043 if (!var->pixclock) in au1200fb_fb_check_var()
1044 return -EINVAL; in au1200fb_fb_check_var()
1046 plane = fbdev->plane; in au1200fb_fb_check_var()
1048 /* Make sure that the mode respect all LCD controller and in au1200fb_fb_check_var()
1050 var->xres = win->w[plane].xres; in au1200fb_fb_check_var()
1051 var->yres = win->w[plane].yres; in au1200fb_fb_check_var()
1054 var->xres_virtual = var->xres; in au1200fb_fb_check_var()
1055 var->yres_virtual = var->yres; in au1200fb_fb_check_var()
1057 var->bits_per_pixel = winbpp(win->w[plane].mode_winctrl1); in au1200fb_fb_check_var()
1059 screen_size = var->xres_virtual * var->yres_virtual; in au1200fb_fb_check_var()
1060 if (var->bits_per_pixel > 8) screen_size *= (var->bits_per_pixel / 8); in au1200fb_fb_check_var()
1061 else screen_size /= (8/var->bits_per_pixel); in au1200fb_fb_check_var()
1063 if (fbdev->fb_len < screen_size) in au1200fb_fb_check_var()
1064 return -EINVAL; /* Virtual screen is to big, abort */ in au1200fb_fb_check_var()
1067 /* The max LCD clock is fixed to 48MHz (value of AUX_CLK). The pixel in au1200fb_fb_check_var()
1070 pixclock = max((u32)(PICOS2KHZ(var->pixclock) * 1000), fbi->monspecs.dclkmin); in au1200fb_fb_check_var()
1071 pixclock = min3(pixclock, fbi->monspecs.dclkmax, (u32)AU1200_LCD_MAX_CLK/2); in au1200fb_fb_check_var()
1075 pixclock -= diff; in au1200fb_fb_check_var()
1078 var->pixclock = KHZ2PICOS(pixclock/1000); in au1200fb_fb_check_var()
1081 int pcd = AU1200_LCD_MAX_CLK / (pixclock * 2) - 1; in au1200fb_fb_check_var()
1084 && (panel->control_base & LCD_CONTROL_MPI) && (pcd < 3)) { in au1200fb_fb_check_var()
1086 var->pixclock = KHZ2PICOS(6000); in au1200fb_fb_check_var()
1089 var->pixclock = KHZ2PICOS(12000); in au1200fb_fb_check_var()
1094 switch (var->bits_per_pixel) { in au1200fb_fb_check_var()
1100 idx = (win->w[0].mode_winctrl1 & LCD_WINCTRL1_FRM) >> 25; in au1200fb_fb_check_var()
1101 var->red = rgb_bitfields[idx][0]; in au1200fb_fb_check_var()
1102 var->green = rgb_bitfields[idx][1]; in au1200fb_fb_check_var()
1103 var->blue = rgb_bitfields[idx][2]; in au1200fb_fb_check_var()
1104 var->transp = rgb_bitfields[idx][3]; in au1200fb_fb_check_var()
1113 idx = (win->w[0].mode_winctrl1 & LCD_WINCTRL1_FRM) >> 25; in au1200fb_fb_check_var()
1114 var->red = rgb_bitfields[idx][0]; in au1200fb_fb_check_var()
1115 var->green = rgb_bitfields[idx][1]; in au1200fb_fb_check_var()
1116 var->blue = rgb_bitfields[idx][2]; in au1200fb_fb_check_var()
1117 var->transp = rgb_bitfields[idx][3]; in au1200fb_fb_check_var()
1121 print_dbg("Unsupported depth %dbpp", var->bits_per_pixel); in au1200fb_fb_check_var()
1122 return -EINVAL; in au1200fb_fb_check_var()
1129 * Set hardware with var settings. This will enable the controller with a
1134 struct au1200fb_device *fbdev = fbi->par; in au1200fb_fb_set_par()
1143 * Set color in LCD palette.
1148 volatile u32 *palette = lcd->palette; in au1200fb_fb_setcolreg()
1151 if (regno > (AU1200_LCD_NBR_PALETTE_ENTRIES - 1)) in au1200fb_fb_setcolreg()
1152 return -EINVAL; in au1200fb_fb_setcolreg()
1154 if (fbi->var.grayscale) { in au1200fb_fb_setcolreg()
1160 if (fbi->fix.visual == FB_VISUAL_TRUECOLOR) { in au1200fb_fb_setcolreg()
1163 return -EINVAL; in au1200fb_fb_setcolreg()
1165 palette = (u32*) fbi->pseudo_palette; in au1200fb_fb_setcolreg()
1167 red >>= (16 - fbi->var.red.length); in au1200fb_fb_setcolreg()
1168 green >>= (16 - fbi->var.green.length); in au1200fb_fb_setcolreg()
1169 blue >>= (16 - fbi->var.blue.length); in au1200fb_fb_setcolreg()
1171 value = (red << fbi->var.red.offset) | in au1200fb_fb_setcolreg()
1172 (green << fbi->var.green.offset)| in au1200fb_fb_setcolreg()
1173 (blue << fbi->var.blue.offset); in au1200fb_fb_setcolreg()
1176 } else if (1 /*FIX!!! panel_is_active(fbdev->panel)*/) { in au1200fb_fb_setcolreg()
1182 } else if (0 /*panel_is_color(fbdev->panel)*/) { in au1200fb_fb_setcolreg()
1203 struct au1200fb_device *fbdev = fbi->par; in au1200fb_fb_blank()
1205 /* Short-circuit screen blanking */ in au1200fb_fb_blank()
1214 au1200_setpanel(panel, fbdev->pd); in au1200fb_fb_blank()
1220 au1200_setpanel(NULL, fbdev->pd); in au1200fb_fb_blank()
1228 return (blank_mode == FB_BLANK_NORMAL) ? -EINVAL : 0; in au1200fb_fb_blank()
1237 struct au1200fb_device *fbdev = info->par; in au1200fb_fb_mmap()
1239 vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); in au1200fb_fb_mmap()
1241 return dma_mmap_coherent(fbdev->dev, vma, in au1200fb_fb_mmap()
1242 fbdev->fb_mem, fbdev->fb_phys, fbdev->fb_len); in au1200fb_fb_mmap()
1252 if (pdata->flags & SCREEN_BACKCOLOR) in set_global()
1253 lcd->backcolor = pdata->backcolor; in set_global()
1255 if (pdata->flags & SCREEN_BRIGHTNESS) { in set_global()
1258 if (pdata->brightness < 30) { in set_global()
1259 pdata->brightness = 30; in set_global()
1261 divider = (lcd->pwmdiv & 0x3FFFF) + 1; in set_global()
1262 hi1 = (((pdata->brightness & 0xFF)+1) * divider >> 8); in set_global()
1263 lcd->pwmhi &= 0xFFFF; in set_global()
1264 lcd->pwmhi |= (hi1 << 16); in set_global()
1267 if (pdata->flags & SCREEN_COLORKEY) in set_global()
1268 lcd->colorkey = pdata->colorkey; in set_global()
1270 if (pdata->flags & SCREEN_MASK) in set_global()
1271 lcd->colorkeymsk = pdata->mask; in set_global()
1279 pdata->xsize = ((lcd->screen & LCD_SCREEN_SX) >> 19) + 1; in get_global()
1280 pdata->ysize = ((lcd->screen & LCD_SCREEN_SY) >> 8) + 1; in get_global()
1282 pdata->backcolor = lcd->backcolor; in get_global()
1283 pdata->colorkey = lcd->colorkey; in get_global()
1284 pdata->mask = lcd->colorkeymsk; in get_global()
1287 hi1 = (lcd->pwmhi >> 16) + 1; in get_global()
1288 divider = (lcd->pwmdiv & 0x3FFFF) + 1; in get_global()
1289 pdata->brightness = ((hi1 << 8) / divider) - 1; in get_global()
1299 if (pdata->flags & WIN_POSITION) { in set_window()
1300 val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_OX | in set_window()
1302 val |= ((pdata->xpos << 21) & LCD_WINCTRL0_OX); in set_window()
1303 val |= ((pdata->ypos << 10) & LCD_WINCTRL0_OY); in set_window()
1304 lcd->window[plane].winctrl0 = val; in set_window()
1306 if (pdata->flags & WIN_ALPHA_COLOR) { in set_window()
1307 val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_A); in set_window()
1308 val |= ((pdata->alpha_color << 2) & LCD_WINCTRL0_A); in set_window()
1309 lcd->window[plane].winctrl0 = val; in set_window()
1311 if (pdata->flags & WIN_ALPHA_MODE) { in set_window()
1312 val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_AEN); in set_window()
1313 val |= ((pdata->alpha_mode << 1) & LCD_WINCTRL0_AEN); in set_window()
1314 lcd->window[plane].winctrl0 = val; in set_window()
1318 if (pdata->flags & WIN_PRIORITY) { in set_window()
1319 val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PRI); in set_window()
1320 val |= ((pdata->priority << 30) & LCD_WINCTRL1_PRI); in set_window()
1321 lcd->window[plane].winctrl1 = val; in set_window()
1323 if (pdata->flags & WIN_CHANNEL) { in set_window()
1324 val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PIPE); in set_window()
1325 val |= ((pdata->channel << 29) & LCD_WINCTRL1_PIPE); in set_window()
1326 lcd->window[plane].winctrl1 = val; in set_window()
1328 if (pdata->flags & WIN_BUFFER_FORMAT) { in set_window()
1329 val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_FRM); in set_window()
1330 val |= ((pdata->buffer_format << 25) & LCD_WINCTRL1_FRM); in set_window()
1331 lcd->window[plane].winctrl1 = val; in set_window()
1333 if (pdata->flags & WIN_COLOR_ORDER) { in set_window()
1334 val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_CCO); in set_window()
1335 val |= ((pdata->color_order << 24) & LCD_WINCTRL1_CCO); in set_window()
1336 lcd->window[plane].winctrl1 = val; in set_window()
1338 if (pdata->flags & WIN_PIXEL_ORDER) { in set_window()
1339 val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PO); in set_window()
1340 val |= ((pdata->pixel_order << 22) & LCD_WINCTRL1_PO); in set_window()
1341 lcd->window[plane].winctrl1 = val; in set_window()
1343 if (pdata->flags & WIN_SIZE) { in set_window()
1344 val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_SZX | in set_window()
1346 val |= (((pdata->xsize << 11) - 1) & LCD_WINCTRL1_SZX); in set_window()
1347 val |= (((pdata->ysize) - 1) & LCD_WINCTRL1_SZY); in set_window()
1348 lcd->window[plane].winctrl1 = val; in set_window()
1351 val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_BX); in set_window()
1352 val |= (((pdata->xsize * bpp) << 8) & LCD_WINCTRL2_BX); in set_window()
1353 lcd->window[plane].winctrl2 = val; in set_window()
1357 if (pdata->flags & WIN_COLORKEY_MODE) { in set_window()
1358 val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_CKMODE); in set_window()
1359 val |= ((pdata->colorkey_mode << 24) & LCD_WINCTRL2_CKMODE); in set_window()
1360 lcd->window[plane].winctrl2 = val; in set_window()
1362 if (pdata->flags & WIN_DOUBLE_BUFFER_MODE) { in set_window()
1363 val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_DBM); in set_window()
1364 val |= ((pdata->double_buffer_mode << 23) & LCD_WINCTRL2_DBM); in set_window()
1365 lcd->window[plane].winctrl2 = val; in set_window()
1367 if (pdata->flags & WIN_RAM_ARRAY_MODE) { in set_window()
1368 val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_RAM); in set_window()
1369 val |= ((pdata->ram_array_mode << 21) & LCD_WINCTRL2_RAM); in set_window()
1370 lcd->window[plane].winctrl2 = val; in set_window()
1375 if (pdata->flags & WIN_BUFFER_SCALE) { in set_window()
1376 val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_SCX | in set_window()
1378 val |= ((pdata->xsize << 11) & LCD_WINCTRL2_SCX); in set_window()
1379 val |= ((pdata->ysize) & LCD_WINCTRL2_SCY); in set_window()
1380 lcd->window[plane].winctrl2 = val; in set_window()
1383 if (pdata->flags & WIN_ENABLE) { in set_window()
1384 val = lcd->winenable; in set_window()
1386 val |= (pdata->enable & 1) << plane; in set_window()
1387 lcd->winenable = val; in set_window()
1396 pdata->xpos = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_OX) >> 21; in get_window()
1397 pdata->ypos = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_OY) >> 10; in get_window()
1398 pdata->alpha_color = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_A) >> 2; in get_window()
1399 pdata->alpha_mode = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_AEN) >> 1; in get_window()
1402 pdata->priority = (lcd->window[plane].winctrl1& LCD_WINCTRL1_PRI) >> 30; in get_window()
1403 pdata->channel = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_PIPE) >> 29; in get_window()
1404 pdata->buffer_format = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_FRM) >> 25; in get_window()
1405 pdata->color_order = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_CCO) >> 24; in get_window()
1406 pdata->pixel_order = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_PO) >> 22; in get_window()
1407 pdata->xsize = ((lcd->window[plane].winctrl1 & LCD_WINCTRL1_SZX) >> 11) + 1; in get_window()
1408 pdata->ysize = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_SZY) + 1; in get_window()
1411 pdata->colorkey_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_CKMODE) >> 24; in get_window()
1412 pdata->double_buffer_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_DBM) >> 23; in get_window()
1413 pdata->ram_array_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_RAM) >> 21; in get_window()
1415 pdata->enable = (lcd->winenable >> plane) & 1; in get_window()
1422 struct au1200fb_device *fbdev = info->par; in au1200fb_ioctl()
1433 return -EFAULT; in au1200fb_ioctl()
1467 au1200_setpanel(newpanel, fbdev->pd); in au1200fb_ioctl()
1477 return -EINVAL; in au1200fb_ioctl()
1483 return -EFAULT; in au1200fb_ioctl()
1504 /*-------------------------------------------------------------------------*/
1509 lcd->intstatus = lcd->intstatus; in au1200fb_handle_irq()
1515 /*-------------------------------------------------------------------------*/
1517 /* AU1200 LCD device probe helpers */
1521 struct fb_info *fbi = fbdev->fb_info; in au1200fb_init_fbinfo()
1524 fbi->fbops = &au1200fb_fb_ops; in au1200fb_init_fbinfo()
1526 bpp = winbpp(win->w[fbdev->plane].mode_winctrl1); in au1200fb_init_fbinfo()
1529 /* fixme: we're setting up LCD controller windows, so these dont give a in au1200fb_init_fbinfo()
1532 memcpy(&fbi->monspecs, &panel->monspecs, sizeof(struct fb_monspecs)); in au1200fb_init_fbinfo()
1537 if (!fb_find_mode(&fbi->var, in au1200fb_init_fbinfo()
1540 fbi->monspecs.modedb, in au1200fb_init_fbinfo()
1541 fbi->monspecs.modedb_len, in au1200fb_init_fbinfo()
1542 fbi->monspecs.modedb, in au1200fb_init_fbinfo()
1545 print_err("Cannot find valid mode for panel %s", panel->name); in au1200fb_init_fbinfo()
1546 return -EFAULT; in au1200fb_init_fbinfo()
1549 fbi->pseudo_palette = kcalloc(16, sizeof(u32), GFP_KERNEL); in au1200fb_init_fbinfo()
1550 if (!fbi->pseudo_palette) in au1200fb_init_fbinfo()
1551 return -ENOMEM; in au1200fb_init_fbinfo()
1553 ret = fb_alloc_cmap(&fbi->cmap, AU1200_LCD_NBR_PALETTE_ENTRIES, 0); in au1200fb_init_fbinfo()
1560 strscpy(fbi->fix.id, "AU1200"); in au1200fb_init_fbinfo()
1561 fbi->fix.smem_start = fbdev->fb_phys; in au1200fb_init_fbinfo()
1562 fbi->fix.smem_len = fbdev->fb_len; in au1200fb_init_fbinfo()
1563 fbi->fix.type = FB_TYPE_PACKED_PIXELS; in au1200fb_init_fbinfo()
1564 fbi->fix.xpanstep = 0; in au1200fb_init_fbinfo()
1565 fbi->fix.ypanstep = 0; in au1200fb_init_fbinfo()
1566 fbi->fix.mmio_start = 0; in au1200fb_init_fbinfo()
1567 fbi->fix.mmio_len = 0; in au1200fb_init_fbinfo()
1568 fbi->fix.accel = FB_ACCEL_NONE; in au1200fb_init_fbinfo()
1570 fbi->flags |= FBINFO_VIRTFB; in au1200fb_init_fbinfo()
1572 fbi->screen_buffer = fbdev->fb_mem; in au1200fb_init_fbinfo()
1579 /*-------------------------------------------------------------------------*/
1587 int panel_idx = -1; in au1200fb_setup()
1595 /* Panel option - can be panel name, in au1200fb_setup()
1596 * "bs" for board-switch, or number/index */ in au1200fb_setup()
1608 panel_idx = pd->panel_index(); in au1200fb_setup()
1647 /* AU1200 LCD controller device driver */
1657 pd = dev->dev.platform_data; in au1200fb_drv_probe()
1659 return -ENODEV; in au1200fb_drv_probe()
1663 return -ENODEV; in au1200fb_drv_probe()
1669 printk(DRIVER_NAME ": Panel %d %s\n", panel_index, panel->name); in au1200fb_drv_probe()
1670 printk(DRIVER_NAME ": Win %d %s\n", window_index, win->name); in au1200fb_drv_probe()
1673 bpp = winbpp(win->w[plane].mode_winctrl1); in au1200fb_drv_probe()
1674 if (win->w[plane].xres == 0) in au1200fb_drv_probe()
1675 win->w[plane].xres = panel->Xres; in au1200fb_drv_probe()
1676 if (win->w[plane].yres == 0) in au1200fb_drv_probe()
1677 win->w[plane].yres = panel->Yres; in au1200fb_drv_probe()
1680 &dev->dev); in au1200fb_drv_probe()
1682 ret = -ENOMEM; in au1200fb_drv_probe()
1687 fbdev = fbi->par; in au1200fb_drv_probe()
1688 fbdev->fb_info = fbi; in au1200fb_drv_probe()
1689 fbdev->pd = pd; in au1200fb_drv_probe()
1690 fbdev->dev = &dev->dev; in au1200fb_drv_probe()
1692 fbdev->plane = plane; in au1200fb_drv_probe()
1695 fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8; in au1200fb_drv_probe()
1697 fbdev->fb_mem = dmam_alloc_attrs(&dev->dev, in au1200fb_drv_probe()
1698 PAGE_ALIGN(fbdev->fb_len), in au1200fb_drv_probe()
1699 &fbdev->fb_phys, GFP_KERNEL, 0); in au1200fb_drv_probe()
1700 if (!fbdev->fb_mem) { in au1200fb_drv_probe()
1702 fbdev->fb_len / 1024); in au1200fb_drv_probe()
1703 ret = -ENOMEM; in au1200fb_drv_probe()
1707 print_dbg("Framebuffer memory map at %p", fbdev->fb_mem); in au1200fb_drv_probe()
1708 print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024); in au1200fb_drv_probe()
1731 IRQF_SHARED, "lcd", (void *)dev); in au1200fb_drv_probe()
1753 if (fbi->cmap.len != 0) in au1200fb_drv_probe()
1754 fb_dealloc_cmap(&fbi->cmap); in au1200fb_drv_probe()
1755 kfree(fbi->pseudo_palette); in au1200fb_drv_probe()
1777 if (fbi->cmap.len != 0) in au1200fb_drv_remove()
1778 fb_dealloc_cmap(&fbi->cmap); in au1200fb_drv_remove()
1779 kfree(fbi->pseudo_palette); in au1200fb_drv_remove()
1794 lcd->outmask = 0; in au1200fb_drv_suspend()
1832 .name = "au1200-lcd",