aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2009-09-22 19:47:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:51 -0400
commit09cf11806e4b4be92af76253ff9834c48b416129 (patch)
treea7a14f280d772f5caebf75af95059be8c2e5649a /drivers/video
parent81228a36a5d05181fff990c852a9abdf03c75593 (diff)
viafb: split viafb_set_start_addr up
Move individual start address setting to viafb_set_primary_address and viafb_set_secondary_address and make it more flexible to reuse it for panning. Using central functions makes it easier to follow HW manipulations. Remove crt locking as it should be only needed for timing manipulation. Move iga_path manipulation to via_pci_probe. Remove memset for screen cleaning as it is currently done only for the second screen. This is not needed for normal operation but has a little chance of causing unwanted display artifacts. This can be fixed later more consistent and more efficient (using viafb_fillrect) if needed. This is a code clenup, no notable runtime changes expected. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Harald Welte <laforge@gnumonks.org> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/via/hw.c80
-rw-r--r--drivers/video/via/hw.h3
-rw-r--r--drivers/video/via/viafbdev.c15
3 files changed, 26 insertions, 72 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 64a820c6d494..5be4a670596f 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -629,70 +629,23 @@ void viafb_set_iga_path(void)
629 } 629 }
630} 630}
631 631
632void viafb_set_start_addr(void) 632void viafb_set_primary_address(u32 addr)
633{ 633{
634 unsigned long offset = 0, tmp = 0, size = 0; 634 DEBUG_MSG(KERN_DEBUG "viafb_set_primary_address(0x%08X)\n", addr);
635 unsigned long length; 635 viafb_write_reg(CR0D, VIACR, addr & 0xFF);
636 636 viafb_write_reg(CR0C, VIACR, (addr >> 8) & 0xFF);
637 DEBUG_MSG(KERN_INFO "viafb_set_start_addr!\n"); 637 viafb_write_reg(CR34, VIACR, (addr >> 16) & 0xFF);
638 viafb_unlock_crt(); 638 viafb_write_reg_mask(CR48, VIACR, (addr >> 24) & 0x1F, 0x1F);
639 /* update starting address of IGA1 */ 639}
640 viafb_write_reg(CR0C, VIACR, 0x00); /*initial starting address */
641 viafb_write_reg(CR0D, VIACR, 0x00);
642 viafb_write_reg(CR34, VIACR, 0x00);
643 viafb_write_reg_mask(CR48, VIACR, 0x00, 0x1F);
644
645 if (viafb_dual_fb) {
646 viaparinfo->iga_path = IGA1;
647 viaparinfo1->iga_path = IGA2;
648 }
649
650 if (viafb_SAMM_ON == 1) {
651 if (!viafb_dual_fb) {
652 if (viafb_second_size)
653 size = viafb_second_size * 1024 * 1024;
654 else
655 size = 8 * 1024 * 1024;
656 } else {
657
658 size = viaparinfo1->memsize;
659 }
660 offset = viafb_second_offset;
661 DEBUG_MSG(KERN_INFO
662 "viafb_second_size=%lx, second start_adddress=%lx\n",
663 size, offset);
664 }
665 if (viafb_SAMM_ON == 1) {
666 offset = offset >> 3;
667
668 tmp = viafb_read_reg(VIACR, 0x62) & 0x01;
669 tmp |= (offset & 0x7F) << 1;
670 viafb_write_reg(CR62, VIACR, tmp);
671 viafb_write_reg(CR63, VIACR, ((offset & 0x7F80) >> 7));
672 viafb_write_reg(CR64, VIACR, ((offset & 0x7F8000) >> 15));
673 viafb_write_reg(CRA3, VIACR, ((offset & 0x3800000) >> 23));
674 } else {
675 /* update starting address */
676 viafb_write_reg(CR62, VIACR, 0x00);
677 viafb_write_reg(CR63, VIACR, 0x00);
678 viafb_write_reg(CR64, VIACR, 0x00);
679 viafb_write_reg(CRA3, VIACR, 0x00);
680 }
681
682 if (viafb_SAMM_ON == 1) {
683 if (viafb_accel) {
684 if (!viafb_dual_fb)
685 length = size - viaparinfo->fbmem_used;
686 else
687 length = size - viaparinfo1->fbmem_used;
688 } else
689 length = size;
690 offset = (unsigned long)(void *)viafb_FB_MM +
691 viafb_second_offset;
692 memset((void *)offset, 0, length);
693 }
694 640
695 viafb_lock_crt(); 641void viafb_set_secondary_address(u32 addr)
642{
643 DEBUG_MSG(KERN_DEBUG "viafb_set_secondary_address(0x%08X)\n", addr);
644 /* secondary display supports only quadword aligned memory */
645 viafb_write_reg_mask(CR62, VIACR, (addr >> 2) & 0xFE, 0xFE);
646 viafb_write_reg(CR63, VIACR, (addr >> 10) & 0xFF);
647 viafb_write_reg(CR64, VIACR, (addr >> 18) & 0xFF);
648 viafb_write_reg_mask(CRA3, VIACR, (addr >> 26) & 0x07, 0x07);
696} 649}
697 650
698void viafb_set_output_path(int device, int set_iga, int output_interface) 651void viafb_set_output_path(int device, int set_iga, int output_interface)
@@ -2288,7 +2241,8 @@ int viafb_setmode(int vmode_index, int hor_res, int ver_res, int video_bpp,
2288 outb(VPIT.SR[i - 1], VIASR + 1); 2241 outb(VPIT.SR[i - 1], VIASR + 1);
2289 } 2242 }
2290 2243
2291 viafb_set_start_addr(); 2244 viafb_set_primary_address(0);
2245 viafb_set_secondary_address(viafb_SAMM_ON ? viafb_second_offset : 0);
2292 viafb_set_iga_path(); 2246 viafb_set_iga_path();
2293 2247
2294 /* Write CRTC */ 2248 /* Write CRTC */
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index 6ff38fa8569a..874ea3fc290d 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -927,7 +927,8 @@ void viafb_get_mmio_info(unsigned long *mmio_base,
927 unsigned long *mmio_len); 927 unsigned long *mmio_len);
928 928
929void viafb_set_iga_path(void); 929void viafb_set_iga_path(void);
930void viafb_set_start_addr(void); 930void viafb_set_primary_address(u32 addr);
931void viafb_set_secondary_address(u32 addr);
931void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len); 932void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len);
932 933
933#endif /* __HW_H__ */ 934#endif /* __HW_H__ */
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 6612ddc2dcd9..743eed48a5f7 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -481,12 +481,7 @@ static int viafb_pan_display(struct fb_var_screeninfo *var,
481 var->bits_per_pixel / 16; 481 var->bits_per_pixel / 16;
482 482
483 DEBUG_MSG(KERN_INFO "\nviafb_pan_display,offset =%d ", offset); 483 DEBUG_MSG(KERN_INFO "\nviafb_pan_display,offset =%d ", offset);
484 484 viafb_set_primary_address(offset);
485 viafb_write_reg_mask(0x48, 0x3d4, ((offset >> 24) & 0x3), 0x3);
486 viafb_write_reg_mask(0x34, 0x3d4, ((offset >> 16) & 0xff), 0xff);
487 viafb_write_reg_mask(0x0c, 0x3d4, ((offset >> 8) & 0xff), 0xff);
488 viafb_write_reg_mask(0x0d, 0x3d4, (offset & 0xff), 0xff);
489
490 return 0; 485 return 0;
491} 486}
492 487
@@ -1353,7 +1348,8 @@ static void viafb_set_device(struct device_t active_dev)
1353 viafb_SAMM_ON = active_dev.samm; 1348 viafb_SAMM_ON = active_dev.samm;
1354 viafb_primary_dev = active_dev.primary_dev; 1349 viafb_primary_dev = active_dev.primary_dev;
1355 1350
1356 viafb_set_start_addr(); 1351 viafb_set_primary_address(0);
1352 viafb_set_secondary_address(viafb_SAMM_ON ? viafb_second_offset : 0);
1357 viafb_set_iga_path(); 1353 viafb_set_iga_path();
1358} 1354}
1359 1355
@@ -1537,7 +1533,8 @@ static int apply_device_setting(struct viafb_ioctl_setting setting_info,
1537 if (viafb_SAMM_ON) 1533 if (viafb_SAMM_ON)
1538 viafb_primary_dev = setting_info.primary_device; 1534 viafb_primary_dev = setting_info.primary_device;
1539 1535
1540 viafb_set_start_addr(); 1536 viafb_set_primary_address(0);
1537 viafb_set_secondary_address(viafb_SAMM_ON ? viafb_second_offset : 0);
1541 viafb_set_iga_path(); 1538 viafb_set_iga_path();
1542 } 1539 }
1543 need_set_mode = 1; 1540 need_set_mode = 1;
@@ -2275,6 +2272,8 @@ static int __devinit via_pci_probe(void)
2275 viafb_second_offset; 2272 viafb_second_offset;
2276 } 2273 }
2277 2274
2275 viaparinfo->iga_path = IGA1;
2276 viaparinfo1->iga_path = IGA2;
2278 memcpy(viafbinfo1, viafbinfo, sizeof(struct fb_info)); 2277 memcpy(viafbinfo1, viafbinfo, sizeof(struct fb_info));
2279 viafbinfo1->screen_base = viafbinfo->screen_base + 2278 viafbinfo1->screen_base = viafbinfo->screen_base +
2280 viafb_second_offset; 2279 viafb_second_offset;