aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/hw.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-08-09 22:44:44 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-09-23 22:14:50 -0400
commit18d9dc08b22145adb248d16dd2cefb2ccf9f7665 (patch)
treed08dc3ce61e4f1c0cc69d5d876ed8e32a1377708 /drivers/video/via/hw.c
parent661c65cd0ce180d5e3a3e05f08fc9e64cedcf91c (diff)
viafb: add new output device management
This patch adds a new output device management that stores for each IGA which output devices are routed to it and a compatiblity layer that converts the old per-output device values in the new format. Bounding the output devices to each IGA is a central idea of the cleanup. Doing it this way should be easier and make much more sense than the old format which happily mixed different output devices together and did not even take into account that some devices are no longer available on newer chipsets. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw>
Diffstat (limited to 'drivers/video/via/hw.c')
-rw-r--r--drivers/video/via/hw.c102
1 files changed, 102 insertions, 0 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 638cf96c8739..30cc2f0961e3 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -753,6 +753,66 @@ void write_dac_reg(u8 index, u8 r, u8 g, u8 b)
753 outb(b, LUT_DATA); 753 outb(b, LUT_DATA);
754} 754}
755 755
756static u32 get_dvi_devices(int output_interface)
757{
758 switch (output_interface) {
759 case INTERFACE_DVP0:
760 return VIA_96 | VIA_6C;
761
762 case INTERFACE_DVP1:
763 if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)
764 return VIA_93;
765 else
766 return VIA_DVP1;
767
768 case INTERFACE_DFP_HIGH:
769 if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)
770 return 0;
771 else
772 return VIA_LVDS2 | VIA_96;
773
774 case INTERFACE_DFP_LOW:
775 if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)
776 return 0;
777 else
778 return VIA_DVP1 | VIA_LVDS1;
779
780 case INTERFACE_TMDS:
781 return VIA_LVDS1;
782 }
783
784 return 0;
785}
786
787static u32 get_lcd_devices(int output_interface)
788{
789 switch (output_interface) {
790 case INTERFACE_DVP0:
791 return VIA_96;
792
793 case INTERFACE_DVP1:
794 return VIA_DVP1;
795
796 case INTERFACE_DFP_HIGH:
797 return VIA_LVDS2 | VIA_96;
798
799 case INTERFACE_DFP_LOW:
800 return VIA_LVDS1 | VIA_DVP1;
801
802 case INTERFACE_DFP:
803 return VIA_LVDS1 | VIA_LVDS2;
804
805 case INTERFACE_LVDS0:
806 case INTERFACE_LVDS0LVDS1:
807 return VIA_LVDS1;
808
809 case INTERFACE_LVDS1:
810 return VIA_LVDS2;
811 }
812
813 return 0;
814}
815
756/*Set IGA path for each device*/ 816/*Set IGA path for each device*/
757void viafb_set_iga_path(void) 817void viafb_set_iga_path(void)
758{ 818{
@@ -819,6 +879,48 @@ void viafb_set_iga_path(void)
819 viaparinfo->tmds_setting_info->iga_path = IGA1; 879 viaparinfo->tmds_setting_info->iga_path = IGA1;
820 } 880 }
821 } 881 }
882
883 viaparinfo->shared->iga1_devices = 0;
884 viaparinfo->shared->iga2_devices = 0;
885 if (viafb_CRT_ON) {
886 if (viaparinfo->crt_setting_info->iga_path == IGA1)
887 viaparinfo->shared->iga1_devices |= VIA_CRT;
888 else
889 viaparinfo->shared->iga2_devices |= VIA_CRT;
890 }
891
892 if (viafb_DVI_ON) {
893 if (viaparinfo->tmds_setting_info->iga_path == IGA1)
894 viaparinfo->shared->iga1_devices |= get_dvi_devices(
895 viaparinfo->chip_info->
896 tmds_chip_info.output_interface);
897 else
898 viaparinfo->shared->iga2_devices |= get_dvi_devices(
899 viaparinfo->chip_info->
900 tmds_chip_info.output_interface);
901 }
902
903 if (viafb_LCD_ON) {
904 if (viaparinfo->lvds_setting_info->iga_path == IGA1)
905 viaparinfo->shared->iga1_devices |= get_lcd_devices(
906 viaparinfo->chip_info->
907 lvds_chip_info.output_interface);
908 else
909 viaparinfo->shared->iga2_devices |= get_lcd_devices(
910 viaparinfo->chip_info->
911 lvds_chip_info.output_interface);
912 }
913
914 if (viafb_LCD2_ON) {
915 if (viaparinfo->lvds_setting_info2->iga_path == IGA1)
916 viaparinfo->shared->iga1_devices |= get_lcd_devices(
917 viaparinfo->chip_info->
918 lvds_chip_info2.output_interface);
919 else
920 viaparinfo->shared->iga2_devices |= get_lcd_devices(
921 viaparinfo->chip_info->
922 lvds_chip_info2.output_interface);
923 }
822} 924}
823 925
824static void set_color_register(u8 index, u8 red, u8 green, u8 blue) 926static void set_color_register(u8 index, u8 red, u8 green, u8 blue)