aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/hw.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-03-10 18:21:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:34 -0500
commit415559fbf2353f4271a4cd6e11259b8bbc97cc33 (patch)
tree4bcece3887bfc489d096f60ae28a688a31abe6fd /drivers/video/via/hw.c
parentdbb7884be758ca9ac5ec84cbe7eb21f21bce9d8f (diff)
viafb: rework color setting
This is a rewritten version of viafb_setcolreg. The hardware register writes were split up and moved to hw.c where they belong as this is really low level stuff. It was made dual fb aware. Furthermore viafb_setcmap was removed as the problem with 8bpp originated from a bug in writing multiple color registers at once. The removal of viafb_setcmap might introduce a small performance regression but its certainly better to receive the correct result a bit slower than a garbled picture fast. It should give us a working 8bpp mode and is more extensible than the old hardcoded code. No other regressions are expected but as the hardware might be a bit picky it might cause some regressions in 8bpp mode on some hardware although I doubt that. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Scott Fang <ScottFang@viatech.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/via/hw.c')
-rw-r--r--drivers/video/via/hw.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 47d9024d7c30..1823253a6f40 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -691,7 +691,7 @@ void viafb_set_primary_color_depth(u8 depth)
691 691
692 DEBUG_MSG(KERN_DEBUG "viafb_set_primary_color_depth(%d)\n", depth); 692 DEBUG_MSG(KERN_DEBUG "viafb_set_primary_color_depth(%d)\n", depth);
693 switch (depth) { 693 switch (depth) {
694 case 6: 694 case 8:
695 value = 0x00; 695 value = 0x00;
696 break; 696 break;
697 case 16: 697 case 16:
@@ -715,7 +715,7 @@ void viafb_set_secondary_color_depth(u8 depth)
715 715
716 DEBUG_MSG(KERN_DEBUG "viafb_set_secondary_color_depth(%d)\n", depth); 716 DEBUG_MSG(KERN_DEBUG "viafb_set_secondary_color_depth(%d)\n", depth);
717 switch (depth) { 717 switch (depth) {
718 case 6: 718 case 8:
719 value = 0x00; 719 value = 0x00;
720 break; 720 break;
721 case 16: 721 case 16:
@@ -733,6 +733,27 @@ void viafb_set_secondary_color_depth(u8 depth)
733 viafb_write_reg_mask(0x67, VIACR, value, 0xC0); 733 viafb_write_reg_mask(0x67, VIACR, value, 0xC0);
734} 734}
735 735
736static void set_color_register(u8 index, u8 red, u8 green, u8 blue)
737{
738 outb(0xFF, 0x3C6); /* bit mask of palette */
739 outb(index, 0x3C8);
740 outb(red, 0x3C9);
741 outb(green, 0x3C9);
742 outb(blue, 0x3C9);
743}
744
745void viafb_set_primary_color_register(u8 index, u8 red, u8 green, u8 blue)
746{
747 viafb_write_reg_mask(0x1A, VIASR, 0x00, 0x01);
748 set_color_register(index, red, green, blue);
749}
750
751void viafb_set_secondary_color_register(u8 index, u8 red, u8 green, u8 blue)
752{
753 viafb_write_reg_mask(0x1A, VIASR, 0x01, 0x01);
754 set_color_register(index, red, green, blue);
755}
756
736void viafb_set_output_path(int device, int set_iga, int output_interface) 757void viafb_set_output_path(int device, int set_iga, int output_interface)
737{ 758{
738 switch (device) { 759 switch (device) {
@@ -2210,8 +2231,7 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
2210 outb(VPIT.SR[i - 1], VIASR + 1); 2231 outb(VPIT.SR[i - 1], VIASR + 1);
2211 } 2232 }
2212 2233
2213 viafb_write_reg_mask(0x15, VIASR, viafbinfo->fix.visual 2234 viafb_write_reg_mask(0x15, VIASR, 0xA2, 0xA2);
2214 == FB_VISUAL_PSEUDOCOLOR ? 0x22 : 0xA2, 0xA2);
2215 viafb_set_iga_path(); 2235 viafb_set_iga_path();
2216 2236
2217 /* Write CRTC */ 2237 /* Write CRTC */