diff options
author | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2010-08-09 22:44:44 -0400 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2010-09-23 22:14:50 -0400 |
commit | 18d9dc08b22145adb248d16dd2cefb2ccf9f7665 (patch) | |
tree | d08dc3ce61e4f1c0cc69d5d876ed8e32a1377708 /drivers/video/via | |
parent | 661c65cd0ce180d5e3a3e05f08fc9e64cedcf91c (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')
-rw-r--r-- | drivers/video/via/hw.c | 102 | ||||
-rw-r--r-- | drivers/video/via/hw.h | 9 | ||||
-rw-r--r-- | drivers/video/via/viafbdev.h | 3 |
3 files changed, 114 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 | ||
756 | static 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 | |||
787 | static 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*/ |
757 | void viafb_set_iga_path(void) | 817 | void 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 | ||
824 | static void set_color_register(u8 index, u8 red, u8 green, u8 blue) | 926 | static void set_color_register(u8 index, u8 red, u8 green, u8 blue) |
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h index 39f3a69bbbd8..c52a1d5f092d 100644 --- a/drivers/video/via/hw.h +++ b/drivers/video/via/hw.h | |||
@@ -30,6 +30,15 @@ | |||
30 | #define viafb_write_reg(i, p, d) via_write_reg(p, i, d) | 30 | #define viafb_write_reg(i, p, d) via_write_reg(p, i, d) |
31 | #define viafb_write_reg_mask(i, p, d, m) via_write_reg_mask(p, i, d, m) | 31 | #define viafb_write_reg_mask(i, p, d, m) via_write_reg_mask(p, i, d, m) |
32 | 32 | ||
33 | /* VIA output devices */ | ||
34 | #define VIA_6C 0x00000001 | ||
35 | #define VIA_93 0x00000002 | ||
36 | #define VIA_96 0x00000004 | ||
37 | #define VIA_CRT 0x00000010 | ||
38 | #define VIA_DVP1 0x00000020 | ||
39 | #define VIA_LVDS1 0x00000040 | ||
40 | #define VIA_LVDS2 0x00000080 | ||
41 | |||
33 | /*************************************************** | 42 | /*************************************************** |
34 | * Definition IGA1 Design Method of CRTC Registers * | 43 | * Definition IGA1 Design Method of CRTC Registers * |
35 | ****************************************************/ | 44 | ****************************************************/ |
diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h index 52a35fabba91..945a47a63c4d 100644 --- a/drivers/video/via/viafbdev.h +++ b/drivers/video/via/viafbdev.h | |||
@@ -40,6 +40,9 @@ | |||
40 | #define VIAFB_NUM_I2C 5 | 40 | #define VIAFB_NUM_I2C 5 |
41 | 41 | ||
42 | struct viafb_shared { | 42 | struct viafb_shared { |
43 | u32 iga1_devices; | ||
44 | u32 iga2_devices; | ||
45 | |||
43 | struct proc_dir_entry *proc_entry; /*viafb proc entry */ | 46 | struct proc_dir_entry *proc_entry; /*viafb proc entry */ |
44 | struct viafb_dev *vdev; /* Global dev info */ | 47 | struct viafb_dev *vdev; /* Global dev info */ |
45 | 48 | ||