sisfb: add subroutine for detecting XGI Z9
authorAaro Koskinen <aaro.koskinen@iki.fi>
Sun, 13 Feb 2011 22:11:25 +0000 (22:11 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Tue, 22 Mar 2011 06:20:30 +0000 (15:20 +0900)
Z7 and Z9 have the same PCI ID, so additional checking is needed to
detect Z9. The method was "documented" in XGI's xgifb driver.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
drivers/video/sis/sis.h
drivers/video/sis/sis_main.c
drivers/video/sis/vgatypes.h

index eac7a01925f3d26e03ab33cc2650a76278993391..1987f1b7212f40732c2c28315d3791b3d08d2652 100644 (file)
@@ -495,6 +495,7 @@ struct sis_video_info {
        unsigned int    refresh_rate;
 
        unsigned int    chip;
+       unsigned int    chip_real_id;
        u8              revision_id;
        int             sisvga_enabled;         /* PCI device was enabled */
 
index 364559b12fc5c9dcd90eed4047fa5d1a582d2c3b..f0c48e84bcdbcc515be6deecc7a536bd2aef4ba1 100644 (file)
@@ -4563,6 +4563,11 @@ sisfb_post_sis315330(struct pci_dev *pdev)
 }
 #endif
 
+static inline int sisfb_xgi_is21(struct sis_video_info *ivideo)
+{
+       return ivideo->chip_real_id == XGI_21;
+}
+
 static void __devinit
 sisfb_post_xgi_delay(struct sis_video_info *ivideo, int delay)
 {
@@ -5802,6 +5807,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 #endif
 
        ivideo->chip = chipinfo->chip;
+       ivideo->chip_real_id = chipinfo->chip;
        ivideo->sisvga_engine = chipinfo->vgaengine;
        ivideo->hwcursor_size = chipinfo->hwcursor_size;
        ivideo->CRT2_write_enable = chipinfo->CRT2_write_enable;
@@ -6035,6 +6041,18 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                sisfb_detect_custom_timing(ivideo);
        }
 
+#ifdef CONFIG_FB_SIS_315
+       if (ivideo->chip == XGI_20) {
+               /* Check if our Z7 chip is actually Z9 */
+               SiS_SetRegOR(SISCR, 0x4a, 0x40);        /* GPIOG EN */
+               reg = SiS_GetReg(SISCR, 0x48);
+               if (reg & 0x02) {                       /* GPIOG */
+                       ivideo->chip_real_id = XGI_21;
+                       dev_info(&pdev->dev, "Z9 detected\n");
+               }
+       }
+#endif
+
        /* POST card in case this has not been done by the BIOS */
        if( (!ivideo->sisvga_enabled)
 #if !defined(__i386__) && !defined(__x86_64__)
index 12c0dfaf251876baf61b54ce5fe848e73151d371..e3f9976cfef084ee5fcde6236d96424adc4c6f10 100644 (file)
@@ -87,6 +87,7 @@ typedef enum _SIS_CHIP_TYPE {
     SIS_341,
     SIS_342,
     XGI_20  = 75,
+    XGI_21,
     XGI_40,
     MAX_SIS_CHIP
 } SIS_CHIP_TYPE;