⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 au1200fb.patch

📁 patches for linux-2.6.
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+	lcd->clkcontrol = panel->mode_clkcontrol;+	lcd->pwmdiv = panel->mode_pwmdiv;+	lcd->pwmhi = panel->mode_pwmhi;+	lcd->outmask = panel->mode_outmask;+	lcd->fifoctrl = panel->mode_fifoctrl;+	au_sync();++	/* FIX!!! Check window settings to make sure still valid for new geometry */+	//au1200_setlocation(fbdev, 0, win->w[0].xpos, win->w[0].ypos);+	//au1200_setlocation(fbdev, 1, win->w[1].xpos, win->w[1].ypos);+	//au1200_setlocation(fbdev, 2, win->w[2].xpos, win->w[2].ypos);+	//au1200_setlocation(fbdev, 3, win->w[3].xpos, win->w[3].ypos);+	lcd->winenable = winenable;++	/*+	 * Re-enable screen now that it is configured+	 */+	lcd->screen |= LCD_SCREEN_SEN;+	au_sync();++	/* Call init of panel */+	if (panel->device_init != NULL) panel->device_init();++	/* FIX!!!! not appropriate on panel change!!! Global setup/init */+	lcd->intenable = 0;+	lcd->intstatus = ~0;+	lcd->backcolor = win->mode_backcolor;++	/* Setup Color Key - FIX!!! */+	lcd->colorkey = win->mode_colorkey;+	lcd->colorkeymsk = win->mode_colorkeymsk;++	/* Setup HWCursor - FIX!!! Need to support this eventually */+	lcd->hwc.cursorctrl = 0;+	lcd->hwc.cursorpos = 0;+	lcd->hwc.cursorcolor0 = 0;+	lcd->hwc.cursorcolor1 = 0;+	lcd->hwc.cursorcolor2 = 0;+	lcd->hwc.cursorcolor3 = 0;+++#if 0+#define D(X) printk("%25s: %08X\n", #X, X)+	D(lcd->screen);+	D(lcd->horztiming);+	D(lcd->verttiming);+	D(lcd->clkcontrol);+	D(lcd->pwmdiv);+	D(lcd->pwmhi);+	D(lcd->outmask);+	D(lcd->fifoctrl);+	D(lcd->window[0].winctrl0);+	D(lcd->window[0].winctrl1);+	D(lcd->window[0].winctrl2);+	D(lcd->window[0].winbuf0);+	D(lcd->window[0].winbuf1);+	D(lcd->window[0].winbufctrl);+	D(lcd->window[1].winctrl0);+	D(lcd->window[1].winctrl1);+	D(lcd->window[1].winctrl2);+	D(lcd->window[1].winbuf0);+	D(lcd->window[1].winbuf1);+	D(lcd->window[1].winbufctrl);+	D(lcd->window[2].winctrl0);+	D(lcd->window[2].winctrl1);+	D(lcd->window[2].winctrl2);+	D(lcd->window[2].winbuf0);+	D(lcd->window[2].winbuf1);+	D(lcd->window[2].winbufctrl);+	D(lcd->window[3].winctrl0);+	D(lcd->window[3].winctrl1);+	D(lcd->window[3].winctrl2);+	D(lcd->window[3].winbuf0);+	D(lcd->window[3].winbuf1);+	D(lcd->window[3].winbufctrl);+	D(lcd->winenable);+	D(lcd->intenable);+	D(lcd->intstatus);+	D(lcd->backcolor);+	D(lcd->winenable);+	D(lcd->colorkey);+    D(lcd->colorkeymsk);+	D(lcd->hwc.cursorctrl);+	D(lcd->hwc.cursorpos);+	D(lcd->hwc.cursorcolor0);+	D(lcd->hwc.cursorcolor1);+	D(lcd->hwc.cursorcolor2);+	D(lcd->hwc.cursorcolor3);+#endif+}++#if 0+static int au1200_setsize (struct au1200fb_device *fbdev, int plane, int xres, int yres)+{+	uint32 winctrl0, winctrl1, winenable;+	int xsz, ysz;++	/* FIX!!! X*Y can not surpass allocated memory */++	printk("setsize: x %d y %d\n", xres, yres);+	winctrl1 = lcd->window[plane].winctrl1;+	printk("org winctrl1 %08X\n", winctrl1);+	winctrl1 &= ~(LCD_WINCTRL1_SZX | LCD_WINCTRL1_SZY);++	xres -= 1;+	yres -= 1;+	winctrl1 |= (xres << 11);+	winctrl1 |= (yres << 0);++	printk("new winctrl1 %08X\n", winctrl1);++	/*winenable = lcd->winenable & (1 << plane); */+	/*lcd->winenable &= ~(1 << plane); */+	lcd->window[plane].winctrl1 = winctrl1;+	/*lcd->winenable |= winenable; */+	return 0;+}+#endif++static void au1200_setmode(struct au1200fb_device *fbdev)+{+	int plane = fbdev->plane;+	/* Window/plane setup */+	lcd->window[plane].winctrl1 = ( 0+		| LCD_WINCTRL1_PRI_N(plane)+		| win->w[plane].mode_winctrl1 /* FRM,CCO,PO,PIPE */+		) ;++	au1200_setlocation(fbdev, plane, win->w[plane].xpos, win->w[plane].ypos);++	lcd->window[plane].winctrl2 = ( 0+		| LCD_WINCTRL2_CKMODE_00+		| LCD_WINCTRL2_DBM+/*			| LCD_WINCTRL2_RAM */+		| LCD_WINCTRL2_BX_N( fbdev->fb_info.fix.line_length)+		| LCD_WINCTRL2_SCX_1+		| LCD_WINCTRL2_SCY_1+		) ;+	lcd->winenable |= win->w[plane].mode_winenable;+	au_sync();+}+++/* Inline helpers */++//#define panel_is_dual(panel)  ((panel->mode_screen & LCD_SCREEN_PT) == LCD_SCREEN_PT_010)+//#define panel_is_active(panel)((panel->mode_screen & LCD_SCREEN_PT) == LCD_SCREEN_PT_010)++#define panel_is_color(panel) ((panel->mode_screen & LCD_SCREEN_PT) <= LCD_SCREEN_PT_CDSTN)++//#define panel_swap_rgb(panel) (panel->mode_screen & LCD_CONTROL_CCO)+++/* Bitfields format supported by the controller. */+struct fb_bitfield rgb_bitfields[][4] = +{+  	/*     Red, 	   Green, 	 Blue, 	     Transp   */+	[LCD_WINCTRL1_FRM_16BPP655 >> 25] =+		{ { 10, 6, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 0, 0, 0 } },++	[LCD_WINCTRL1_FRM_16BPP565 >> 25] =+		{ { 11, 5, 0 }, { 5, 6, 0 }, { 0, 5, 0 }, { 0, 0, 0 } },++	[LCD_WINCTRL1_FRM_16BPP556 >> 25] =+		{ { 11, 5, 0 }, { 6, 5, 0 }, { 0, 6, 0 }, { 0, 0, 0 } },++	[LCD_WINCTRL1_FRM_16BPPI1555 >> 25] =+		{ { 10, 5, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 0, 0, 0 } },++	[LCD_WINCTRL1_FRM_16BPPI5551 >> 25] =+		{ { 11, 5, 0 }, { 6, 5, 0 }, { 1, 5, 0 }, { 0, 0, 0 } },++	[LCD_WINCTRL1_FRM_16BPPA1555 >> 25] =+		{ { 10, 5, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 15, 1, 0 } },++	[LCD_WINCTRL1_FRM_16BPPA5551 >> 25] =+		{ { 11, 5, 0 }, { 6, 5, 0 }, { 1, 5, 0 }, { 0, 1, 0 } },++	[LCD_WINCTRL1_FRM_24BPP >> 25] =+		{ { 16, 8, 0 }, { 8, 8, 0 }, { 0, 8, 0 }, { 0, 0, 0 } },++	[LCD_WINCTRL1_FRM_32BPP >> 25] =+		{ { 16, 8, 0 }, { 8, 8, 0 }, { 0, 8, 0 }, { 24, 0, 0 } },+};++/*-------------------------------------------------------------------------*/++/* Helpers */+	+static void +au1200fb_update_fbinfo(struct fb_info *fbi)+{+	/* FIX!!!! This also needs to take the window pixel format into account!!! */++	/* Update var-dependent FB info */+	if (panel_is_color(panel)) {+		if (fbi->var.bits_per_pixel <= 8) {+			/* palettized */+			fbi->fix.visual = FB_VISUAL_PSEUDOCOLOR;+			fbi->fix.line_length = fbi->var.xres_virtual / +							(8/fbi->var.bits_per_pixel); // FIX!!!!+		} else {+			/* non-palettized */+			fbi->fix.visual = FB_VISUAL_TRUECOLOR;+			fbi->fix.line_length = fbi->var.xres_virtual * (fbi->var.bits_per_pixel / 8); +		}+	} else {+		/* mono FIX!!! mono 8 and 4 bits */+		fbi->fix.visual = FB_VISUAL_MONO10;+		fbi->fix.line_length = fbi->var.xres_virtual / 8;  // FIX!!!+	}++	fbi->screen_size = fbi->fix.line_length * fbi->var.yres_virtual;+	print_dbg("line length: %d\n", fbi->fix.line_length);+	print_dbg("bits_per_pixel: %d\n", fbi->var.bits_per_pixel);+}++/*-------------------------------------------------------------------------*/++/* AU1200 framebuffer driver */++int au1200fb_fb_open(struct fb_info *fbi, int user)+{+	return 0;+}++int au1200fb_fb_release(struct fb_info *fbi, int user)+{+	return 0;+}++/* fb_check_var+ * Validate var settings with hardware restrictions and modify it if necessary + */+int au1200fb_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *fbi)+{+	struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi;+	u32 pixclock;+	int screen_size, plane;++	plane = fbdev->plane;++	/* Make sure that the mode respect all LCD controller and +	 * panel restrictions. */+	var->xres = win->w[plane].xres;+	var->yres = win->w[plane].yres;+	+	/* No need for virtual resolution support */+	var->xres_virtual = var->xres;+	var->yres_virtual = var->yres;++	var->bits_per_pixel = winbpp(win->w[plane].mode_winctrl1);++	screen_size = var->xres_virtual * var->yres_virtual;+	if (var->bits_per_pixel > 8) screen_size *= (var->bits_per_pixel / 8);  +	else screen_size /= (8/var->bits_per_pixel);++	if (fbdev->fb_len < screen_size)+		return -EINVAL; /* Virtual screen is to big, abort */++	/* FIX!!!! what are the implicaitons of ignoring this for windows ??? */+	/* The max LCD clock is fixed to 48MHz (value of AUX_CLK). The pixel+	 * clock can only be obtain by dividing this value by an even integer.+	 * Fallback to a slower pixel clock if necessary. */+	pixclock = max((u32)(PICOS2KHZ(var->pixclock) * 1000), fbi->monspecs.dclkmin);+	pixclock = min(pixclock, min(fbi->monspecs.dclkmax, (u32)AU1200_LCD_MAX_CLK/2));++	if (AU1200_LCD_MAX_CLK % pixclock) {+		int diff = AU1200_LCD_MAX_CLK % pixclock;+		pixclock -= diff;+	}++	var->pixclock = KHZ2PICOS(pixclock/1000);+#if 0+	if (!panel_is_active(panel)) {+		int pcd = AU1200_LCD_MAX_CLK / (pixclock * 2) - 1;++		if (!panel_is_color(panel) +			&& (panel->control_base & LCD_CONTROL_MPI) && (pcd < 3)) {+			/* STN 8bit mono panel support is up to 6MHz pixclock */+			var->pixclock = KHZ2PICOS(6000);+		} else if (!pcd) {+			/* Other STN panel support is up to 12MHz  */+			var->pixclock = KHZ2PICOS(12000);+		}+	}+#endif+	/* Set bitfield accordingly */+	switch (var->bits_per_pixel) {+#if 0 // FIX!!!+		case 1:+		case 2: +		case 4: +	case 8:+			/* Pseudo color. SHOULD be the following. */+		var->red.offset = 0;+			var->red.length    = var->bits_per_pixel;+			var->red.msb_right = 0;++		var->green.offset = 0;+			var->green.length  = var->bits_per_pixel;+			var->green.msb_right = 0;++		var->blue.offset = 0;+			var->blue.length   = var->bits_per_pixel;+			var->blue.msb_right = 0;++		var->transp.offset = 0;+		var->transp.length = 0;+			var->transp.msb_right = 0;++		break;+		case 12:+		{+			/* 12bpp True color. Use the last RGB bitfield */+			int idx = ARRAY_SIZE(rgb_bitfields) - 1;++			var->red    = rgb_bitfields[idx][0];+			var->green  = rgb_bitfields[idx][1];+			var->blue   = rgb_bitfields[idx][2];+			var->transp = rgb_bitfields[idx][3];++		break;+#endif+		case 16:+		{+			/* 16bpp True color.  These must be set to MATCH WINCTRL[FORM] */+			int idx;+			idx = (win->w[0].mode_winctrl1 & LCD_WINCTRL1_FRM) >> 25;+			var->red    = rgb_bitfields[idx][0];+			var->green  = rgb_bitfields[idx][1];+			var->blue   = rgb_bitfields[idx][2];+			var->transp = rgb_bitfields[idx][3];+			break;+		}++		case 32:+		{+			/* 32bpp True color.  These must be set to MATCH WINCTRL[FORM] */+			int idx;+			idx = (win->w[0].mode_winctrl1 & LCD_WINCTRL1_FRM) >> 25;+			var->red    = rgb_bitfields[idx][0];+			var->green  = rgb_bitfields[idx][1];+			var->blue   = rgb_bitfields[idx][2];+			var->transp = rgb_bitfields[idx][3];+			break;+		}+		default:+			print_dbg("Unsupported depth %dbpp", var->bits_per_pixel);+			return -EINVAL;+	}++	return 0;+}++/* fb_set_par + * Set hardware with var settings. This will enable the controller with a specific+ * mode, normally validated with the fb_check_var method+ */+int au1200fb_fb_set_par(struct fb_info *fbi)+{+	struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi;++	au1200fb_update_fbinfo(fbi);+	au1200_setmode(fbdev);++	return 0;+}++/* fb_setcolreg+ * Set color in LCD palette.+ */+int au1200fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *fbi)+{+	u32 *palette = lcd->palette;+	u32 value;+//printk("\nau1200fb_fb_setcolreg\n");	++	if (regno > (AU1200_LCD_NBR_PALETTE_ENTRIES - 1))+		return -EINVAL;++	if (fbi->var.grayscale) {+		/* Convert color to grayscale */+		red = green = blue = +			(19595 * red + 38470 * green + 7471 * blue) >> 16;+	}++	if (fbi->fix.visual == FB_VISUAL_TRUECOLOR) {+		/* Place color in the pseudopalette */+		if (regno > 16)+			return -EINVAL;+   +		palette = (u32*)fbi->pseudo_palette;++		red   >>= (16 - fbi->var.red.length);+		green >>= (16 - fbi->var.green.length);+		blue  >>= (16 - fbi->var.blue.length);+	+		value = (red   << fbi->var.red.offset) 	|	+			(green << fbi->var.green.offset)|+			(blue  << fbi->var.blue.offset);+		value &= 0xFFFF;++	} else if (1 /*FIX!!! panel_is_active(fbdev->panel)*/) {+		/* COLOR TFT PALLETTIZED (use RGB 565) */+		value = (red & 0xF800)|((green >> 5) & 0x07E0)|((blue >> 11) & 0x001F);+		value &= 0xFFFF;++	} else if (0 /*panel_is_color(fbdev->panel)*/) {+		/* COLOR STN MODE */+		value = 0x1234; /* FIX!!! (((panel_swap_rgb(fbdev->panel) ? blue : red) >> 12) & 0x000F) | +			((green >> 8) & 0x00F0) | +			(((panel_swap_rgb(fbdev->panel) ? red : blue) >> 4) & 0x0F00); */+		value &= 0xFFF;+	} else {+		/* MONOCHROME MODE */+		value = (green >> 12) & 0x000F;+		value &= 0xF;+	}++	palette[regno] = value;+	+	return 0;+}++/* fb_blank+ * Blank the screen. Depending on the mode, the screen will be+ * activated with the backlight color, or desactivated+ */+int au1200fb_fb_blank(int blank_mode, struct fb_info *fbi)+{+	/* Short-circuit screen blanking */+	if (noblanking)+		return 0;++	switch (blank_mode) {++	case VESA_NO_BLANKING:+		/* printk("turn on panel\n"); */+		au1200_setpanel(panel);+		break;++	case VESA_VSYNC_SUSPEND:+	case VESA_HSYNC_SUSPEND:+	case VESA_POWERDOWN:+		/* printk("turn off panel\n"); */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -