?? au1200fb.patch
字號:
+ .mode_horztiming = 0x003c5859,+ .mode_verttiming = 0x00741201,+ .mode_clkcontrol = 0x00020001, /* /4=24Mhz */+ .mode_pwmdiv = 0x00000000,+ .mode_pwmhi = 0x00000000,+ .mode_outmask = 0x00FFFFFF,+ .mode_fifoctrl = 0x2f2f2f2f,+ .mode_toyclksrc = 0x00000004, /* AUXPLL directly */+ .mode_backlight = 0x00000000,+ .mode_auxpll = 8, /* 96MHz AUXPLL */+ .device_init = NULL,+ .device_shutdown = NULL,+ 640, 640,+ 480, 480,+ },++ [2] = { /* SVGA 800x600 H:46.1kHz V:69Hz */+ .name = "SVGA_800x600",+ .monspecs = {+ .modedb = NULL,+ .modedb_len = 0,+ .hfmin = 30000,+ .hfmax = 70000,+ .vfmin = 60,+ .vfmax = 60,+ .dclkmin = 6000000,+ .dclkmax = 28000000,+ .input = FB_DISP_RGB,+ },+ .mode_screen = 0x18fa5780,+ .mode_horztiming = 0x00dc7e77,+ .mode_verttiming = 0x00584805,+ .mode_clkcontrol = 0x00020000, /* /2=48Mhz */+ .mode_pwmdiv = 0x00000000,+ .mode_pwmhi = 0x00000000,+ .mode_outmask = 0x00FFFFFF,+ .mode_fifoctrl = 0x2f2f2f2f,+ .mode_toyclksrc = 0x00000004, /* AUXPLL directly */+ .mode_backlight = 0x00000000,+ .mode_auxpll = 8, /* 96MHz AUXPLL */+ .device_init = NULL,+ .device_shutdown = NULL,+ 800, 800,+ 600, 600,+ },++ [3] = { /* XVGA 1024x768 H:56.2kHz V:70Hz */+ .name = "XVGA_1024x768",+ .monspecs = {+ .modedb = NULL,+ .modedb_len = 0,+ .hfmin = 30000, // FIX+ .hfmax = 70000, // FIX+ .vfmin = 60, // FIX+ .vfmax = 60, // FIX+ .dclkmin = 6000000, // FIX+ .dclkmax = 28000000, // FIX+ .input = FB_DISP_RGB,+ },+ .mode_screen = 0x1ffaff80,+ .mode_horztiming = 0x007d0e57,+ .mode_verttiming = 0x00740a01,+ .mode_clkcontrol = 0x000A0000, /* /1 */+ .mode_pwmdiv = 0x00000000,+ .mode_pwmhi = 0x00000000,+ .mode_outmask = 0x00FFFFFF,+ .mode_fifoctrl = 0x2f2f2f2f,+ .mode_toyclksrc = 0x00000004, /* AUXPLL directly */+ .mode_backlight = 0x00000000,+ .mode_auxpll = 6, /* 72MHz AUXPLL */+ .device_init = NULL,+ .device_shutdown = NULL,+ 1024, 1024,+ 768, 768,+ },++ [4] = { /* XVGA XVGA 1280x1024 H:68.5kHz V:65Hz */+ .name = "XVGA_1280x1024",+ .monspecs = {+ .modedb = NULL,+ .modedb_len = 0,+ .hfmin = 30000, // FIX+ .hfmax = 70000, // FIX+ .vfmin = 60, // FIX+ .vfmax = 60, // FIX+ .dclkmin = 6000000, // FIX+ .dclkmax = 28000000, // FIX+ .input = FB_DISP_RGB,+ },+ .mode_screen = 0x27fbff80,+ .mode_horztiming = 0x00cdb2c7,+ .mode_verttiming = 0x00600002,+ .mode_clkcontrol = 0x000A0000, /* /1 */+ .mode_pwmdiv = 0x00000000,+ .mode_pwmhi = 0x00000000,+ .mode_outmask = 0x00FFFFFF,+ .mode_fifoctrl = 0x2f2f2f2f,+ .mode_toyclksrc = 0x00000004, /* AUXPLL directly */+ .mode_backlight = 0x00000000,+ .mode_auxpll = 10, /* 120MHz AUXPLL */+ .device_init = NULL,+ .device_shutdown = NULL,+ 1280, 1280,+ 1024, 1024,+ },++ [5] = { /* Samsung 1024x768 TFT */+ .name = "Samsung_1024x768_TFT",+ .monspecs = {+ .modedb = NULL,+ .modedb_len = 0,+ .hfmin = 30000, // FIX+ .hfmax = 70000, // FIX+ .vfmin = 60, // FIX+ .vfmax = 60, // FIX+ .dclkmin = 6000000, // FIX+ .dclkmax = 28000000, // FIX+ .input = FB_DISP_RGB,+ },+ .mode_screen = 0x1ffaff80,+ .mode_horztiming = 0x018cc677,+ .mode_verttiming = 0x00241217,+ .mode_clkcontrol = 0x00000000, /* SCB 0x1 /4=24Mhz */+ .mode_pwmdiv = 0x8000063f, /* SCB 0x0 */+ .mode_pwmhi = 0x03400000, /* SCB 0x0 */+ .mode_outmask = 0x00FFFFFF,+ .mode_fifoctrl = 0x2f2f2f2f,+ .mode_toyclksrc = 0x00000004, /* AUXPLL directly */+ .mode_backlight = 0x00000000,+ .mode_auxpll = 8, /* 96MHz AUXPLL */+ .device_init = board_au1200fb_panel_init,+ .device_shutdown = board_au1200fb_panel_shutdown,+ 1024, 1024,+ 768, 768,+ },++ [6] = { /* Toshiba 640x480 TFT */+ .name = "Toshiba_640x480_TFT",+ .monspecs = {+ .modedb = NULL,+ .modedb_len = 0,+ .hfmin = 30000, // FIX+ .hfmax = 70000, // FIX+ .vfmin = 60, // FIX+ .vfmax = 60, // FIX+ .dclkmin = 6000000, // FIX+ .dclkmax = 28000000, // FIX+ .input = FB_DISP_RGB,+ },+ .mode_screen = LCD_SCREEN_SX_N(640) | LCD_SCREEN_SY_N(480),+ .mode_horztiming = LCD_HORZTIMING_HPW_N(96) | LCD_HORZTIMING_HND1_N(13) | LCD_HORZTIMING_HND2_N(51),+ .mode_verttiming = LCD_VERTTIMING_VPW_N(2) | LCD_VERTTIMING_VND1_N(11) | LCD_VERTTIMING_VND2_N(32),+ .mode_clkcontrol = 0x00000000, /* /4=24Mhz */+ .mode_pwmdiv = 0x8000063f,+ .mode_pwmhi = 0x03400000,+ .mode_outmask = 0x00fcfcfc,+ .mode_fifoctrl = 0x2f2f2f2f,+ .mode_toyclksrc = 0x00000004, /* AUXPLL directly */+ .mode_backlight = 0x00000000,+ .mode_auxpll = 8, /* 96MHz AUXPLL */+ .device_init = board_au1200fb_panel_init,+ .device_shutdown = board_au1200fb_panel_shutdown,+ 640, 640,+ 480, 480,+ },++ [7] = { /* Sharp 320x240 TFT */+ .name = "Sharp_320x240_TFT",+ .monspecs = {+ .modedb = NULL,+ .modedb_len = 0,+ //.modedb = sharp_lq038q5dr01_modes,+ //.modedb_len = ARRAY_SIZE(sharp_lq038q5dr01_modes),+ .hfmin = 12500,+ .hfmax = 20000,+ .vfmin = 38,+ .vfmax = 81,+ .dclkmin = 4500000,+ .dclkmax = 6800000,+ .input = FB_DISP_RGB,+ },+ .mode_screen = LCD_SCREEN_SX_N(320) | LCD_SCREEN_SY_N(240),+ .mode_horztiming = LCD_HORZTIMING_HPW_N(60) | LCD_HORZTIMING_HND1_N(13) | LCD_HORZTIMING_HND2_N(2),+ .mode_verttiming = LCD_VERTTIMING_VPW_N(2) | LCD_VERTTIMING_VND1_N(2) | LCD_VERTTIMING_VND2_N(5),+ .mode_clkcontrol = LCD_CLKCONTROL_PCD_N(7), /* /16=6Mhz */+ .mode_pwmdiv = 0x8000063f,+ .mode_pwmhi = 0x03400000,+ .mode_outmask = 0x00fcfcfc,+ .mode_fifoctrl = 0x2f2f2f2f,+ .mode_toyclksrc = 0x00000004, /* AUXPLL directly */+ .mode_backlight = 0x00000000,+ .mode_auxpll = 8, /* 96MHz AUXPLL */+ .device_init = board_au1200fb_panel_init,+ .device_shutdown = board_au1200fb_panel_shutdown,+ 320, 320,+ 240, 240,+ },++ [8] = { /* Toppoly TD070WGCB2 7" 856x480 TFT */+ .name = "Toppoly_TD070WGCB2",+ .monspecs = {+ .modedb = NULL,+ .modedb_len = 0,+ .hfmin = 30000, // FIX+ .hfmax = 70000, // FIX+ .vfmin = 60, // FIX+ .vfmax = 60, // FIX+ .dclkmin = 6000000, // FIX+ .dclkmax = 28000000, // FIX+ .input = FB_DISP_RGB,+ },+ .mode_screen = LCD_SCREEN_SX_N(856) | LCD_SCREEN_SY_N(480),+ .mode_horztiming = LCD_HORZTIMING_HND2_N(43) | LCD_HORZTIMING_HND1_N(43) | LCD_HORZTIMING_HPW_N(114),+ .mode_verttiming = LCD_VERTTIMING_VND2_N(20) | LCD_VERTTIMING_VND1_N(21) | LCD_VERTTIMING_VPW_N(4),+ .mode_clkcontrol = 0x00020001, /* /4=24Mhz */+ .mode_pwmdiv = 0x8000063f,+ .mode_pwmhi = 0x03400000,+ .mode_outmask = 0x00fcfcfc,+ .mode_fifoctrl = 0x2f2f2f2f,+ .mode_toyclksrc = 0x00000004, /* AUXPLL directly */+ .mode_backlight = 0x00000000,+ .mode_auxpll = 8, /* 96MHz AUXPLL */+ .device_init = board_au1200fb_panel_init,+ .device_shutdown = board_au1200fb_panel_shutdown,+ 856, 856,+ 480, 480,+ },++#if defined(CONFIG_FOCUS_ENHANCEMENTS)+ /* FIX!!!! */+#endif++};++#define NUM_PANELS (sizeof(known_lcd_panels) / sizeof(struct panel_settings))++/********************************************************************/++static int set_brightness(unsigned int brightness)+{+ unsigned int hi1, divider;++ // limit brightness pwm duty to >= 30/1600+ if (brightness < 30) {+ brightness = 30;+ }+ divider = (lcd->pwmdiv & 0x3FFFF) + 1;+ hi1 = (lcd->pwmhi >> 16) + 1;+ hi1 = (((brightness & 0xFF)+1) * divider >> 8);+ lcd->pwmhi &= 0xFFFF;+ lcd->pwmhi |= (hi1 << 16);++ return brightness;+}++static int+winbpp (unsigned int winctrl1)+{+ /* how many bits are needed for each pixel format */+ switch (winctrl1 & LCD_WINCTRL1_FRM)+ {+ case LCD_WINCTRL1_FRM_1BPP: return 1; break;+ case LCD_WINCTRL1_FRM_2BPP: return 2; break;+ case LCD_WINCTRL1_FRM_4BPP: return 4; break;+ case LCD_WINCTRL1_FRM_8BPP: return 8; break;+ case LCD_WINCTRL1_FRM_12BPP: return 16; break;+ case LCD_WINCTRL1_FRM_16BPP655: return 16; break;+ case LCD_WINCTRL1_FRM_16BPP565: return 16; break;+ case LCD_WINCTRL1_FRM_16BPP556: return 16; break;+ case LCD_WINCTRL1_FRM_16BPPI1555: return 16; break;+ case LCD_WINCTRL1_FRM_16BPPI5551: return 16; break;+ case LCD_WINCTRL1_FRM_16BPPA1555: return 16; break;+ case LCD_WINCTRL1_FRM_16BPPA5551: return 16; break;+ case LCD_WINCTRL1_FRM_24BPP: return 32; break;+ case LCD_WINCTRL1_FRM_32BPP: return 32; break;+ default: return 0; break;+ }+}++static int+fbinfo2index (struct fb_info *fb_info)+{+ int i;+ for (i = 0; i < CONFIG_FB_AU1200_DEVS; ++i)+ {+ if (fb_info == (struct fb_info *)(&_au1200fb_devices[i].fb_info))+ return i;+ }+ printk("au1200fb: ERROR: fbinfo2index failed!\n");+ return -1;+}++static int au1200_setlocation (struct au1200fb_device *fbdev, int plane, int xpos, int ypos)+{+ uint32 winctrl0, winctrl1, winenable, fb_offset = 0;+ int xsz, ysz, xsc, ysc;++ winctrl0 = lcd->window[plane].winctrl0;+ winctrl1 = lcd->window[plane].winctrl1;+ winctrl0 &= (LCD_WINCTRL0_A | LCD_WINCTRL0_AEN);+ winctrl1 &= ~(LCD_WINCTRL1_SZX | LCD_WINCTRL1_SZY);+ + xsc = ((lcd->window[plane].winctrl2 & LCD_WINCTRL2_SCX) >> 4);+ ysc = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_SCY);++ /* Check for off-screen adjustments */+ xsz = win->w[plane].xres;+ ysz = win->w[plane].yres;+ if ((xpos + win->w[plane].xres) > panel->Xres)+ {+ /* Off-screen to the right */+ xsz = panel->Xres - xpos; /* off by 1 ??? */+ /*printk("off screen right\n");*/+ }++ if ((ypos + win->w[plane].yres) > panel->Yres)+ {+ /* Off-screen to the bottom */+ ysz = panel->Yres - ypos; /* off by 1 ??? */+ /*printk("off screen bottom\n");*/+ }++ if (xpos < 0)+ {+ /* Off-screen to the left */+ xsz = win->w[plane].xres + xpos;+ fb_offset += (((0 - xpos) * winbpp(winctrl1))/8);+ xpos = 0;+ /*printk("off screen left\n");*/+ }++ if (ypos < 0)+ {+ /* Off-screen to the top */+ ysz = win->w[plane].yres + ypos;+ fb_offset += ((0 - ypos) * (winbpp(winctrl1)/8) * win->w[plane].xres);+ ypos = 0;+ /*printk("off screen top\n");*/+ }++ /* check for correct size depending on scaling */+ if (xsc == 1)+ xsz &= ~1;+ if (xsc == 2)+ xsz &= ~3;+ + if (ysc == 1)+ ysz &= ~1;+ if (ysc == 2)+ ysz &= ~3;+ + /* check for complete off-screen */+ if (xsz <= 0 || ysz <= 0) {+ lcd->winenable &= ~(1 << plane);+ return 0;+ }+ + xsz -= 1;+ ysz -= 1;+ + winctrl0 |= (xpos << 21);+ winctrl0 |= (ypos << 10);+ winctrl1 |= (xsz << 11);+ winctrl1 |= (ysz << 0);++ /* Disable the window while making changes, then restore WINEN */+ winenable = lcd->winenable & (1 << plane);+ au_sync();+ lcd->winenable &= ~(1 << plane);+ lcd->window[plane].winctrl0 = winctrl0;+ lcd->window[plane].winctrl1 = winctrl1;+ lcd->window[plane].winbuf0 =+ lcd->window[plane].winbuf1 = fbdev->fb_phys + fb_offset;+ lcd->window[plane].winbufctrl = 0; /* select winbuf0 */+ lcd->winenable |= winenable;+ au_sync();++ return 0;+}++static void au1200_setpanel (struct panel_settings *newpanel)+{+ /*+ * Perform global setup/init of LCD controller+ */+ uint32 winenable;++ /* Make sure all windows disabled */+ winenable = lcd->winenable;+ lcd->winenable = 0;+ au_sync();+ /*+ * Ensure everything is disabled before reconfiguring+ */+ if (lcd->screen & LCD_SCREEN_SEN)+ {+ /* Wait for vertical sync period */+ lcd->intstatus = LCD_INT_SS;+ while ((lcd->intstatus & LCD_INT_SS) == 0) {+ au_sync();+ }+ + lcd->screen &= ~LCD_SCREEN_SEN; /*disable the controller*/+ + do+ {+ lcd->intstatus = lcd->intstatus; /*clear interrupts*/+ au_sync();+ }+ /*wait for controller to shut down*/+ while ((lcd->intstatus & LCD_INT_SD) == 0);+ + /* Call shutdown of current panel (if up) */+ /* this must occur last, because if an external clock is driving+ the controller, the clock cannot be turned off before first+ shutting down the controller.+ */+ if (panel->device_shutdown != NULL) panel->device_shutdown();+ }++ /* Newpanel == NULL indicates a shutdown operation only */+ if (newpanel == NULL)+ return;++ panel = newpanel;+ + printk("Panel(%s), %dx%d\n", panel->name, panel->Xres, panel->Yres);++ /*+ * Setup clocking if internal LCD clock source (assumes sys_auxpll valid)+ */+ if (!(panel->mode_clkcontrol & LCD_CLKCONTROL_EXT))+ {+ uint32 sys_clksrc;+ au_writel(panel->mode_auxpll, SYS_AUXPLL); // FIX!!! This should really just be a check!+ sys_clksrc = au_readl(SYS_CLKSRC) & ~0x0000001f; + sys_clksrc |= panel->mode_toyclksrc;+ au_writel(sys_clksrc, SYS_CLKSRC);+ }++ /*+ * Configure panel timings+ */+ lcd->screen = panel->mode_screen;+ lcd->horztiming = panel->mode_horztiming;+ lcd->verttiming = panel->mode_verttiming;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -