aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/hw.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-09-04 21:33:28 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-09-23 22:14:59 -0400
commit2a9183923af1f6f4da66aeabf9fa5af0dc58ccec (patch)
tree710f8f8fc1b5f922e4c6405abf60eedaff5eb715 /drivers/video/via/hw.c
parentcd7e9103e983ff0f518ac0e85cee265027ccbfa4 (diff)
viafb: add interface for output device configuration
This patch extends the proc entry to contain a possibility to view and change the output devices for each IGA. This is useful for debugging output problems as it provides a reliable way to query which low level devices are active after VIAs output device configuration nightmare happended. It's as well suitable for daily use as one can change the output configuration on the fly for example to connect a projector. At the moment it's still unstable. The reason is that we have to handle a bunch of undocumented output devices (those without a proper name) and that this patch is the first step to collect and verify the needed information. Basically the only configuration change that is expected to work at the moment is switching output devices between IGA1 and IGA2. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Acked-by: Jonathan Corbet <corbet@lwn.net> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'drivers/video/via/hw.c')
-rw-r--r--drivers/video/via/hw.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 03303232e543..e65edcea46eb 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -718,6 +718,16 @@ static struct rgbLUT palLUT_table[] = {
718 0x00} 718 0x00}
719}; 719};
720 720
721static struct via_device_mapping device_mapping[] = {
722 {VIA_6C, "6C"},
723 {VIA_93, "93"},
724 {VIA_96, "96"},
725 {VIA_CRT, "CRT"},
726 {VIA_DVP1, "DVP1"},
727 {VIA_LVDS1, "LVDS1"},
728 {VIA_LVDS2, "LVDS2"}
729};
730
721static void load_fix_bit_crtc_reg(void); 731static void load_fix_bit_crtc_reg(void);
722static void __devinit init_gfx_chip_info(int chip_type); 732static void __devinit init_gfx_chip_info(int chip_type);
723static void __devinit init_tmds_chip_info(void); 733static void __devinit init_tmds_chip_info(void);
@@ -1026,6 +1036,49 @@ void via_set_source(u32 devices, u8 iga)
1026 set_lvds2_source(iga); 1036 set_lvds2_source(iga);
1027} 1037}
1028 1038
1039u32 via_parse_odev(char *input, char **end)
1040{
1041 char *ptr = input;
1042 u32 odev = 0;
1043 bool next = true;
1044 int i, len;
1045
1046 while (next) {
1047 next = false;
1048 for (i = 0; i < ARRAY_SIZE(device_mapping); i++) {
1049 len = strlen(device_mapping[i].name);
1050 if (!strncmp(ptr, device_mapping[i].name, len)) {
1051 odev |= device_mapping[i].device;
1052 ptr += len;
1053 if (*ptr == ',') {
1054 ptr++;
1055 next = true;
1056 }
1057 }
1058 }
1059 }
1060
1061 *end = ptr;
1062 return odev;
1063}
1064
1065void via_odev_to_seq(struct seq_file *m, u32 odev)
1066{
1067 int i, count = 0;
1068
1069 for (i = 0; i < ARRAY_SIZE(device_mapping); i++) {
1070 if (odev & device_mapping[i].device) {
1071 if (count > 0)
1072 seq_putc(m, ',');
1073
1074 seq_puts(m, device_mapping[i].name);
1075 count++;
1076 }
1077 }
1078
1079 seq_putc(m, '\n');
1080}
1081
1029static void load_fix_bit_crtc_reg(void) 1082static void load_fix_bit_crtc_reg(void)
1030{ 1083{
1031 /* always set to 1 */ 1084 /* always set to 1 */