aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sis/sis_main.c
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2007-05-08 03:39:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:33 -0400
commit0959f0ca29244ae983b406fba313816a29244be7 (patch)
tree1dd6c165a9298418eab3965eaec4d5c6727e6b50 /drivers/video/sis/sis_main.c
parentc831c338f0ad299fcd1592c6e4f30657480f39af (diff)
drivers/video/sis/: remove more kernel 2.4 code
Signed-off-by: Adrian Bunk <bunk@stusta.de> Cc: Thomas Winischhofer <thomas@winischhofer.net> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/sis/sis_main.c')
-rw-r--r--drivers/video/sis/sis_main.c105
1 files changed, 20 insertions, 85 deletions
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index 6e094688a637..a30e1e13d8be 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -1947,7 +1947,7 @@ sisfb_get_northbridge(int basechipid)
1947 default: return NULL; 1947 default: return NULL;
1948 } 1948 }
1949 for(i = 0; i < nbridgenum; i++) { 1949 for(i = 0; i < nbridgenum; i++) {
1950 if((pdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 1950 if((pdev = pci_get_device(PCI_VENDOR_ID_SI,
1951 nbridgeids[nbridgeidx+i], NULL))) 1951 nbridgeids[nbridgeidx+i], NULL)))
1952 break; 1952 break;
1953 } 1953 }
@@ -4612,9 +4612,9 @@ sisfb_find_host_bridge(struct sis_video_info *ivideo, struct pci_dev *mypdev,
4612 unsigned short temp; 4612 unsigned short temp;
4613 int ret = 0; 4613 int ret = 0;
4614 4614
4615 while((pdev = SIS_PCI_GET_CLASS(PCI_CLASS_BRIDGE_HOST, pdev))) { 4615 while((pdev = pci_get_class(PCI_CLASS_BRIDGE_HOST, pdev))) {
4616 temp = pdev->vendor; 4616 temp = pdev->vendor;
4617 SIS_PCI_PUT_DEVICE(pdev); 4617 pci_dev_put(pdev);
4618 if(temp == pcivendor) { 4618 if(temp == pcivendor) {
4619 ret = 1; 4619 ret = 1;
4620 break; 4620 break;
@@ -5153,24 +5153,24 @@ sisfb_post_xgi(struct pci_dev *pdev)
5153 if(reg & 0x80) v2 |= 0x80; 5153 if(reg & 0x80) v2 |= 0x80;
5154 v2 |= 0x01; 5154 v2 |= 0x01;
5155 5155
5156 if((mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0730, NULL))) { 5156 if((mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0730, NULL))) {
5157 SIS_PCI_PUT_DEVICE(mypdev); 5157 pci_dev_put(mypdev);
5158 if(((v2 & 0x06) == 2) || ((v2 & 0x06) == 4)) 5158 if(((v2 & 0x06) == 2) || ((v2 & 0x06) == 4))
5159 v2 &= 0xf9; 5159 v2 &= 0xf9;
5160 v2 |= 0x08; 5160 v2 |= 0x08;
5161 v1 &= 0xfe; 5161 v1 &= 0xfe;
5162 } else { 5162 } else {
5163 mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0735, NULL); 5163 mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0735, NULL);
5164 if(!mypdev) 5164 if(!mypdev)
5165 mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0645, NULL); 5165 mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0645, NULL);
5166 if(!mypdev) 5166 if(!mypdev)
5167 mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0650, NULL); 5167 mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0650, NULL);
5168 if(mypdev) { 5168 if(mypdev) {
5169 pci_read_config_dword(mypdev, 0x94, &regd); 5169 pci_read_config_dword(mypdev, 0x94, &regd);
5170 regd &= 0xfffffeff; 5170 regd &= 0xfffffeff;
5171 pci_write_config_dword(mypdev, 0x94, regd); 5171 pci_write_config_dword(mypdev, 0x94, regd);
5172 v1 &= 0xfe; 5172 v1 &= 0xfe;
5173 SIS_PCI_PUT_DEVICE(mypdev); 5173 pci_dev_put(mypdev);
5174 } else if(sisfb_find_host_bridge(ivideo, pdev, PCI_VENDOR_ID_SI)) { 5174 } else if(sisfb_find_host_bridge(ivideo, pdev, PCI_VENDOR_ID_SI)) {
5175 v1 &= 0xfe; 5175 v1 &= 0xfe;
5176 } else if(sisfb_find_host_bridge(ivideo, pdev, 0x1106) || 5176 } else if(sisfb_find_host_bridge(ivideo, pdev, 0x1106) ||
@@ -5193,13 +5193,13 @@ sisfb_post_xgi(struct pci_dev *pdev)
5193 if( (!(v1 & 0x02)) && (v2 & 0x30) && (regd < 0xcf) ) 5193 if( (!(v1 & 0x02)) && (v2 & 0x30) && (regd < 0xcf) )
5194 setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01); 5194 setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01);
5195 5195
5196 if((mypdev = SIS_PCI_GET_DEVICE(0x10de, 0x01e0, NULL))) { 5196 if((mypdev = pci_get_device(0x10de, 0x01e0, NULL))) {
5197 /* TODO: set CR5f &0xf1 | 0x01 for version 6570 5197 /* TODO: set CR5f &0xf1 | 0x01 for version 6570
5198 * of nforce 2 ROM 5198 * of nforce 2 ROM
5199 */ 5199 */
5200 if(0) 5200 if(0)
5201 setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01); 5201 setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01);
5202 SIS_PCI_PUT_DEVICE(mypdev); 5202 pci_dev_put(mypdev);
5203 } 5203 }
5204 } 5204 }
5205 5205
@@ -5235,9 +5235,9 @@ sisfb_post_xgi(struct pci_dev *pdev)
5235 setSISIDXREG(SISCR, 0x75, 0xe0, bios[0x4ff] & 0x1f); 5235 setSISIDXREG(SISCR, 0x75, 0xe0, bios[0x4ff] & 0x1f);
5236 setSISIDXREG(SISCR, 0x76, 0xe0, bios[0x500] & 0x1f); 5236 setSISIDXREG(SISCR, 0x76, 0xe0, bios[0x500] & 0x1f);
5237 v1 = bios[0x501]; 5237 v1 = bios[0x501];
5238 if((mypdev = SIS_PCI_GET_DEVICE(0x8086, 0x2530, NULL))) { 5238 if((mypdev = pci_get_device(0x8086, 0x2530, NULL))) {
5239 v1 = 0xf0; 5239 v1 = 0xf0;
5240 SIS_PCI_PUT_DEVICE(mypdev); 5240 pci_dev_put(mypdev);
5241 } 5241 }
5242 outSISIDXREG(SISCR, 0x77, v1); 5242 outSISIDXREG(SISCR, 0x77, v1);
5243 } 5243 }
@@ -5946,7 +5946,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5946 5946
5947 if(!ivideo->sisvga_enabled) { 5947 if(!ivideo->sisvga_enabled) {
5948 if(pci_enable_device(pdev)) { 5948 if(pci_enable_device(pdev)) {
5949 if(ivideo->nbridge) SIS_PCI_PUT_DEVICE(ivideo->nbridge); 5949 if(ivideo->nbridge) pci_dev_put(ivideo->nbridge);
5950 pci_set_drvdata(pdev, NULL); 5950 pci_set_drvdata(pdev, NULL);
5951 kfree(sis_fb_info); 5951 kfree(sis_fb_info);
5952 return -EIO; 5952 return -EIO;
@@ -5973,7 +5973,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5973 "requiring Chrontel/GPIO setup\n", 5973 "requiring Chrontel/GPIO setup\n",
5974 mychswtable[i].vendorName, 5974 mychswtable[i].vendorName,
5975 mychswtable[i].cardName); 5975 mychswtable[i].cardName);
5976 ivideo->lpcdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0008, NULL); 5976 ivideo->lpcdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0008, NULL);
5977 break; 5977 break;
5978 } 5978 }
5979 i++; 5979 i++;
@@ -5983,7 +5983,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5983 5983
5984#ifdef CONFIG_FB_SIS_315 5984#ifdef CONFIG_FB_SIS_315
5985 if((ivideo->chip == SIS_760) && (ivideo->nbridge)) { 5985 if((ivideo->chip == SIS_760) && (ivideo->nbridge)) {
5986 ivideo->lpcdev = SIS_PCI_GET_SLOT(ivideo->nbridge->bus, (2 << 3)); 5986 ivideo->lpcdev = pci_get_slot(ivideo->nbridge->bus, (2 << 3));
5987 } 5987 }
5988#endif 5988#endif
5989 5989
@@ -6148,9 +6148,9 @@ error_1: release_mem_region(ivideo->video_base, ivideo->video_size);
6148error_2: release_mem_region(ivideo->mmio_base, ivideo->mmio_size); 6148error_2: release_mem_region(ivideo->mmio_base, ivideo->mmio_size);
6149error_3: vfree(ivideo->bios_abase); 6149error_3: vfree(ivideo->bios_abase);
6150 if(ivideo->lpcdev) 6150 if(ivideo->lpcdev)
6151 SIS_PCI_PUT_DEVICE(ivideo->lpcdev); 6151 pci_dev_put(ivideo->lpcdev);
6152 if(ivideo->nbridge) 6152 if(ivideo->nbridge)
6153 SIS_PCI_PUT_DEVICE(ivideo->nbridge); 6153 pci_dev_put(ivideo->nbridge);
6154 pci_set_drvdata(pdev, NULL); 6154 pci_set_drvdata(pdev, NULL);
6155 if(!ivideo->sisvga_enabled) 6155 if(!ivideo->sisvga_enabled)
6156 pci_disable_device(pdev); 6156 pci_disable_device(pdev);
@@ -6330,70 +6330,6 @@ error_3: vfree(ivideo->bios_abase);
6330 6330
6331 sisfb_set_vparms(ivideo); 6331 sisfb_set_vparms(ivideo);
6332 6332
6333#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6334
6335 /* ---------------- For 2.4: Now switch the mode ------------------ */
6336
6337 printk(KERN_INFO "sisfb: Setting mode %dx%dx%d (%dHz)\n",
6338 ivideo->video_width, ivideo->video_height, ivideo->video_bpp,
6339 ivideo->refresh_rate);
6340
6341 /* Determine whether or not acceleration is to be
6342 * used. Need to know before pre/post_set_mode()
6343 */
6344 ivideo->accel = 0;
6345 ivideo->default_var.accel_flags &= ~FB_ACCELF_TEXT;
6346 if(ivideo->sisfb_accel) {
6347 ivideo->accel = -1;
6348 ivideo->default_var.accel_flags |= FB_ACCELF_TEXT;
6349 }
6350
6351 /* Now switch the mode */
6352 sisfb_pre_setmode(ivideo);
6353
6354 if(SiSSetMode(&ivideo->SiS_Pr, ivideo->mode_no) == 0) {
6355 printk(KERN_ERR "sisfb: Fatal error: Setting mode[0x%x] failed\n",
6356 ivideo->mode_no);
6357 ret = -EINVAL;
6358 iounmap(ivideo->mmio_vbase);
6359 goto error_0;
6360 }
6361
6362 outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
6363
6364 sisfb_post_setmode(ivideo);
6365
6366 /* Maximize regardless of sisfb_max at startup */
6367 ivideo->default_var.yres_virtual = 32767;
6368
6369 /* Force reset of x virtual in crtc_to_var */
6370 ivideo->default_var.xres_virtual = 0;
6371
6372 /* Copy mode timing to var */
6373 sisfb_crtc_to_var(ivideo, &ivideo->default_var);
6374
6375 /* Find out about screen pitch */
6376 sisfb_calc_pitch(ivideo, &ivideo->default_var);
6377 sisfb_set_pitch(ivideo);
6378
6379 /* Init the accelerator (does nothing currently) */
6380 sisfb_initaccel(ivideo);
6381
6382 /* Init some fbinfo entries */
6383 sis_fb_info->node = -1;
6384 sis_fb_info->flags = FBINFO_FLAG_DEFAULT;
6385 sis_fb_info->fbops = &sisfb_ops;
6386 sis_fb_info->disp = &ivideo->sis_disp;
6387 sis_fb_info->blank = &sisfb_blank;
6388 sis_fb_info->switch_con = &sisfb_switch;
6389 sis_fb_info->updatevar = &sisfb_update_var;
6390 sis_fb_info->changevar = NULL;
6391 strcpy(sis_fb_info->fontname, sisfb_fontname);
6392
6393 sisfb_set_disp(-1, &ivideo->default_var, sis_fb_info);
6394
6395#else /* --------- For 2.6: Setup a somewhat sane default var ------------ */
6396
6397 printk(KERN_INFO "sisfb: Default mode is %dx%dx%d (%dHz)\n", 6333 printk(KERN_INFO "sisfb: Default mode is %dx%dx%d (%dHz)\n",
6398 ivideo->video_width, ivideo->video_height, ivideo->video_bpp, 6334 ivideo->video_width, ivideo->video_height, ivideo->video_bpp,
6399 ivideo->refresh_rate); 6335 ivideo->refresh_rate);
@@ -6453,7 +6389,6 @@ error_3: vfree(ivideo->bios_abase);
6453 sis_fb_info->pseudo_palette = ivideo->pseudo_palette; 6389 sis_fb_info->pseudo_palette = ivideo->pseudo_palette;
6454 6390
6455 fb_alloc_cmap(&sis_fb_info->cmap, 256 , 0); 6391 fb_alloc_cmap(&sis_fb_info->cmap, 256 , 0);
6456#endif /* 2.6 */
6457 6392
6458 printk(KERN_DEBUG "sisfb: Initial vbflags 0x%x\n", (int)ivideo->vbflags); 6393 printk(KERN_DEBUG "sisfb: Initial vbflags 0x%x\n", (int)ivideo->vbflags);
6459 6394
@@ -6563,10 +6498,10 @@ static void __devexit sisfb_remove(struct pci_dev *pdev)
6563 vfree(ivideo->bios_abase); 6498 vfree(ivideo->bios_abase);
6564 6499
6565 if(ivideo->lpcdev) 6500 if(ivideo->lpcdev)
6566 SIS_PCI_PUT_DEVICE(ivideo->lpcdev); 6501 pci_dev_put(ivideo->lpcdev);
6567 6502
6568 if(ivideo->nbridge) 6503 if(ivideo->nbridge)
6569 SIS_PCI_PUT_DEVICE(ivideo->nbridge); 6504 pci_dev_put(ivideo->nbridge);
6570 6505
6571#ifdef CONFIG_MTRR 6506#ifdef CONFIG_MTRR
6572 /* Release MTRR region */ 6507 /* Release MTRR region */