THIS IS NOT FOR RE-DISTRIBUTION, AND IT SHOULD NOT BE PUBLICLY DISCUSSED.
IT IS BETA SOFTWARE FOR MEMBERS OF THE VIPER X-SERVER BETA TESTERS ONLY.
 * 
 * HARRY LANGENBACHER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS, IN NO EVENT SHALL HARRY LANGENBACHER BE LIABLE FOR ANY
 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 * 
The mhzfreq clock setter is also included - it was statically linked,
and stripped (with Linux 1.08, gcc 2.5.8, libc.so.4.5.24).
This version of "freq" accepts
its first argument in Mhz which makes it suitable for use with
XFree86. It limits the clock frequency to 50Mhz which is the limit
for the W5186 - setting the frequency higher while the W5186 is
enables could cause damage to the W5186. (min freq 20mhz???)

the second argument to the program is ignored (see Xconfig man page for
description of "clockprog").  Dot-clock-register in the clock chip is
always 0. It should be different than the register being used by your
ordinairy text mode.

----------excerpt from e-mail discussion relating to viper clocks-------

a little lecture on the viper's clock chip (high speed ICD2061A clone)

	it has 3 registers for the dotclock and one for the memclk.
	all 4 of these regs are initialized at power-up, but I don't know
	what values.
	To change a value in one of these registers you have to follow a
	complex procedure outlined in the ICD or weitek or diamond docs.
	To switch between dot-clock frequencies already programmed into
	any of the 3 clock-chip dot-clock regs, you just have to change
	the clock select bits in vga reg 3c2 - the same bits used to program
	the clock chip. After the clock select bits have been stable for
	the "timeout" time (min 2ms, max 10ms) the dot clock output will
	be determined by the indicated register
	register 0x32c bit3 bit2		(READ FROM 0X3CC)
		       0    0  reg 0
		       0    1  reg 1
		       1    1  reg 2
		       1    0  ???reg2??? dont use???
(note - to use reg 2, specify "2" as the register to program, but then
 switch bits 3 and 2 of 0x3c2 to 11 (binary) afterwards. This may not
be necessary, but it's consistant with weitek p9000 vlb documentation)

so we could just read the value of these bits from 3cc, and select a
different clock chip reg to program in the dot clock for the p9000
modes, and then just switch back these bits for vga text mode - in
fact, since there's no direct way to read out the clock chip reg's -
this is probably the only reliable way to gaurantee that we switch back
to the same clock freq for vga text mode. Is that clear as mud ?? e.g.
- if we read 3cc and see bit3-bit2 is 3 (11 binary) then we could chose
reg 0 to program our dot clock, and thereafter to switch from the
p9000's dot clock (for X) back and forth to vga text mode, we just have
to switch the bits 3 and 2 in 3c2 between 00 and 11 without
reprogramming the clock chip regs.

and now here's what I probably should have told you in the first place -
from my old experimental copy of "enable.c" :

  outp (MISCOUT, 0x6F /* savemisc*/ ) ;	/* 3c2 Enable VGA Clocks (icd reg 2) */

  usleep(40000); 	/* Wait For ICD To Settle Some - if you dont' then
                            the restore palette thing won't work good ??? 
			colors will be screwed up */
  /* note: this needs to be at about 20milliseconds? */

As I recall - when I took out the usleep - "the restore palette thing
won't work good".

any delay > 10ms after the last write to 3c2 before restoring the
palette should do it.

