2 * newport.c: context switching the newport graphics card and
3 * newport graphics support.
5 * Author: Miguel de Icaza
8 #include <linux/errno.h>
9 #include <linux/sched.h>
10 #include <asm/types.h>
13 #include <asm/uaccess.h>
14 #include <video/newport.h>
15 #include <linux/module.h>
17 struct newport_regs *npregs;
19 EXPORT_SYMBOL(npregs);
21 /* Kernel routines for supporting graphics context switching */
23 void newport_save (void *y)
28 #define LOAD(val) x->val = npregs->set.val;
29 #define LOADI(val) x->val = npregs->set.val.word;
30 #define LOADC(val) x->val = npregs->cset.val;
84 /* Mhm, maybe I am missing something, but it seems that
85 * saving/restoring the DCB is only a matter of saving these
92 x->dcbdata0 = npregs->set.dcbdata0.byword;
98 * Importat things to keep in mind when restoring the newport context:
100 * 1. slopered register is stored as a 2's complete (s12.11);
101 * needs to be converted to a signed magnitude (s(8)12.11).
103 * 2. xsave should be stored after xstart.
105 * 3. None of the registers should be written with the GO address.
106 * (read the docs for more details on this).
108 void newport_restore (void *y)
111 #define STORE(val) npregs->set.val = x->val
112 #define STOREI(val) npregs->set.val.word = x->val
113 #define STOREC(val) npregs->cset.val = x->val
168 /* FIXME: restore dcb thingies */
172 newport_ioctl (int card, int cmd, unsigned long arg)
175 case NG1_SETDISPLAYMODE: {
176 struct ng1_setdisplaymode_args request;
178 if (copy_from_user (&request, (void *) arg, sizeof (request)))
183 npregs->set.dcbmode = DCB_XMAP0 | XM9_CRS_FIFO_AVAIL |
184 DCB_DATAWIDTH_1 | R_DCB_XMAP9_PROTOCOL;
185 xmap9FIFOWait (npregs);
187 /* FIXME: timing is wrong, just be extracted from
188 * the per-board timing table. I still have to figure
189 * out where this comes from
191 * This is used to select the protocol used to talk to
192 * the xmap9. For now I am using 60, selecting the
193 * WSLOW_DCB_XMAP9_PROTOCOL.
195 * Robert Tray comments on this issue:
197 * cfreq refers to the frequency of the monitor
198 * (ie. the refresh rate). Our monitors run typically
199 * between 60 Hz and 76 Hz. But it will be as low as
200 * 50 Hz if you're displaying NTSC/PAL and as high as
201 * 120 Hz if you are runining in stereo mode. You
202 * might want to try the WSLOW values.
204 xmap9SetModeReg (npregs, request.wid, request.mode, 60);
207 case NG1_SET_CURSOR_HOTSPOT: {
208 struct ng1_set_cursor_hotspot request;
210 if (copy_from_user (&request, (void *) arg, sizeof (request)))
212 /* FIXME: make request.xhot, request.yhot the hot spot */
216 case NG1_SETGAMMARAMP0:
217 /* FIXME: load the gamma ramps :-) */