aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-04-17 15:44:52 -0400
committerJonathan Corbet <corbet@lwn.net>2010-05-07 19:17:38 -0400
commit2749413db17723cf894036c0eaf339f289bcc841 (patch)
tree8bfff7a881bf7fa54e93a8a11665c6e51c736859 /drivers/video/via
parentc2b12cd496bbe5eff6a48bc669fe6b0c56f2b3d9 (diff)
viafb: unify modesetting functions
viafb: unify modesetting functions This patch unifies some cleaned up modesetting functions to prepare for moving them to an extra file. This includes make them use via_io and changing there names to reflect that they do not depend on anything framebuffer specific. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via')
-rw-r--r--drivers/video/via/hw.c66
-rw-r--r--drivers/video/via/hw.h8
-rw-r--r--drivers/video/via/viafbdev.c17
3 files changed, 46 insertions, 45 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 805151f48ea9..1628a5f93dc2 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -624,50 +624,50 @@ void viafb_set_iga_path(void)
624 } 624 }
625} 625}
626 626
627void viafb_set_primary_address(u32 addr) 627void via_set_primary_address(u32 addr)
628{ 628{
629 DEBUG_MSG(KERN_DEBUG "viafb_set_primary_address(0x%08X)\n", addr); 629 DEBUG_MSG(KERN_DEBUG "via_set_primary_address(0x%08X)\n", addr);
630 viafb_write_reg(CR0D, VIACR, addr & 0xFF); 630 via_write_reg(VIACR, 0x0D, addr & 0xFF);
631 viafb_write_reg(CR0C, VIACR, (addr >> 8) & 0xFF); 631 via_write_reg(VIACR, 0x0C, (addr >> 8) & 0xFF);
632 viafb_write_reg(CR34, VIACR, (addr >> 16) & 0xFF); 632 via_write_reg(VIACR, 0x34, (addr >> 16) & 0xFF);
633 viafb_write_reg_mask(CR48, VIACR, (addr >> 24) & 0x1F, 0x1F); 633 via_write_reg_mask(VIACR, 0x48, (addr >> 24) & 0x1F, 0x1F);
634} 634}
635 635
636void viafb_set_secondary_address(u32 addr) 636void via_set_secondary_address(u32 addr)
637{ 637{
638 DEBUG_MSG(KERN_DEBUG "viafb_set_secondary_address(0x%08X)\n", addr); 638 DEBUG_MSG(KERN_DEBUG "via_set_secondary_address(0x%08X)\n", addr);
639 /* secondary display supports only quadword aligned memory */ 639 /* secondary display supports only quadword aligned memory */
640 viafb_write_reg_mask(CR62, VIACR, (addr >> 2) & 0xFE, 0xFE); 640 via_write_reg_mask(VIACR, 0x62, (addr >> 2) & 0xFE, 0xFE);
641 viafb_write_reg(CR63, VIACR, (addr >> 10) & 0xFF); 641 via_write_reg(VIACR, 0x63, (addr >> 10) & 0xFF);
642 viafb_write_reg(CR64, VIACR, (addr >> 18) & 0xFF); 642 via_write_reg(VIACR, 0x64, (addr >> 18) & 0xFF);
643 viafb_write_reg_mask(CRA3, VIACR, (addr >> 26) & 0x07, 0x07); 643 via_write_reg_mask(VIACR, 0xA3, (addr >> 26) & 0x07, 0x07);
644} 644}
645 645
646void viafb_set_primary_pitch(u32 pitch) 646void via_set_primary_pitch(u32 pitch)
647{ 647{
648 DEBUG_MSG(KERN_DEBUG "viafb_set_primary_pitch(0x%08X)\n", pitch); 648 DEBUG_MSG(KERN_DEBUG "via_set_primary_pitch(0x%08X)\n", pitch);
649 /* spec does not say that first adapter skips 3 bits but old 649 /* spec does not say that first adapter skips 3 bits but old
650 * code did it and seems to be reasonable in analogy to 2nd adapter 650 * code did it and seems to be reasonable in analogy to 2nd adapter
651 */ 651 */
652 pitch = pitch >> 3; 652 pitch = pitch >> 3;
653 viafb_write_reg(0x13, VIACR, pitch & 0xFF); 653 via_write_reg(VIACR, 0x13, pitch & 0xFF);
654 viafb_write_reg_mask(0x35, VIACR, (pitch >> (8 - 5)) & 0xE0, 0xE0); 654 via_write_reg_mask(VIACR, 0x35, (pitch >> (8 - 5)) & 0xE0, 0xE0);
655} 655}
656 656
657void viafb_set_secondary_pitch(u32 pitch) 657void via_set_secondary_pitch(u32 pitch)
658{ 658{
659 DEBUG_MSG(KERN_DEBUG "viafb_set_secondary_pitch(0x%08X)\n", pitch); 659 DEBUG_MSG(KERN_DEBUG "via_set_secondary_pitch(0x%08X)\n", pitch);
660 pitch = pitch >> 3; 660 pitch = pitch >> 3;
661 viafb_write_reg(0x66, VIACR, pitch & 0xFF); 661 via_write_reg(VIACR, 0x66, pitch & 0xFF);
662 viafb_write_reg_mask(0x67, VIACR, (pitch >> 8) & 0x03, 0x03); 662 via_write_reg_mask(VIACR, 0x67, (pitch >> 8) & 0x03, 0x03);
663 viafb_write_reg_mask(0x71, VIACR, (pitch >> (10 - 7)) & 0x80, 0x80); 663 via_write_reg_mask(VIACR, 0x71, (pitch >> (10 - 7)) & 0x80, 0x80);
664} 664}
665 665
666void viafb_set_primary_color_depth(u8 depth) 666void via_set_primary_color_depth(u8 depth)
667{ 667{
668 u8 value; 668 u8 value;
669 669
670 DEBUG_MSG(KERN_DEBUG "viafb_set_primary_color_depth(%d)\n", depth); 670 DEBUG_MSG(KERN_DEBUG "via_set_primary_color_depth(%d)\n", depth);
671 switch (depth) { 671 switch (depth) {
672 case 8: 672 case 8:
673 value = 0x00; 673 value = 0x00;
@@ -685,19 +685,19 @@ void viafb_set_primary_color_depth(u8 depth)
685 value = 0x08; 685 value = 0x08;
686 break; 686 break;
687 default: 687 default:
688 printk(KERN_WARNING "viafb_set_primary_color_depth: " 688 printk(KERN_WARNING "via_set_primary_color_depth: "
689 "Unsupported depth: %d\n", depth); 689 "Unsupported depth: %d\n", depth);
690 return; 690 return;
691 } 691 }
692 692
693 viafb_write_reg_mask(0x15, VIASR, value, 0x1C); 693 via_write_reg_mask(VIASR, 0x15, value, 0x1C);
694} 694}
695 695
696void viafb_set_secondary_color_depth(u8 depth) 696void via_set_secondary_color_depth(u8 depth)
697{ 697{
698 u8 value; 698 u8 value;
699 699
700 DEBUG_MSG(KERN_DEBUG "viafb_set_secondary_color_depth(%d)\n", depth); 700 DEBUG_MSG(KERN_DEBUG "via_set_secondary_color_depth(%d)\n", depth);
701 switch (depth) { 701 switch (depth) {
702 case 8: 702 case 8:
703 value = 0x00; 703 value = 0x00;
@@ -712,12 +712,12 @@ void viafb_set_secondary_color_depth(u8 depth)
712 value = 0x80; 712 value = 0x80;
713 break; 713 break;
714 default: 714 default:
715 printk(KERN_WARNING "viafb_set_secondary_color_depth: " 715 printk(KERN_WARNING "via_set_secondary_color_depth: "
716 "Unsupported depth: %d\n", depth); 716 "Unsupported depth: %d\n", depth);
717 return; 717 return;
718 } 718 }
719 719
720 viafb_write_reg_mask(0x67, VIACR, value, 0xC0); 720 via_write_reg_mask(VIACR, 0x67, value, 0xC0);
721} 721}
722 722
723static void set_color_register(u8 index, u8 red, u8 green, u8 blue) 723static void set_color_register(u8 index, u8 red, u8 green, u8 blue)
@@ -2268,11 +2268,11 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
2268 } 2268 }
2269 } 2269 }
2270 2270
2271 viafb_set_primary_pitch(viafbinfo->fix.line_length); 2271 via_set_primary_pitch(viafbinfo->fix.line_length);
2272 viafb_set_secondary_pitch(viafb_dual_fb ? viafbinfo1->fix.line_length 2272 via_set_secondary_pitch(viafb_dual_fb ? viafbinfo1->fix.line_length
2273 : viafbinfo->fix.line_length); 2273 : viafbinfo->fix.line_length);
2274 viafb_set_primary_color_depth(viaparinfo->depth); 2274 via_set_primary_color_depth(viaparinfo->depth);
2275 viafb_set_secondary_color_depth(viafb_dual_fb ? viaparinfo1->depth 2275 via_set_secondary_color_depth(viafb_dual_fb ? viaparinfo1->depth
2276 : viaparinfo->depth); 2276 : viaparinfo->depth);
2277 /* Update Refresh Rate Setting */ 2277 /* Update Refresh Rate Setting */
2278 2278
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index 23c319010913..641a5fa4bd33 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -910,10 +910,10 @@ void viafb_update_device_setting(int hres, int vres, int bpp,
910 int vmode_refresh, int flag); 910 int vmode_refresh, int flag);
911 911
912void viafb_set_iga_path(void); 912void viafb_set_iga_path(void);
913void viafb_set_primary_address(u32 addr); 913void via_set_primary_address(u32 addr);
914void viafb_set_secondary_address(u32 addr); 914void via_set_secondary_address(u32 addr);
915void viafb_set_primary_pitch(u32 pitch); 915void via_set_primary_pitch(u32 pitch);
916void viafb_set_secondary_pitch(u32 pitch); 916void via_set_secondary_pitch(u32 pitch);
917void viafb_set_primary_color_register(u8 index, u8 red, u8 green, u8 blue); 917void viafb_set_primary_color_register(u8 index, u8 red, u8 green, u8 blue);
918void viafb_set_secondary_color_register(u8 index, u8 red, u8 green, u8 blue); 918void viafb_set_secondary_color_register(u8 index, u8 red, u8 green, u8 blue);
919void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len); 919void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len);
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 70ed71facd87..e94f913f87be 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -317,12 +317,12 @@ static int viafb_pan_display(struct fb_var_screeninfo *var,
317 317
318 DEBUG_MSG(KERN_DEBUG "viafb_pan_display, address = %d\n", vram_addr); 318 DEBUG_MSG(KERN_DEBUG "viafb_pan_display, address = %d\n", vram_addr);
319 if (!viafb_dual_fb) { 319 if (!viafb_dual_fb) {
320 viafb_set_primary_address(vram_addr); 320 via_set_primary_address(vram_addr);
321 viafb_set_secondary_address(vram_addr); 321 via_set_secondary_address(vram_addr);
322 } else if (viapar->iga_path == IGA1) 322 } else if (viapar->iga_path == IGA1)
323 viafb_set_primary_address(vram_addr); 323 via_set_primary_address(vram_addr);
324 else 324 else
325 viafb_set_secondary_address(vram_addr); 325 via_set_secondary_address(vram_addr);
326 326
327 return 0; 327 return 0;
328} 328}
@@ -1018,8 +1018,8 @@ static void viafb_set_device(struct device_t active_dev)
1018 viafb_SAMM_ON = active_dev.samm; 1018 viafb_SAMM_ON = active_dev.samm;
1019 viafb_primary_dev = active_dev.primary_dev; 1019 viafb_primary_dev = active_dev.primary_dev;
1020 1020
1021 viafb_set_primary_address(0); 1021 via_set_primary_address(0);
1022 viafb_set_secondary_address(viafb_SAMM_ON ? viafb_second_offset : 0); 1022 via_set_secondary_address(viafb_SAMM_ON ? viafb_second_offset : 0);
1023 viafb_set_iga_path(); 1023 viafb_set_iga_path();
1024} 1024}
1025 1025
@@ -1165,8 +1165,9 @@ static int apply_device_setting(struct viafb_ioctl_setting setting_info,
1165 if (viafb_SAMM_ON) 1165 if (viafb_SAMM_ON)
1166 viafb_primary_dev = setting_info.primary_device; 1166 viafb_primary_dev = setting_info.primary_device;
1167 1167
1168 viafb_set_primary_address(0); 1168 via_set_primary_address(0);
1169 viafb_set_secondary_address(viafb_SAMM_ON ? viafb_second_offset : 0); 1169 via_set_secondary_address(viafb_SAMM_ON ?
1170 viafb_second_offset : 0);
1170 viafb_set_iga_path(); 1171 viafb_set_iga_path();
1171 } 1172 }
1172 need_set_mode = 1; 1173 need_set_mode = 1;