sa1100fb.c
来自「S3C44B0X下的LCD (framebuffer)驱动资料与相关代码」· C语言 代码 · 共 2,397 行 · 第 1/5 页
C
2,397 行
right_margin: 115, lower_margin: 36, sync: 0, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Act, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512),};#endif#endif#ifdef CONFIG_SA1100_H3600static struct sa1100fb_mach_info h3600_info __initdata = {#ifdef CONFIG_IPAQ_H3100 pixclock: 407766, bpp: 4, xres: 320, yres: 240, hsync_len: 26, vsync_len: 41, left_margin: 4, upper_margin: 0, right_margin: 4, lower_margin: 0, sync: FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, cmap_greyscale: 1, cmap_static: 1, cmap_inverse: 1, lccr0: LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),#else pixclock: 174757, bpp: 16, xres: 320, yres: 240, hsync_len: 3, vsync_len: 3, left_margin: 12, upper_margin: 10, right_margin: 17, lower_margin: 1, sync: 0, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Act, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),#endif};static struct sa1100fb_rgb h3600_rgb_16 = { red: { offset: 12, length: 4, }, green: { offset: 7, length: 4, }, blue: { offset: 1, length: 4, }, transp: { offset: 0, length: 0, },};#endif#ifdef CONFIG_SA1100_BRUTUSstatic struct sa1100fb_mach_info brutus_info __initdata = { pixclock: 0, bpp: 8, xres: 320, yres: 240, hsync_len: 3, vsync_len: 1, left_margin: 41, upper_margin: 0, right_margin: 101, lower_margin: 0, sync: FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Pas, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2) | LCCR3_PixClkDiv(44),};#endif#ifdef CONFIG_SA1100_CERFstatic struct sa1100fb_mach_info cerf_info __initdata = {#if defined(CONFIG_CERF_LCD_72_A) pixclock: 171521, bpp: 8, xres: 640, yres: 480, lccr0: LCCR0_Color | LCCR0_Dual | LCCR0_Pas, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2) | LCCR3_PixClkDiv(38),#elif defined(CONFIG_CERF_LCD_57_A) pixclock: 171521, bpp: 8, xres: 320, yres: 240, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Pas, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2) | LCCR3_PixClkDiv(38),#elif defined(CONFIG_CERF_LCD_38_A) pixclock: 171521, bpp: 8, xres: 240, yres: 320, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Pas, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(56) | LCCR3_PixClkDiv(38),#elif defined(CONFIG_CERF_LCD_38_B) pixclock: 171521, bpp: 4, xres: 320, yres: 240, lccr0: LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(56) | LCCR3_PixClkDiv(38),#else#error "Must have a CerfBoard LCD form factor selected"#endif hsync_len: 5, vsync_len: 1, left_margin: 61, upper_margin: 3, right_margin: 9, lower_margin: 0, sync: FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,};#if 0static struct sa1100fb_rgb cerf_rgb_16 = { red: { offset: 8, length: 4, }, green: { offset: 4, length: 4, }, blue: { offset: 0, length: 4, }, transp: { offset: 0, length: 0, },};#endif#endif#ifdef CONFIG_SA1100_FREEBIRD#warning Please check this carefullystatic struct sa1100fb_mach_info freebird_info __initdata = { pixclock: 171521, bpp: 16, xres: 240, yres: 320, hsync_len: 3, vsync_len: 2, left_margin: 2, upper_margin: 0, right_margin: 2, lower_margin: 0, sync: FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Pas, lccr3: LCCR3_OutEnH | LCCR3_PixFlEdg | LCCR3_ACBsDiv(2),};static struct sa1100fb_rgb freebird_rgb_16 = { red: { offset: 8, length: 4, }, green: { offset: 4, length: 4, }, blue: { offset: 0, length: 4, }, transp: { offset: 12, length: 4, },};#endif#ifdef CONFIG_SA1100_GRAPHICSCLIENTstatic struct sa1100fb_mach_info graphicsclient_info __initdata = { pixclock: 53500, bpp: 8, xres: 640, yres: 480, hsync_len: 9, vsync_len: 9, left_margin: 54, upper_margin: 24, right_margin: 54, lower_margin: 32, sync: 0, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Act, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),};#endif#ifdef CONFIG_SA1100_HUW_WEBPANELstatic struct sa1100fb_mach_info huw_webpanel_info __initdata = { pixclock: 0, bpp: 8, xres: 640, yres: 480, hsync_len: 3, vsync_len: 1, left_margin: 41, upper_margin: 0, right_margin: 101, lower_margin: 0, sync: FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, lccr0: LCCR0_Color | LCCR0_Dual | LCCR0_Pas, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2) | 8,#error FIXME /* * FIXME: please get rid of the '| 8' in preference to an * LCCR3_PixClkDiv() version. --rmk */};#endif#ifdef LART_GREY_LCDstatic struct sa1100fb_mach_info lart_grey_info __initdata = { pixclock: 150000, bpp: 4, xres: 320, yres: 240, hsync_len: 1, vsync_len: 1, left_margin: 4, upper_margin: 0, right_margin: 2, lower_margin: 0, cmap_greyscale: 1, sync: FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, lccr0: LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_4PixMono, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512),};#endif#ifdef LART_COLOR_LCDstatic struct sa1100fb_mach_info lart_color_info __initdata = { pixclock: 150000, bpp: 16, xres: 320, yres: 240, hsync_len: 2, vsync_len: 3, left_margin: 69, upper_margin: 14, right_margin: 8, lower_margin: 4, sync: 0, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Act, lccr3: LCCR3_OutEnH | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),};#endif#ifdef LART_VIDEO_OUTstatic struct sa1100fb_mach_info lart_video_info __initdata = { pixclock: 39721, bpp: 16, xres: 640, yres: 480, hsync_len: 95, vsync_len: 2, left_margin: 40, upper_margin: 32, right_margin: 24, lower_margin: 11, sync: FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Act, lccr3: LCCR3_OutEnL | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),};#endif#ifdef LART_KIT01_LCDstatic struct sa1100fb_mach_info lart_kit01_info __initdata ={ pixclock: 63291, bpp: 16, xres: 640, yres: 480, hsync_len: 64, vsync_len: 3, left_margin: 122, upper_margin: 45, right_margin: 10, lower_margin: 10, sync: 0, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Act, lccr3: LCCR3_OutEnH | LCCR3_PixFlEdg};#endif#ifdef CONFIG_SA1100_OMNIMETERstatic struct sa1100fb_mach_info omnimeter_info __initdata = { pixclock: 0, bpp: 4, xres: 480, yres: 320, hsync_len: 1, vsync_len: 1, left_margin: 10, upper_margin: 0, right_margin: 10, lower_margin: 0, cmap_greyscale: 1, sync: FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, lccr0: LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_8PixMono, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(255) | LCCR3_PixClkDiv(44),#error FIXME: fix pixclock, ACBsDiv /* * FIXME: I think ACBsDiv is wrong above - should it be 512 (disabled)? * - rmk */};#endif#ifdef CONFIG_SA1100_PANGOLINstatic struct sa1100fb_mach_info pangolin_info __initdata = { pixclock: 341521, bpp: 16, xres: 800, yres: 600, hsync_len: 64, vsync_len: 7, left_margin: 160, upper_margin: 7, right_margin: 24, lower_margin: 1, sync: FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Act, lccr3: LCCR3_OutEnH | LCCR3_PixFlEdg,};#endif#ifdef CONFIG_SA1100_STORK#if STORK_TFT /* ie the NEC TFT *//* * pixclock is ps per clock. say 72Hz, 800x600 clocks => (1/72)/(800*600) * = 28935 and a bit * NB likely to be increased to ease bus timings wrt pcmcia interface */static struct sa1100fb_mach_info stork_tft_info __initdata = { pixclock: 28935, bpp: 16, xres: 640, yres: 480, hsync_len: 64, vsync_len: 2, left_margin: 48, upper_margin: 12, right_margin: 48, lower_margin: 31, sync: 0, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Act, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg,};static struct sa1100fb_rgb stork_tft_rgb_16 = { red: { offset: 11, length: 5, }, green: { offset: 5, length: 6, }, blue: { offset: 0, length: 5, }, transp: { offset: 0, length: 0, },};#else /* Kyocera DSTN */static struct sa1100fb_mach_info stork_dstn_info __initdata = { pixclock: 0, bpp: 16, xres: 640, yres: 480, hsync_len: 2, vsync_len: 2, left_margin: 2, upper_margin: 0, right_margin: 2, lower_margin: 0, sync: FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT , lccr0: LCCR0_Color | LCCR0_Dual | LCCR0_Pas,#error Fixme lccr3: 0xff00 | 0x18 /* ought to be 0x14 but DMA isn't up to that as yet */};static struct sa1100fb_rgb stork_dstn_rgb_16 = { red: { offset: 8, length: 4, }, green: { offset: 4, length: 4, }, blue: { offset: 0, length: 4, }, transp: { offset: 0, length: 0, },};#endif#endif#ifdef CONFIG_SA1100_XP860static struct sa1100fb_mach_info xp860_info __initdata = { pixclock: 0, bpp: 8, xres: 1024, yres: 768, hsync_len: 3, vsync_len: 3, left_margin: 3, upper_margin: 2, right_margin: 2, lower_margin: 1, sync: 0, lccr0: LCCR0_Color | LCCR0_Sngl | LCCR0_Act, lccr3: LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_PixClkDiv(6),};#endifstatic struct sa1100fb_mach_info * __initsa1100fb_get_machine_info(struct sa1100fb_info *fbi){ struct sa1100fb_mach_info *inf = NULL; /* * R G B T * default {11,5}, { 5,6}, { 0,5}, { 0,0} * h3600 {12,4}, { 7,4}, { 1,4}, { 0,0} * freebird { 8,4}, { 4,4}, { 0,4}, {12,4} */#ifdef CONFIG_SA1100_ASSABET if (machine_is_assabet()) {#ifndef ASSABET_PAL_VIDEO inf = &lq039q2ds54_info;#else inf = &pal_info;#endif }#endif#ifdef CONFIG_SA1100_H3600 if (machine_is_h3600()) { inf = &h3600_info; fbi->rgb[RGB_16] = &h3600_rgb_16; }#endif#ifdef CONFIG_SA1100_BRUTUS if (machine_is_brutus()) { inf = &brutus_info; }#endif#ifdef CONFIG_SA1100_CERF if (machine_is_cerf()) { inf = &cerf_info; }#endif#ifdef CONFIG_SA1100_FREEBIRD if (machine_is_freebird()) { inf = &freebird_info; fbi->rgb[RGB_16] = &freebird_rgb16; }#endif#ifdef CONFIG_SA1100_GRAPHICSCLIENT if (machine_is_graphicsclient()) { inf = &graphicsclient_info; }#endif#ifdef CONFIG_SA1100_HUW_WEBPANEL if (machine_is_huw_webpanel()) { inf = &huw_webpanel_info; }#endif#ifdef CONFIG_SA1100_LART if (machine_is_lart()) {#ifdef LART_GREY_LCD inf = &lart_grey_info;#endif#ifdef LART_COLOR_LCD inf = &lart_color_info;#endif#ifdef LART_VIDEO_OUT inf = &lart_video_info;#endif#ifdef LART_KIT01_LCD inf = &lart_kit01_info;#endif }#endif#ifdef CONFIG_SA1100_OMNIMETER if (machine_is_omnimeter()) { inf = &omnimeter_info; }#endif#ifdef CONFIG_SA1100_PANGOLIN if (machine_is_pangolin()) { inf = &pangolin_info; }#endif#ifdef CONFIG_SA1100_XP860 if (machine_is_xp860()) { inf = &xp860_info; }#endif#ifdef CONFIG_SA1100_STORK if (machine_is_stork()) {#if STORK_TFT inf = &stork_tft_info; fbi->rgb[RGB_16] = &stork_tft_rgb_16;#else inf = &stork_dstn_info; fbi->rgb[RGB_16] = &stork_dstn_rgb_16;#endif }#endif return inf;}static int sa1100fb_activate_var(struct fb_var_screeninfo *var, struct sa1100fb_info *);static void set_ctrlr_state(struct sa1100fb_info *fbi, u_int state);static inline void sa1100fb_schedule_task(struct sa1100fb_info *fbi, u_int state){ unsigned long flags; local_irq_save(flags); /* * We need to handle two requests being made at the same time. * There are two important cases: * 1. When we are changing VT (C_REENABLE) while unblanking (C_ENABLE) * We must perform the unblanking, which will do our REENABLE for us. * 2. When we are blanking, but immediately unblank before we have * blanked. We do the "REENABLE" thing here as well, just to be sure. */ if (fbi->task_state == C_ENABLE && state == C_REENABLE) state = (u_int) -1; if (fbi->task_state == C_DISABLE && state == C_ENABLE) state = C_REENABLE; if (state != (u_int)-1) { fbi->task_state = state; schedule_task(&fbi->task); } local_irq_restore(flags);}/* * Get the VAR structure pointer for the specified console */static inline struct fb_var_screeninfo *get_con_var(struct fb_info *info, int con)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?