Commit bd969d05 authored by Jean Delvare's avatar Jean Delvare Committed by James Toy

With multihead support always enabled, these macros are no longer needed

and make the code harder to read.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Acked-by: default avatarPetr Vandrovec <vandrove@vc.cvut.cz>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f098310d
...@@ -30,7 +30,7 @@ static unsigned int g450_mnp2vco(CPMINFO unsigned int mnp) { ...@@ -30,7 +30,7 @@ static unsigned int g450_mnp2vco(CPMINFO unsigned int mnp) {
m = ((mnp >> 16) & 0x0FF) + 1; m = ((mnp >> 16) & 0x0FF) + 1;
n = ((mnp >> 7) & 0x1FE) + 4; n = ((mnp >> 7) & 0x1FE) + 4;
return (ACCESS_FBINFO(features).pll.ref_freq * n + (m >> 1)) / m; return (minfo->features.pll.ref_freq * n + (m >> 1)) / m;
} }
unsigned int g450_mnp2f(CPMINFO unsigned int mnp) { unsigned int g450_mnp2f(CPMINFO unsigned int mnp) {
...@@ -90,7 +90,7 @@ static unsigned int g450_nextpll(CPMINFO const struct matrox_pll_limits* pi, uns ...@@ -90,7 +90,7 @@ static unsigned int g450_nextpll(CPMINFO const struct matrox_pll_limits* pi, uns
} else { } else {
m--; m--;
} }
n = ((tvco * (m+1) + ACCESS_FBINFO(features).pll.ref_freq) / (ACCESS_FBINFO(features).pll.ref_freq * 2)) - 2; n = ((tvco * (m+1) + minfo->features.pll.ref_freq) / (minfo->features.pll.ref_freq * 2)) - 2;
} while (n < 0x03 || n > 0x7A); } while (n < 0x03 || n > 0x7A);
return (m << 16) | (n << 8) | p; return (m << 16) | (n << 8) | p;
} }
...@@ -333,7 +333,7 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll, ...@@ -333,7 +333,7 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll,
matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp); matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp);
/* DVI PLL preferred for frequencies up to /* DVI PLL preferred for frequencies up to
panel link max, standard PLL otherwise */ panel link max, standard PLL otherwise */
if (fout >= MINFO->max_pixel_clock_panellink) if (fout >= minfo->max_pixel_clock_panellink)
tmp = 0; tmp = 0;
else tmp = else tmp =
M1064_XDVICLKCTRL_DVIDATAPATHSEL | M1064_XDVICLKCTRL_DVIDATAPATHSEL |
...@@ -363,20 +363,20 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll, ...@@ -363,20 +363,20 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll,
} }
mga_outb(M_MISC_REG, misc); mga_outb(M_MISC_REG, misc);
} }
pi = &ACCESS_FBINFO(limits.pixel); pi = &minfo->limits.pixel;
ci = &ACCESS_FBINFO(cache.pixel); ci = &minfo->cache.pixel;
break; break;
case M_SYSTEM_PLL: case M_SYSTEM_PLL:
{ {
u_int32_t opt; u_int32_t opt;
pci_read_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, &opt); pci_read_config_dword(minfo->pcidev, PCI_OPTION_REG, &opt);
if (!(opt & 0x20)) { if (!(opt & 0x20)) {
pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, opt | 0x20); pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, opt | 0x20);
} }
} }
pi = &ACCESS_FBINFO(limits.system); pi = &minfo->limits.system;
ci = &ACCESS_FBINFO(cache.system); ci = &minfo->cache.system;
break; break;
case M_VIDEO_PLL: case M_VIDEO_PLL:
{ {
...@@ -395,8 +395,8 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll, ...@@ -395,8 +395,8 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll,
pixel_vco = g450_mnp2vco(PMINFO mnp); pixel_vco = g450_mnp2vco(PMINFO mnp);
matroxfb_DAC_unlock_irqrestore(flags); matroxfb_DAC_unlock_irqrestore(flags);
} }
pi = &ACCESS_FBINFO(limits.video); pi = &minfo->limits.video;
ci = &ACCESS_FBINFO(cache.video); ci = &minfo->cache.video;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -475,7 +475,7 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll, ...@@ -475,7 +475,7 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll,
mnp = g450_findworkingpll(PMINFO pll, mnparray, mnpcount); mnp = g450_findworkingpll(PMINFO pll, mnparray, mnpcount);
g450_addcache(ci, mnparray[0], mnp); g450_addcache(ci, mnparray[0], mnp);
} }
updatehwstate_clk(&ACCESS_FBINFO(hw), mnp, pll); updatehwstate_clk(&minfo->hw, mnp, pll);
matroxfb_DAC_unlock_irqrestore(flags); matroxfb_DAC_unlock_irqrestore(flags);
return mnp; return mnp;
} }
......
...@@ -112,7 +112,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo, ...@@ -112,7 +112,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo,
i2c_set_adapdata(&b->adapter, b); i2c_set_adapdata(&b->adapter, b);
b->adapter.class = class; b->adapter.class = class;
b->adapter.algo_data = &b->bac; b->adapter.algo_data = &b->bac;
b->adapter.dev.parent = &ACCESS_FBINFO(pcidev)->dev; b->adapter.dev.parent = &minfo->pcidev->dev;
b->bac = matrox_i2c_algo_template; b->bac = matrox_i2c_algo_template;
b->bac.data = b; b->bac.data = b;
err = i2c_bit_add_bus(&b->adapter); err = i2c_bit_add_bus(&b->adapter);
...@@ -153,7 +153,7 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) { ...@@ -153,7 +153,7 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
matroxfb_DAC_out(PMINFO DAC_XGENIOCTRL, 0x00); matroxfb_DAC_out(PMINFO DAC_XGENIOCTRL, 0x00);
matroxfb_DAC_unlock_irqrestore(flags); matroxfb_DAC_unlock_irqrestore(flags);
switch (ACCESS_FBINFO(chip)) { switch (minfo->chip) {
case MGA_2064: case MGA_2064:
case MGA_2164: case MGA_2164:
err = i2c_bus_reg(&m2info->ddc1, minfo, err = i2c_bus_reg(&m2info->ddc1, minfo,
...@@ -168,7 +168,7 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) { ...@@ -168,7 +168,7 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
} }
if (err) if (err)
goto fail_ddc1; goto fail_ddc1;
if (ACCESS_FBINFO(devflags.dualhead)) { if (minfo->devflags.dualhead) {
err = i2c_bus_reg(&m2info->ddc2, minfo, err = i2c_bus_reg(&m2info->ddc2, minfo,
DDC2_DATA, DDC2_CLK, DDC2_DATA, DDC2_CLK,
"DDC:fb%u #1", I2C_CLASS_DDC); "DDC:fb%u #1", I2C_CLASS_DDC);
......
This diff is collapsed.
...@@ -295,11 +295,11 @@ static int Ti3026_calcclock(CPMINFO unsigned int freq, unsigned int fmax, int* i ...@@ -295,11 +295,11 @@ static int Ti3026_calcclock(CPMINFO unsigned int freq, unsigned int fmax, int* i
static int Ti3026_setpclk(WPMINFO int clk) { static int Ti3026_setpclk(WPMINFO int clk) {
unsigned int f_pll; unsigned int f_pll;
unsigned int pixfeed, pixin, pixpost; unsigned int pixfeed, pixin, pixpost;
struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); struct matrox_hw_state *hw = &minfo->hw;
DBG(__func__) DBG(__func__)
f_pll = Ti3026_calcclock(PMINFO clk, ACCESS_FBINFO(max_pixel_clock), &pixin, &pixfeed, &pixpost); f_pll = Ti3026_calcclock(PMINFO clk, minfo->max_pixel_clock, &pixin, &pixfeed, &pixpost);
hw->DACclk[0] = pixin | 0xC0; hw->DACclk[0] = pixin | 0xC0;
hw->DACclk[1] = pixfeed; hw->DACclk[1] = pixfeed;
...@@ -309,9 +309,9 @@ static int Ti3026_setpclk(WPMINFO int clk) { ...@@ -309,9 +309,9 @@ static int Ti3026_setpclk(WPMINFO int clk) {
unsigned int loopfeed, loopin, looppost, loopdiv, z; unsigned int loopfeed, loopin, looppost, loopdiv, z;
unsigned int Bpp; unsigned int Bpp;
Bpp = ACCESS_FBINFO(curr.final_bppShift); Bpp = minfo->curr.final_bppShift;
if (ACCESS_FBINFO(fbcon).var.bits_per_pixel == 24) { if (minfo->fbcon.var.bits_per_pixel == 24) {
loopfeed = 3; /* set lm to any possible value */ loopfeed = 3; /* set lm to any possible value */
loopin = 3 * 32 / Bpp; loopin = 3 * 32 / Bpp;
} else { } else {
...@@ -330,18 +330,18 @@ static int Ti3026_setpclk(WPMINFO int clk) { ...@@ -330,18 +330,18 @@ static int Ti3026_setpclk(WPMINFO int clk) {
looppost = 3; looppost = 3;
loopdiv = z/16; loopdiv = z/16;
} }
if (ACCESS_FBINFO(fbcon).var.bits_per_pixel == 24) { if (minfo->fbcon.var.bits_per_pixel == 24) {
hw->DACclk[3] = ((65 - loopin) & 0x3F) | 0xC0; hw->DACclk[3] = ((65 - loopin) & 0x3F) | 0xC0;
hw->DACclk[4] = (65 - loopfeed) | 0x80; hw->DACclk[4] = (65 - loopfeed) | 0x80;
if (ACCESS_FBINFO(accel.ramdac_rev) > 0x20) { if (minfo->accel.ramdac_rev > 0x20) {
if (isInterleave(MINFO)) if (isInterleave(minfo))
hw->DACreg[POS3026_XLATCHCTRL] = TVP3026B_XLATCHCTRL_8_3; hw->DACreg[POS3026_XLATCHCTRL] = TVP3026B_XLATCHCTRL_8_3;
else { else {
hw->DACclk[4] &= ~0xC0; hw->DACclk[4] &= ~0xC0;
hw->DACreg[POS3026_XLATCHCTRL] = TVP3026B_XLATCHCTRL_4_3; hw->DACreg[POS3026_XLATCHCTRL] = TVP3026B_XLATCHCTRL_4_3;
} }
} else { } else {
if (isInterleave(MINFO)) if (isInterleave(minfo))
; /* default... */ ; /* default... */
else { else {
hw->DACclk[4] ^= 0xC0; /* change from 0x80 to 0x40 */ hw->DACclk[4] ^= 0xC0; /* change from 0x80 to 0x40 */
...@@ -349,7 +349,7 @@ static int Ti3026_setpclk(WPMINFO int clk) { ...@@ -349,7 +349,7 @@ static int Ti3026_setpclk(WPMINFO int clk) {
} }
} }
hw->DACclk[5] = looppost | 0xF8; hw->DACclk[5] = looppost | 0xF8;
if (ACCESS_FBINFO(devflags.mga_24bpp_fix)) if (minfo->devflags.mga_24bpp_fix)
hw->DACclk[5] ^= 0x40; hw->DACclk[5] ^= 0x40;
} else { } else {
hw->DACclk[3] = ((65 - loopin) & 0x3F) | 0xC0; hw->DACclk[3] = ((65 - loopin) & 0x3F) | 0xC0;
...@@ -362,13 +362,13 @@ static int Ti3026_setpclk(WPMINFO int clk) { ...@@ -362,13 +362,13 @@ static int Ti3026_setpclk(WPMINFO int clk) {
} }
static int Ti3026_init(WPMINFO struct my_timming* m) { static int Ti3026_init(WPMINFO struct my_timming* m) {
u_int8_t muxctrl = isInterleave(MINFO) ? TVP3026_XMUXCTRL_MEMORY_64BIT : TVP3026_XMUXCTRL_MEMORY_32BIT; u_int8_t muxctrl = isInterleave(minfo) ? TVP3026_XMUXCTRL_MEMORY_64BIT : TVP3026_XMUXCTRL_MEMORY_32BIT;
struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); struct matrox_hw_state *hw = &minfo->hw;
DBG(__func__) DBG(__func__)
memcpy(hw->DACreg, MGADACbpp32, sizeof(hw->DACreg)); memcpy(hw->DACreg, MGADACbpp32, sizeof(hw->DACreg));
switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { switch (minfo->fbcon.var.bits_per_pixel) {
case 4: hw->DACreg[POS3026_XLATCHCTRL] = TVP3026_XLATCHCTRL_16_1; /* or _8_1, they are same */ case 4: hw->DACreg[POS3026_XLATCHCTRL] = TVP3026_XLATCHCTRL_16_1; /* or _8_1, they are same */
hw->DACreg[POS3026_XTRUECOLORCTRL] = TVP3026_XTRUECOLORCTRL_PSEUDOCOLOR; hw->DACreg[POS3026_XTRUECOLORCTRL] = TVP3026_XTRUECOLORCTRL_PSEUDOCOLOR;
hw->DACreg[POS3026_XMUXCTRL] = muxctrl | TVP3026_XMUXCTRL_PIXEL_4BIT; hw->DACreg[POS3026_XMUXCTRL] = muxctrl | TVP3026_XMUXCTRL_PIXEL_4BIT;
...@@ -383,7 +383,7 @@ static int Ti3026_init(WPMINFO struct my_timming* m) { ...@@ -383,7 +383,7 @@ static int Ti3026_init(WPMINFO struct my_timming* m) {
break; break;
case 16: case 16:
/* XLATCHCTRL should be _4_1 / _2_1... Why is not? (_2_1 is used everytime) */ /* XLATCHCTRL should be _4_1 / _2_1... Why is not? (_2_1 is used everytime) */
hw->DACreg[POS3026_XTRUECOLORCTRL] = (ACCESS_FBINFO(fbcon).var.green.length == 5)? (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_ORGB_1555 ) : (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_RGB_565); hw->DACreg[POS3026_XTRUECOLORCTRL] = (minfo->fbcon.var.green.length == 5) ? (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_ORGB_1555) : (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_RGB_565);
hw->DACreg[POS3026_XMUXCTRL] = muxctrl | TVP3026_XMUXCTRL_PIXEL_16BIT; hw->DACreg[POS3026_XMUXCTRL] = muxctrl | TVP3026_XMUXCTRL_PIXEL_16BIT;
hw->DACreg[POS3026_XCLKCTRL] = TVP3026_XCLKCTRL_SRC_PLL | TVP3026_XCLKCTRL_DIV2; hw->DACreg[POS3026_XCLKCTRL] = TVP3026_XCLKCTRL_SRC_PLL | TVP3026_XCLKCTRL_DIV2;
break; break;
...@@ -412,9 +412,9 @@ static int Ti3026_init(WPMINFO struct my_timming* m) { ...@@ -412,9 +412,9 @@ static int Ti3026_init(WPMINFO struct my_timming* m) {
hw->DACreg[POS3026_XGENCTRL] |= TVP3026_XGENCTRL_SYNC_ON_GREEN; hw->DACreg[POS3026_XGENCTRL] |= TVP3026_XGENCTRL_SYNC_ON_GREEN;
/* set DELAY */ /* set DELAY */
if (ACCESS_FBINFO(video.len) < 0x400000) if (minfo->video.len < 0x400000)
hw->CRTCEXT[3] |= 0x08; hw->CRTCEXT[3] |= 0x08;
else if (ACCESS_FBINFO(video.len) > 0x400000) else if (minfo->video.len > 0x400000)
hw->CRTCEXT[3] |= 0x10; hw->CRTCEXT[3] |= 0x10;
/* set HWCURSOR */ /* set HWCURSOR */
...@@ -426,7 +426,7 @@ static int Ti3026_init(WPMINFO struct my_timming* m) { ...@@ -426,7 +426,7 @@ static int Ti3026_init(WPMINFO struct my_timming* m) {
/* set interleaving */ /* set interleaving */
hw->MXoptionReg &= ~0x00001000; hw->MXoptionReg &= ~0x00001000;
if (isInterleave(MINFO)) hw->MXoptionReg |= 0x00001000; if (isInterleave(minfo)) hw->MXoptionReg |= 0x00001000;
/* set DAC */ /* set DAC */
Ti3026_setpclk(PMINFO m->pixclock); Ti3026_setpclk(PMINFO m->pixclock);
...@@ -442,7 +442,7 @@ static void ti3026_setMCLK(WPMINFO int fout){ ...@@ -442,7 +442,7 @@ static void ti3026_setMCLK(WPMINFO int fout){
DBG(__func__) DBG(__func__)
f_pll = Ti3026_calcclock(PMINFO fout, ACCESS_FBINFO(max_pixel_clock), &mclk_n, &mclk_m, &mclk_p); f_pll = Ti3026_calcclock(PMINFO fout, minfo->max_pixel_clock, &mclk_n, &mclk_m, &mclk_p);
/* save pclk */ /* save pclk */
outTi3026(PMINFO TVP3026_XPLLADDR, 0xFC); outTi3026(PMINFO TVP3026_XPLLADDR, 0xFC);
...@@ -496,7 +496,7 @@ static void ti3026_setMCLK(WPMINFO int fout){ ...@@ -496,7 +496,7 @@ static void ti3026_setMCLK(WPMINFO int fout){
printk(KERN_ERR "matroxfb: Memory PLL not locked after 5 secs\n"); printk(KERN_ERR "matroxfb: Memory PLL not locked after 5 secs\n");
f_pll = f_pll * 333 / (10000 << mclk_p); f_pll = f_pll * 333 / (10000 << mclk_p);
if (isMilleniumII(MINFO)) { if (isMilleniumII(minfo)) {
rfhcnt = (f_pll - 128) / 256; rfhcnt = (f_pll - 128) / 256;
if (rfhcnt > 15) if (rfhcnt > 15)
rfhcnt = 15; rfhcnt = 15;
...@@ -505,8 +505,8 @@ static void ti3026_setMCLK(WPMINFO int fout){ ...@@ -505,8 +505,8 @@ static void ti3026_setMCLK(WPMINFO int fout){
if (rfhcnt > 15) if (rfhcnt > 15)
rfhcnt = 0; rfhcnt = 0;
} }
ACCESS_FBINFO(hw).MXoptionReg = (ACCESS_FBINFO(hw).MXoptionReg & ~0x000F0000) | (rfhcnt << 16); minfo->hw.MXoptionReg = (minfo->hw.MXoptionReg & ~0x000F0000) | (rfhcnt << 16);
pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, ACCESS_FBINFO(hw).MXoptionReg); pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, minfo->hw.MXoptionReg);
/* output MCLK to MCLK pin */ /* output MCLK to MCLK pin */
outTi3026(PMINFO TVP3026_XMEMPLLCTRL, (mclk_ctl & 0xE7) | TVP3026_XMEMPLLCTRL_MCLK_MCLKPLL); outTi3026(PMINFO TVP3026_XMEMPLLCTRL, (mclk_ctl & 0xE7) | TVP3026_XMEMPLLCTRL_MCLK_MCLKPLL);
...@@ -536,14 +536,14 @@ static void ti3026_ramdac_init(WPMINFO2) { ...@@ -536,14 +536,14 @@ static void ti3026_ramdac_init(WPMINFO2) {
DBG(__func__) DBG(__func__)
ACCESS_FBINFO(features.pll.vco_freq_min) = 110000; minfo->features.pll.vco_freq_min = 110000;
ACCESS_FBINFO(features.pll.ref_freq) = 114545; minfo->features.pll.ref_freq = 114545;
ACCESS_FBINFO(features.pll.feed_div_min) = 2; minfo->features.pll.feed_div_min = 2;
ACCESS_FBINFO(features.pll.feed_div_max) = 24; minfo->features.pll.feed_div_max = 24;
ACCESS_FBINFO(features.pll.in_div_min) = 2; minfo->features.pll.in_div_min = 2;
ACCESS_FBINFO(features.pll.in_div_max) = 63; minfo->features.pll.in_div_max = 63;
ACCESS_FBINFO(features.pll.post_shift_max) = 3; minfo->features.pll.post_shift_max = 3;
if (ACCESS_FBINFO(devflags.noinit)) if (minfo->devflags.noinit)
return; return;
ti3026_setMCLK(PMINFO 60000); ti3026_setMCLK(PMINFO 60000);
} }
...@@ -551,7 +551,7 @@ static void ti3026_ramdac_init(WPMINFO2) { ...@@ -551,7 +551,7 @@ static void ti3026_ramdac_init(WPMINFO2) {
static void Ti3026_restore(WPMINFO2) { static void Ti3026_restore(WPMINFO2) {
int i; int i;
unsigned char progdac[6]; unsigned char progdac[6];
struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); struct matrox_hw_state *hw = &minfo->hw;
CRITFLAGS CRITFLAGS
DBG(__func__) DBG(__func__)
...@@ -565,7 +565,7 @@ static void Ti3026_restore(WPMINFO2) { ...@@ -565,7 +565,7 @@ static void Ti3026_restore(WPMINFO2) {
CRITBEGIN CRITBEGIN
pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg);
CRITEND CRITEND
...@@ -573,7 +573,7 @@ static void Ti3026_restore(WPMINFO2) { ...@@ -573,7 +573,7 @@ static void Ti3026_restore(WPMINFO2) {
CRITBEGIN CRITBEGIN
ACCESS_FBINFO(crtc1.panpos) = -1; minfo->crtc1.panpos = -1;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]); mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]);
...@@ -678,35 +678,35 @@ static int Ti3026_preinit(WPMINFO2) { ...@@ -678,35 +678,35 @@ static int Ti3026_preinit(WPMINFO2) {
static const int vxres_mill1[] = { 640, 768, 800, 960, static const int vxres_mill1[] = { 640, 768, 800, 960,
1024, 1152, 1280, 1600, 1920, 1024, 1152, 1280, 1600, 1920,
2048, 0}; 2048, 0};
struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); struct matrox_hw_state *hw = &minfo->hw;
DBG(__func__) DBG(__func__)
ACCESS_FBINFO(millenium) = 1; minfo->millenium = 1;
ACCESS_FBINFO(milleniumII) = (ACCESS_FBINFO(pcidev)->device != PCI_DEVICE_ID_MATROX_MIL); minfo->milleniumII = (minfo->pcidev->device != PCI_DEVICE_ID_MATROX_MIL);
ACCESS_FBINFO(capable.cfb4) = 1; minfo->capable.cfb4 = 1;
ACCESS_FBINFO(capable.text) = 1; /* isMilleniumII(MINFO); */ minfo->capable.text = 1; /* isMilleniumII(minfo); */
ACCESS_FBINFO(capable.vxres) = isMilleniumII(MINFO)?vxres_mill2:vxres_mill1; minfo->capable.vxres = isMilleniumII(minfo) ? vxres_mill2 : vxres_mill1;
ACCESS_FBINFO(outputs[0]).data = MINFO; minfo->outputs[0].data = minfo;
ACCESS_FBINFO(outputs[0]).output = &ti3026_output; minfo->outputs[0].output = &ti3026_output;
ACCESS_FBINFO(outputs[0]).src = ACCESS_FBINFO(outputs[0]).default_src; minfo->outputs[0].src = minfo->outputs[0].default_src;
ACCESS_FBINFO(outputs[0]).mode = MATROXFB_OUTPUT_MODE_MONITOR; minfo->outputs[0].mode = MATROXFB_OUTPUT_MODE_MONITOR;
if (ACCESS_FBINFO(devflags.noinit)) if (minfo->devflags.noinit)
return 0; return 0;
/* preserve VGA I/O, BIOS and PPC */ /* preserve VGA I/O, BIOS and PPC */
hw->MXoptionReg &= 0xC0000100; hw->MXoptionReg &= 0xC0000100;
hw->MXoptionReg |= 0x002C0000; hw->MXoptionReg |= 0x002C0000;
if (ACCESS_FBINFO(devflags.novga)) if (minfo->devflags.novga)
hw->MXoptionReg &= ~0x00000100; hw->MXoptionReg &= ~0x00000100;
if (ACCESS_FBINFO(devflags.nobios)) if (minfo->devflags.nobios)
hw->MXoptionReg &= ~0x40000000; hw->MXoptionReg &= ~0x40000000;
if (ACCESS_FBINFO(devflags.nopciretry)) if (minfo->devflags.nopciretry)
hw->MXoptionReg |= 0x20000000; hw->MXoptionReg |= 0x20000000;
pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, hw->MXoptionReg);
ACCESS_FBINFO(accel.ramdac_rev) = inTi3026(PMINFO TVP3026_XSILICONREV); minfo->accel.ramdac_rev = inTi3026(PMINFO TVP3026_XSILICONREV);
outTi3026(PMINFO TVP3026_XCLKCTRL, TVP3026_XCLKCTRL_SRC_CLK0VGA | TVP3026_XCLKCTRL_CLKSTOPPED); outTi3026(PMINFO TVP3026_XCLKCTRL, TVP3026_XCLKCTRL_SRC_CLK0VGA | TVP3026_XCLKCTRL_CLKSTOPPED);
outTi3026(PMINFO TVP3026_XTRUECOLORCTRL, TVP3026_XTRUECOLORCTRL_PSEUDOCOLOR); outTi3026(PMINFO TVP3026_XTRUECOLORCTRL, TVP3026_XTRUECOLORCTRL_PSEUDOCOLOR);
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
#include "matroxfb_Ti3026.h" #include "matroxfb_Ti3026.h"
#include "matroxfb_misc.h" #include "matroxfb_misc.h"
#define curr_ydstorg(x) ACCESS_FBINFO2(x, curr.ydstorg.pixels) #define curr_ydstorg(x) ((x)->curr.ydstorg.pixels)
#define mga_ydstlen(y,l) mga_outl(M_YDSTLEN | M_EXEC, ((y) << 16) | (l)) #define mga_ydstlen(y,l) mga_outl(M_YDSTLEN | M_EXEC, ((y) << 16) | (l))
...@@ -115,59 +115,59 @@ void matrox_cfbX_init(WPMINFO2) { ...@@ -115,59 +115,59 @@ void matrox_cfbX_init(WPMINFO2) {
DBG(__func__) DBG(__func__)
mpitch = ACCESS_FBINFO(fbcon).var.xres_virtual; mpitch = minfo->fbcon.var.xres_virtual;
ACCESS_FBINFO(fbops).fb_copyarea = cfb_copyarea; minfo->fbops.fb_copyarea = cfb_copyarea;
ACCESS_FBINFO(fbops).fb_fillrect = cfb_fillrect; minfo->fbops.fb_fillrect = cfb_fillrect;
ACCESS_FBINFO(fbops).fb_imageblit = cfb_imageblit; minfo->fbops.fb_imageblit = cfb_imageblit;
ACCESS_FBINFO(fbops).fb_cursor = NULL; minfo->fbops.fb_cursor = NULL;
accel = (ACCESS_FBINFO(fbcon).var.accel_flags & FB_ACCELF_TEXT) == FB_ACCELF_TEXT; accel = (minfo->fbcon.var.accel_flags & FB_ACCELF_TEXT) == FB_ACCELF_TEXT;
switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { switch (minfo->fbcon.var.bits_per_pixel) {
case 4: maccess = 0x00000000; /* accelerate as 8bpp video */ case 4: maccess = 0x00000000; /* accelerate as 8bpp video */
mpitch = (mpitch >> 1) | 0x8000; /* disable linearization */ mpitch = (mpitch >> 1) | 0x8000; /* disable linearization */
mopmode = M_OPMODE_4BPP; mopmode = M_OPMODE_4BPP;
matrox_cfb4_pal(ACCESS_FBINFO(cmap)); matrox_cfb4_pal(minfo->cmap);
if (accel && !(mpitch & 1)) { if (accel && !(mpitch & 1)) {
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_cfb4_copyarea; minfo->fbops.fb_copyarea = matroxfb_cfb4_copyarea;
ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_cfb4_fillrect; minfo->fbops.fb_fillrect = matroxfb_cfb4_fillrect;
} }
break; break;
case 8: maccess = 0x00000000; case 8: maccess = 0x00000000;
mopmode = M_OPMODE_8BPP; mopmode = M_OPMODE_8BPP;
matrox_cfb8_pal(ACCESS_FBINFO(cmap)); matrox_cfb8_pal(minfo->cmap);
if (accel) { if (accel) {
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; minfo->fbops.fb_copyarea = matroxfb_copyarea;
ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; minfo->fbops.fb_fillrect = matroxfb_fillrect;
ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit; minfo->fbops.fb_imageblit = matroxfb_imageblit;
} }
break; break;
case 16: if (ACCESS_FBINFO(fbcon).var.green.length == 5) case 16: if (minfo->fbcon.var.green.length == 5)
maccess = 0xC0000001; maccess = 0xC0000001;
else else
maccess = 0x40000001; maccess = 0x40000001;
mopmode = M_OPMODE_16BPP; mopmode = M_OPMODE_16BPP;
if (accel) { if (accel) {
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; minfo->fbops.fb_copyarea = matroxfb_copyarea;
ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; minfo->fbops.fb_fillrect = matroxfb_fillrect;
ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit; minfo->fbops.fb_imageblit = matroxfb_imageblit;
} }
break; break;
case 24: maccess = 0x00000003; case 24: maccess = 0x00000003;
mopmode = M_OPMODE_24BPP; mopmode = M_OPMODE_24BPP;
if (accel) { if (accel) {
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; minfo->fbops.fb_copyarea = matroxfb_copyarea;
ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; minfo->fbops.fb_fillrect = matroxfb_fillrect;
ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit; minfo->fbops.fb_imageblit = matroxfb_imageblit;
} }
break; break;
case 32: maccess = 0x00000002; case 32: maccess = 0x00000002;
mopmode = M_OPMODE_32BPP; mopmode = M_OPMODE_32BPP;
if (accel) { if (accel) {
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; minfo->fbops.fb_copyarea = matroxfb_copyarea;
ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; minfo->fbops.fb_fillrect = matroxfb_fillrect;
ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit; minfo->fbops.fb_imageblit = matroxfb_imageblit;
} }
break; break;
default: maccess = 0x00000000; default: maccess = 0x00000000;
...@@ -176,10 +176,10 @@ void matrox_cfbX_init(WPMINFO2) { ...@@ -176,10 +176,10 @@ void matrox_cfbX_init(WPMINFO2) {
} }
mga_fifo(8); mga_fifo(8);
mga_outl(M_PITCH, mpitch); mga_outl(M_PITCH, mpitch);
mga_outl(M_YDSTORG, curr_ydstorg(MINFO)); mga_outl(M_YDSTORG, curr_ydstorg(minfo));
if (ACCESS_FBINFO(capable.plnwt)) if (minfo->capable.plnwt)
mga_outl(M_PLNWT, -1); mga_outl(M_PLNWT, -1);
if (ACCESS_FBINFO(capable.srcorg)) { if (minfo->capable.srcorg) {
mga_outl(M_SRCORG, 0); mga_outl(M_SRCORG, 0);
mga_outl(M_DSTORG, 0); mga_outl(M_DSTORG, 0);
} }
...@@ -188,9 +188,9 @@ void matrox_cfbX_init(WPMINFO2) { ...@@ -188,9 +188,9 @@ void matrox_cfbX_init(WPMINFO2) {
mga_outl(M_YTOP, 0); mga_outl(M_YTOP, 0);
mga_outl(M_YBOT, 0x01FFFFFF); mga_outl(M_YBOT, 0x01FFFFFF);
mga_outl(M_MACCESS, maccess); mga_outl(M_MACCESS, maccess);
ACCESS_FBINFO(accel.m_dwg_rect) = M_DWG_TRAP | M_DWG_SOLID | M_DWG_ARZERO | M_DWG_SGNZERO | M_DWG_SHIFTZERO; minfo->accel.m_dwg_rect = M_DWG_TRAP | M_DWG_SOLID | M_DWG_ARZERO | M_DWG_SGNZERO | M_DWG_SHIFTZERO;
if (isMilleniumII(MINFO)) ACCESS_FBINFO(accel.m_dwg_rect) |= M_DWG_TRANSC; if (isMilleniumII(minfo)) minfo->accel.m_dwg_rect |= M_DWG_TRANSC;
ACCESS_FBINFO(accel.m_opmode) = mopmode; minfo->accel.m_opmode = mopmode;
} }
EXPORT_SYMBOL(matrox_cfbX_init); EXPORT_SYMBOL(matrox_cfbX_init);
...@@ -209,7 +209,7 @@ static void matrox_accel_bmove(WPMINFO int vxres, int sy, int sx, int dy, int dx ...@@ -209,7 +209,7 @@ static void matrox_accel_bmove(WPMINFO int vxres, int sy, int sx, int dy, int dx
M_DWG_BFCOL | M_DWG_REPLACE); M_DWG_BFCOL | M_DWG_REPLACE);
mga_outl(M_AR5, vxres); mga_outl(M_AR5, vxres);
width--; width--;
start = sy*vxres+sx+curr_ydstorg(MINFO); start = sy*vxres+sx+curr_ydstorg(minfo);
end = start+width; end = start+width;
} else { } else {
mga_fifo(3); mga_fifo(3);
...@@ -217,7 +217,7 @@ static void matrox_accel_bmove(WPMINFO int vxres, int sy, int sx, int dy, int dx ...@@ -217,7 +217,7 @@ static void matrox_accel_bmove(WPMINFO int vxres, int sy, int sx, int dy, int dx
mga_outl(M_SGN, 5); mga_outl(M_SGN, 5);
mga_outl(M_AR5, -vxres); mga_outl(M_AR5, -vxres);
width--; width--;
end = (sy+height-1)*vxres+sx+curr_ydstorg(MINFO); end = (sy+height-1)*vxres+sx+curr_ydstorg(minfo);
start = end+width; start = end+width;
dy += height-1; dy += height-1;
} }
...@@ -245,7 +245,7 @@ static void matrox_accel_bmove_lin(WPMINFO int vxres, int sy, int sx, int dy, in ...@@ -245,7 +245,7 @@ static void matrox_accel_bmove_lin(WPMINFO int vxres, int sy, int sx, int dy, in
M_DWG_BFCOL | M_DWG_REPLACE); M_DWG_BFCOL | M_DWG_REPLACE);
mga_outl(M_AR5, vxres); mga_outl(M_AR5, vxres);
width--; width--;
start = sy*vxres+sx+curr_ydstorg(MINFO); start = sy*vxres+sx+curr_ydstorg(minfo);
end = start+width; end = start+width;
} else { } else {
mga_fifo(3); mga_fifo(3);
...@@ -253,7 +253,7 @@ static void matrox_accel_bmove_lin(WPMINFO int vxres, int sy, int sx, int dy, in ...@@ -253,7 +253,7 @@ static void matrox_accel_bmove_lin(WPMINFO int vxres, int sy, int sx, int dy, in
mga_outl(M_SGN, 5); mga_outl(M_SGN, 5);
mga_outl(M_AR5, -vxres); mga_outl(M_AR5, -vxres);
width--; width--;
end = (sy+height-1)*vxres+sx+curr_ydstorg(MINFO); end = (sy+height-1)*vxres+sx+curr_ydstorg(minfo);
start = end+width; start = end+width;
dy += height-1; dy += height-1;
} }
...@@ -274,13 +274,13 @@ static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyare ...@@ -274,13 +274,13 @@ static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyare
if ((area->sx | area->dx | area->width) & 1) if ((area->sx | area->dx | area->width) & 1)
cfb_copyarea(info, area); cfb_copyarea(info, area);
else else
matrox_accel_bmove_lin(PMINFO ACCESS_FBINFO(fbcon.var.xres_virtual) >> 1, area->sy, area->sx >> 1, area->dy, area->dx >> 1, area->height, area->width >> 1); 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);
} }
static void matroxfb_copyarea(struct fb_info* info, const struct fb_copyarea* area) { static void matroxfb_copyarea(struct fb_info* info, const struct fb_copyarea* area) {
MINFO_FROM_INFO(info); MINFO_FROM_INFO(info);
matrox_accel_bmove(PMINFO ACCESS_FBINFO(fbcon.var.xres_virtual), area->sy, area->sx, area->dy, area->dx, area->height, area->width); matrox_accel_bmove(PMINFO minfo->fbcon.var.xres_virtual, area->sy, area->sx, area->dy, area->dx, area->height, area->width);
} }
static void matroxfb_accel_clear(WPMINFO u_int32_t color, int sy, int sx, int height, static void matroxfb_accel_clear(WPMINFO u_int32_t color, int sy, int sx, int height,
...@@ -292,7 +292,7 @@ static void matroxfb_accel_clear(WPMINFO u_int32_t color, int sy, int sx, int he ...@@ -292,7 +292,7 @@ static void matroxfb_accel_clear(WPMINFO u_int32_t color, int sy, int sx, int he
CRITBEGIN CRITBEGIN
mga_fifo(5); mga_fifo(5);
mga_outl(M_DWGCTL, ACCESS_FBINFO(accel.m_dwg_rect) | M_DWG_REPLACE); mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE);
mga_outl(M_FCOL, color); mga_outl(M_FCOL, color);
mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx);
mga_ydstlen(sy, height); mga_ydstlen(sy, height);
...@@ -333,16 +333,16 @@ static void matroxfb_cfb4_clear(WPMINFO u_int32_t bgx, int sy, int sx, int heigh ...@@ -333,16 +333,16 @@ static void matroxfb_cfb4_clear(WPMINFO u_int32_t bgx, int sy, int sx, int heigh
sx >>= 1; sx >>= 1;
if (width) { if (width) {
mga_fifo(5); mga_fifo(5);
mga_outl(M_DWGCTL, ACCESS_FBINFO(accel.m_dwg_rect) | M_DWG_REPLACE2); mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE2);
mga_outl(M_FCOL, bgx); mga_outl(M_FCOL, bgx);
mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx);
mga_outl(M_YDST, sy * ACCESS_FBINFO(fbcon).var.xres_virtual >> 6); mga_outl(M_YDST, sy * minfo->fbcon.var.xres_virtual >> 6);
mga_outl(M_LEN | M_EXEC, height); mga_outl(M_LEN | M_EXEC, height);
WaitTillIdle(); WaitTillIdle();
} }
if (whattodo) { if (whattodo) {
u_int32_t step = ACCESS_FBINFO(fbcon).var.xres_virtual >> 1; u_int32_t step = minfo->fbcon.var.xres_virtual >> 1;
vaddr_t vbase = ACCESS_FBINFO(video.vbase); vaddr_t vbase = minfo->video.vbase;
if (whattodo & 1) { if (whattodo & 1) {
unsigned int uaddr = sy * step + sx - 1; unsigned int uaddr = sy * step + sx - 1;
u_int32_t loop; u_int32_t loop;
...@@ -412,7 +412,7 @@ static void matroxfb_1bpp_imageblit(WPMINFO u_int32_t fgx, u_int32_t bgx, ...@@ -412,7 +412,7 @@ static void matroxfb_1bpp_imageblit(WPMINFO u_int32_t fgx, u_int32_t bgx,
mga_outl(M_FCOL, fgx); mga_outl(M_FCOL, fgx);
mga_outl(M_BCOL, bgx); mga_outl(M_BCOL, bgx);
fxbndry = ((xx + width - 1) << 16) | xx; fxbndry = ((xx + width - 1) << 16) | xx;
mmio = ACCESS_FBINFO(mmio.vbase); mmio = minfo->mmio.vbase;
mga_fifo(6); mga_fifo(6);
mga_writel(mmio, M_FXBNDRY, fxbndry); mga_writel(mmio, M_FXBNDRY, fxbndry);
......
This diff is collapsed.
...@@ -524,11 +524,6 @@ struct matrox_fb_info { ...@@ -524,11 +524,6 @@ struct matrox_fb_info {
#define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon) #define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon)
#define ACCESS_FBINFO2(info, x) (info->x)
#define ACCESS_FBINFO(x) ACCESS_FBINFO2(minfo,x)
#define MINFO minfo
#define WPMINFO2 struct matrox_fb_info* minfo #define WPMINFO2 struct matrox_fb_info* minfo
#define WPMINFO WPMINFO2 , #define WPMINFO WPMINFO2 ,
#define CPMINFO2 const struct matrox_fb_info* minfo #define CPMINFO2 const struct matrox_fb_info* minfo
...@@ -707,11 +702,11 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv); ...@@ -707,11 +702,11 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv);
#endif #endif
#endif #endif
#define mga_inb(addr) mga_readb(ACCESS_FBINFO(mmio.vbase), (addr)) #define mga_inb(addr) mga_readb(minfo->mmio.vbase, (addr))
#define mga_inl(addr) mga_readl(ACCESS_FBINFO(mmio.vbase), (addr)) #define mga_inl(addr) mga_readl(minfo->mmio.vbase, (addr))
#define mga_outb(addr,val) mga_writeb(ACCESS_FBINFO(mmio.vbase), (addr), (val)) #define mga_outb(addr,val) mga_writeb(minfo->mmio.vbase, (addr), (val))
#define mga_outw(addr,val) mga_writew(ACCESS_FBINFO(mmio.vbase), (addr), (val)) #define mga_outw(addr,val) mga_writew(minfo->mmio.vbase, (addr), (val))
#define mga_outl(addr,val) mga_writel(ACCESS_FBINFO(mmio.vbase), (addr), (val)) #define mga_outl(addr,val) mga_writel(minfo->mmio.vbase, (addr), (val))
#define mga_readr(port,idx) (mga_outb((port),(idx)), mga_inb((port)+1)) #define mga_readr(port,idx) (mga_outb((port),(idx)), mga_inb((port)+1))
#define mga_setr(addr,port,val) mga_outw(addr, ((val)<<8) | (port)) #define mga_setr(addr,port,val) mga_outw(addr, ((val)<<8) | (port))
...@@ -730,10 +725,10 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv); ...@@ -730,10 +725,10 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv);
#define isMilleniumII(x) (0) #define isMilleniumII(x) (0)
#endif #endif
#define matroxfb_DAC_lock() spin_lock(&ACCESS_FBINFO(lock.DAC)) #define matroxfb_DAC_lock() spin_lock(&minfo->lock.DAC)
#define matroxfb_DAC_unlock() spin_unlock(&ACCESS_FBINFO(lock.DAC)) #define matroxfb_DAC_unlock() spin_unlock(&minfo->lock.DAC)
#define matroxfb_DAC_lock_irqsave(flags) spin_lock_irqsave(&ACCESS_FBINFO(lock.DAC),flags) #define matroxfb_DAC_lock_irqsave(flags) spin_lock_irqsave(&minfo->lock.DAC, flags)
#define matroxfb_DAC_unlock_irqrestore(flags) spin_unlock_irqrestore(&ACCESS_FBINFO(lock.DAC),flags) #define matroxfb_DAC_unlock_irqrestore(flags) spin_unlock_irqrestore(&minfo->lock.DAC, flags)
extern void matroxfb_DAC_out(CPMINFO int reg, int val); extern void matroxfb_DAC_out(CPMINFO int reg, int val);
extern int matroxfb_DAC_in(CPMINFO int reg); extern int matroxfb_DAC_in(CPMINFO int reg);
extern void matroxfb_var2my(struct fb_var_screeninfo* fvsi, struct my_timming* mt); extern void matroxfb_var2my(struct fb_var_screeninfo* fvsi, struct my_timming* mt);
...@@ -741,8 +736,8 @@ extern int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc); ...@@ -741,8 +736,8 @@ extern int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc);
extern int matroxfb_enable_irq(WPMINFO int reenable); extern int matroxfb_enable_irq(WPMINFO int reenable);
#ifdef MATROXFB_USE_SPINLOCKS #ifdef MATROXFB_USE_SPINLOCKS
#define CRITBEGIN spin_lock_irqsave(&ACCESS_FBINFO(lock.accel), critflags); #define CRITBEGIN spin_lock_irqsave(&minfo->lock.accel, critflags);
#define CRITEND spin_unlock_irqrestore(&ACCESS_FBINFO(lock.accel), critflags); #define CRITEND spin_unlock_irqrestore(&minfo->lock.accel, critflags);
#define CRITFLAGS unsigned long critflags; #define CRITFLAGS unsigned long critflags;
#else #else
#define CRITBEGIN #define CRITBEGIN
......
This diff is collapsed.
...@@ -81,7 +81,7 @@ static int get_ctrl_id(__u32 v4l2_id) { ...@@ -81,7 +81,7 @@ static int get_ctrl_id(__u32 v4l2_id) {
} }
static inline int* get_ctrl_ptr(WPMINFO unsigned int idx) { static inline int* get_ctrl_ptr(WPMINFO unsigned int idx) {
return (int*)((char*)MINFO + g450_controls[idx].control); return (int*)((char*)minfo + g450_controls[idx].control);
} }
static void tvo_fill_defaults(WPMINFO2) { static void tvo_fill_defaults(WPMINFO2) {
...@@ -124,8 +124,8 @@ static void cve2_set_reg10(WPMINFO int reg, int val) { ...@@ -124,8 +124,8 @@ static void cve2_set_reg10(WPMINFO int reg, int val) {
} }
static void g450_compute_bwlevel(CPMINFO int *bl, int *wl) { static void g450_compute_bwlevel(CPMINFO int *bl, int *wl) {
const int b = ACCESS_FBINFO(altout.tvo_params.brightness) + BLMIN; const int b = minfo->altout.tvo_params.brightness + BLMIN;
const int c = ACCESS_FBINFO(altout.tvo_params.contrast); const int c = minfo->altout.tvo_params.contrast;
*bl = max(b - c, BLMIN); *bl = max(b - c, BLMIN);
*wl = min(b + c, WLMAX); *wl = min(b + c, WLMAX);
...@@ -509,31 +509,31 @@ static void cve2_init_TV(WPMINFO const struct mavenregs* m) { ...@@ -509,31 +509,31 @@ static void cve2_init_TV(WPMINFO const struct mavenregs* m) {
static int matroxfb_g450_compute(void* md, struct my_timming* mt) { static int matroxfb_g450_compute(void* md, struct my_timming* mt) {
MINFO_FROM(md); MINFO_FROM(md);
dprintk(KERN_DEBUG "Computing, mode=%u\n", ACCESS_FBINFO(outputs[1]).mode); dprintk(KERN_DEBUG "Computing, mode=%u\n", minfo->outputs[1].mode);
if (mt->crtc == MATROXFB_SRC_CRTC2 && if (mt->crtc == MATROXFB_SRC_CRTC2 &&
ACCESS_FBINFO(outputs[1]).mode != MATROXFB_OUTPUT_MODE_MONITOR) { minfo->outputs[1].mode != MATROXFB_OUTPUT_MODE_MONITOR) {
const struct output_desc* outd; const struct output_desc* outd;
cve2_init_TVdata(ACCESS_FBINFO(outputs[1]).mode, &ACCESS_FBINFO(hw).maven, &outd); cve2_init_TVdata(minfo->outputs[1].mode, &minfo->hw.maven, &outd);
{ {
int blacklevel, whitelevel; int blacklevel, whitelevel;
g450_compute_bwlevel(PMINFO &blacklevel, &whitelevel); g450_compute_bwlevel(PMINFO &blacklevel, &whitelevel);
ACCESS_FBINFO(hw).maven.regs[0x0E] = blacklevel >> 2; minfo->hw.maven.regs[0x0E] = blacklevel >> 2;
ACCESS_FBINFO(hw).maven.regs[0x0F] = blacklevel & 3; minfo->hw.maven.regs[0x0F] = blacklevel & 3;
ACCESS_FBINFO(hw).maven.regs[0x1E] = whitelevel >> 2; minfo->hw.maven.regs[0x1E] = whitelevel >> 2;
ACCESS_FBINFO(hw).maven.regs[0x1F] = whitelevel & 3; minfo->hw.maven.regs[0x1F] = whitelevel & 3;
ACCESS_FBINFO(hw).maven.regs[0x20] = minfo->hw.maven.regs[0x20] =
ACCESS_FBINFO(hw).maven.regs[0x22] = ACCESS_FBINFO(altout.tvo_params.saturation); minfo->hw.maven.regs[0x22] = minfo->altout.tvo_params.saturation;
ACCESS_FBINFO(hw).maven.regs[0x25] = ACCESS_FBINFO(altout.tvo_params.hue); minfo->hw.maven.regs[0x25] = minfo->altout.tvo_params.hue;
if (ACCESS_FBINFO(altout.tvo_params.testout)) { if (minfo->altout.tvo_params.testout) {
ACCESS_FBINFO(hw).maven.regs[0x05] |= 0x02; minfo->hw.maven.regs[0x05] |= 0x02;
} }
} }
computeRegs(PMINFO &ACCESS_FBINFO(hw).maven, mt, outd); computeRegs(PMINFO &minfo->hw.maven, mt, outd);
} else if (mt->mnp < 0) { } else if (mt->mnp < 0) {
/* We must program clocks before CRTC2, otherwise interlaced mode /* We must program clocks before CRTC2, otherwise interlaced mode
startup may fail */ startup may fail */
...@@ -547,8 +547,8 @@ static int matroxfb_g450_compute(void* md, struct my_timming* mt) { ...@@ -547,8 +547,8 @@ static int matroxfb_g450_compute(void* md, struct my_timming* mt) {
static int matroxfb_g450_program(void* md) { static int matroxfb_g450_program(void* md) {
MINFO_FROM(md); MINFO_FROM(md);
if (ACCESS_FBINFO(outputs[1]).mode != MATROXFB_OUTPUT_MODE_MONITOR) { if (minfo->outputs[1].mode != MATROXFB_OUTPUT_MODE_MONITOR) {
cve2_init_TV(PMINFO &ACCESS_FBINFO(hw).maven); cve2_init_TV(PMINFO &minfo->hw.maven);
} }
return 0; return 0;
} }
...@@ -589,33 +589,33 @@ static struct matrox_altout matroxfb_g450_dvi = { ...@@ -589,33 +589,33 @@ static struct matrox_altout matroxfb_g450_dvi = {
}; };
void matroxfb_g450_connect(WPMINFO2) { void matroxfb_g450_connect(WPMINFO2) {
if (ACCESS_FBINFO(devflags.g450dac)) { if (minfo->devflags.g450dac) {
down_write(&ACCESS_FBINFO(altout.lock)); down_write(&minfo->altout.lock);
tvo_fill_defaults(PMINFO2); tvo_fill_defaults(PMINFO2);
ACCESS_FBINFO(outputs[1]).src = ACCESS_FBINFO(outputs[1]).default_src; minfo->outputs[1].src = minfo->outputs[1].default_src;
ACCESS_FBINFO(outputs[1]).data = MINFO; minfo->outputs[1].data = minfo;
ACCESS_FBINFO(outputs[1]).output = &matroxfb_g450_altout; minfo->outputs[1].output = &matroxfb_g450_altout;
ACCESS_FBINFO(outputs[1]).mode = MATROXFB_OUTPUT_MODE_MONITOR; minfo->outputs[1].mode = MATROXFB_OUTPUT_MODE_MONITOR;
ACCESS_FBINFO(outputs[2]).src = ACCESS_FBINFO(outputs[2]).default_src; minfo->outputs[2].src = minfo->outputs[2].default_src;
ACCESS_FBINFO(outputs[2]).data = MINFO; minfo->outputs[2].data = minfo;
ACCESS_FBINFO(outputs[2]).output = &matroxfb_g450_dvi; minfo->outputs[2].output = &matroxfb_g450_dvi;
ACCESS_FBINFO(outputs[2]).mode = MATROXFB_OUTPUT_MODE_MONITOR; minfo->outputs[2].mode = MATROXFB_OUTPUT_MODE_MONITOR;
up_write(&ACCESS_FBINFO(altout.lock)); up_write(&minfo->altout.lock);
} }
} }
void matroxfb_g450_shutdown(WPMINFO2) { void matroxfb_g450_shutdown(WPMINFO2) {
if (ACCESS_FBINFO(devflags.g450dac)) { if (minfo->devflags.g450dac) {
down_write(&ACCESS_FBINFO(altout.lock)); down_write(&minfo->altout.lock);
ACCESS_FBINFO(outputs[1]).src = MATROXFB_SRC_NONE; minfo->outputs[1].src = MATROXFB_SRC_NONE;
ACCESS_FBINFO(outputs[1]).output = NULL; minfo->outputs[1].output = NULL;
ACCESS_FBINFO(outputs[1]).data = NULL; minfo->outputs[1].data = NULL;
ACCESS_FBINFO(outputs[1]).mode = MATROXFB_OUTPUT_MODE_MONITOR; minfo->outputs[1].mode = MATROXFB_OUTPUT_MODE_MONITOR;
ACCESS_FBINFO(outputs[2]).src = MATROXFB_SRC_NONE; minfo->outputs[2].src = MATROXFB_SRC_NONE;
ACCESS_FBINFO(outputs[2]).output = NULL; minfo->outputs[2].output = NULL;
ACCESS_FBINFO(outputs[2]).data = NULL; minfo->outputs[2].data = NULL;
ACCESS_FBINFO(outputs[2]).mode = MATROXFB_OUTPUT_MODE_MONITOR; minfo->outputs[2].mode = MATROXFB_OUTPUT_MODE_MONITOR;
up_write(&ACCESS_FBINFO(altout.lock)); up_write(&minfo->altout.lock);
} }
} }
......
...@@ -460,7 +460,7 @@ static void maven_init_TVdata(const struct maven_data* md, struct mavenregs* dat ...@@ -460,7 +460,7 @@ static void maven_init_TVdata(const struct maven_data* md, struct mavenregs* dat
}, MATROXFB_OUTPUT_MODE_NTSC, 525, 60 }; }, MATROXFB_OUTPUT_MODE_NTSC, 525, 60 };
MINFO_FROM(md->primary_head); MINFO_FROM(md->primary_head);
if (ACCESS_FBINFO(outputs[1]).mode == MATROXFB_OUTPUT_MODE_PAL) if (minfo->outputs[1].mode == MATROXFB_OUTPUT_MODE_PAL)
*data = palregs; *data = palregs;
else else
*data = ntscregs; *data = ntscregs;
...@@ -496,11 +496,11 @@ static void maven_init_TVdata(const struct maven_data* md, struct mavenregs* dat ...@@ -496,11 +496,11 @@ static void maven_init_TVdata(const struct maven_data* md, struct mavenregs* dat
/* Set saturation */ /* Set saturation */
{ {
data->regs[0x20] = data->regs[0x20] =
data->regs[0x22] = ACCESS_FBINFO(altout.tvo_params.saturation); data->regs[0x22] = minfo->altout.tvo_params.saturation;
} }
/* Set HUE */ /* Set HUE */
data->regs[0x25] = ACCESS_FBINFO(altout.tvo_params.hue); data->regs[0x25] = minfo->altout.tvo_params.hue;
return; return;
} }
...@@ -743,7 +743,7 @@ static inline int maven_compute_timming(struct maven_data* md, ...@@ -743,7 +743,7 @@ static inline int maven_compute_timming(struct maven_data* md,
unsigned int a, bv, c; unsigned int a, bv, c;
MINFO_FROM(md->primary_head); MINFO_FROM(md->primary_head);
m->mode = ACCESS_FBINFO(outputs[1]).mode; m->mode = minfo->outputs[1].mode;
if (m->mode != MATROXFB_OUTPUT_MODE_MONITOR) { if (m->mode != MATROXFB_OUTPUT_MODE_MONITOR) {
unsigned int lmargin; unsigned int lmargin;
unsigned int umargin; unsigned int umargin;
...@@ -1132,7 +1132,7 @@ static int maven_get_control (struct maven_data* md, ...@@ -1132,7 +1132,7 @@ static int maven_get_control (struct maven_data* md,
static int maven_out_compute(void* md, struct my_timming* mt) { static int maven_out_compute(void* md, struct my_timming* mt) {
#define mdinfo ((struct maven_data*)md) #define mdinfo ((struct maven_data*)md)
#define minfo (mdinfo->primary_head) #define minfo (mdinfo->primary_head)
return maven_compute_timming(md, mt, &ACCESS_FBINFO(hw).maven); return maven_compute_timming(md, mt, &minfo->hw.maven);
#undef minfo #undef minfo
#undef mdinfo #undef mdinfo
} }
...@@ -1140,7 +1140,7 @@ static int maven_out_compute(void* md, struct my_timming* mt) { ...@@ -1140,7 +1140,7 @@ static int maven_out_compute(void* md, struct my_timming* mt) {
static int maven_out_program(void* md) { static int maven_out_program(void* md) {
#define mdinfo ((struct maven_data*)md) #define mdinfo ((struct maven_data*)md)
#define minfo (mdinfo->primary_head) #define minfo (mdinfo->primary_head)
return maven_program_timming(md, &ACCESS_FBINFO(hw).maven); return maven_program_timming(md, &minfo->hw.maven);
#undef minfo #undef minfo
#undef mdinfo #undef mdinfo
} }
...@@ -1186,14 +1186,14 @@ static int maven_init_client(struct i2c_client* clnt) { ...@@ -1186,14 +1186,14 @@ static int maven_init_client(struct i2c_client* clnt) {
struct maven_data* md = i2c_get_clientdata(clnt); struct maven_data* md = i2c_get_clientdata(clnt);
MINFO_FROM(container_of(clnt->adapter, struct i2c_bit_adapter, adapter)->minfo); MINFO_FROM(container_of(clnt->adapter, struct i2c_bit_adapter, adapter)->minfo);
md->primary_head = MINFO; md->primary_head = minfo;
md->client = clnt; md->client = clnt;
down_write(&ACCESS_FBINFO(altout.lock)); down_write(&minfo->altout.lock);
ACCESS_FBINFO(outputs[1]).output = &maven_altout; minfo->outputs[1].output = &maven_altout;
ACCESS_FBINFO(outputs[1]).src = ACCESS_FBINFO(outputs[1]).default_src; minfo->outputs[1].src = minfo->outputs[1].default_src;
ACCESS_FBINFO(outputs[1]).data = md; minfo->outputs[1].data = md;
ACCESS_FBINFO(outputs[1]).mode = MATROXFB_OUTPUT_MODE_MONITOR; minfo->outputs[1].mode = MATROXFB_OUTPUT_MODE_MONITOR;
up_write(&ACCESS_FBINFO(altout.lock)); up_write(&minfo->altout.lock);
if (maven_get_reg(clnt, 0xB2) < 0x14) { if (maven_get_reg(clnt, 0xB2) < 0x14) {
md->version = MGATVO_B; md->version = MGATVO_B;
/* Tweak some things for this old chip */ /* Tweak some things for this old chip */
...@@ -1220,12 +1220,12 @@ static int maven_shutdown_client(struct i2c_client* clnt) { ...@@ -1220,12 +1220,12 @@ static int maven_shutdown_client(struct i2c_client* clnt) {
if (md->primary_head) { if (md->primary_head) {
MINFO_FROM(md->primary_head); MINFO_FROM(md->primary_head);
down_write(&ACCESS_FBINFO(altout.lock)); down_write(&minfo->altout.lock);
ACCESS_FBINFO(outputs[1]).src = MATROXFB_SRC_NONE; minfo->outputs[1].src = MATROXFB_SRC_NONE;
ACCESS_FBINFO(outputs[1]).output = NULL; minfo->outputs[1].output = NULL;
ACCESS_FBINFO(outputs[1]).data = NULL; minfo->outputs[1].data = NULL;
ACCESS_FBINFO(outputs[1]).mode = MATROXFB_OUTPUT_MODE_MONITOR; minfo->outputs[1].mode = MATROXFB_OUTPUT_MODE_MONITOR;
up_write(&ACCESS_FBINFO(altout.lock)); up_write(&minfo->altout.lock);
md->primary_head = NULL; md->primary_head = NULL;
} }
return 0; return 0;
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ int matroxfb_PLL_calcclock(const struct matrox_pll_features* pll, unsigned int f ...@@ -8,7 +8,7 @@ int matroxfb_PLL_calcclock(const struct matrox_pll_features* pll, unsigned int f
unsigned int* in, unsigned int* feed, unsigned int* post); unsigned int* in, unsigned int* feed, unsigned int* post);
static inline int PLL_calcclock(CPMINFO unsigned int freq, unsigned int fmax, static inline int PLL_calcclock(CPMINFO unsigned int freq, unsigned int fmax,
unsigned int* in, unsigned int* feed, unsigned int* post) { unsigned int* in, unsigned int* feed, unsigned int* post) {
return matroxfb_PLL_calcclock(&ACCESS_FBINFO(features.pll), freq, fmax, in, feed, post); return matroxfb_PLL_calcclock(&minfo->features.pll, freq, fmax, in, feed, post);
} }
int matroxfb_vgaHWinit(WPMINFO struct my_timming* m); int matroxfb_vgaHWinit(WPMINFO struct my_timming* m);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment