]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - drivers/video/via/hw.c
viafb: add interface for output device configuration
[~shefty/rdma-dev.git] / drivers / video / via / hw.c
index 03303232e543b08af4a94bc2733c946029e577c3..e65edcea46eb81cbc474daf3eb3e11ec79d97d0a 100644 (file)
@@ -718,6 +718,16 @@ static struct rgbLUT palLUT_table[] = {
                                                                     0x00}
 };
 
+static struct via_device_mapping device_mapping[] = {
+       {VIA_6C, "6C"},
+       {VIA_93, "93"},
+       {VIA_96, "96"},
+       {VIA_CRT, "CRT"},
+       {VIA_DVP1, "DVP1"},
+       {VIA_LVDS1, "LVDS1"},
+       {VIA_LVDS2, "LVDS2"}
+};
+
 static void load_fix_bit_crtc_reg(void);
 static void __devinit init_gfx_chip_info(int chip_type);
 static void __devinit init_tmds_chip_info(void);
@@ -1026,6 +1036,49 @@ void via_set_source(u32 devices, u8 iga)
                set_lvds2_source(iga);
 }
 
+u32 via_parse_odev(char *input, char **end)
+{
+       char *ptr = input;
+       u32 odev = 0;
+       bool next = true;
+       int i, len;
+
+       while (next) {
+               next = false;
+               for (i = 0; i < ARRAY_SIZE(device_mapping); i++) {
+                       len = strlen(device_mapping[i].name);
+                       if (!strncmp(ptr, device_mapping[i].name, len)) {
+                               odev |= device_mapping[i].device;
+                               ptr += len;
+                               if (*ptr == ',') {
+                                       ptr++;
+                                       next = true;
+                               }
+                       }
+               }
+       }
+
+       *end = ptr;
+       return odev;
+}
+
+void via_odev_to_seq(struct seq_file *m, u32 odev)
+{
+       int i, count = 0;
+
+       for (i = 0; i < ARRAY_SIZE(device_mapping); i++) {
+               if (odev & device_mapping[i].device) {
+                       if (count > 0)
+                               seq_putc(m, ',');
+
+                       seq_puts(m, device_mapping[i].name);
+                       count++;
+               }
+       }
+
+       seq_putc(m, '\n');
+}
+
 static void load_fix_bit_crtc_reg(void)
 {
        /* always set to 1 */