aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ast/ast_main.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-01-16 19:56:09 -0500
committerDave Airlie <airlied@redhat.com>2014-05-18 21:13:55 -0400
commitf1f62f2ccba0967c493ac9ad31c9b04d29688aaa (patch)
tree18549684b758fdfca521cc95ff3c289c6f54149f /drivers/gpu/drm/ast/ast_main.c
parentbf21d605bf7d18d2b3cdb1c19fc1b2a1549c1f11 (diff)
drm/ast: add widescreen + rb modes from X.org driver (v2)
This syncs up the mode code from the X.org driver upstream, and adds the mode validation step for hw that doesn't have widescreen. v2: (from Egbert Eich <eich@suse.de) squash drm/ast: Use correct structure member for mode validation to avoid bisect regression. In struct drm_display_mode crtc_hdisplay and crtc_vdisplay are holding the crtc parameters after mode fixup. For validation we need hdisplay and vdisplay. Signed-off-by: Egbert Eich <eich@suse.de> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/ast/ast_main.c')
-rw-r--r--drivers/gpu/drm/ast/ast_main.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 50535fd5a88d..cd0a791e76c5 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -66,6 +66,7 @@ uint8_t ast_get_index_reg_mask(struct ast_private *ast,
66static int ast_detect_chip(struct drm_device *dev) 66static int ast_detect_chip(struct drm_device *dev)
67{ 67{
68 struct ast_private *ast = dev->dev_private; 68 struct ast_private *ast = dev->dev_private;
69 uint32_t data, jreg;
69 70
70 if (dev->pdev->device == PCI_CHIP_AST1180) { 71 if (dev->pdev->device == PCI_CHIP_AST1180) {
71 ast->chip = AST1100; 72 ast->chip = AST1100;
@@ -104,6 +105,33 @@ static int ast_detect_chip(struct drm_device *dev)
104 DRM_INFO("AST 2000 detected\n"); 105 DRM_INFO("AST 2000 detected\n");
105 } 106 }
106 } 107 }
108
109 switch (ast->chip) {
110 case AST1180:
111 ast->support_wide_screen = true;
112 break;
113 case AST2000:
114 ast->support_wide_screen = false;
115 break;
116 default:
117 jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff);
118 if (!(jreg & 0x80))
119 ast->support_wide_screen = true;
120 else if (jreg & 0x01)
121 ast->support_wide_screen = true;
122 else {
123 ast->support_wide_screen = false;
124 if (ast->chip == AST2300) {
125 ast_write32(ast, 0xf004, 0x1e6e0000);
126 ast_write32(ast, 0xf000, 0x1);
127 data = ast_read32(ast, 0x1207c);
128 if ((data & 0x300) == 0) /* ast1300 */
129 ast->support_wide_screen = true;
130 }
131 }
132 break;
133 }
134
107 return 0; 135 return 0;
108} 136}
109 137