patch-2.4.0-test7 linux/drivers/video/hgafb.c

Next file: linux/drivers/video/matrox/matroxfb_DAC1064.c
Previous file: linux/drivers/video/acornfb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test6/linux/drivers/video/hgafb.c linux/drivers/video/hgafb.c
@@ -7,6 +7,8 @@
  *
  * History:
  *
+ * - Revision 0.1.6 (17 Aug 2000): new style structs
+ *                                 documentation
  * - Revision 0.1.5 (13 Mar 2000): spinlocks instead of saveflags();cli();etc
  *                                 minor fixes
  * - Revision 0.1.4 (24 Jan 2000): fixed a bug in hga_card_detect() for 
@@ -107,19 +109,23 @@
 /* Framebuffer driver structures */
 
 static struct fb_var_screeninfo hga_default_var = {
-	720, 348,			/* xres, yres */
-	720, 348,			/* xres_virtual, yres_virtual */
-	0, 0,				/* xoffset, yoffset */
-	1,				/* bits_per_pixel */
-	0,				/* grayscale */
-	{0, 1, 0},			/* red */
-	{0, 1, 0},			/* green */
-	{0, 1, 0},			/* blue */
-	{0, 0, 0},			/* transp */ 
-	0,				/* nonstd (FB_NONSTD_HGA ?) */
-	0,				/* activate */
-	-1, -1,				/* height, width */
-	0,				/* accel_flags */
+	xres:		720,
+	yres:		348,
+	xres_virtual:	720,
+	yres_virtual:	348,
+	xoffset:	0,
+	yoffset:	0,
+	bits_per_pixel:	1,
+	grayscale:	0,
+	red:		{0, 1, 0},
+	green:		{0, 1, 0},
+	blue:		{0, 1, 0},
+	transp:		{0, 0, 0},
+	nonstd:		0,			/* (FB_NONSTD_HGA ?) */
+	activate:	0,
+	height:		-1,
+	width:		-1,
+	accel_flags:	0,
 	/* pixclock */
 	/* left_margin, right_margin */
 	/* upper_margin, lower_margin */
@@ -129,19 +135,19 @@
 };
 
 static struct fb_fix_screeninfo hga_fix = {
-	"HGA",				/* id */
-	(unsigned long) NULL,		/* smem_start */
-	0,				/* smem_len */
-	FB_TYPE_PACKED_PIXELS,		/* type (not sure) */
-	0,				/* type_aux (not sure) */
-	FB_VISUAL_MONO10,		/* visual */
-	8,				/* xpanstep */
-	8,				/* ypanstep */
-	0,				/* ywrapstep */
-	90,				/* line_length */
-	0,				/* mmio_start */
-	0,				/* mmio_len */
-	FB_ACCEL_NONE			/* accel */
+	id:		"HGA",
+	smem_start:	(unsigned long) NULL,
+	smem_len:	0,
+	type:		FB_TYPE_PACKED_PIXELS,	/* (not sure) */
+	type_aux:	0,			/* (not sure) */
+	visual:		FB_VISUAL_MONO10,
+	xpanstep:	8,
+	ypanstep:	8,
+	ywrapstep:	0,
+	line_length:	90,
+	mmio_start:	0,
+	mmio_len:	0,
+	accel:		FB_ACCEL_NONE
 };
 
 static struct fb_info fb_info;
@@ -377,9 +383,15 @@
  *
  * ------------------------------------------------------------------------- */
 
-	/*
-	 * Get the Fixed Part of the Display
-	 */
+/**
+ *	hga_get_fix - get the fixed part of the display
+ *	@fix:struct fb_fix_screeninfo to fill in
+ *	@con:unused
+ *	@info:pointer to fb_info object containing info for current hga board
+ *
+ *	This wrapper function copies @info->fix to @fix.
+ *	A zero is returned on success and %-EINVAL for failure.
+ */
 
 int hga_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info)
 {
@@ -390,10 +402,15 @@
 	return 0;
 }
 
-
-	/*
-	 *  Get the User Defined Part of the Display
-	 */
+/**
+ *	hga_get_var - get the user defined part of the display
+ *	@var:struct fb_var_screeninfo to fill in
+ *	@con:unused
+ *	@info:pointer to fb_info object containing info for current hga board
+ *
+ *	This wrapper function copies @info->var to @var.
+ *	A zero is returned on success and %-EINVAL for failure.
+ */
 
 int hga_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
 {
@@ -404,13 +421,23 @@
 	return 0;
 }
 
-	/*
-	 * Set the User Defined Part of the Display
-	 * This is the most mystical function (at least for me).
-	 * What is the exact specification of xxx_set_var?
-	 * Should it handle xoffset, yoffset? Should it do pannig?
-	 * What does vmode mean?
-	 */
+/**
+ *	hga_set_var - set the user defined part of the display
+ *	@var:new video mode
+ *	@con:unused
+ *	@info:pointer to fb_info object containing info for current hga board
+ *	
+ *	This function is called for changing video modes. Since HGA cards have
+ *	only one fixed mode we have not much to do. After checking input 
+ *	parameters @var is copied to @info->var and @info->changevar is called.
+ *	A zero is returned on success and %-EINVAL for failure.
+ *	
+ *	FIXME:
+ *	This is the most mystical function (at least for me).
+ *	What is the exact specification of xxx_set_var()?
+ *	Should it handle xoffset, yoffset? Should it do panning?
+ *	What does vmode mean?
+ */
 
 int hga_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
 {
@@ -431,10 +458,20 @@
 	return 0;
 }
 
-
-	/*
-	 *  Get the Colormap
-	 */
+/**
+ *	hga_getcolreg - read color registers
+ *	@regno:register index to read out
+ *	@red:red value
+ *	@green:green value
+ *	@blue:blue value
+ *	@transp:transparency value
+ *	@info:unused
+ *
+ *	This callback function is used to read the color registers of a HGA
+ *	board. Since we have only two fixed colors, RGB values are 0x0000 
+ *	for register0 and 0xaaaa for register1.
+ *	A zero is returned on success and 1 for failure.
+ */
 
 static int hga_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
 			 u_int *transp, struct fb_info *info)
@@ -450,6 +487,17 @@
 	return 0;
 }
 
+/**
+ *	hga_get_cmap - get the colormap
+ *	@cmap:struct fb_cmap to fill in
+ *	@kspc:called from kernel space?
+ *	@con:unused
+ *	@info:pointer to fb_info object containing info for current hga board
+ *
+ *	This wrapper function passes it's input parameters to fb_get_cmap().
+ *	Callback function hga_getcolreg() is used to read the color registers.
+ */
+
 int hga_get_cmap(struct fb_cmap *cmap, int kspc, int con,
                  struct fb_info *info)
 {
@@ -458,9 +506,19 @@
 	return fb_get_cmap(cmap, kspc, hga_getcolreg, info);
 }
 	
-	/*
-	 * Set the Colormap
-	 */
+/**
+ *	hga_setcolreg - set color registers
+ *	@regno:register index to set
+ *	@red:red value, unused
+ *	@green:green value, unused
+ *	@blue:blue value, unused
+ *	@transp:transparency value, unused
+ *	@info:unused
+ *
+ *	This callback function is used to set the color registers of a HGA
+ *	board. Since we have only two fixed colors only @regno is checked.
+ *	A zero is returned on success and 1 for failure.
+ */
 
 static int hga_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
 			 u_int transp, struct fb_info *info)
@@ -470,6 +528,17 @@
 	return 0;
 }
 
+/**
+ *	hga_set_cmap - set the colormap
+ *	@cmap:struct fb_cmap to set
+ *	@kspc:called from kernel space?
+ *	@con:unused
+ *	@info:pointer to fb_info object containing info for current hga board
+ *
+ *	This wrapper function passes it's input parameters to fb_set_cmap().
+ *	Callback function hga_setcolreg() is used to set the color registers.
+ */
+
 int hga_set_cmap(struct fb_cmap *cmap, int kspc, int con,
                  struct fb_info *info)
 {
@@ -478,11 +547,17 @@
 	return fb_set_cmap(cmap, kspc, hga_setcolreg, info);
 }
 
-	/*
-	 *  Pan or Wrap the Display
-	 *
-	 *  This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
-	 */
+/**
+ *	hga_pan_display - pan or wrap the display
+ *	@var:contains new xoffset, yoffset and vmode values
+ *	@con:unused
+ *	@info:pointer to fb_info object containing info for current hga board
+ *
+ *	This function looks only at xoffset, yoffset and the %FB_VMODE_YWRAP
+ *	flag in @var. If input parameters are correct it calls hga_pan() to 
+ *	program the hardware. @info->var is updated to the new values.
+ *	A zero is returned on success and %-EINVAL for failure.
+ */
 
 int hga_pan_display(struct fb_var_screeninfo *var, int con,
                     struct fb_info *info)
@@ -531,6 +606,18 @@
  * 
  * ------------------------------------------------------------------------- */
 
+/**
+ *	hgafbcon_switch - switch console
+ *	@con:new console to switch to
+ *	@info:pointer to fb_info object containing info for current hga board
+ *
+ *	This function should install a new colormap and change the video mode.
+ *	Since we have fixed colors and only one video mode we have nothing to 
+ *	do.
+ *	Only console administration is done but it should go to fbcon.c IMHO.
+ *	A zero is returned on success and %-EINVAL for failure.
+ */
+
 static int hgafbcon_switch(int con, struct fb_info *info)
 {
 	CHKINFO(-EINVAL);
@@ -564,6 +651,17 @@
 	return 0;
 }
 
+/**
+ *	hgafbcon_updatevar - update the user defined part of the display
+ *	@con:console to update or -1 when no consoles defined on this fb
+ *	@info:pointer to fb_info object containing info for current hga board
+ *
+ *	This function is called when @var is changed by fbcon.c without calling 
+ *	hga_set_var(). It usually means scrolling.  hga_pan_display() is called
+ *	to update the hardware and @info->var.
+ *	A zero is returned on success and %-EINVAL for failure.
+ */
+
 static int hgafbcon_updatevar(int con, struct fb_info *info)
 {
 	CHKINFO(-EINVAL);
@@ -571,17 +669,21 @@
 	return (con < 0) ? -EINVAL : hga_pan_display(&fb_display[con].var, con, info);
 }
 
+/**
+ *	hgafbcon_blank - (un)blank the screen
+ *	@blank_mode:blanking method to use
+ *	@info:unused
+ *	
+ *	Blank the screen if blank_mode != 0, else unblank. 
+ *	Implements VESA suspend and powerdown modes on hardware that supports 
+ *	disabling hsync/vsync:
+ *		@blank_mode == 2 means suspend vsync,
+ *		@blank_mode == 3 means suspend hsync,
+ *		@blank_mode == 4 means powerdown.
+ */
+
 static void hgafbcon_blank(int blank_mode, struct fb_info *info)
 {
-	/*
-	 *  Blank the screen if blank_mode != 0, else unblank. 
-	 *  Implements VESA suspend and powerdown modes on hardware 
-	 *  that supports disabling hsync/vsync:
-	 *    blank_mode == 2: suspend vsync
-	 *    blank_mode == 3: suspend hsync
-	 *    blank_mode == 4: powerdown
-	 */
-
 	CHKINFO( );
 	DPRINTK("hga_blank: blank_mode:%d, info:%x, fb_info:%x\n", blank_mode, (unsigned)info, (unsigned)&fb_info);
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)