Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

matroxfb: get rid of unneeded macros WPMINFO and friends

With multihead support always enabled, these macros are no longer needed
and make the code harder to read.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Petr Vandrovec <vandrove@vc.cvut.cz>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jean Delvare and committed by
Linus Torvalds
316b4d64 fc2d10dd

+580 -444
+107 -78
drivers/video/matrox/g450_pll.c
··· 25 25 return (p & 0x40) ? fin : fin << ((p & 3) + 1); 26 26 } 27 27 28 - static unsigned int g450_mnp2vco(CPMINFO unsigned int mnp) { 28 + static unsigned int g450_mnp2vco(const struct matrox_fb_info *minfo, 29 + unsigned int mnp) 30 + { 29 31 unsigned int m, n; 30 32 31 33 m = ((mnp >> 16) & 0x0FF) + 1; ··· 35 33 return (minfo->features.pll.ref_freq * n + (m >> 1)) / m; 36 34 } 37 35 38 - unsigned int g450_mnp2f(CPMINFO unsigned int mnp) { 39 - return g450_vco2f(mnp, g450_mnp2vco(PMINFO mnp)); 36 + unsigned int g450_mnp2f(const struct matrox_fb_info *minfo, unsigned int mnp) 37 + { 38 + return g450_vco2f(mnp, g450_mnp2vco(minfo, mnp)); 40 39 } 41 40 42 41 static inline unsigned int pll_freq_delta(unsigned int f1, unsigned int f2) { ··· 52 49 #define NO_MORE_MNP 0x01FFFFFF 53 50 #define G450_MNP_FREQBITS (0xFFFFFF43) /* do not mask high byte so we'll catch NO_MORE_MNP */ 54 51 55 - static unsigned int g450_nextpll(CPMINFO const struct matrox_pll_limits* pi, unsigned int* fvco, unsigned int mnp) { 52 + static unsigned int g450_nextpll(const struct matrox_fb_info *minfo, 53 + const struct matrox_pll_limits *pi, 54 + unsigned int *fvco, unsigned int mnp) 55 + { 56 56 unsigned int m, n, p; 57 57 unsigned int tvco = *fvco; 58 58 ··· 101 95 return (m << 16) | (n << 8) | p; 102 96 } 103 97 104 - static unsigned int g450_firstpll(CPMINFO const struct matrox_pll_limits* pi, unsigned int* vco, unsigned int fout) { 98 + static unsigned int g450_firstpll(const struct matrox_fb_info *minfo, 99 + const struct matrox_pll_limits *pi, 100 + unsigned int *vco, unsigned int fout) 101 + { 105 102 unsigned int p; 106 103 unsigned int vcomax; 107 104 ··· 130 121 } 131 122 *vco = tvco; 132 123 } 133 - return g450_nextpll(PMINFO pi, vco, 0xFF0000 | p); 124 + return g450_nextpll(minfo, pi, vco, 0xFF0000 | p); 134 125 } 135 126 136 - static inline unsigned int g450_setpll(CPMINFO unsigned int mnp, unsigned int pll) { 127 + static inline unsigned int g450_setpll(const struct matrox_fb_info *minfo, 128 + unsigned int mnp, unsigned int pll) 129 + { 137 130 switch (pll) { 138 131 case M_PIXEL_PLL_A: 139 - matroxfb_DAC_out(PMINFO M1064_XPIXPLLAM, mnp >> 16); 140 - matroxfb_DAC_out(PMINFO M1064_XPIXPLLAN, mnp >> 8); 141 - matroxfb_DAC_out(PMINFO M1064_XPIXPLLAP, mnp); 132 + matroxfb_DAC_out(minfo, M1064_XPIXPLLAM, mnp >> 16); 133 + matroxfb_DAC_out(minfo, M1064_XPIXPLLAN, mnp >> 8); 134 + matroxfb_DAC_out(minfo, M1064_XPIXPLLAP, mnp); 142 135 return M1064_XPIXPLLSTAT; 143 136 144 137 case M_PIXEL_PLL_B: 145 - matroxfb_DAC_out(PMINFO M1064_XPIXPLLBM, mnp >> 16); 146 - matroxfb_DAC_out(PMINFO M1064_XPIXPLLBN, mnp >> 8); 147 - matroxfb_DAC_out(PMINFO M1064_XPIXPLLBP, mnp); 138 + matroxfb_DAC_out(minfo, M1064_XPIXPLLBM, mnp >> 16); 139 + matroxfb_DAC_out(minfo, M1064_XPIXPLLBN, mnp >> 8); 140 + matroxfb_DAC_out(minfo, M1064_XPIXPLLBP, mnp); 148 141 return M1064_XPIXPLLSTAT; 149 142 150 143 case M_PIXEL_PLL_C: 151 - matroxfb_DAC_out(PMINFO M1064_XPIXPLLCM, mnp >> 16); 152 - matroxfb_DAC_out(PMINFO M1064_XPIXPLLCN, mnp >> 8); 153 - matroxfb_DAC_out(PMINFO M1064_XPIXPLLCP, mnp); 144 + matroxfb_DAC_out(minfo, M1064_XPIXPLLCM, mnp >> 16); 145 + matroxfb_DAC_out(minfo, M1064_XPIXPLLCN, mnp >> 8); 146 + matroxfb_DAC_out(minfo, M1064_XPIXPLLCP, mnp); 154 147 return M1064_XPIXPLLSTAT; 155 148 156 149 case M_SYSTEM_PLL: 157 - matroxfb_DAC_out(PMINFO DAC1064_XSYSPLLM, mnp >> 16); 158 - matroxfb_DAC_out(PMINFO DAC1064_XSYSPLLN, mnp >> 8); 159 - matroxfb_DAC_out(PMINFO DAC1064_XSYSPLLP, mnp); 150 + matroxfb_DAC_out(minfo, DAC1064_XSYSPLLM, mnp >> 16); 151 + matroxfb_DAC_out(minfo, DAC1064_XSYSPLLN, mnp >> 8); 152 + matroxfb_DAC_out(minfo, DAC1064_XSYSPLLP, mnp); 160 153 return DAC1064_XSYSPLLSTAT; 161 154 162 155 case M_VIDEO_PLL: 163 - matroxfb_DAC_out(PMINFO M1064_XVIDPLLM, mnp >> 16); 164 - matroxfb_DAC_out(PMINFO M1064_XVIDPLLN, mnp >> 8); 165 - matroxfb_DAC_out(PMINFO M1064_XVIDPLLP, mnp); 156 + matroxfb_DAC_out(minfo, M1064_XVIDPLLM, mnp >> 16); 157 + matroxfb_DAC_out(minfo, M1064_XVIDPLLN, mnp >> 8); 158 + matroxfb_DAC_out(minfo, M1064_XVIDPLLP, mnp); 166 159 return M1064_XVIDPLLSTAT; 167 160 } 168 161 return 0; 169 162 } 170 163 171 - static inline unsigned int g450_cmppll(CPMINFO unsigned int mnp, unsigned int pll) { 164 + static inline unsigned int g450_cmppll(const struct matrox_fb_info *minfo, 165 + unsigned int mnp, unsigned int pll) 166 + { 172 167 unsigned char m = mnp >> 16; 173 168 unsigned char n = mnp >> 8; 174 169 unsigned char p = mnp; 175 170 176 171 switch (pll) { 177 172 case M_PIXEL_PLL_A: 178 - return (matroxfb_DAC_in(PMINFO M1064_XPIXPLLAM) != m || 179 - matroxfb_DAC_in(PMINFO M1064_XPIXPLLAN) != n || 180 - matroxfb_DAC_in(PMINFO M1064_XPIXPLLAP) != p); 173 + return (matroxfb_DAC_in(minfo, M1064_XPIXPLLAM) != m || 174 + matroxfb_DAC_in(minfo, M1064_XPIXPLLAN) != n || 175 + matroxfb_DAC_in(minfo, M1064_XPIXPLLAP) != p); 181 176 182 177 case M_PIXEL_PLL_B: 183 - return (matroxfb_DAC_in(PMINFO M1064_XPIXPLLBM) != m || 184 - matroxfb_DAC_in(PMINFO M1064_XPIXPLLBN) != n || 185 - matroxfb_DAC_in(PMINFO M1064_XPIXPLLBP) != p); 178 + return (matroxfb_DAC_in(minfo, M1064_XPIXPLLBM) != m || 179 + matroxfb_DAC_in(minfo, M1064_XPIXPLLBN) != n || 180 + matroxfb_DAC_in(minfo, M1064_XPIXPLLBP) != p); 186 181 187 182 case M_PIXEL_PLL_C: 188 - return (matroxfb_DAC_in(PMINFO M1064_XPIXPLLCM) != m || 189 - matroxfb_DAC_in(PMINFO M1064_XPIXPLLCN) != n || 190 - matroxfb_DAC_in(PMINFO M1064_XPIXPLLCP) != p); 183 + return (matroxfb_DAC_in(minfo, M1064_XPIXPLLCM) != m || 184 + matroxfb_DAC_in(minfo, M1064_XPIXPLLCN) != n || 185 + matroxfb_DAC_in(minfo, M1064_XPIXPLLCP) != p); 191 186 192 187 case M_SYSTEM_PLL: 193 - return (matroxfb_DAC_in(PMINFO DAC1064_XSYSPLLM) != m || 194 - matroxfb_DAC_in(PMINFO DAC1064_XSYSPLLN) != n || 195 - matroxfb_DAC_in(PMINFO DAC1064_XSYSPLLP) != p); 188 + return (matroxfb_DAC_in(minfo, DAC1064_XSYSPLLM) != m || 189 + matroxfb_DAC_in(minfo, DAC1064_XSYSPLLN) != n || 190 + matroxfb_DAC_in(minfo, DAC1064_XSYSPLLP) != p); 196 191 197 192 case M_VIDEO_PLL: 198 - return (matroxfb_DAC_in(PMINFO M1064_XVIDPLLM) != m || 199 - matroxfb_DAC_in(PMINFO M1064_XVIDPLLN) != n || 200 - matroxfb_DAC_in(PMINFO M1064_XVIDPLLP) != p); 193 + return (matroxfb_DAC_in(minfo, M1064_XVIDPLLM) != m || 194 + matroxfb_DAC_in(minfo, M1064_XVIDPLLN) != n || 195 + matroxfb_DAC_in(minfo, M1064_XVIDPLLP) != p); 201 196 } 202 197 return 1; 203 198 } 204 199 205 - static inline int g450_isplllocked(CPMINFO unsigned int regidx) { 200 + static inline int g450_isplllocked(const struct matrox_fb_info *minfo, 201 + unsigned int regidx) 202 + { 206 203 unsigned int j; 207 204 208 205 for (j = 0; j < 1000; j++) { 209 - if (matroxfb_DAC_in(PMINFO regidx) & 0x40) { 206 + if (matroxfb_DAC_in(minfo, regidx) & 0x40) { 210 207 unsigned int r = 0; 211 208 int i; 212 209 213 210 for (i = 0; i < 100; i++) { 214 - r += matroxfb_DAC_in(PMINFO regidx) & 0x40; 211 + r += matroxfb_DAC_in(minfo, regidx) & 0x40; 215 212 } 216 213 return r >= (90 * 0x40); 217 214 } ··· 226 211 return 0; 227 212 } 228 213 229 - static int g450_testpll(CPMINFO unsigned int mnp, unsigned int pll) { 230 - return g450_isplllocked(PMINFO g450_setpll(PMINFO mnp, pll)); 214 + static int g450_testpll(const struct matrox_fb_info *minfo, unsigned int mnp, 215 + unsigned int pll) 216 + { 217 + return g450_isplllocked(minfo, g450_setpll(minfo, mnp, pll)); 231 218 } 232 219 233 220 static void updatehwstate_clk(struct matrox_hw_state* hw, unsigned int mnp, unsigned int pll) { ··· 242 225 } 243 226 } 244 227 245 - void matroxfb_g450_setpll_cond(WPMINFO unsigned int mnp, unsigned int pll) { 246 - if (g450_cmppll(PMINFO mnp, pll)) { 247 - g450_setpll(PMINFO mnp, pll); 228 + void matroxfb_g450_setpll_cond(struct matrox_fb_info *minfo, unsigned int mnp, 229 + unsigned int pll) 230 + { 231 + if (g450_cmppll(minfo, mnp, pll)) { 232 + g450_setpll(minfo, mnp, pll); 248 233 } 249 234 } 250 235 251 - static inline unsigned int g450_findworkingpll(WPMINFO unsigned int pll, unsigned int* mnparray, unsigned int mnpcount) { 236 + static inline unsigned int g450_findworkingpll(struct matrox_fb_info *minfo, 237 + unsigned int pll, 238 + unsigned int *mnparray, 239 + unsigned int mnpcount) 240 + { 252 241 unsigned int found = 0; 253 242 unsigned int idx; 254 243 unsigned int mnpfound = mnparray[0]; ··· 278 255 while (sptr >= sarray) { 279 256 unsigned int mnp = *sptr--; 280 257 281 - if (g450_testpll(PMINFO mnp - 0x0300, pll) && 282 - g450_testpll(PMINFO mnp + 0x0300, pll) && 283 - g450_testpll(PMINFO mnp - 0x0200, pll) && 284 - g450_testpll(PMINFO mnp + 0x0200, pll) && 285 - g450_testpll(PMINFO mnp - 0x0100, pll) && 286 - g450_testpll(PMINFO mnp + 0x0100, pll)) { 287 - if (g450_testpll(PMINFO mnp, pll)) { 258 + if (g450_testpll(minfo, mnp - 0x0300, pll) && 259 + g450_testpll(minfo, mnp + 0x0300, pll) && 260 + g450_testpll(minfo, mnp - 0x0200, pll) && 261 + g450_testpll(minfo, mnp + 0x0200, pll) && 262 + g450_testpll(minfo, mnp - 0x0100, pll) && 263 + g450_testpll(minfo, mnp + 0x0100, pll)) { 264 + if (g450_testpll(minfo, mnp, pll)) { 288 265 return mnp; 289 266 } 290 - } else if (!found && g450_testpll(PMINFO mnp, pll)) { 267 + } else if (!found && g450_testpll(minfo, mnp, pll)) { 291 268 mnpfound = mnp; 292 269 found = 1; 293 270 } 294 271 } 295 272 } 296 - g450_setpll(PMINFO mnpfound, pll); 273 + g450_setpll(minfo, mnpfound, pll); 297 274 return mnpfound; 298 275 } 299 276 ··· 306 283 ci->data[0].mnp_value = mnp_value; 307 284 } 308 285 309 - static int g450_checkcache(WPMINFO struct matrox_pll_cache* ci, unsigned int mnp_key) { 286 + static int g450_checkcache(struct matrox_fb_info *minfo, 287 + struct matrox_pll_cache *ci, unsigned int mnp_key) 288 + { 310 289 unsigned int i; 311 290 312 291 mnp_key &= G450_MNP_FREQBITS; ··· 328 303 return NO_MORE_MNP; 329 304 } 330 305 331 - static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll, 332 - unsigned int* mnparray, unsigned int* deltaarray) { 306 + static int __g450_setclk(struct matrox_fb_info *minfo, unsigned int fout, 307 + unsigned int pll, unsigned int *mnparray, 308 + unsigned int *deltaarray) 309 + { 333 310 unsigned int mnpcount; 334 311 unsigned int pixel_vco; 335 312 const struct matrox_pll_limits* pi; ··· 348 321 349 322 matroxfb_DAC_lock_irqsave(flags); 350 323 351 - xpwrctrl = matroxfb_DAC_in(PMINFO M1064_XPWRCTRL); 352 - matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl & ~M1064_XPWRCTRL_PANELPDN); 324 + xpwrctrl = matroxfb_DAC_in(minfo, M1064_XPWRCTRL); 325 + matroxfb_DAC_out(minfo, M1064_XPWRCTRL, xpwrctrl & ~M1064_XPWRCTRL_PANELPDN); 353 326 mga_outb(M_SEQ_INDEX, M_SEQ1); 354 327 mga_outb(M_SEQ_DATA, mga_inb(M_SEQ_DATA) | M_SEQ1_SCROFF); 355 - tmp = matroxfb_DAC_in(PMINFO M1064_XPIXCLKCTRL); 328 + tmp = matroxfb_DAC_in(minfo, M1064_XPIXCLKCTRL); 356 329 tmp |= M1064_XPIXCLKCTRL_DIS; 357 330 if (!(tmp & M1064_XPIXCLKCTRL_PLL_UP)) { 358 331 tmp |= M1064_XPIXCLKCTRL_PLL_UP; 359 332 } 360 - matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp); 333 + matroxfb_DAC_out(minfo, M1064_XPIXCLKCTRL, tmp); 361 334 /* DVI PLL preferred for frequencies up to 362 335 panel link max, standard PLL otherwise */ 363 336 if (fout >= minfo->max_pixel_clock_panellink) ··· 368 341 M1064_XDVICLKCTRL_C1DVICLKEN | 369 342 M1064_XDVICLKCTRL_DVILOOPCTL | 370 343 M1064_XDVICLKCTRL_P1LOOPBWDTCTL; 371 - matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL,tmp); 372 - matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, 344 + matroxfb_DAC_out(minfo, M1064_XDVICLKCTRL, tmp); 345 + matroxfb_DAC_out(minfo, M1064_XPWRCTRL, 373 346 xpwrctrl); 374 347 375 348 matroxfb_DAC_unlock_irqrestore(flags); ··· 412 385 unsigned long flags; 413 386 414 387 matroxfb_DAC_lock_irqsave(flags); 415 - tmp = matroxfb_DAC_in(PMINFO M1064_XPWRCTRL); 388 + tmp = matroxfb_DAC_in(minfo, M1064_XPWRCTRL); 416 389 if (!(tmp & 2)) { 417 - matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, tmp | 2); 390 + matroxfb_DAC_out(minfo, M1064_XPWRCTRL, tmp | 2); 418 391 } 419 392 420 - mnp = matroxfb_DAC_in(PMINFO M1064_XPIXPLLCM) << 16; 421 - mnp |= matroxfb_DAC_in(PMINFO M1064_XPIXPLLCN) << 8; 422 - pixel_vco = g450_mnp2vco(PMINFO mnp); 393 + mnp = matroxfb_DAC_in(minfo, M1064_XPIXPLLCM) << 16; 394 + mnp |= matroxfb_DAC_in(minfo, M1064_XPIXPLLCN) << 8; 395 + pixel_vco = g450_mnp2vco(minfo, mnp); 423 396 matroxfb_DAC_unlock_irqrestore(flags); 424 397 } 425 398 pi = &minfo->limits.video; ··· 434 407 unsigned int mnp; 435 408 unsigned int xvco; 436 409 437 - for(mnp = g450_firstpll(PMINFO pi, &xvco, fout); mnp != NO_MORE_MNP; mnp = g450_nextpll(PMINFO pi, &xvco, mnp)) { 410 + for (mnp = g450_firstpll(minfo, pi, &xvco, fout); mnp != NO_MORE_MNP; mnp = g450_nextpll(minfo, pi, &xvco, mnp)) { 438 411 unsigned int idx; 439 412 unsigned int vco; 440 413 unsigned int delta; 441 414 442 - vco = g450_mnp2vco(PMINFO mnp); 415 + vco = g450_mnp2vco(minfo, mnp); 443 416 #if 0 444 417 if (pll == M_VIDEO_PLL) { 445 418 unsigned int big, small; ··· 471 444 * (freqs near VCOmin aren't as stable) 472 445 */ 473 446 if (delta == deltaarray[idx-1] 474 - && vco != g450_mnp2vco(PMINFO mnparray[idx-1]) 447 + && vco != g450_mnp2vco(minfo, mnparray[idx-1]) 475 448 && vco < (pi->vcomin * 17 / 16)) { 476 449 break; 477 450 } ··· 495 468 unsigned int mnp; 496 469 497 470 matroxfb_DAC_lock_irqsave(flags); 498 - mnp = g450_checkcache(PMINFO ci, mnparray[0]); 471 + mnp = g450_checkcache(minfo, ci, mnparray[0]); 499 472 if (mnp != NO_MORE_MNP) { 500 - matroxfb_g450_setpll_cond(PMINFO mnp, pll); 473 + matroxfb_g450_setpll_cond(minfo, mnp, pll); 501 474 } else { 502 - mnp = g450_findworkingpll(PMINFO pll, mnparray, mnpcount); 475 + mnp = g450_findworkingpll(minfo, pll, mnparray, mnpcount); 503 476 g450_addcache(ci, mnparray[0], mnp); 504 477 } 505 478 updatehwstate_clk(&minfo->hw, mnp, pll); ··· 512 485 * Currently there is 5(p) * 10(m) = 50 possible values. */ 513 486 #define MNP_TABLE_SIZE 64 514 487 515 - int matroxfb_g450_setclk(WPMINFO unsigned int fout, unsigned int pll) { 488 + int matroxfb_g450_setclk(struct matrox_fb_info *minfo, unsigned int fout, 489 + unsigned int pll) 490 + { 516 491 unsigned int* arr; 517 492 518 493 arr = kmalloc(sizeof(*arr) * MNP_TABLE_SIZE * 2, GFP_KERNEL); 519 494 if (arr) { 520 495 int r; 521 496 522 - r = __g450_setclk(PMINFO fout, pll, arr, arr + MNP_TABLE_SIZE); 497 + r = __g450_setclk(minfo, fout, pll, arr, arr + MNP_TABLE_SIZE); 523 498 kfree(arr); 524 499 return r; 525 500 }
+5 -3
drivers/video/matrox/g450_pll.h
··· 3 3 4 4 #include "matroxfb_base.h" 5 5 6 - int matroxfb_g450_setclk(WPMINFO unsigned int fout, unsigned int pll); 7 - unsigned int g450_mnp2f(CPMINFO unsigned int mnp); 8 - void matroxfb_g450_setpll_cond(WPMINFO unsigned int mnp, unsigned int pll); 6 + int matroxfb_g450_setclk(struct matrox_fb_info *minfo, unsigned int fout, 7 + unsigned int pll); 8 + unsigned int g450_mnp2f(const struct matrox_fb_info *minfo, unsigned int mnp); 9 + void matroxfb_g450_setpll_cond(struct matrox_fb_info *minfo, unsigned int mnp, 10 + unsigned int pll); 9 11 10 12 #endif /* __G450_PLL_H__ */
+6 -6
drivers/video/matrox/i2c-matroxfb.c
··· 41 41 int v; 42 42 43 43 matroxfb_DAC_lock_irqsave(flags); 44 - v = matroxfb_DAC_in(PMINFO DAC_XGENIODATA); 44 + v = matroxfb_DAC_in(minfo, DAC_XGENIODATA); 45 45 matroxfb_DAC_unlock_irqrestore(flags); 46 46 return v; 47 47 } ··· 51 51 int v; 52 52 53 53 matroxfb_DAC_lock_irqsave(flags); 54 - v = (matroxfb_DAC_in(PMINFO DAC_XGENIOCTRL) & mask) | val; 55 - matroxfb_DAC_out(PMINFO DAC_XGENIOCTRL, v); 54 + v = (matroxfb_DAC_in(minfo, DAC_XGENIOCTRL) & mask) | val; 55 + matroxfb_DAC_out(minfo, DAC_XGENIOCTRL, v); 56 56 /* We must reset GENIODATA very often... XFree plays with this register */ 57 - matroxfb_DAC_out(PMINFO DAC_XGENIODATA, 0x00); 57 + matroxfb_DAC_out(minfo, DAC_XGENIODATA, 0x00); 58 58 matroxfb_DAC_unlock_irqrestore(flags); 59 59 } 60 60 ··· 149 149 return NULL; 150 150 151 151 matroxfb_DAC_lock_irqsave(flags); 152 - matroxfb_DAC_out(PMINFO DAC_XGENIODATA, 0xFF); 153 - matroxfb_DAC_out(PMINFO DAC_XGENIOCTRL, 0x00); 152 + matroxfb_DAC_out(minfo, DAC_XGENIODATA, 0xFF); 153 + matroxfb_DAC_out(minfo, DAC_XGENIOCTRL, 0x00); 154 154 matroxfb_DAC_unlock_irqrestore(flags); 155 155 156 156 switch (minfo->chip) {
+139 -109
drivers/video/matrox/matroxfb_DAC1064.c
··· 33 33 #define DAC1064_OPT_MDIV2 0x00 34 34 #define DAC1064_OPT_RESERVED 0x10 35 35 36 - static void DAC1064_calcclock(CPMINFO unsigned int freq, unsigned int fmax, unsigned int* in, unsigned int* feed, unsigned int* post) { 36 + static void DAC1064_calcclock(const struct matrox_fb_info *minfo, 37 + unsigned int freq, unsigned int fmax, 38 + unsigned int *in, unsigned int *feed, 39 + unsigned int *post) 40 + { 37 41 unsigned int fvco; 38 42 unsigned int p; 39 43 ··· 45 41 46 42 /* only for devices older than G450 */ 47 43 48 - fvco = PLL_calcclock(PMINFO freq, fmax, in, feed, &p); 44 + fvco = PLL_calcclock(minfo, freq, fmax, in, feed, &p); 49 45 50 46 p = (1 << p) - 1; 51 47 if (fvco <= 100000) ··· 84 80 0x00, 85 81 0x00, 0x00, 0xFF, 0xFF}; 86 82 87 - static void DAC1064_setpclk(WPMINFO unsigned long fout) { 83 + static void DAC1064_setpclk(struct matrox_fb_info *minfo, unsigned long fout) 84 + { 88 85 unsigned int m, n, p; 89 86 90 87 DBG(__func__) 91 88 92 - DAC1064_calcclock(PMINFO fout, minfo->max_pixel_clock, &m, &n, &p); 89 + DAC1064_calcclock(minfo, fout, minfo->max_pixel_clock, &m, &n, &p); 93 90 minfo->hw.DACclk[0] = m; 94 91 minfo->hw.DACclk[1] = n; 95 92 minfo->hw.DACclk[2] = p; 96 93 } 97 94 98 - static void DAC1064_setmclk(WPMINFO int oscinfo, unsigned long fmem) { 95 + static void DAC1064_setmclk(struct matrox_fb_info *minfo, int oscinfo, 96 + unsigned long fmem) 97 + { 99 98 u_int32_t mx; 100 99 struct matrox_hw_state *hw = &minfo->hw; 101 100 ··· 106 99 107 100 if (minfo->devflags.noinit) { 108 101 /* read MCLK and give up... */ 109 - hw->DACclk[3] = inDAC1064(PMINFO DAC1064_XSYSPLLM); 110 - hw->DACclk[4] = inDAC1064(PMINFO DAC1064_XSYSPLLN); 111 - hw->DACclk[5] = inDAC1064(PMINFO DAC1064_XSYSPLLP); 102 + hw->DACclk[3] = inDAC1064(minfo, DAC1064_XSYSPLLM); 103 + hw->DACclk[4] = inDAC1064(minfo, DAC1064_XSYSPLLN); 104 + hw->DACclk[5] = inDAC1064(minfo, DAC1064_XSYSPLLP); 112 105 return; 113 106 } 114 107 mx = hw->MXoptionReg | 0x00000004; ··· 138 131 perfect... */ 139 132 /* (bit 2 of PCI_OPTION_REG must be 0... and bits 0,1 must not 140 133 select PLL... because of PLL can be stopped at this time) */ 141 - DAC1064_calcclock(PMINFO fmem, minfo->max_pixel_clock, &m, &n, &p); 142 - outDAC1064(PMINFO DAC1064_XSYSPLLM, hw->DACclk[3] = m); 143 - outDAC1064(PMINFO DAC1064_XSYSPLLN, hw->DACclk[4] = n); 144 - outDAC1064(PMINFO DAC1064_XSYSPLLP, hw->DACclk[5] = p); 134 + DAC1064_calcclock(minfo, fmem, minfo->max_pixel_clock, &m, &n, &p); 135 + outDAC1064(minfo, DAC1064_XSYSPLLM, hw->DACclk[3] = m); 136 + outDAC1064(minfo, DAC1064_XSYSPLLN, hw->DACclk[4] = n); 137 + outDAC1064(minfo, DAC1064_XSYSPLLP, hw->DACclk[5] = p); 145 138 for (clk = 65536; clk; --clk) { 146 - if (inDAC1064(PMINFO DAC1064_XSYSPLLSTAT) & 0x40) 139 + if (inDAC1064(minfo, DAC1064_XSYSPLLSTAT) & 0x40) 147 140 break; 148 141 } 149 142 if (!clk) ··· 161 154 } 162 155 163 156 #ifdef CONFIG_FB_MATROX_G 164 - static void g450_set_plls(WPMINFO2) { 157 + static void g450_set_plls(struct matrox_fb_info *minfo) 158 + { 165 159 u_int32_t c2_ctl; 166 160 unsigned int pxc; 167 161 struct matrox_hw_state *hw = &minfo->hw; ··· 192 184 c2_ctl |= 0x0006; /* Use video PLL */ 193 185 hw->DACreg[POS1064_XPWRCTRL] |= 0x02; 194 186 195 - outDAC1064(PMINFO M1064_XPWRCTRL, hw->DACreg[POS1064_XPWRCTRL]); 196 - matroxfb_g450_setpll_cond(PMINFO videomnp, M_VIDEO_PLL); 187 + outDAC1064(minfo, M1064_XPWRCTRL, hw->DACreg[POS1064_XPWRCTRL]); 188 + matroxfb_g450_setpll_cond(minfo, videomnp, M_VIDEO_PLL); 197 189 } 198 190 199 191 hw->DACreg[POS1064_XPIXCLKCTRL] &= ~M1064_XPIXCLKCTRL_PLL_UP; 200 192 if (pixelmnp >= 0) { 201 193 hw->DACreg[POS1064_XPIXCLKCTRL] |= M1064_XPIXCLKCTRL_PLL_UP; 202 194 203 - outDAC1064(PMINFO M1064_XPIXCLKCTRL, hw->DACreg[POS1064_XPIXCLKCTRL]); 204 - matroxfb_g450_setpll_cond(PMINFO pixelmnp, M_PIXEL_PLL_C); 195 + outDAC1064(minfo, M1064_XPIXCLKCTRL, hw->DACreg[POS1064_XPIXCLKCTRL]); 196 + matroxfb_g450_setpll_cond(minfo, pixelmnp, M_PIXEL_PLL_C); 205 197 } 206 198 if (c2_ctl != hw->crtc2.ctl) { 207 199 hw->crtc2.ctl = c2_ctl; ··· 253 245 } 254 246 #endif 255 247 256 - void DAC1064_global_init(WPMINFO2) { 248 + void DAC1064_global_init(struct matrox_fb_info *minfo) 249 + { 257 250 struct matrox_hw_state *hw = &minfo->hw; 258 251 259 252 hw->DACreg[POS1064_XMISCCTRL] &= M1064_XMISCCTRL_DAC_WIDTHMASK; ··· 308 299 break; 309 300 } 310 301 /* Now set timming related variables... */ 311 - g450_set_plls(PMINFO2); 302 + g450_set_plls(minfo); 312 303 } else 313 304 #endif 314 305 { ··· 327 318 } 328 319 } 329 320 330 - void DAC1064_global_restore(WPMINFO2) { 321 + void DAC1064_global_restore(struct matrox_fb_info *minfo) 322 + { 331 323 struct matrox_hw_state *hw = &minfo->hw; 332 324 333 - outDAC1064(PMINFO M1064_XPIXCLKCTRL, hw->DACreg[POS1064_XPIXCLKCTRL]); 334 - outDAC1064(PMINFO M1064_XMISCCTRL, hw->DACreg[POS1064_XMISCCTRL]); 325 + outDAC1064(minfo, M1064_XPIXCLKCTRL, hw->DACreg[POS1064_XPIXCLKCTRL]); 326 + outDAC1064(minfo, M1064_XMISCCTRL, hw->DACreg[POS1064_XMISCCTRL]); 335 327 if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG400) { 336 - outDAC1064(PMINFO 0x20, 0x04); 337 - outDAC1064(PMINFO 0x1F, minfo->devflags.dfp_type); 328 + outDAC1064(minfo, 0x20, 0x04); 329 + outDAC1064(minfo, 0x1F, minfo->devflags.dfp_type); 338 330 if (minfo->devflags.g450dac) { 339 - outDAC1064(PMINFO M1064_XSYNCCTRL, 0xCC); 340 - outDAC1064(PMINFO M1064_XPWRCTRL, hw->DACreg[POS1064_XPWRCTRL]); 341 - outDAC1064(PMINFO M1064_XPANMODE, hw->DACreg[POS1064_XPANMODE]); 342 - outDAC1064(PMINFO M1064_XOUTPUTCONN, hw->DACreg[POS1064_XOUTPUTCONN]); 331 + outDAC1064(minfo, M1064_XSYNCCTRL, 0xCC); 332 + outDAC1064(minfo, M1064_XPWRCTRL, hw->DACreg[POS1064_XPWRCTRL]); 333 + outDAC1064(minfo, M1064_XPANMODE, hw->DACreg[POS1064_XPANMODE]); 334 + outDAC1064(minfo, M1064_XOUTPUTCONN, hw->DACreg[POS1064_XOUTPUTCONN]); 343 335 } 344 336 } 345 337 } 346 338 347 - static int DAC1064_init_1(WPMINFO struct my_timming* m) { 339 + static int DAC1064_init_1(struct matrox_fb_info *minfo, struct my_timming *m) 340 + { 348 341 struct matrox_hw_state *hw = &minfo->hw; 349 342 350 343 DBG(__func__) ··· 378 367 hw->DACreg[POS1064_XCURADDL] = 0; 379 368 hw->DACreg[POS1064_XCURADDH] = 0; 380 369 381 - DAC1064_global_init(PMINFO2); 370 + DAC1064_global_init(minfo); 382 371 return 0; 383 372 } 384 373 385 - static int DAC1064_init_2(WPMINFO struct my_timming* m) { 374 + static int DAC1064_init_2(struct matrox_fb_info *minfo, struct my_timming *m) 375 + { 386 376 struct matrox_hw_state *hw = &minfo->hw; 387 377 388 378 DBG(__func__) ··· 425 413 return 0; 426 414 } 427 415 428 - static void DAC1064_restore_1(WPMINFO2) { 416 + static void DAC1064_restore_1(struct matrox_fb_info *minfo) 417 + { 429 418 struct matrox_hw_state *hw = &minfo->hw; 430 419 431 420 CRITFLAGS ··· 435 422 436 423 CRITBEGIN 437 424 438 - if ((inDAC1064(PMINFO DAC1064_XSYSPLLM) != hw->DACclk[3]) || 439 - (inDAC1064(PMINFO DAC1064_XSYSPLLN) != hw->DACclk[4]) || 440 - (inDAC1064(PMINFO DAC1064_XSYSPLLP) != hw->DACclk[5])) { 441 - outDAC1064(PMINFO DAC1064_XSYSPLLM, hw->DACclk[3]); 442 - outDAC1064(PMINFO DAC1064_XSYSPLLN, hw->DACclk[4]); 443 - outDAC1064(PMINFO DAC1064_XSYSPLLP, hw->DACclk[5]); 425 + if ((inDAC1064(minfo, DAC1064_XSYSPLLM) != hw->DACclk[3]) || 426 + (inDAC1064(minfo, DAC1064_XSYSPLLN) != hw->DACclk[4]) || 427 + (inDAC1064(minfo, DAC1064_XSYSPLLP) != hw->DACclk[5])) { 428 + outDAC1064(minfo, DAC1064_XSYSPLLM, hw->DACclk[3]); 429 + outDAC1064(minfo, DAC1064_XSYSPLLN, hw->DACclk[4]); 430 + outDAC1064(minfo, DAC1064_XSYSPLLP, hw->DACclk[5]); 444 431 } 445 432 { 446 433 unsigned int i; 447 434 448 435 for (i = 0; i < sizeof(MGA1064_DAC_regs); i++) { 449 436 if ((i != POS1064_XPIXCLKCTRL) && (i != POS1064_XMISCCTRL)) 450 - outDAC1064(PMINFO MGA1064_DAC_regs[i], hw->DACreg[i]); 437 + outDAC1064(minfo, MGA1064_DAC_regs[i], hw->DACreg[i]); 451 438 } 452 439 } 453 440 454 - DAC1064_global_restore(PMINFO2); 441 + DAC1064_global_restore(minfo); 455 442 456 443 CRITEND 457 444 }; 458 445 459 - static void DAC1064_restore_2(WPMINFO2) { 446 + static void DAC1064_restore_2(struct matrox_fb_info *minfo) 447 + { 460 448 #ifdef DEBUG 461 449 unsigned int i; 462 450 #endif ··· 484 470 int tmout; 485 471 CRITFLAGS 486 472 487 - DAC1064_setpclk(PMINFO m->pixclock); 473 + DAC1064_setpclk(minfo, m->pixclock); 488 474 489 475 CRITBEGIN 490 476 491 477 for (i = 0; i < 3; i++) 492 - outDAC1064(PMINFO M1064_XPIXPLLCM + i, minfo->hw.DACclk[i]); 478 + outDAC1064(minfo, M1064_XPIXPLLCM + i, minfo->hw.DACclk[i]); 493 479 for (tmout = 500000; tmout; tmout--) { 494 - if (inDAC1064(PMINFO M1064_XPIXPLLSTAT) & 0x40) 480 + if (inDAC1064(minfo, M1064_XPIXPLLSTAT) & 0x40) 495 481 break; 496 482 udelay(10); 497 483 }; ··· 514 500 static int g450_compute(void* out, struct my_timming* m) { 515 501 #define minfo ((struct matrox_fb_info*)out) 516 502 if (m->mnp < 0) { 517 - m->mnp = matroxfb_g450_setclk(PMINFO m->pixclock, (m->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL); 503 + m->mnp = matroxfb_g450_setclk(minfo, m->pixclock, (m->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL); 518 504 if (m->mnp >= 0) { 519 - m->pixclock = g450_mnp2f(PMINFO m->mnp); 505 + m->pixclock = g450_mnp2f(minfo, m->mnp); 520 506 } 521 507 } 522 508 #undef minfo ··· 532 518 #endif /* NEED_DAC1064 */ 533 519 534 520 #ifdef CONFIG_FB_MATROX_MYSTIQUE 535 - static int MGA1064_init(WPMINFO struct my_timming* m) { 521 + static int MGA1064_init(struct matrox_fb_info *minfo, struct my_timming *m) 522 + { 536 523 struct matrox_hw_state *hw = &minfo->hw; 537 524 538 525 DBG(__func__) 539 526 540 - if (DAC1064_init_1(PMINFO m)) return 1; 541 - if (matroxfb_vgaHWinit(PMINFO m)) return 1; 527 + if (DAC1064_init_1(minfo, m)) return 1; 528 + if (matroxfb_vgaHWinit(minfo, m)) return 1; 542 529 543 530 hw->MiscOutReg = 0xCB; 544 531 if (m->sync & FB_SYNC_HOR_HIGH_ACT) ··· 549 534 if (m->sync & FB_SYNC_COMP_HIGH_ACT) /* should be only FB_SYNC_COMP */ 550 535 hw->CRTCEXT[3] |= 0x40; 551 536 552 - if (DAC1064_init_2(PMINFO m)) return 1; 537 + if (DAC1064_init_2(minfo, m)) return 1; 553 538 return 0; 554 539 } 555 540 #endif 556 541 557 542 #ifdef CONFIG_FB_MATROX_G 558 - static int MGAG100_init(WPMINFO struct my_timming* m) { 543 + static int MGAG100_init(struct matrox_fb_info *minfo, struct my_timming *m) 544 + { 559 545 struct matrox_hw_state *hw = &minfo->hw; 560 546 561 547 DBG(__func__) 562 548 563 - if (DAC1064_init_1(PMINFO m)) return 1; 549 + if (DAC1064_init_1(minfo, m)) return 1; 564 550 hw->MXoptionReg &= ~0x2000; 565 - if (matroxfb_vgaHWinit(PMINFO m)) return 1; 551 + if (matroxfb_vgaHWinit(minfo, m)) return 1; 566 552 567 553 hw->MiscOutReg = 0xEF; 568 554 if (m->sync & FB_SYNC_HOR_HIGH_ACT) ··· 573 557 if (m->sync & FB_SYNC_COMP_HIGH_ACT) /* should be only FB_SYNC_COMP */ 574 558 hw->CRTCEXT[3] |= 0x40; 575 559 576 - if (DAC1064_init_2(PMINFO m)) return 1; 560 + if (DAC1064_init_2(minfo, m)) return 1; 577 561 return 0; 578 562 } 579 563 #endif /* G */ 580 564 581 565 #ifdef CONFIG_FB_MATROX_MYSTIQUE 582 - static void MGA1064_ramdac_init(WPMINFO2) { 566 + static void MGA1064_ramdac_init(struct matrox_fb_info *minfo) 567 + { 583 568 584 569 DBG(__func__) 585 570 ··· 594 577 minfo->features.pll.post_shift_max = 3; 595 578 minfo->features.DAC1064.xvrefctrl = DAC1064_XVREFCTRL_EXTERNAL; 596 579 /* maybe cmdline MCLK= ?, doc says gclk=44MHz, mclk=66MHz... it was 55/83 with old values */ 597 - DAC1064_setmclk(PMINFO DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV3 | DAC1064_OPT_SCLK_PLL, 133333); 580 + DAC1064_setmclk(minfo, DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV3 | DAC1064_OPT_SCLK_PLL, 133333); 598 581 } 599 582 #endif 600 583 ··· 606 589 static int def50 = 0; /* reg50, & 0x0F, & 0x3000 (only 0x0000, 0x1000, 0x2000 (0x3000 disallowed and treated as 0) */ 607 590 #endif 608 591 609 - static void MGAG100_progPixClock(CPMINFO int flags, int m, int n, int p) { 592 + static void MGAG100_progPixClock(const struct matrox_fb_info *minfo, int flags, 593 + int m, int n, int p) 594 + { 610 595 int reg; 611 596 int selClk; 612 597 int clk; 613 598 614 599 DBG(__func__) 615 600 616 - outDAC1064(PMINFO M1064_XPIXCLKCTRL, inDAC1064(PMINFO M1064_XPIXCLKCTRL) | M1064_XPIXCLKCTRL_DIS | 601 + outDAC1064(minfo, M1064_XPIXCLKCTRL, inDAC1064(minfo, M1064_XPIXCLKCTRL) | M1064_XPIXCLKCTRL_DIS | 617 602 M1064_XPIXCLKCTRL_PLL_UP); 618 603 switch (flags & 3) { 619 604 case 0: reg = M1064_XPIXPLLAM; break; 620 605 case 1: reg = M1064_XPIXPLLBM; break; 621 606 default: reg = M1064_XPIXPLLCM; break; 622 607 } 623 - outDAC1064(PMINFO reg++, m); 624 - outDAC1064(PMINFO reg++, n); 625 - outDAC1064(PMINFO reg, p); 608 + outDAC1064(minfo, reg++, m); 609 + outDAC1064(minfo, reg++, n); 610 + outDAC1064(minfo, reg, p); 626 611 selClk = mga_inb(M_MISC_REG_READ) & ~0xC; 627 612 /* there should be flags & 0x03 & case 0/1/else */ 628 613 /* and we should first select source and after that we should wait for PLL */ ··· 636 617 } 637 618 mga_outb(M_MISC_REG, selClk); 638 619 for (clk = 500000; clk; clk--) { 639 - if (inDAC1064(PMINFO M1064_XPIXPLLSTAT) & 0x40) 620 + if (inDAC1064(minfo, M1064_XPIXPLLSTAT) & 0x40) 640 621 break; 641 622 udelay(10); 642 623 }; 643 624 if (!clk) 644 625 printk(KERN_ERR "matroxfb: Pixel PLL%c not locked after usual time\n", (reg-M1064_XPIXPLLAM-2)/4 + 'A'); 645 - selClk = inDAC1064(PMINFO M1064_XPIXCLKCTRL) & ~M1064_XPIXCLKCTRL_SRC_MASK; 626 + selClk = inDAC1064(minfo, M1064_XPIXCLKCTRL) & ~M1064_XPIXCLKCTRL_SRC_MASK; 646 627 switch (flags & 0x0C) { 647 628 case 0x00: selClk |= M1064_XPIXCLKCTRL_SRC_PCI; break; 648 629 case 0x04: selClk |= M1064_XPIXCLKCTRL_SRC_PLL; break; 649 630 default: selClk |= M1064_XPIXCLKCTRL_SRC_EXT; break; 650 631 } 651 - outDAC1064(PMINFO M1064_XPIXCLKCTRL, selClk); 652 - outDAC1064(PMINFO M1064_XPIXCLKCTRL, inDAC1064(PMINFO M1064_XPIXCLKCTRL) & ~M1064_XPIXCLKCTRL_DIS); 632 + outDAC1064(minfo, M1064_XPIXCLKCTRL, selClk); 633 + outDAC1064(minfo, M1064_XPIXCLKCTRL, inDAC1064(minfo, M1064_XPIXCLKCTRL) & ~M1064_XPIXCLKCTRL_DIS); 653 634 } 654 635 655 - static void MGAG100_setPixClock(CPMINFO int flags, int freq) { 636 + static void MGAG100_setPixClock(const struct matrox_fb_info *minfo, int flags, 637 + int freq) 638 + { 656 639 unsigned int m, n, p; 657 640 658 641 DBG(__func__) 659 642 660 - DAC1064_calcclock(PMINFO freq, minfo->max_pixel_clock, &m, &n, &p); 661 - MGAG100_progPixClock(PMINFO flags, m, n, p); 643 + DAC1064_calcclock(minfo, freq, minfo->max_pixel_clock, &m, &n, &p); 644 + MGAG100_progPixClock(minfo, flags, m, n, p); 662 645 } 663 646 #endif 664 647 665 648 #ifdef CONFIG_FB_MATROX_MYSTIQUE 666 - static int MGA1064_preinit(WPMINFO2) { 649 + static int MGA1064_preinit(struct matrox_fb_info *minfo) 650 + { 667 651 static const int vxres_mystique[] = { 512, 640, 768, 800, 832, 960, 668 652 1024, 1152, 1280, 1600, 1664, 1920, 669 653 2048, 0}; ··· 703 681 return 0; 704 682 } 705 683 706 - static void MGA1064_reset(WPMINFO2) { 684 + static void MGA1064_reset(struct matrox_fb_info *minfo) 685 + { 707 686 708 687 DBG(__func__); 709 688 710 - MGA1064_ramdac_init(PMINFO2); 689 + MGA1064_ramdac_init(minfo); 711 690 } 712 691 #endif 713 692 714 693 #ifdef CONFIG_FB_MATROX_G 715 - static void g450_mclk_init(WPMINFO2) { 694 + static void g450_mclk_init(struct matrox_fb_info *minfo) 695 + { 716 696 /* switch all clocks to PCI source */ 717 697 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg | 4); 718 698 pci_write_config_dword(minfo->pcidev, PCI_OPTION3_REG, minfo->values.reg.opt3 & ~0x00300C03); ··· 723 699 if (((minfo->values.reg.opt3 & 0x000003) == 0x000003) || 724 700 ((minfo->values.reg.opt3 & 0x000C00) == 0x000C00) || 725 701 ((minfo->values.reg.opt3 & 0x300000) == 0x300000)) { 726 - matroxfb_g450_setclk(PMINFO minfo->values.pll.video, M_VIDEO_PLL); 702 + matroxfb_g450_setclk(minfo, minfo->values.pll.video, M_VIDEO_PLL); 727 703 } else { 728 704 unsigned long flags; 729 705 unsigned int pwr; 730 706 731 707 matroxfb_DAC_lock_irqsave(flags); 732 - pwr = inDAC1064(PMINFO M1064_XPWRCTRL) & ~0x02; 733 - outDAC1064(PMINFO M1064_XPWRCTRL, pwr); 708 + pwr = inDAC1064(minfo, M1064_XPWRCTRL) & ~0x02; 709 + outDAC1064(minfo, M1064_XPWRCTRL, pwr); 734 710 matroxfb_DAC_unlock_irqrestore(flags); 735 711 } 736 - matroxfb_g450_setclk(PMINFO minfo->values.pll.system, M_SYSTEM_PLL); 712 + matroxfb_g450_setclk(minfo, minfo->values.pll.system, M_SYSTEM_PLL); 737 713 738 714 /* switch clocks to their real PLL source(s) */ 739 715 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg | 4); ··· 742 718 743 719 } 744 720 745 - static void g450_memory_init(WPMINFO2) { 721 + static void g450_memory_init(struct matrox_fb_info *minfo) 722 + { 746 723 /* disable memory refresh */ 747 724 minfo->hw.MXoptionReg &= ~0x001F8000; 748 725 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg); ··· 785 760 786 761 } 787 762 788 - static void g450_preinit(WPMINFO2) { 763 + static void g450_preinit(struct matrox_fb_info *minfo) 764 + { 789 765 u_int32_t c2ctl; 790 766 u_int8_t curctl; 791 767 u_int8_t c1ctl; ··· 809 783 c2ctl = mga_inl(M_C2CTL); 810 784 mga_outl(M_C2CTL, c2ctl & ~1); 811 785 /* stop cursor */ 812 - curctl = inDAC1064(PMINFO M1064_XCURCTRL); 813 - outDAC1064(PMINFO M1064_XCURCTRL, 0); 786 + curctl = inDAC1064(minfo, M1064_XCURCTRL); 787 + outDAC1064(minfo, M1064_XCURCTRL, 0); 814 788 /* stop crtc1 */ 815 789 c1ctl = mga_readr(M_SEQ_INDEX, 1); 816 790 mga_setr(M_SEQ_INDEX, 1, c1ctl | 0x20); 817 791 818 - g450_mclk_init(PMINFO2); 819 - g450_memory_init(PMINFO2); 792 + g450_mclk_init(minfo); 793 + g450_memory_init(minfo); 820 794 821 795 /* set legacy VGA clock sources for DOSEmu or VMware... */ 822 - matroxfb_g450_setclk(PMINFO 25175, M_PIXEL_PLL_A); 823 - matroxfb_g450_setclk(PMINFO 28322, M_PIXEL_PLL_B); 796 + matroxfb_g450_setclk(minfo, 25175, M_PIXEL_PLL_A); 797 + matroxfb_g450_setclk(minfo, 28322, M_PIXEL_PLL_B); 824 798 825 799 /* restore crtc1 */ 826 800 mga_setr(M_SEQ_INDEX, 1, c1ctl); 827 801 828 802 /* restore cursor */ 829 - outDAC1064(PMINFO M1064_XCURCTRL, curctl); 803 + outDAC1064(minfo, M1064_XCURCTRL, curctl); 830 804 831 805 /* restore crtc2 */ 832 806 mga_outl(M_C2CTL, c2ctl); ··· 834 808 return; 835 809 } 836 810 837 - static int MGAG100_preinit(WPMINFO2) { 811 + static int MGAG100_preinit(struct matrox_fb_info *minfo) 812 + { 838 813 static const int vxres_g100[] = { 512, 640, 768, 800, 832, 960, 839 814 1024, 1152, 1280, 1600, 1664, 1920, 840 815 2048, 0}; ··· 889 862 if (minfo->devflags.noinit) 890 863 return 0; 891 864 if (minfo->devflags.g450dac) { 892 - g450_preinit(PMINFO2); 865 + g450_preinit(minfo); 893 866 return 0; 894 867 } 895 868 hw->MXoptionReg &= 0xC0000100; ··· 901 874 if (minfo->devflags.nopciretry) 902 875 hw->MXoptionReg |= 0x20000000; 903 876 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg); 904 - DAC1064_setmclk(PMINFO DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV3 | DAC1064_OPT_SCLK_PCI, 133333); 877 + DAC1064_setmclk(minfo, DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV3 | DAC1064_OPT_SCLK_PCI, 133333); 905 878 906 879 if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG100) { 907 880 pci_read_config_dword(minfo->pcidev, PCI_OPTION2_REG, &reg50); ··· 979 952 return 0; 980 953 } 981 954 982 - static void MGAG100_reset(WPMINFO2) { 955 + static void MGAG100_reset(struct matrox_fb_info *minfo) 956 + { 983 957 u_int8_t b; 984 958 struct matrox_hw_state *hw = &minfo->hw; 985 959 ··· 1009 981 } 1010 982 if (minfo->devflags.g450dac) { 1011 983 /* either leave MCLK as is... or they were set in preinit */ 1012 - hw->DACclk[3] = inDAC1064(PMINFO DAC1064_XSYSPLLM); 1013 - hw->DACclk[4] = inDAC1064(PMINFO DAC1064_XSYSPLLN); 1014 - hw->DACclk[5] = inDAC1064(PMINFO DAC1064_XSYSPLLP); 984 + hw->DACclk[3] = inDAC1064(minfo, DAC1064_XSYSPLLM); 985 + hw->DACclk[4] = inDAC1064(minfo, DAC1064_XSYSPLLN); 986 + hw->DACclk[5] = inDAC1064(minfo, DAC1064_XSYSPLLP); 1015 987 } else { 1016 - DAC1064_setmclk(PMINFO DAC1064_OPT_RESERVED | DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV1 | DAC1064_OPT_SCLK_PLL, 133333); 988 + DAC1064_setmclk(minfo, DAC1064_OPT_RESERVED | DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV1 | DAC1064_OPT_SCLK_PLL, 133333); 1017 989 } 1018 990 if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG400) { 1019 991 if (minfo->devflags.dfp_type == -1) { 1020 - minfo->devflags.dfp_type = inDAC1064(PMINFO 0x1F); 992 + minfo->devflags.dfp_type = inDAC1064(minfo, 0x1F); 1021 993 } 1022 994 } 1023 995 if (minfo->devflags.noinit) 1024 996 return; 1025 997 if (minfo->devflags.g450dac) { 1026 998 } else { 1027 - MGAG100_setPixClock(PMINFO 4, 25175); 1028 - MGAG100_setPixClock(PMINFO 5, 28322); 999 + MGAG100_setPixClock(minfo, 4, 25175); 1000 + MGAG100_setPixClock(minfo, 5, 28322); 1029 1001 if (x7AF4 & 0x10) { 1030 - b = inDAC1064(PMINFO M1064_XGENIODATA) & ~1; 1031 - outDAC1064(PMINFO M1064_XGENIODATA, b); 1032 - b = inDAC1064(PMINFO M1064_XGENIOCTRL) | 1; 1033 - outDAC1064(PMINFO M1064_XGENIOCTRL, b); 1002 + b = inDAC1064(minfo, M1064_XGENIODATA) & ~1; 1003 + outDAC1064(minfo, M1064_XGENIODATA, b); 1004 + b = inDAC1064(minfo, M1064_XGENIOCTRL) | 1; 1005 + outDAC1064(minfo, M1064_XGENIOCTRL, b); 1034 1006 } 1035 1007 } 1036 1008 } 1037 1009 #endif 1038 1010 1039 1011 #ifdef CONFIG_FB_MATROX_MYSTIQUE 1040 - static void MGA1064_restore(WPMINFO2) { 1012 + static void MGA1064_restore(struct matrox_fb_info *minfo) 1013 + { 1041 1014 int i; 1042 1015 struct matrox_hw_state *hw = &minfo->hw; 1043 1016 ··· 1054 1025 1055 1026 CRITEND 1056 1027 1057 - DAC1064_restore_1(PMINFO2); 1058 - matroxfb_vgaHWrestore(PMINFO2); 1028 + DAC1064_restore_1(minfo); 1029 + matroxfb_vgaHWrestore(minfo); 1059 1030 minfo->crtc1.panpos = -1; 1060 1031 for (i = 0; i < 6; i++) 1061 1032 mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]); 1062 - DAC1064_restore_2(PMINFO2); 1033 + DAC1064_restore_2(minfo); 1063 1034 } 1064 1035 #endif 1065 1036 1066 1037 #ifdef CONFIG_FB_MATROX_G 1067 - static void MGAG100_restore(WPMINFO2) { 1038 + static void MGAG100_restore(struct matrox_fb_info *minfo) 1039 + { 1068 1040 int i; 1069 1041 struct matrox_hw_state *hw = &minfo->hw; 1070 1042 ··· 1078 1048 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg); 1079 1049 CRITEND 1080 1050 1081 - DAC1064_restore_1(PMINFO2); 1082 - matroxfb_vgaHWrestore(PMINFO2); 1051 + DAC1064_restore_1(minfo); 1052 + matroxfb_vgaHWrestore(minfo); 1083 1053 #ifdef CONFIG_FB_MATROX_32MB 1084 1054 if (minfo->devflags.support32MB) 1085 1055 mga_setr(M_EXTVGA_INDEX, 8, hw->CRTCEXT[8]); ··· 1087 1057 minfo->crtc1.panpos = -1; 1088 1058 for (i = 0; i < 6; i++) 1089 1059 mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]); 1090 - DAC1064_restore_2(PMINFO2); 1060 + DAC1064_restore_2(minfo); 1091 1061 } 1092 1062 #endif 1093 1063
+2 -2
drivers/video/matrox/matroxfb_DAC1064.h
··· 11 11 extern struct matrox_switch matrox_G100; 12 12 #endif 13 13 #ifdef NEED_DAC1064 14 - void DAC1064_global_init(WPMINFO2); 15 - void DAC1064_global_restore(WPMINFO2); 14 + void DAC1064_global_init(struct matrox_fb_info *minfo); 15 + void DAC1064_global_restore(struct matrox_fb_info *minfo); 16 16 #endif 17 17 18 18 #define M1064_INDEX 0x00
+89 -81
drivers/video/matrox/matroxfb_Ti3026.c
··· 279 279 TVP3026_XCOLKEYCTRL_ZOOM1, 280 280 0x00, 0x00, TVP3026_XCURCTRL_DIS }; 281 281 282 - static int Ti3026_calcclock(CPMINFO unsigned int freq, unsigned int fmax, int* in, int* feed, int* post) { 282 + static int Ti3026_calcclock(const struct matrox_fb_info *minfo, 283 + unsigned int freq, unsigned int fmax, int *in, 284 + int *feed, int *post) 285 + { 283 286 unsigned int fvco; 284 287 unsigned int lin, lfeed, lpost; 285 288 286 289 DBG(__func__) 287 290 288 - fvco = PLL_calcclock(PMINFO freq, fmax, &lin, &lfeed, &lpost); 291 + fvco = PLL_calcclock(minfo, freq, fmax, &lin, &lfeed, &lpost); 289 292 fvco >>= (*post = lpost); 290 293 *in = 64 - lin; 291 294 *feed = 64 - lfeed; 292 295 return fvco; 293 296 } 294 297 295 - static int Ti3026_setpclk(WPMINFO int clk) { 298 + static int Ti3026_setpclk(struct matrox_fb_info *minfo, int clk) 299 + { 296 300 unsigned int f_pll; 297 301 unsigned int pixfeed, pixin, pixpost; 298 302 struct matrox_hw_state *hw = &minfo->hw; 299 303 300 304 DBG(__func__) 301 305 302 - f_pll = Ti3026_calcclock(PMINFO clk, minfo->max_pixel_clock, &pixin, &pixfeed, &pixpost); 306 + f_pll = Ti3026_calcclock(minfo, clk, minfo->max_pixel_clock, &pixin, &pixfeed, &pixpost); 303 307 304 308 hw->DACclk[0] = pixin | 0xC0; 305 309 hw->DACclk[1] = pixfeed; ··· 365 361 return 0; 366 362 } 367 363 368 - static int Ti3026_init(WPMINFO struct my_timming* m) { 364 + static int Ti3026_init(struct matrox_fb_info *minfo, struct my_timming *m) 365 + { 369 366 u_int8_t muxctrl = isInterleave(minfo) ? TVP3026_XMUXCTRL_MEMORY_64BIT : TVP3026_XMUXCTRL_MEMORY_32BIT; 370 367 struct matrox_hw_state *hw = &minfo->hw; 371 368 ··· 405 400 default: 406 401 return 1; /* TODO: failed */ 407 402 } 408 - if (matroxfb_vgaHWinit(PMINFO m)) return 1; 403 + if (matroxfb_vgaHWinit(minfo, m)) return 1; 409 404 410 405 /* set SYNC */ 411 406 hw->MiscOutReg = 0xCB; ··· 434 429 if (isInterleave(minfo)) hw->MXoptionReg |= 0x00001000; 435 430 436 431 /* set DAC */ 437 - Ti3026_setpclk(PMINFO m->pixclock); 432 + Ti3026_setpclk(minfo, m->pixclock); 438 433 return 0; 439 434 } 440 435 441 - static void ti3026_setMCLK(WPMINFO int fout){ 436 + static void ti3026_setMCLK(struct matrox_fb_info *minfo, int fout) 437 + { 442 438 unsigned int f_pll; 443 439 unsigned int pclk_m, pclk_n, pclk_p; 444 440 unsigned int mclk_m, mclk_n, mclk_p; ··· 448 442 449 443 DBG(__func__) 450 444 451 - f_pll = Ti3026_calcclock(PMINFO fout, minfo->max_pixel_clock, &mclk_n, &mclk_m, &mclk_p); 445 + f_pll = Ti3026_calcclock(minfo, fout, minfo->max_pixel_clock, &mclk_n, &mclk_m, &mclk_p); 452 446 453 447 /* save pclk */ 454 - outTi3026(PMINFO TVP3026_XPLLADDR, 0xFC); 455 - pclk_n = inTi3026(PMINFO TVP3026_XPIXPLLDATA); 456 - outTi3026(PMINFO TVP3026_XPLLADDR, 0xFD); 457 - pclk_m = inTi3026(PMINFO TVP3026_XPIXPLLDATA); 458 - outTi3026(PMINFO TVP3026_XPLLADDR, 0xFE); 459 - pclk_p = inTi3026(PMINFO TVP3026_XPIXPLLDATA); 448 + outTi3026(minfo, TVP3026_XPLLADDR, 0xFC); 449 + pclk_n = inTi3026(minfo, TVP3026_XPIXPLLDATA); 450 + outTi3026(minfo, TVP3026_XPLLADDR, 0xFD); 451 + pclk_m = inTi3026(minfo, TVP3026_XPIXPLLDATA); 452 + outTi3026(minfo, TVP3026_XPLLADDR, 0xFE); 453 + pclk_p = inTi3026(minfo, TVP3026_XPIXPLLDATA); 460 454 461 455 /* stop pclk */ 462 - outTi3026(PMINFO TVP3026_XPLLADDR, 0xFE); 463 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, 0x00); 456 + outTi3026(minfo, TVP3026_XPLLADDR, 0xFE); 457 + outTi3026(minfo, TVP3026_XPIXPLLDATA, 0x00); 464 458 465 459 /* set pclk to new mclk */ 466 - outTi3026(PMINFO TVP3026_XPLLADDR, 0xFC); 467 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, mclk_n | 0xC0); 468 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, mclk_m); 469 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, mclk_p | 0xB0); 460 + outTi3026(minfo, TVP3026_XPLLADDR, 0xFC); 461 + outTi3026(minfo, TVP3026_XPIXPLLDATA, mclk_n | 0xC0); 462 + outTi3026(minfo, TVP3026_XPIXPLLDATA, mclk_m); 463 + outTi3026(minfo, TVP3026_XPIXPLLDATA, mclk_p | 0xB0); 470 464 471 465 /* wait for PLL to lock */ 472 466 for (tmout = 500000; tmout; tmout--) { 473 - if (inTi3026(PMINFO TVP3026_XPIXPLLDATA) & 0x40) 467 + if (inTi3026(minfo, TVP3026_XPIXPLLDATA) & 0x40) 474 468 break; 475 469 udelay(10); 476 470 }; ··· 478 472 printk(KERN_ERR "matroxfb: Temporary pixel PLL not locked after 5 secs\n"); 479 473 480 474 /* output pclk on mclk pin */ 481 - mclk_ctl = inTi3026(PMINFO TVP3026_XMEMPLLCTRL); 482 - outTi3026(PMINFO TVP3026_XMEMPLLCTRL, mclk_ctl & 0xE7); 483 - outTi3026(PMINFO TVP3026_XMEMPLLCTRL, (mclk_ctl & 0xE7) | TVP3026_XMEMPLLCTRL_STROBEMKC4); 475 + mclk_ctl = inTi3026(minfo, TVP3026_XMEMPLLCTRL); 476 + outTi3026(minfo, TVP3026_XMEMPLLCTRL, mclk_ctl & 0xE7); 477 + outTi3026(minfo, TVP3026_XMEMPLLCTRL, (mclk_ctl & 0xE7) | TVP3026_XMEMPLLCTRL_STROBEMKC4); 484 478 485 479 /* stop MCLK */ 486 - outTi3026(PMINFO TVP3026_XPLLADDR, 0xFB); 487 - outTi3026(PMINFO TVP3026_XMEMPLLDATA, 0x00); 480 + outTi3026(minfo, TVP3026_XPLLADDR, 0xFB); 481 + outTi3026(minfo, TVP3026_XMEMPLLDATA, 0x00); 488 482 489 483 /* set mclk to new freq */ 490 - outTi3026(PMINFO TVP3026_XPLLADDR, 0xF3); 491 - outTi3026(PMINFO TVP3026_XMEMPLLDATA, mclk_n | 0xC0); 492 - outTi3026(PMINFO TVP3026_XMEMPLLDATA, mclk_m); 493 - outTi3026(PMINFO TVP3026_XMEMPLLDATA, mclk_p | 0xB0); 484 + outTi3026(minfo, TVP3026_XPLLADDR, 0xF3); 485 + outTi3026(minfo, TVP3026_XMEMPLLDATA, mclk_n | 0xC0); 486 + outTi3026(minfo, TVP3026_XMEMPLLDATA, mclk_m); 487 + outTi3026(minfo, TVP3026_XMEMPLLDATA, mclk_p | 0xB0); 494 488 495 489 /* wait for PLL to lock */ 496 490 for (tmout = 500000; tmout; tmout--) { 497 - if (inTi3026(PMINFO TVP3026_XMEMPLLDATA) & 0x40) 491 + if (inTi3026(minfo, TVP3026_XMEMPLLDATA) & 0x40) 498 492 break; 499 493 udelay(10); 500 494 } ··· 515 509 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg); 516 510 517 511 /* output MCLK to MCLK pin */ 518 - outTi3026(PMINFO TVP3026_XMEMPLLCTRL, (mclk_ctl & 0xE7) | TVP3026_XMEMPLLCTRL_MCLK_MCLKPLL); 519 - outTi3026(PMINFO TVP3026_XMEMPLLCTRL, (mclk_ctl ) | TVP3026_XMEMPLLCTRL_MCLK_MCLKPLL | TVP3026_XMEMPLLCTRL_STROBEMKC4); 512 + outTi3026(minfo, TVP3026_XMEMPLLCTRL, (mclk_ctl & 0xE7) | TVP3026_XMEMPLLCTRL_MCLK_MCLKPLL); 513 + outTi3026(minfo, TVP3026_XMEMPLLCTRL, (mclk_ctl ) | TVP3026_XMEMPLLCTRL_MCLK_MCLKPLL | TVP3026_XMEMPLLCTRL_STROBEMKC4); 520 514 521 515 /* stop PCLK */ 522 - outTi3026(PMINFO TVP3026_XPLLADDR, 0xFE); 523 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, 0x00); 516 + outTi3026(minfo, TVP3026_XPLLADDR, 0xFE); 517 + outTi3026(minfo, TVP3026_XPIXPLLDATA, 0x00); 524 518 525 519 /* restore pclk */ 526 - outTi3026(PMINFO TVP3026_XPLLADDR, 0xFC); 527 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, pclk_n); 528 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, pclk_m); 529 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, pclk_p); 520 + outTi3026(minfo, TVP3026_XPLLADDR, 0xFC); 521 + outTi3026(minfo, TVP3026_XPIXPLLDATA, pclk_n); 522 + outTi3026(minfo, TVP3026_XPIXPLLDATA, pclk_m); 523 + outTi3026(minfo, TVP3026_XPIXPLLDATA, pclk_p); 530 524 531 525 /* wait for PLL to lock */ 532 526 for (tmout = 500000; tmout; tmout--) { 533 - if (inTi3026(PMINFO TVP3026_XPIXPLLDATA) & 0x40) 527 + if (inTi3026(minfo, TVP3026_XPIXPLLDATA) & 0x40) 534 528 break; 535 529 udelay(10); 536 530 } ··· 538 532 printk(KERN_ERR "matroxfb: Pixel PLL not locked after 5 secs\n"); 539 533 } 540 534 541 - static void ti3026_ramdac_init(WPMINFO2) { 542 - 535 + static void ti3026_ramdac_init(struct matrox_fb_info *minfo) 536 + { 543 537 DBG(__func__) 544 538 545 539 minfo->features.pll.vco_freq_min = 110000; ··· 551 545 minfo->features.pll.post_shift_max = 3; 552 546 if (minfo->devflags.noinit) 553 547 return; 554 - ti3026_setMCLK(PMINFO 60000); 548 + ti3026_setMCLK(minfo, 60000); 555 549 } 556 550 557 - static void Ti3026_restore(WPMINFO2) { 551 + static void Ti3026_restore(struct matrox_fb_info *minfo) 552 + { 558 553 int i; 559 554 unsigned char progdac[6]; 560 555 struct matrox_hw_state *hw = &minfo->hw; ··· 576 569 577 570 CRITEND 578 571 579 - matroxfb_vgaHWrestore(PMINFO2); 572 + matroxfb_vgaHWrestore(minfo); 580 573 581 574 CRITBEGIN 582 575 ··· 585 578 mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]); 586 579 587 580 for (i = 0; i < 21; i++) { 588 - outTi3026(PMINFO DACseq[i], hw->DACreg[i]); 581 + outTi3026(minfo, DACseq[i], hw->DACreg[i]); 589 582 } 590 583 591 - outTi3026(PMINFO TVP3026_XPLLADDR, 0x00); 592 - progdac[0] = inTi3026(PMINFO TVP3026_XPIXPLLDATA); 593 - progdac[3] = inTi3026(PMINFO TVP3026_XLOOPPLLDATA); 594 - outTi3026(PMINFO TVP3026_XPLLADDR, 0x15); 595 - progdac[1] = inTi3026(PMINFO TVP3026_XPIXPLLDATA); 596 - progdac[4] = inTi3026(PMINFO TVP3026_XLOOPPLLDATA); 597 - outTi3026(PMINFO TVP3026_XPLLADDR, 0x2A); 598 - progdac[2] = inTi3026(PMINFO TVP3026_XPIXPLLDATA); 599 - progdac[5] = inTi3026(PMINFO TVP3026_XLOOPPLLDATA); 584 + outTi3026(minfo, TVP3026_XPLLADDR, 0x00); 585 + progdac[0] = inTi3026(minfo, TVP3026_XPIXPLLDATA); 586 + progdac[3] = inTi3026(minfo, TVP3026_XLOOPPLLDATA); 587 + outTi3026(minfo, TVP3026_XPLLADDR, 0x15); 588 + progdac[1] = inTi3026(minfo, TVP3026_XPIXPLLDATA); 589 + progdac[4] = inTi3026(minfo, TVP3026_XLOOPPLLDATA); 590 + outTi3026(minfo, TVP3026_XPLLADDR, 0x2A); 591 + progdac[2] = inTi3026(minfo, TVP3026_XPIXPLLDATA); 592 + progdac[5] = inTi3026(minfo, TVP3026_XLOOPPLLDATA); 600 593 601 594 CRITEND 602 595 if (memcmp(hw->DACclk, progdac, 6)) { ··· 605 598 /* Maybe even we should call schedule() ? */ 606 599 607 600 CRITBEGIN 608 - outTi3026(PMINFO TVP3026_XCLKCTRL, hw->DACreg[POS3026_XCLKCTRL]); 609 - outTi3026(PMINFO TVP3026_XPLLADDR, 0x2A); 610 - outTi3026(PMINFO TVP3026_XLOOPPLLDATA, 0); 611 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, 0); 601 + outTi3026(minfo, TVP3026_XCLKCTRL, hw->DACreg[POS3026_XCLKCTRL]); 602 + outTi3026(minfo, TVP3026_XPLLADDR, 0x2A); 603 + outTi3026(minfo, TVP3026_XLOOPPLLDATA, 0); 604 + outTi3026(minfo, TVP3026_XPIXPLLDATA, 0); 612 605 613 - outTi3026(PMINFO TVP3026_XPLLADDR, 0x00); 606 + outTi3026(minfo, TVP3026_XPLLADDR, 0x00); 614 607 for (i = 0; i < 3; i++) 615 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, hw->DACclk[i]); 608 + outTi3026(minfo, TVP3026_XPIXPLLDATA, hw->DACclk[i]); 616 609 /* wait for PLL only if PLL clock requested (always for PowerMode, never for VGA) */ 617 610 if (hw->MiscOutReg & 0x08) { 618 611 int tmout; 619 - outTi3026(PMINFO TVP3026_XPLLADDR, 0x3F); 612 + outTi3026(minfo, TVP3026_XPLLADDR, 0x3F); 620 613 for (tmout = 500000; tmout; --tmout) { 621 - if (inTi3026(PMINFO TVP3026_XPIXPLLDATA) & 0x40) 614 + if (inTi3026(minfo, TVP3026_XPIXPLLDATA) & 0x40) 622 615 break; 623 616 udelay(10); 624 617 } ··· 631 624 dprintk(KERN_INFO "PixelPLL: %d\n", 500000-tmout); 632 625 CRITBEGIN 633 626 } 634 - outTi3026(PMINFO TVP3026_XMEMPLLCTRL, hw->DACreg[POS3026_XMEMPLLCTRL]); 635 - outTi3026(PMINFO TVP3026_XPLLADDR, 0x00); 627 + outTi3026(minfo, TVP3026_XMEMPLLCTRL, hw->DACreg[POS3026_XMEMPLLCTRL]); 628 + outTi3026(minfo, TVP3026_XPLLADDR, 0x00); 636 629 for (i = 3; i < 6; i++) 637 - outTi3026(PMINFO TVP3026_XLOOPPLLDATA, hw->DACclk[i]); 630 + outTi3026(minfo, TVP3026_XLOOPPLLDATA, hw->DACclk[i]); 638 631 CRITEND 639 632 if ((hw->MiscOutReg & 0x08) && ((hw->DACclk[5] & 0x80) == 0x80)) { 640 633 int tmout; 641 634 642 635 CRITBEGIN 643 - outTi3026(PMINFO TVP3026_XPLLADDR, 0x3F); 636 + outTi3026(minfo, TVP3026_XPLLADDR, 0x3F); 644 637 for (tmout = 500000; tmout; --tmout) { 645 - if (inTi3026(PMINFO TVP3026_XLOOPPLLDATA) & 0x40) 638 + if (inTi3026(minfo, TVP3026_XLOOPPLLDATA) & 0x40) 646 639 break; 647 640 udelay(10); 648 641 } ··· 667 660 #endif 668 661 } 669 662 670 - static void Ti3026_reset(WPMINFO2) { 671 - 663 + static void Ti3026_reset(struct matrox_fb_info *minfo) 664 + { 672 665 DBG(__func__) 673 666 674 - ti3026_ramdac_init(PMINFO2); 667 + ti3026_ramdac_init(minfo); 675 668 } 676 669 677 670 static struct matrox_altout ti3026_output = { 678 671 .name = "Primary output", 679 672 }; 680 673 681 - static int Ti3026_preinit(WPMINFO2) { 674 + static int Ti3026_preinit(struct matrox_fb_info *minfo) 675 + { 682 676 static const int vxres_mill2[] = { 512, 640, 768, 800, 832, 960, 683 677 1024, 1152, 1280, 1600, 1664, 1920, 684 678 2048, 0}; ··· 714 706 hw->MXoptionReg |= 0x20000000; 715 707 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg); 716 708 717 - minfo->accel.ramdac_rev = inTi3026(PMINFO TVP3026_XSILICONREV); 709 + minfo->accel.ramdac_rev = inTi3026(minfo, TVP3026_XSILICONREV); 718 710 719 - outTi3026(PMINFO TVP3026_XCLKCTRL, TVP3026_XCLKCTRL_SRC_CLK0VGA | TVP3026_XCLKCTRL_CLKSTOPPED); 720 - outTi3026(PMINFO TVP3026_XTRUECOLORCTRL, TVP3026_XTRUECOLORCTRL_PSEUDOCOLOR); 721 - outTi3026(PMINFO TVP3026_XMUXCTRL, TVP3026_XMUXCTRL_VGA); 711 + outTi3026(minfo, TVP3026_XCLKCTRL, TVP3026_XCLKCTRL_SRC_CLK0VGA | TVP3026_XCLKCTRL_CLKSTOPPED); 712 + outTi3026(minfo, TVP3026_XTRUECOLORCTRL, TVP3026_XTRUECOLORCTRL_PSEUDOCOLOR); 713 + outTi3026(minfo, TVP3026_XMUXCTRL, TVP3026_XMUXCTRL_VGA); 722 714 723 - outTi3026(PMINFO TVP3026_XPLLADDR, 0x2A); 724 - outTi3026(PMINFO TVP3026_XLOOPPLLDATA, 0x00); 725 - outTi3026(PMINFO TVP3026_XPIXPLLDATA, 0x00); 715 + outTi3026(minfo, TVP3026_XPLLADDR, 0x2A); 716 + outTi3026(minfo, TVP3026_XLOOPPLLDATA, 0x00); 717 + outTi3026(minfo, TVP3026_XPIXPLLDATA, 0x00); 726 718 727 719 mga_outb(M_MISC_REG, 0x67); 728 720 729 - outTi3026(PMINFO TVP3026_XMEMPLLCTRL, TVP3026_XMEMPLLCTRL_STROBEMKC4 | TVP3026_XMEMPLLCTRL_MCLK_MCLKPLL); 721 + outTi3026(minfo, TVP3026_XMEMPLLCTRL, TVP3026_XMEMPLLCTRL_STROBEMKC4 | TVP3026_XMEMPLLCTRL_MCLK_MCLKPLL); 730 722 731 723 mga_outl(M_RESET, 1); 732 724 udelay(250);
+24 -13
drivers/video/matrox/matroxfb_accel.c
··· 107 107 static void matroxfb_cfb4_fillrect(struct fb_info* info, const struct fb_fillrect* rect); 108 108 static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyarea* area); 109 109 110 - void matrox_cfbX_init(WPMINFO2) { 110 + void matrox_cfbX_init(struct matrox_fb_info *minfo) 111 + { 111 112 u_int32_t maccess; 112 113 u_int32_t mpitch; 113 114 u_int32_t mopmode; ··· 196 195 197 196 EXPORT_SYMBOL(matrox_cfbX_init); 198 197 199 - static void matrox_accel_bmove(WPMINFO int vxres, int sy, int sx, int dy, int dx, int height, int width) { 198 + static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, 199 + int sx, int dy, int dx, int height, int width) 200 + { 200 201 int start, end; 201 202 CRITFLAGS 202 203 ··· 234 231 CRITEND 235 232 } 236 233 237 - static void matrox_accel_bmove_lin(WPMINFO int vxres, int sy, int sx, int dy, int dx, int height, int width) { 234 + static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres, 235 + int sy, int sx, int dy, int dx, int height, 236 + int width) 237 + { 238 238 int start, end; 239 239 CRITFLAGS 240 240 ··· 280 274 if ((area->sx | area->dx | area->width) & 1) 281 275 cfb_copyarea(info, area); 282 276 else 283 - matrox_accel_bmove_lin(PMINFO minfo->fbcon.var.xres_virtual >> 1, area->sy, area->sx >> 1, area->dy, area->dx >> 1, area->height, area->width >> 1); 277 + matrox_accel_bmove_lin(minfo, minfo->fbcon.var.xres_virtual >> 1, area->sy, area->sx >> 1, area->dy, area->dx >> 1, area->height, area->width >> 1); 284 278 } 285 279 286 280 static void matroxfb_copyarea(struct fb_info* info, const struct fb_copyarea* area) { 287 281 MINFO_FROM_INFO(info); 288 282 289 - matrox_accel_bmove(PMINFO minfo->fbcon.var.xres_virtual, area->sy, area->sx, area->dy, area->dx, area->height, area->width); 283 + matrox_accel_bmove(minfo, minfo->fbcon.var.xres_virtual, area->sy, area->sx, area->dy, area->dx, area->height, area->width); 290 284 } 291 285 292 - static void matroxfb_accel_clear(WPMINFO u_int32_t color, int sy, int sx, int height, 293 - int width) { 286 + static void matroxfb_accel_clear(struct matrox_fb_info *minfo, u_int32_t color, 287 + int sy, int sx, int height, int width) 288 + { 294 289 CRITFLAGS 295 290 296 291 DBG(__func__) ··· 313 306 314 307 switch (rect->rop) { 315 308 case ROP_COPY: 316 - matroxfb_accel_clear(PMINFO ((u_int32_t*)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width); 309 + matroxfb_accel_clear(minfo, ((u_int32_t *)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width); 317 310 break; 318 311 } 319 312 } 320 313 321 - static void matroxfb_cfb4_clear(WPMINFO u_int32_t bgx, int sy, int sx, int height, int width) { 314 + static void matroxfb_cfb4_clear(struct matrox_fb_info *minfo, u_int32_t bgx, 315 + int sy, int sx, int height, int width) 316 + { 322 317 int whattodo; 323 318 CRITFLAGS 324 319 ··· 380 371 381 372 switch (rect->rop) { 382 373 case ROP_COPY: 383 - matroxfb_cfb4_clear(PMINFO ((u_int32_t*)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width); 374 + matroxfb_cfb4_clear(minfo, ((u_int32_t *)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width); 384 375 break; 385 376 } 386 377 } 387 378 388 - static void matroxfb_1bpp_imageblit(WPMINFO u_int32_t fgx, u_int32_t bgx, 389 - const u_int8_t* chardata, int width, int height, int yy, int xx) { 379 + static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx, 380 + u_int32_t bgx, const u_int8_t *chardata, 381 + int width, int height, int yy, int xx) 382 + { 390 383 u_int32_t step; 391 384 u_int32_t ydstlen; 392 385 u_int32_t xlen; ··· 487 476 488 477 fgx = ((u_int32_t*)info->pseudo_palette)[image->fg_color]; 489 478 bgx = ((u_int32_t*)info->pseudo_palette)[image->bg_color]; 490 - matroxfb_1bpp_imageblit(PMINFO fgx, bgx, image->data, image->width, image->height, image->dy, image->dx); 479 + matroxfb_1bpp_imageblit(minfo, fgx, bgx, image->data, image->width, image->height, image->dy, image->dx); 491 480 } else { 492 481 /* Danger! image->depth is useless: logo painting code always 493 482 passes framebuffer color depth here, although logo data are
+1 -1
drivers/video/matrox/matroxfb_accel.h
··· 3 3 4 4 #include "matroxfb_base.h" 5 5 6 - void matrox_cfbX_init(WPMINFO2); 6 + void matrox_cfbX_init(struct matrox_fb_info *minfo); 7 7 8 8 #endif
+73 -51
drivers/video/matrox/matroxfb_base.c
··· 154 154 155 155 156 156 /* --------------------------------------------------------------------- */ 157 - static void update_crtc2(WPMINFO unsigned int pos) { 157 + static void update_crtc2(struct matrox_fb_info *minfo, unsigned int pos) 158 + { 158 159 struct matroxfb_dh_fb_info *info = minfo->crtc2.info; 159 160 160 161 /* Make sure that displays are compatible */ ··· 178 177 } 179 178 } 180 179 181 - static void matroxfb_crtc1_panpos(WPMINFO2) { 180 + static void matroxfb_crtc1_panpos(struct matrox_fb_info *minfo) 181 + { 182 182 if (minfo->crtc1.panpos >= 0) { 183 183 unsigned long flags; 184 184 int panpos; ··· 212 210 if (status & 0x20) { 213 211 mga_outl(M_ICLEAR, 0x20); 214 212 minfo->crtc1.vsync.cnt++; 215 - matroxfb_crtc1_panpos(PMINFO2); 213 + matroxfb_crtc1_panpos(minfo); 216 214 wake_up_interruptible(&minfo->crtc1.vsync.wait); 217 215 handled = 1; 218 216 } ··· 225 223 return IRQ_RETVAL(handled); 226 224 } 227 225 228 - int matroxfb_enable_irq(WPMINFO int reenable) { 226 + int matroxfb_enable_irq(struct matrox_fb_info *minfo, int reenable) 227 + { 229 228 u_int32_t bm; 230 229 231 230 if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG400) ··· 255 252 return 0; 256 253 } 257 254 258 - static void matroxfb_disable_irq(WPMINFO2) { 255 + static void matroxfb_disable_irq(struct matrox_fb_info *minfo) 256 + { 259 257 if (test_and_clear_bit(0, &minfo->irq_flags)) { 260 258 /* Flush pending pan-at-vbl request... */ 261 - matroxfb_crtc1_panpos(PMINFO2); 259 + matroxfb_crtc1_panpos(minfo); 262 260 if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG400) 263 261 mga_outl(M_IEN, mga_inl(M_IEN) & ~0x220); 264 262 else ··· 268 264 } 269 265 } 270 266 271 - int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc) { 267 + int matroxfb_wait_for_sync(struct matrox_fb_info *minfo, u_int32_t crtc) 268 + { 272 269 struct matrox_vsync *vs; 273 270 unsigned int cnt; 274 271 int ret; ··· 287 282 default: 288 283 return -ENODEV; 289 284 } 290 - ret = matroxfb_enable_irq(PMINFO 0); 285 + ret = matroxfb_enable_irq(minfo, 0); 291 286 if (ret) { 292 287 return ret; 293 288 } ··· 298 293 return ret; 299 294 } 300 295 if (ret == 0) { 301 - matroxfb_enable_irq(PMINFO 1); 296 + matroxfb_enable_irq(minfo, 1); 302 297 return -ETIMEDOUT; 303 298 } 304 299 return 0; ··· 306 301 307 302 /* --------------------------------------------------------------------- */ 308 303 309 - static void matrox_pan_var(WPMINFO struct fb_var_screeninfo *var) { 304 + static void matrox_pan_var(struct matrox_fb_info *minfo, 305 + struct fb_var_screeninfo *var) 306 + { 310 307 unsigned int pos; 311 308 unsigned short p0, p1, p2; 312 309 #ifdef CONFIG_FB_MATROX_32MB ··· 336 329 #endif 337 330 338 331 /* FB_ACTIVATE_VBL and we can acquire interrupts? Honor FB_ACTIVATE_VBL then... */ 339 - vbl = (var->activate & FB_ACTIVATE_VBL) && (matroxfb_enable_irq(PMINFO 0) == 0); 332 + vbl = (var->activate & FB_ACTIVATE_VBL) && (matroxfb_enable_irq(minfo, 0) == 0); 340 333 341 334 CRITBEGIN 342 335 ··· 356 349 } 357 350 matroxfb_DAC_unlock_irqrestore(flags); 358 351 359 - update_crtc2(PMINFO pos); 352 + update_crtc2(minfo, pos); 360 353 361 354 CRITEND 362 355 } 363 356 364 - static void matroxfb_remove(WPMINFO int dummy) { 357 + static void matroxfb_remove(struct matrox_fb_info *minfo, int dummy) 358 + { 365 359 /* Currently we are holding big kernel lock on all dead & usecount updates. 366 360 * Destroy everything after all users release it. Especially do not unregister 367 361 * framebuffer and iounmap memory, neither fbmem nor fbcon-cfb* does not check ··· 378 370 } 379 371 matroxfb_unregister_device(minfo); 380 372 unregister_framebuffer(&minfo->fbcon); 381 - matroxfb_g450_shutdown(PMINFO2); 373 + matroxfb_g450_shutdown(minfo); 382 374 #ifdef CONFIG_MTRR 383 375 if (minfo->mtrr.vram_valid) 384 376 mtrr_del(minfo->mtrr.vram, minfo->video.base, minfo->video.len); ··· 418 410 419 411 if (user) { 420 412 if (0 == --minfo->userusecount) { 421 - matroxfb_disable_irq(PMINFO2); 413 + matroxfb_disable_irq(minfo); 422 414 } 423 415 } 424 416 if (!(--minfo->usecount) && minfo->dead) { 425 - matroxfb_remove(PMINFO 0); 417 + matroxfb_remove(minfo, 0); 426 418 } 427 419 return(0); 428 420 } ··· 433 425 434 426 DBG(__func__) 435 427 436 - matrox_pan_var(PMINFO var); 428 + matrox_pan_var(minfo, var); 437 429 return 0; 438 430 } 439 431 440 - static int matroxfb_get_final_bppShift(CPMINFO int bpp) { 432 + static int matroxfb_get_final_bppShift(const struct matrox_fb_info *minfo, 433 + int bpp) 434 + { 441 435 int bppshft2; 442 436 443 437 DBG(__func__) ··· 455 445 return bppshft2; 456 446 } 457 447 458 - static int matroxfb_test_and_set_rounding(CPMINFO int xres, int bpp) { 448 + static int matroxfb_test_and_set_rounding(const struct matrox_fb_info *minfo, 449 + int xres, int bpp) 450 + { 459 451 int over; 460 452 int rounding; 461 453 ··· 488 476 return xres; 489 477 } 490 478 491 - static int matroxfb_pitch_adjust(CPMINFO int xres, int bpp) { 479 + static int matroxfb_pitch_adjust(const struct matrox_fb_info *minfo, int xres, 480 + int bpp) 481 + { 492 482 const int* width; 493 483 int xres_new; 494 484 ··· 502 488 503 489 if (minfo->devflags.precise_width) { 504 490 while (*width) { 505 - if ((*width >= xres) && (matroxfb_test_and_set_rounding(PMINFO *width, bpp) == *width)) { 491 + if ((*width >= xres) && (matroxfb_test_and_set_rounding(minfo, *width, bpp) == *width)) { 506 492 break; 507 493 } 508 494 width++; 509 495 } 510 496 xres_new = *width; 511 497 } else { 512 - xres_new = matroxfb_test_and_set_rounding(PMINFO xres, bpp); 498 + xres_new = matroxfb_test_and_set_rounding(minfo, xres, bpp); 513 499 } 514 500 return xres_new; 515 501 } ··· 536 522 return 16; /* return something reasonable... or panic()? */ 537 523 } 538 524 539 - static int matroxfb_decode_var(CPMINFO struct fb_var_screeninfo *var, int *visual, int *video_cmap_len, unsigned int* ydstorg) { 525 + static int matroxfb_decode_var(const struct matrox_fb_info *minfo, 526 + struct fb_var_screeninfo *var, int *visual, 527 + int *video_cmap_len, unsigned int* ydstorg) 528 + { 540 529 struct RGBT { 541 530 unsigned char bpp; 542 531 struct { ··· 581 564 if (var->xres_virtual < var->xres) 582 565 var->xres_virtual = var->xres; 583 566 584 - var->xres_virtual = matroxfb_pitch_adjust(PMINFO var->xres_virtual, bpp); 567 + var->xres_virtual = matroxfb_pitch_adjust(minfo, var->xres_virtual, bpp); 585 568 memlen = var->xres_virtual * bpp * var->yres_virtual / 8; 586 569 if (memlen > vramlen) { 587 570 var->yres_virtual = vramlen * 8 / (var->xres_virtual * bpp); ··· 717 700 return 0; 718 701 } 719 702 720 - static void matroxfb_init_fix(WPMINFO2) 703 + static void matroxfb_init_fix(struct matrox_fb_info *minfo) 721 704 { 722 705 struct fb_fix_screeninfo *fix = &minfo->fbcon.fix; 723 706 DBG(__func__) ··· 732 715 fix->accel = minfo->devflags.accelerator; 733 716 } 734 717 735 - static void matroxfb_update_fix(WPMINFO2) 718 + static void matroxfb_update_fix(struct matrox_fb_info *minfo) 736 719 { 737 720 struct fb_fix_screeninfo *fix = &minfo->fbcon.fix; 738 721 DBG(__func__) ··· 754 737 if (minfo->dead) { 755 738 return -ENXIO; 756 739 } 757 - if ((err = matroxfb_decode_var(PMINFO var, &visual, &cmap_len, &ydstorg)) != 0) 740 + if ((err = matroxfb_decode_var(minfo, var, &visual, &cmap_len, &ydstorg)) != 0) 758 741 return err; 759 742 return 0; 760 743 } ··· 775 758 } 776 759 777 760 var = &info->var; 778 - if ((err = matroxfb_decode_var(PMINFO var, &visual, &cmap_len, &ydstorg)) != 0) 761 + if ((err = matroxfb_decode_var(minfo, var, &visual, &cmap_len, &ydstorg)) != 0) 779 762 return err; 780 763 minfo->fbcon.screen_base = vaddr_va(minfo->video.vbase) + ydstorg; 781 - matroxfb_update_fix(PMINFO2); 764 + matroxfb_update_fix(minfo); 782 765 minfo->fbcon.fix.visual = visual; 783 766 minfo->fbcon.fix.type = FB_TYPE_PACKED_PIXELS; 784 767 minfo->fbcon.fix.type_aux = 0; ··· 794 777 minfo->curr.ydstorg.pixels = ydstorg; 795 778 else 796 779 minfo->curr.ydstorg.pixels = (ydstorg * 8) / var->bits_per_pixel; 797 - minfo->curr.final_bppShift = matroxfb_get_final_bppShift(PMINFO var->bits_per_pixel); 780 + minfo->curr.final_bppShift = matroxfb_get_final_bppShift(minfo, var->bits_per_pixel); 798 781 { struct my_timming mt; 799 782 struct matrox_hw_state* hw; 800 783 int out; ··· 822 805 up_read(&minfo->altout.lock); 823 806 minfo->crtc1.pixclock = mt.pixclock; 824 807 minfo->crtc1.mnp = mt.mnp; 825 - minfo->hw_switch->init(PMINFO &mt); 808 + minfo->hw_switch->init(minfo, &mt); 826 809 pos = (var->yoffset * var->xres_virtual + var->xoffset) * minfo->curr.final_bppShift / 32; 827 810 pos += minfo->curr.ydstorg.chunks; 828 811 ··· 830 813 hw->CRTC[0x0C] = (pos & 0xFF00) >> 8; 831 814 hw->CRTCEXT[0] = (hw->CRTCEXT[0] & 0xF0) | ((pos >> 16) & 0x0F) | ((pos >> 14) & 0x40); 832 815 hw->CRTCEXT[8] = pos >> 21; 833 - minfo->hw_switch->restore(PMINFO2); 834 - update_crtc2(PMINFO pos); 816 + minfo->hw_switch->restore(minfo); 817 + update_crtc2(minfo, pos); 835 818 down_read(&minfo->altout.lock); 836 819 for (out = 0; out < MATROXFB_MAX_OUTPUTS; out++) { 837 820 if (minfo->outputs[out].src == MATROXFB_SRC_CRTC1 && ··· 846 829 } 847 830 } 848 831 up_read(&minfo->altout.lock); 849 - matrox_cfbX_init(PMINFO2); 832 + matrox_cfbX_init(minfo); 850 833 } 851 834 } 852 835 minfo->initialized = 1; 853 836 return 0; 854 837 } 855 838 856 - static int matroxfb_get_vblank(WPMINFO struct fb_vblank *vblank) 839 + static int matroxfb_get_vblank(struct matrox_fb_info *minfo, 840 + struct fb_vblank *vblank) 857 841 { 858 842 unsigned int sts1; 859 843 860 - matroxfb_enable_irq(PMINFO 0); 844 + matroxfb_enable_irq(minfo, 0); 861 845 memset(vblank, 0, sizeof(*vblank)); 862 846 vblank->flags = FB_VBLANK_HAVE_VCOUNT | FB_VBLANK_HAVE_VSYNC | 863 847 FB_VBLANK_HAVE_VBLANK | FB_VBLANK_HAVE_HBLANK; ··· 904 886 struct fb_vblank vblank; 905 887 int err; 906 888 907 - err = matroxfb_get_vblank(PMINFO &vblank); 889 + err = matroxfb_get_vblank(minfo, &vblank); 908 890 if (err) 909 891 return err; 910 892 if (copy_to_user(argp, &vblank, sizeof(vblank))) ··· 918 900 if (get_user(crt, (u_int32_t __user *)arg)) 919 901 return -EFAULT; 920 902 921 - return matroxfb_wait_for_sync(PMINFO crt); 903 + return matroxfb_wait_for_sync(minfo, crt); 922 904 } 923 905 case MATROXFB_SET_OUTPUT_MODE: 924 906 { ··· 1295 1277 static char videomode[64]; /* "matrox:mode:xxxxx" or "matrox:xxxxx" */ 1296 1278 #endif 1297 1279 1298 - static int matroxfb_getmemory(WPMINFO unsigned int maxSize, unsigned int *realSize){ 1280 + static int matroxfb_getmemory(struct matrox_fb_info *minfo, 1281 + unsigned int maxSize, unsigned int *realSize) 1282 + { 1299 1283 vaddr_t vm; 1300 1284 unsigned int offs; 1301 1285 unsigned int offs2; ··· 1574 1554 1575 1555 static int hotplug = 0; 1576 1556 1577 - static void setDefaultOutputs(WPMINFO2) { 1557 + static void setDefaultOutputs(struct matrox_fb_info *minfo) 1558 + { 1578 1559 unsigned int i; 1579 1560 const char* ptr; 1580 1561 ··· 1608 1587 outputs[0] = 0; 1609 1588 } 1610 1589 1611 - static int initMatrox2(WPMINFO struct board* b){ 1590 + static int initMatrox2(struct matrox_fb_info *minfo, struct board *b) 1591 + { 1612 1592 unsigned long ctrlptr_phys = 0; 1613 1593 unsigned long video_base_phys = 0; 1614 1594 unsigned int memsize; ··· 1658 1636 minfo->devflags.g450dac = (b->flags & DEVF_G450DAC) != 0; 1659 1637 minfo->devflags.textstep = minfo->devflags.vgastep * minfo->devflags.textmode; 1660 1638 minfo->devflags.textvram = 65536 / minfo->devflags.textmode; 1661 - setDefaultOutputs(PMINFO2); 1639 + setDefaultOutputs(minfo); 1662 1640 if (b->flags & DEVF_PANELLINK_CAPABLE) { 1663 1641 minfo->outputs[2].data = minfo; 1664 1642 minfo->outputs[2].output = &panellink_output; ··· 1741 1719 } 1742 1720 1743 1721 err = -ENXIO; 1744 - matroxfb_read_pins(PMINFO2); 1745 - if (minfo->hw_switch->preinit(PMINFO2)) { 1722 + matroxfb_read_pins(minfo); 1723 + if (minfo->hw_switch->preinit(minfo)) { 1746 1724 goto failVideoIO; 1747 1725 } 1748 1726 1749 1727 err = -ENOMEM; 1750 - if (!matroxfb_getmemory(PMINFO memsize, &minfo->video.len) || !minfo->video.len) { 1728 + if (!matroxfb_getmemory(minfo, memsize, &minfo->video.len) || !minfo->video.len) { 1751 1729 printk(KERN_ERR "matroxfb: cannot determine memory size\n"); 1752 1730 goto failVideoIO; 1753 1731 } ··· 1767 1745 1768 1746 if (!minfo->devflags.novga) 1769 1747 request_region(0x3C0, 32, "matrox"); 1770 - matroxfb_g450_connect(PMINFO2); 1771 - minfo->hw_switch->reset(PMINFO2); 1748 + matroxfb_g450_connect(minfo); 1749 + minfo->hw_switch->reset(minfo); 1772 1750 1773 1751 minfo->fbcon.monspecs.hfmin = 0; 1774 1752 minfo->fbcon.monspecs.hfmax = fh; ··· 1892 1870 vesafb_defined.yres_virtual = 65536; /* large enough to be INF, but small enough 1893 1871 to yres_virtual * xres_virtual < 2^32 */ 1894 1872 } 1895 - matroxfb_init_fix(PMINFO2); 1873 + matroxfb_init_fix(minfo); 1896 1874 minfo->fbcon.screen_base = vaddr_va(minfo->video.vbase); 1897 1875 /* Normalize values (namely yres_virtual) */ 1898 1876 matroxfb_check_var(&vesafb_defined, &minfo->fbcon); ··· 1932 1910 1933 1911 return 0; 1934 1912 failVideoIO:; 1935 - matroxfb_g450_shutdown(PMINFO2); 1913 + matroxfb_g450_shutdown(minfo); 1936 1914 mga_iounmap(minfo->video.vbase); 1937 1915 failCtrlIO:; 1938 1916 mga_iounmap(minfo->mmio.vbase); ··· 2097 2075 init_waitqueue_head(&minfo->crtc2.vsync.wait); 2098 2076 minfo->crtc1.panpos = -1; 2099 2077 2100 - err = initMatrox2(PMINFO b); 2078 + err = initMatrox2(minfo, b); 2101 2079 if (!err) { 2102 2080 matroxfb_register_device(minfo); 2103 2081 return 0; ··· 2110 2088 struct matrox_fb_info* minfo; 2111 2089 2112 2090 minfo = pci_get_drvdata(pdev); 2113 - matroxfb_remove(PMINFO 1); 2091 + matroxfb_remove(minfo, 1); 2114 2092 } 2115 2093 2116 2094 static struct pci_device_id matroxfb_devices[] = {
+9 -15
drivers/video/matrox/matroxfb_base.h
··· 524 524 525 525 #define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon) 526 526 527 - #define WPMINFO2 struct matrox_fb_info* minfo 528 - #define WPMINFO WPMINFO2 , 529 - #define CPMINFO2 const struct matrox_fb_info* minfo 530 - #define CPMINFO CPMINFO2 , 531 - #define PMINFO2 minfo 532 - #define PMINFO PMINFO2 , 533 - 534 527 #define MINFO_FROM(x) struct matrox_fb_info* minfo = x 535 528 536 529 #define MINFO_FROM_INFO(x) MINFO_FROM(info2minfo(x)) 537 530 538 531 struct matrox_switch { 539 - int (*preinit)(WPMINFO2); 540 - void (*reset)(WPMINFO2); 541 - int (*init)(WPMINFO struct my_timming*); 542 - void (*restore)(WPMINFO2); 532 + int (*preinit)(struct matrox_fb_info *minfo); 533 + void (*reset)(struct matrox_fb_info *minfo); 534 + int (*init)(struct matrox_fb_info *minfo, struct my_timming*); 535 + void (*restore)(struct matrox_fb_info *minfo); 543 536 }; 544 537 545 538 struct matroxfb_driver { ··· 722 729 #define matroxfb_DAC_unlock() spin_unlock(&minfo->lock.DAC) 723 730 #define matroxfb_DAC_lock_irqsave(flags) spin_lock_irqsave(&minfo->lock.DAC, flags) 724 731 #define matroxfb_DAC_unlock_irqrestore(flags) spin_unlock_irqrestore(&minfo->lock.DAC, flags) 725 - extern void matroxfb_DAC_out(CPMINFO int reg, int val); 726 - extern int matroxfb_DAC_in(CPMINFO int reg); 732 + extern void matroxfb_DAC_out(const struct matrox_fb_info *minfo, int reg, 733 + int val); 734 + extern int matroxfb_DAC_in(const struct matrox_fb_info *minfo, int reg); 727 735 extern void matroxfb_var2my(struct fb_var_screeninfo* fvsi, struct my_timming* mt); 728 - extern int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc); 729 - extern int matroxfb_enable_irq(WPMINFO int reenable); 736 + extern int matroxfb_wait_for_sync(struct matrox_fb_info *minfo, u_int32_t crtc); 737 + extern int matroxfb_enable_irq(struct matrox_fb_info *minfo, int reenable); 730 738 731 739 #ifdef MATROXFB_USE_SPINLOCKS 732 740 #define CRITBEGIN spin_lock_irqsave(&minfo->lock.accel, critflags);
+8 -6
drivers/video/matrox/matroxfb_crtc2.c
··· 369 369 } else { 370 370 matroxfb_dh_disable(m2info); 371 371 } 372 - DAC1064_global_init(PMINFO2); 373 - DAC1064_global_restore(PMINFO2); 372 + DAC1064_global_init(minfo); 373 + DAC1064_global_restore(minfo); 374 374 down_read(&minfo->altout.lock); 375 375 for (out = 0; out < MATROXFB_MAX_OUTPUTS; out++) { 376 376 if (minfo->outputs[out].src == MATROXFB_SRC_CRTC2 && ··· 401 401 static int matroxfb_dh_get_vblank(const struct matroxfb_dh_fb_info* m2info, struct fb_vblank* vblank) { 402 402 MINFO_FROM(m2info->primary_dev); 403 403 404 - matroxfb_enable_irq(PMINFO 0); 404 + matroxfb_enable_irq(minfo, 0); 405 405 memset(vblank, 0, sizeof(*vblank)); 406 406 vblank->flags = FB_VBLANK_HAVE_VCOUNT | FB_VBLANK_HAVE_VBLANK; 407 407 /* mask out reserved bits + field number (odd/even) */ ··· 449 449 450 450 if (crt != 0) 451 451 return -ENODEV; 452 - return matroxfb_wait_for_sync(PMINFO 1); 452 + return matroxfb_wait_for_sync(minfo, 1); 453 453 } 454 454 case MATROXFB_SET_OUTPUT_MODE: 455 455 case MATROXFB_GET_OUTPUT_MODE: ··· 595 595 0, {0,0,0,0,0} 596 596 }; 597 597 598 - static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) { 598 + static int matroxfb_dh_regit(const struct matrox_fb_info *minfo, 599 + struct matroxfb_dh_fb_info *m2info) 600 + { 599 601 #define minfo (m2info->primary_dev) 600 602 void* oldcrtc2; 601 603 ··· 651 649 652 650 static int matroxfb_dh_registerfb(struct matroxfb_dh_fb_info* m2info) { 653 651 #define minfo (m2info->primary_dev) 654 - if (matroxfb_dh_regit(PMINFO m2info)) { 652 + if (matroxfb_dh_regit(minfo, m2info)) { 655 653 printk(KERN_ERR "matroxfb_crtc2: secondary head failed to register\n"); 656 654 return -1; 657 655 }
+56 -43
drivers/video/matrox/matroxfb_g450.c
··· 80 80 return -EINVAL; 81 81 } 82 82 83 - static inline int* get_ctrl_ptr(WPMINFO unsigned int idx) { 83 + static inline int *get_ctrl_ptr(struct matrox_fb_info *minfo, unsigned int idx) 84 + { 84 85 return (int*)((char*)minfo + g450_controls[idx].control); 85 86 } 86 87 87 - static void tvo_fill_defaults(WPMINFO2) { 88 + static void tvo_fill_defaults(struct matrox_fb_info *minfo) 89 + { 88 90 unsigned int i; 89 91 90 92 for (i = 0; i < G450CTRLS; i++) { 91 - *get_ctrl_ptr(PMINFO i) = g450_controls[i].desc.default_value; 93 + *get_ctrl_ptr(minfo, i) = g450_controls[i].desc.default_value; 92 94 } 93 95 } 94 96 95 - static int cve2_get_reg(WPMINFO int reg) { 97 + static int cve2_get_reg(struct matrox_fb_info *minfo, int reg) 98 + { 96 99 unsigned long flags; 97 100 int val; 98 101 99 102 matroxfb_DAC_lock_irqsave(flags); 100 - matroxfb_DAC_out(PMINFO 0x87, reg); 101 - val = matroxfb_DAC_in(PMINFO 0x88); 103 + matroxfb_DAC_out(minfo, 0x87, reg); 104 + val = matroxfb_DAC_in(minfo, 0x88); 102 105 matroxfb_DAC_unlock_irqrestore(flags); 103 106 return val; 104 107 } 105 108 106 - static void cve2_set_reg(WPMINFO int reg, int val) { 109 + static void cve2_set_reg(struct matrox_fb_info *minfo, int reg, int val) 110 + { 107 111 unsigned long flags; 108 112 109 113 matroxfb_DAC_lock_irqsave(flags); 110 - matroxfb_DAC_out(PMINFO 0x87, reg); 111 - matroxfb_DAC_out(PMINFO 0x88, val); 114 + matroxfb_DAC_out(minfo, 0x87, reg); 115 + matroxfb_DAC_out(minfo, 0x88, val); 112 116 matroxfb_DAC_unlock_irqrestore(flags); 113 117 } 114 118 115 - static void cve2_set_reg10(WPMINFO int reg, int val) { 119 + static void cve2_set_reg10(struct matrox_fb_info *minfo, int reg, int val) 120 + { 116 121 unsigned long flags; 117 122 118 123 matroxfb_DAC_lock_irqsave(flags); 119 - matroxfb_DAC_out(PMINFO 0x87, reg); 120 - matroxfb_DAC_out(PMINFO 0x88, val >> 2); 121 - matroxfb_DAC_out(PMINFO 0x87, reg + 1); 122 - matroxfb_DAC_out(PMINFO 0x88, val & 3); 124 + matroxfb_DAC_out(minfo, 0x87, reg); 125 + matroxfb_DAC_out(minfo, 0x88, val >> 2); 126 + matroxfb_DAC_out(minfo, 0x87, reg + 1); 127 + matroxfb_DAC_out(minfo, 0x88, val & 3); 123 128 matroxfb_DAC_unlock_irqrestore(flags); 124 129 } 125 130 126 - static void g450_compute_bwlevel(CPMINFO int *bl, int *wl) { 131 + static void g450_compute_bwlevel(const struct matrox_fb_info *minfo, int *bl, 132 + int *wl) 133 + { 127 134 const int b = minfo->altout.tvo_params.brightness + BLMIN; 128 135 const int c = minfo->altout.tvo_params.contrast; 129 136 ··· 169 162 /* 170 163 * Check if changed. 171 164 */ 172 - if (p->value == *get_ctrl_ptr(PMINFO i)) return 0; 165 + if (p->value == *get_ctrl_ptr(minfo, i)) return 0; 173 166 174 167 /* 175 168 * Check limits. ··· 180 173 /* 181 174 * Store new value. 182 175 */ 183 - *get_ctrl_ptr(PMINFO i) = p->value; 176 + *get_ctrl_ptr(minfo, i) = p->value; 184 177 185 178 switch (p->id) { 186 179 case V4L2_CID_BRIGHTNESS: 187 180 case V4L2_CID_CONTRAST: 188 181 { 189 182 int blacklevel, whitelevel; 190 - g450_compute_bwlevel(PMINFO &blacklevel, &whitelevel); 191 - cve2_set_reg10(PMINFO 0x0e, blacklevel); 192 - cve2_set_reg10(PMINFO 0x1e, whitelevel); 183 + g450_compute_bwlevel(minfo, &blacklevel, &whitelevel); 184 + cve2_set_reg10(minfo, 0x0e, blacklevel); 185 + cve2_set_reg10(minfo, 0x1e, whitelevel); 193 186 } 194 187 break; 195 188 case V4L2_CID_SATURATION: 196 - cve2_set_reg(PMINFO 0x20, p->value); 197 - cve2_set_reg(PMINFO 0x22, p->value); 189 + cve2_set_reg(minfo, 0x20, p->value); 190 + cve2_set_reg(minfo, 0x22, p->value); 198 191 break; 199 192 case V4L2_CID_HUE: 200 - cve2_set_reg(PMINFO 0x25, p->value); 193 + cve2_set_reg(minfo, 0x25, p->value); 201 194 break; 202 195 case MATROXFB_CID_TESTOUT: 203 196 { 204 - unsigned char val = cve2_get_reg (PMINFO 0x05); 197 + unsigned char val = cve2_get_reg(minfo, 0x05); 205 198 if (p->value) val |= 0x02; 206 199 else val &= ~0x02; 207 - cve2_set_reg(PMINFO 0x05, val); 200 + cve2_set_reg(minfo, 0x05, val); 208 201 } 209 202 break; 210 203 } ··· 219 212 220 213 i = get_ctrl_id(p->id); 221 214 if (i < 0) return -EINVAL; 222 - p->value = *get_ctrl_ptr(PMINFO i); 215 + p->value = *get_ctrl_ptr(minfo, i); 223 216 return 0; 224 217 } 225 218 ··· 233 226 unsigned int v_total; 234 227 }; 235 228 236 - static void computeRegs(WPMINFO struct mavenregs* r, struct my_timming* mt, const struct output_desc* outd) { 229 + static void computeRegs(struct matrox_fb_info *minfo, struct mavenregs *r, 230 + struct my_timming *mt, const struct output_desc *outd) 231 + { 237 232 u_int32_t chromasc; 238 233 u_int32_t hlen; 239 234 u_int32_t hsl; ··· 260 251 261 252 dprintk(KERN_DEBUG "Want %u kHz pixclock\n", (unsigned int)piic); 262 253 263 - mnp = matroxfb_g450_setclk(PMINFO piic, M_VIDEO_PLL); 254 + mnp = matroxfb_g450_setclk(minfo, piic, M_VIDEO_PLL); 264 255 265 256 mt->mnp = mnp; 266 - mt->pixclock = g450_mnp2f(PMINFO mnp); 257 + mt->pixclock = g450_mnp2f(minfo, mnp); 267 258 268 259 dprintk(KERN_DEBUG "MNP=%08X\n", mnp); 269 260 ··· 499 490 return; 500 491 } 501 492 502 - #define LR(x) cve2_set_reg(PMINFO (x), m->regs[(x)]) 503 - static void cve2_init_TV(WPMINFO const struct mavenregs* m) { 493 + #define LR(x) cve2_set_reg(minfo, (x), m->regs[(x)]) 494 + static void cve2_init_TV(struct matrox_fb_info *minfo, 495 + const struct mavenregs *m) 496 + { 504 497 int i; 505 498 506 499 LR(0x80); 507 500 LR(0x82); LR(0x83); 508 501 LR(0x84); LR(0x85); 509 502 510 - cve2_set_reg(PMINFO 0x3E, 0x01); 503 + cve2_set_reg(minfo, 0x3E, 0x01); 511 504 512 505 for (i = 0; i < 0x3E; i++) { 513 506 LR(i); 514 507 } 515 - cve2_set_reg(PMINFO 0x3E, 0x00); 508 + cve2_set_reg(minfo, 0x3E, 0x00); 516 509 } 517 510 518 511 static int matroxfb_g450_compute(void* md, struct my_timming* mt) { ··· 529 518 cve2_init_TVdata(minfo->outputs[1].mode, &minfo->hw.maven, &outd); 530 519 { 531 520 int blacklevel, whitelevel; 532 - g450_compute_bwlevel(PMINFO &blacklevel, &whitelevel); 521 + g450_compute_bwlevel(minfo, &blacklevel, &whitelevel); 533 522 minfo->hw.maven.regs[0x0E] = blacklevel >> 2; 534 523 minfo->hw.maven.regs[0x0F] = blacklevel & 3; 535 524 minfo->hw.maven.regs[0x1E] = whitelevel >> 2; ··· 544 533 minfo->hw.maven.regs[0x05] |= 0x02; 545 534 } 546 535 } 547 - computeRegs(PMINFO &minfo->hw.maven, mt, outd); 536 + computeRegs(minfo, &minfo->hw.maven, mt, outd); 548 537 } else if (mt->mnp < 0) { 549 538 /* We must program clocks before CRTC2, otherwise interlaced mode 550 539 startup may fail */ 551 - mt->mnp = matroxfb_g450_setclk(PMINFO mt->pixclock, (mt->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL); 552 - mt->pixclock = g450_mnp2f(PMINFO mt->mnp); 540 + mt->mnp = matroxfb_g450_setclk(minfo, mt->pixclock, (mt->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL); 541 + mt->pixclock = g450_mnp2f(minfo, mt->mnp); 553 542 } 554 543 dprintk(KERN_DEBUG "Pixclock = %u\n", mt->pixclock); 555 544 return 0; ··· 559 548 MINFO_FROM(md); 560 549 561 550 if (minfo->outputs[1].mode != MATROXFB_OUTPUT_MODE_MONITOR) { 562 - cve2_init_TV(PMINFO &minfo->hw.maven); 551 + cve2_init_TV(minfo, &minfo->hw.maven); 563 552 } 564 553 return 0; 565 554 } ··· 578 567 MINFO_FROM(md); 579 568 580 569 if (mt->mnp < 0) { 581 - mt->mnp = matroxfb_g450_setclk(PMINFO mt->pixclock, (mt->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL); 582 - mt->pixclock = g450_mnp2f(PMINFO mt->mnp); 570 + mt->mnp = matroxfb_g450_setclk(minfo, mt->pixclock, (mt->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL); 571 + mt->pixclock = g450_mnp2f(minfo, mt->mnp); 583 572 } 584 573 return 0; 585 574 } ··· 599 588 .compute = g450_dvi_compute, 600 589 }; 601 590 602 - void matroxfb_g450_connect(WPMINFO2) { 591 + void matroxfb_g450_connect(struct matrox_fb_info *minfo) 592 + { 603 593 if (minfo->devflags.g450dac) { 604 594 down_write(&minfo->altout.lock); 605 - tvo_fill_defaults(PMINFO2); 595 + tvo_fill_defaults(minfo); 606 596 minfo->outputs[1].src = minfo->outputs[1].default_src; 607 597 minfo->outputs[1].data = minfo; 608 598 minfo->outputs[1].output = &matroxfb_g450_altout; ··· 616 604 } 617 605 } 618 606 619 - void matroxfb_g450_shutdown(WPMINFO2) { 607 + void matroxfb_g450_shutdown(struct matrox_fb_info *minfo) 608 + { 620 609 if (minfo->devflags.g450dac) { 621 610 down_write(&minfo->altout.lock); 622 611 minfo->outputs[1].src = MATROXFB_SRC_NONE;
+4 -4
drivers/video/matrox/matroxfb_g450.h
··· 4 4 #include "matroxfb_base.h" 5 5 6 6 #ifdef CONFIG_FB_MATROX_G 7 - void matroxfb_g450_connect(WPMINFO2); 8 - void matroxfb_g450_shutdown(WPMINFO2); 7 + void matroxfb_g450_connect(struct matrox_fb_info *minfo); 8 + void matroxfb_g450_shutdown(struct matrox_fb_info *minfo); 9 9 #else 10 - static inline void matroxfb_g450_connect(WPMINFO2) { }; 11 - static inline void matroxfb_g450_shutdown(WPMINFO2) { }; 10 + static inline void matroxfb_g450_connect(struct matrox_fb_info *minfo) { }; 11 + static inline void matroxfb_g450_shutdown(struct matrox_fb_info *minfo) { }; 12 12 #endif 13 13 14 14 #endif /* __MATROXFB_G450_H__ */
+49 -27
drivers/video/matrox/matroxfb_misc.c
··· 89 89 #include <linux/interrupt.h> 90 90 #include <linux/matroxfb.h> 91 91 92 - void matroxfb_DAC_out(CPMINFO int reg, int val) { 92 + void matroxfb_DAC_out(const struct matrox_fb_info *minfo, int reg, int val) 93 + { 93 94 DBG_REG(__func__) 94 95 mga_outb(M_RAMDAC_BASE+M_X_INDEX, reg); 95 96 mga_outb(M_RAMDAC_BASE+M_X_DATAREG, val); 96 97 } 97 98 98 - int matroxfb_DAC_in(CPMINFO int reg) { 99 + int matroxfb_DAC_in(const struct matrox_fb_info *minfo, int reg) 100 + { 99 101 DBG_REG(__func__) 100 102 mga_outb(M_RAMDAC_BASE+M_X_INDEX, reg); 101 103 return mga_inb(M_RAMDAC_BASE+M_X_DATAREG); ··· 186 184 return bestvco; 187 185 } 188 186 189 - int matroxfb_vgaHWinit(WPMINFO struct my_timming* m) { 187 + int matroxfb_vgaHWinit(struct matrox_fb_info *minfo, struct my_timming *m) 188 + { 190 189 unsigned int hd, hs, he, hbe, ht; 191 190 unsigned int vd, vs, ve, vt, lc; 192 191 unsigned int wd; ··· 334 331 return 0; 335 332 }; 336 333 337 - void matroxfb_vgaHWrestore(WPMINFO2) { 334 + void matroxfb_vgaHWrestore(struct matrox_fb_info *minfo) 335 + { 338 336 int i; 339 337 struct matrox_hw_state * const hw = &minfo->hw; 340 338 CRITFLAGS ··· 526 522 #endif 527 523 } 528 524 529 - static int parse_pins1(WPMINFO const struct matrox_bios* bd) { 525 + static int parse_pins1(struct matrox_fb_info *minfo, 526 + const struct matrox_bios *bd) 527 + { 530 528 unsigned int maxdac; 531 529 532 530 switch (bd->pins[22]) { ··· 548 542 return 0; 549 543 } 550 544 551 - static void default_pins1(WPMINFO2) { 545 + static void default_pins1(struct matrox_fb_info *minfo) 546 + { 552 547 /* Millennium */ 553 548 minfo->limits.pixel.vcomax = 220000; 554 549 minfo->values.pll.system = 50000; ··· 557 550 minfo->values.reg.mctlwtst = 0x00030101; 558 551 } 559 552 560 - static int parse_pins2(WPMINFO const struct matrox_bios* bd) { 553 + static int parse_pins2(struct matrox_fb_info *minfo, 554 + const struct matrox_bios *bd) 555 + { 561 556 minfo->limits.pixel.vcomax = 562 557 minfo->limits.system.vcomax = (bd->pins[41] == 0xFF) ? 230000 : ((bd->pins[41] + 100) * 1000); 563 558 minfo->values.reg.mctlwtst = ((bd->pins[51] & 0x01) ? 0x00000001 : 0) | ··· 571 562 return 0; 572 563 } 573 564 574 - static void default_pins2(WPMINFO2) { 565 + static void default_pins2(struct matrox_fb_info *minfo) 566 + { 575 567 /* Millennium II, Mystique */ 576 568 minfo->limits.pixel.vcomax = 577 569 minfo->limits.system.vcomax = 230000; ··· 581 571 minfo->features.pll.ref_freq = 14318; 582 572 } 583 573 584 - static int parse_pins3(WPMINFO const struct matrox_bios* bd) { 574 + static int parse_pins3(struct matrox_fb_info *minfo, 575 + const struct matrox_bios *bd) 576 + { 585 577 minfo->limits.pixel.vcomax = 586 578 minfo->limits.system.vcomax = (bd->pins[36] == 0xFF) ? 230000 : ((bd->pins[36] + 100) * 1000); 587 579 minfo->values.reg.mctlwtst = get_unaligned_le32(bd->pins + 48) == 0xFFFFFFFF ? ··· 599 587 return 0; 600 588 } 601 589 602 - static void default_pins3(WPMINFO2) { 590 + static void default_pins3(struct matrox_fb_info *minfo) 591 + { 603 592 /* G100, G200 */ 604 593 minfo->limits.pixel.vcomax = 605 594 minfo->limits.system.vcomax = 230000; ··· 611 598 minfo->features.pll.ref_freq = 27000; 612 599 } 613 600 614 - static int parse_pins4(WPMINFO const struct matrox_bios* bd) { 601 + static int parse_pins4(struct matrox_fb_info *minfo, 602 + const struct matrox_bios *bd) 603 + { 615 604 minfo->limits.pixel.vcomax = (bd->pins[ 39] == 0xFF) ? 230000 : bd->pins[ 39] * 4000; 616 605 minfo->limits.system.vcomax = (bd->pins[ 38] == 0xFF) ? minfo->limits.pixel.vcomax : bd->pins[ 38] * 4000; 617 606 minfo->values.reg.mctlwtst = get_unaligned_le32(bd->pins + 71); ··· 630 615 return 0; 631 616 } 632 617 633 - static void default_pins4(WPMINFO2) { 618 + static void default_pins4(struct matrox_fb_info *minfo) 619 + { 634 620 /* G400 */ 635 621 minfo->limits.pixel.vcomax = 636 622 minfo->limits.system.vcomax = 252000; ··· 643 627 minfo->features.pll.ref_freq = 27000; 644 628 } 645 629 646 - static int parse_pins5(WPMINFO const struct matrox_bios* bd) { 630 + static int parse_pins5(struct matrox_fb_info *minfo, 631 + const struct matrox_bios *bd) 632 + { 647 633 unsigned int mult; 648 634 649 635 mult = bd->pins[4]?8000:6000; ··· 680 662 return 0; 681 663 } 682 664 683 - static void default_pins5(WPMINFO2) { 665 + static void default_pins5(struct matrox_fb_info *minfo) 666 + { 684 667 /* Mine 16MB G450 with SDRAM DDR */ 685 668 minfo->limits.pixel.vcomax = 686 669 minfo->limits.system.vcomax = ··· 705 686 minfo->values.reg.maccess = 0x00004000; 706 687 } 707 688 708 - static int matroxfb_set_limits(WPMINFO const struct matrox_bios* bd) { 689 + static int matroxfb_set_limits(struct matrox_fb_info *minfo, 690 + const struct matrox_bios *bd) 691 + { 709 692 unsigned int pins_version; 710 693 static const unsigned int pinslen[] = { 64, 64, 64, 128, 128 }; 711 694 712 695 switch (minfo->chip) { 713 - case MGA_2064: default_pins1(PMINFO2); break; 696 + case MGA_2064: default_pins1(minfo); break; 714 697 case MGA_2164: 715 698 case MGA_1064: 716 - case MGA_1164: default_pins2(PMINFO2); break; 699 + case MGA_1164: default_pins2(minfo); break; 717 700 case MGA_G100: 718 - case MGA_G200: default_pins3(PMINFO2); break; 719 - case MGA_G400: default_pins4(PMINFO2); break; 701 + case MGA_G200: default_pins3(minfo); break; 702 + case MGA_G400: default_pins4(minfo); break; 720 703 case MGA_G450: 721 - case MGA_G550: default_pins5(PMINFO2); break; 704 + case MGA_G550: default_pins5(minfo); break; 722 705 } 723 706 if (!bd->bios_valid) { 724 707 printk(KERN_INFO "matroxfb: Your Matrox device does not have BIOS\n"); ··· 745 724 } 746 725 switch (pins_version) { 747 726 case 1: 748 - return parse_pins1(PMINFO bd); 727 + return parse_pins1(minfo, bd); 749 728 case 2: 750 - return parse_pins2(PMINFO bd); 729 + return parse_pins2(minfo, bd); 751 730 case 3: 752 - return parse_pins3(PMINFO bd); 731 + return parse_pins3(minfo, bd); 753 732 case 4: 754 - return parse_pins4(PMINFO bd); 733 + return parse_pins4(minfo, bd); 755 734 case 5: 756 - return parse_pins5(PMINFO bd); 735 + return parse_pins5(minfo, bd); 757 736 default: 758 737 printk(KERN_DEBUG "matroxfb: Powerup info version %u is not yet supported\n", pins_version); 759 738 return -1; 760 739 } 761 740 } 762 741 763 - void matroxfb_read_pins(WPMINFO2) { 742 + void matroxfb_read_pins(struct matrox_fb_info *minfo) 743 + { 764 744 u32 opt; 765 745 u32 biosbase; 766 746 u32 fbbase; ··· 797 775 } 798 776 } 799 777 #endif 800 - matroxfb_set_limits(PMINFO &minfo->bios); 778 + matroxfb_set_limits(minfo, &minfo->bios); 801 779 printk(KERN_INFO "PInS memtype = %u\n", 802 780 (minfo->values.reg.opt & 0x1C00) >> 10); 803 781 }
+8 -5
drivers/video/matrox/matroxfb_misc.h
··· 6 6 /* also for modules */ 7 7 int matroxfb_PLL_calcclock(const struct matrox_pll_features* pll, unsigned int freq, unsigned int fmax, 8 8 unsigned int* in, unsigned int* feed, unsigned int* post); 9 - static inline int PLL_calcclock(CPMINFO unsigned int freq, unsigned int fmax, 10 - unsigned int* in, unsigned int* feed, unsigned int* post) { 9 + static inline int PLL_calcclock(const struct matrox_fb_info *minfo, 10 + unsigned int freq, unsigned int fmax, 11 + unsigned int *in, unsigned int *feed, 12 + unsigned int *post) 13 + { 11 14 return matroxfb_PLL_calcclock(&minfo->features.pll, freq, fmax, in, feed, post); 12 15 } 13 16 14 - int matroxfb_vgaHWinit(WPMINFO struct my_timming* m); 15 - void matroxfb_vgaHWrestore(WPMINFO2); 16 - void matroxfb_read_pins(WPMINFO2); 17 + int matroxfb_vgaHWinit(struct matrox_fb_info *minfo, struct my_timming* m); 18 + void matroxfb_vgaHWrestore(struct matrox_fb_info *minfo); 19 + void matroxfb_read_pins(struct matrox_fb_info *minfo); 17 20 18 21 #endif /* __MATROXFB_MISC_H__ */