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 /* Kernel routines for supporting graphics context switching */
21 void newport_save (void *y
)
26 #define LOAD(val) x->val = npregs->set.val;
27 #define LOADI(val) x->val = npregs->set.val.word;
28 #define LOADC(val) x->val = npregs->cset.val;
82 /* Mhm, maybe I am missing something, but it seems that
83 * saving/restoring the DCB is only a matter of saving these
90 x
->dcbdata0
= npregs
->set
.dcbdata0
.byword
;
96 * Importat things to keep in mind when restoring the newport context:
98 * 1. slopered register is stored as a 2's complete (s12.11);
99 * needs to be converted to a signed magnitude (s(8)12.11).
101 * 2. xsave should be stored after xstart.
103 * 3. None of the registers should be written with the GO address.
104 * (read the docs for more details on this).
106 void newport_restore (void *y
)
109 #define STORE(val) npregs->set.val = x->val
110 #define STOREI(val) npregs->set.val.word = x->val
111 #define STOREC(val) npregs->cset.val = x->val
166 /* FIXME: restore dcb thingies */
170 newport_ioctl (int card
, int cmd
, unsigned long arg
)
173 case NG1_SETDISPLAYMODE
: {
174 struct ng1_setdisplaymode_args request
;
176 if (copy_from_user (&request
, (void *) arg
, sizeof (request
)))
181 npregs
->set
.dcbmode
= DCB_XMAP0
| XM9_CRS_FIFO_AVAIL
|
182 DCB_DATAWIDTH_1
| R_DCB_XMAP9_PROTOCOL
;
183 xmap9FIFOWait (npregs
);
185 /* FIXME: timing is wrong, just be extracted from
186 * the per-board timing table. I still have to figure
187 * out where this comes from
189 * This is used to select the protocol used to talk to
190 * the xmap9. For now I am using 60, selecting the
191 * WSLOW_DCB_XMAP9_PROTOCOL.
193 * Robert Tray comments on this issue:
195 * cfreq refers to the frequency of the monitor
196 * (ie. the refresh rate). Our monitors run typically
197 * between 60 Hz and 76 Hz. But it will be as low as
198 * 50 Hz if you're displaying NTSC/PAL and as high as
199 * 120 Hz if you are runining in stereo mode. You
200 * might want to try the WSLOW values.
202 xmap9SetModeReg (npregs
, request
.wid
, request
.mode
, 60);
205 case NG1_SET_CURSOR_HOTSPOT
: {
206 struct ng1_set_cursor_hotspot request
;
208 if (copy_from_user (&request
, (void *) arg
, sizeof (request
)))
210 /* FIXME: make request.xhot, request.yhot the hot spot */
214 case NG1_SETGAMMARAMP0
:
215 /* FIXME: load the gamma ramps :-) */