9 * Tvp3026 Viewpoint Video Interface Palette.
10 * Assumes hooked up to an S3 chip of some kind.
11 * Why is register access different from the
15 Index = 0x00, /* Index register */
16 Data = 0x0A, /* Data register */
18 Id = 0x3F, /* ID Register */
23 tvp3026io(uchar reg, uchar data)
27 crt55 = vgaxi(Crtx, 0x55) & 0xFC;
28 vgaxo(Crtx, 0x55, crt55|((reg>>2) & 0x03));
29 vgao(dacxreg[reg & 0x03], data);
39 crt55 = vgaxi(Crtx, 0x55) & 0xFC;
40 vgaxo(Crtx, 0x55, crt55|((reg>>2) & 0x03));
41 r = vgai(dacxreg[reg & 0x03]);
42 vgaxo(Crtx, 0x55, crt55);
48 tvp3026xi(uchar index)
52 crt55 = tvp3026io(Index, index);
53 vgaxo(Crtx, 0x55, crt55|((Data>>2) & 0x03));
54 r = vgai(dacxreg[Data & 0x03]);
55 vgaxo(Crtx, 0x55, crt55);
61 tvp3026o(uchar reg, uchar data)
65 crt55 = tvp3026io(reg, data);
66 vgaxo(Crtx, 0x55, crt55);
70 tvp3026xo(uchar index, uchar data)
74 crt55 = tvp3026io(Index, index);
75 vgaxo(Crtx, 0x55, crt55|((Data>>2) & 0x03));
76 vgao(dacxreg[Data & 0x03], data);
77 vgaxo(Crtx, 0x55, crt55);
81 options(Vga*, Ctlr* ctlr)
83 ctlr->flag |= Hclk2|Hextsid|Henhanced|Foptions;
87 init(Vga* vga, Ctlr* ctlr)
93 * Work out the part speed-grade from name. Name can have,
94 * e.g. '-135' on the end for 135MHz part.
97 if(p = strrchr(ctlr->name, '-'))
98 grade = strtoul(p+1, 0, 0) * 1000000;
101 * If we don't already have a desired pclk,
102 * take it from the mode.
103 * Check it's within range.
106 vga->f[0] = vga->mode->frequency;
107 if(vga->f[0] > grade)
108 error("%s: invalid pclk - %ld\n", ctlr->name, vga->f[0]);
111 * Determine whether to use clock-doubler or not.
113 if((ctlr->flag & Uclk2) == 0 && vga->mode->z == 8 && vga->f[0] > 85000000)
114 resyncinit(vga, ctlr, Uclk2, 0);
120 load(Vga* vga, Ctlr* ctlr)
126 * output sync polarity
127 * It's important to set this properly and to turn off the
128 * VGA controller H and V syncs. Can't be set in VGA mode.
131 if((vga->misc & 0x40) == 0)
133 if((vga->misc & 0x80) == 0)
137 vgao(MiscW, vga->misc);
143 dump(Vga*, Ctlr* ctlr)
148 printitem(ctlr->name, "direct");
149 for(i = 0; i < 16; i++)
150 printreg(tvp3026i(i));
152 printitem(ctlr->name, "index");
153 for(i = 0; i < 64; i++)
154 printreg(tvp3026xi(i));
156 printitem(ctlr->name, "PCLK");
157 for(i = 0; i < 3; i++){
158 tvp3026xo(0x2C, (i<<4)|(i<<2)|i);
159 printreg(clock[i] = tvp3026xi(0x2D));
161 f = (RefFreq*(65-clock[1]))/(65-(clock[0] & 0x3F));
162 f >>= clock[2] & 0x03;
163 Bprint(&stdout, "%23ld", f);
165 printitem(ctlr->name, "MCLK");
166 for(i = 0; i < 3; i++){
167 tvp3026xo(0x2C, (i<<4)|(i<<2)|i);
168 printreg(clock[i] = tvp3026xi(0x2E));
170 f = (RefFreq*(65-clock[1]))/(65-(clock[0] & 0x3F));
171 f >>= clock[2] & 0x03;
172 Bprint(&stdout, "%23ld", f);
174 printitem(ctlr->name, "LCLK");
175 for(i = 0; i < 3; i++){
176 tvp3026xo(0x2C, (i<<4)|(i<<2)|i);
177 printreg(clock[i] = tvp3026xi(0x2F));
179 Bprint(&stdout, "\n");
183 "tvp3026", /* name */
185 options, /* options */