~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/drivers/video/stifb.c

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * linux/drivers/video/stifb.c - Generic frame buffer driver for HP
  3  * workstations with STI (standard text interface) video firmware.
  4  *
  5  * Based on:
  6  * linux/drivers/video/artistfb.c -- Artist frame buffer driver
  7  *
  8  *      Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
  9  *
 10  *  based on skeletonfb, which was
 11  *      Created 28 Dec 1997 by Geert Uytterhoeven
 12  *
 13  * This file is subject to the terms and conditions of the GNU General Public
 14  * License.  See the file COPYING in the main directory of this archive
 15  * for more details.  */
 16 
 17 /*
 18  * Notes:
 19  *
 20  * This driver assumes that the video has been set up in 1bpp mode by
 21  * the firmware.  Since HP video tends to be planar rather than
 22  * packed-pixel this will probably work anyway even if it isn't.
 23  */
 24 
 25 #include <linux/module.h>
 26 #include <linux/kernel.h>
 27 #include <linux/errno.h>
 28 #include <linux/string.h>
 29 #include <linux/mm.h>
 30 #include <linux/tty.h>
 31 #include <linux/malloc.h>
 32 #include <linux/delay.h>
 33 #include <linux/fb.h>
 34 #include <linux/init.h>
 35 
 36 #include <video/fbcon.h>
 37 
 38 #include "sti.h"
 39 
 40 static struct fb_ops stifb_ops;
 41 
 42 struct stifb_info {
 43         struct fb_info_gen gen;
 44         struct sti_struct *sti;
 45 };
 46 
 47 struct stifb_par {
 48 };
 49 
 50 static struct stifb_info fb_info;
 51 static struct display disp;
 52 
 53 int stifb_init(void);
 54 int stifb_setup(char*);
 55 
 56 extern struct display_switch fbcon_sti;
 57 
 58 /* ------------------- chipset specific functions -------------------------- */
 59 
 60 static int
 61 sti_encode_fix(struct fb_fix_screeninfo *fix,
 62                const void *par, struct fb_info_gen *info)
 63 {
 64         /* XXX: what about smem_len? */
 65         fix->smem_start = PTR_STI(fb_info.sti->glob_cfg)->region_ptrs[1];
 66         fix->type = FB_TYPE_PLANES; /* well, sort of */
 67 
 68         return 0;
 69 }
 70 
 71 static int
 72 sti_decode_var(const struct fb_var_screeninfo *var,
 73         void *par, struct fb_info_gen *info)
 74 {
 75         return 0;
 76 }
 77 
 78 static int
 79 sti_encode_var(struct fb_var_screeninfo *var,
 80                const void *par, struct fb_info_gen *info)
 81 {
 82         var->xres = PTR_STI(fb_info.sti->glob_cfg)->onscreen_x;
 83         var->yres = PTR_STI(fb_info.sti->glob_cfg)->onscreen_y;
 84         var->xres_virtual = PTR_STI(fb_info.sti->glob_cfg)->total_x;
 85         var->yres_virtual = PTR_STI(fb_info.sti->glob_cfg)->total_y;
 86         var->xoffset = var->yoffset = 0;
 87 
 88         var->bits_per_pixel = 1;
 89         var->grayscale = 0;
 90 
 91         return 0;
 92 }
 93 
 94 static void
 95 sti_get_par(void *par, struct fb_info_gen *info)
 96 {
 97 }
 98 
 99 static void
100 sti_set_par(const void *par, struct fb_info_gen *info)
101 {
102 }
103 
104 static int
105 sti_getcolreg(unsigned regno, unsigned *red, unsigned *green,
106               unsigned *blue, unsigned *transp, struct fb_info *info)
107 {
108         return 0;
109 }
110 
111 static int
112 sti_setcolreg(unsigned regno, unsigned red, unsigned green,
113               unsigned blue, unsigned transp, struct fb_info *info)
114 {
115         return 0;
116 }
117 
118 static void
119 sti_set_disp(const void *par, struct display *disp,
120              struct fb_info_gen *info)
121 {
122         disp->screen_base =
123                 (void *) PTR_STI(fb_info.sti->glob_cfg)->region_ptrs[1];
124         disp->dispsw = &fbcon_sti;
125 }
126 
127 static void
128 sti_detect(void)
129 {
130 }
131 
132 static int
133 sti_blank(int blank_mode, const struct fb_info *info)
134 {
135         return 0;
136 }
137 
138 /* ------------ Interfaces to hardware functions ------------ */
139 
140 struct fbgen_hwswitch sti_switch = {
141         detect:         sti_detect,
142         encode_fix:     sti_encode_fix,
143         decode_var:     sti_decode_var,
144         encode_var:     sti_encode_var,
145         get_par:        sti_get_par,
146         set_par:        sti_set_par,
147         getcolreg:      sti_getcolreg,
148         setcolreg:      sti_setcolreg,
149         pan_display:    NULL,
150         blank:          sti_blank,
151         set_disp:       sti_set_disp
152 };
153 
154 
155 /* ------------ Hardware Independent Functions ------------ */
156 
157     /*
158      *  Initialization
159      */
160 
161 int __init
162 stifb_init(void)
163 {
164         printk("searching for word mode STI ROMs\n");
165         /* XXX: in the future this will return a list of ROMs */
166         if ((fb_info.sti = sti_init_roms()) == NULL)
167                 return -ENXIO;
168 
169         fb_info.gen.info.node = -1;
170         fb_info.gen.info.flags = FBINFO_FLAG_DEFAULT;
171         fb_info.gen.info.fbops = &stifb_ops;
172         fb_info.gen.info.disp = &disp;
173         fb_info.gen.info.changevar = NULL;
174         fb_info.gen.info.switch_con = &fbgen_switch;
175         fb_info.gen.info.updatevar = &fbgen_update_var;
176         fb_info.gen.info.blank = &fbgen_blank;
177         strcpy(fb_info.gen.info.modename, "STI Generic");
178         fb_info.gen.fbhw = &sti_switch;
179         fb_info.gen.fbhw->detect();
180 
181         /* This should give a reasonable default video mode */
182         fbgen_get_var(&disp.var, -1, &fb_info.gen.info);
183         fbgen_do_set_var(&disp.var, 1, &fb_info.gen);
184         fbgen_set_disp(-1, &fb_info.gen);
185         fbgen_install_cmap(0, &fb_info.gen);
186         pdc_console_die();
187         if (register_framebuffer(&fb_info.gen.info) < 0)
188                 return -EINVAL;
189 
190         printk(KERN_INFO "fb%d: %s frame buffer device\n",
191                 GET_FB_IDX(fb_info.gen.info.node), fb_info.gen.info.modename);
192 
193         return 0;
194 }
195 
196 
197     /*
198      *  Cleanup
199      */
200 
201 void
202 stifb_cleanup(struct fb_info *info)
203 {
204         printk("stifb_cleanup: you're on crack\n");
205 }
206 
207 
208 int __init
209 stifb_setup(char *options)
210 {
211         /* XXX: we should take the resolution, bpp as command line arguments. */
212         return 0;
213 }
214 
215 
216 /* ------------------------------------------------------------------------- */
217 
218 
219 static struct fb_ops stifb_ops = {
220         owner:          THIS_MODULE,
221         fb_open:        NULL,
222         fb_release:     NULL,
223         fb_get_fix:     fbgen_get_fix,
224         fb_get_var:     fbgen_get_var,
225         fb_set_var:     fbgen_set_var,
226         fb_get_cmap:    fbgen_get_cmap,
227         fb_set_cmap:    fbgen_set_cmap,
228         fb_pan_display: fbgen_pan_display,
229         fb_ioctl:       NULL
230 };
231 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.