From patchwork Fri Aug 22 03:00:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Y.C. Chen" X-Patchwork-Id: 4762751 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 537D4C0338 for ; Fri, 22 Aug 2014 10:07:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 534782018A for ; Fri, 22 Aug 2014 10:07:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3A7AF2017A for ; Fri, 22 Aug 2014 10:07:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6231F6E874; Fri, 22 Aug 2014 03:07:19 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from msr12.hinet.net (msr12.hinet.net [168.95.4.112]) by gabe.freedesktop.org (Postfix) with ESMTP id A98E16E845 for ; Thu, 21 Aug 2014 20:00:55 -0700 (PDT) Received: from localhost.localdomain.com (211-20-114-70.HINET-IP.hinet.net [211.20.114.70]) (authenticated bits=0) by msr12.hinet.net (8.14.2/8.14.2) with ESMTP id s7M30hKi021025; Fri, 22 Aug 2014 11:00:48 +0800 (CST) From: "Y.C. Chen" To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/ast: Add reduced/non-reduced mode parsing for wide screen mode Date: Fri, 22 Aug 2014 11:00:18 +0800 Message-Id: <1408676418-29890-2-git-send-email-yc_chen@aspeedtech.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1408676418-29890-1-git-send-email-yc_chen@aspeedtech.com> References: <1408676418-29890-1-git-send-email-yc_chen@aspeedtech.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCrMTGxXJZpMhNN2HTt2CDSb/ELK58fc9mcfXWAiaLw93zmS0a/31h tej6dY/ZgdXjfvdxJo/3+66yeazfcpXFo+vuffYAlijWzLyk/IoE1oyl1x6xF/y0qThybxtT A2OPQRcjJ4eQQKTE9uctrCA2m4CWxOepM5hAbBEBZYm/E1cxgtjMArkSd+Y8YAOxhQXCJY4v O8YCYrMIqErsf/8JrJ5XwE3i+8qjYLaEgILElIfvmUFsTgF3iYvdG1ghdrlJPF+xnXkCI9cq RpHc4kTd4txiQ10TvYzMvNQSPSDexAj07op4dq8djGdPGh5iZOLgPMQowMGoxMP7ifFGsBBr YllxZS5InPsQoyQHk5Io79oV34KF+JLyUyozEosz4otKc1KLDzFKcPAoifCu3wCU4y0uSMwt zkyHSclwcChJ8LaDpASLUtNTK9Iyc0pSiyDSpxh1OebtfdvLJMSSl5+XKiXOe249UKEAyIyM 0jy4Oli0XGKUlRLmbV4DVMNTkFqUm1mCKv+KURzoemGIS3gy80rgDnkFdCMT0I3WM7+C3FiS iJACALjSprz5AQAA X-Mailman-Approved-At: Fri, 22 Aug 2014 03:07:09 -0700 Cc: airlied@redhat.com, "Y.C. Chen" , eich@suse.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Y.C. Chen" Signed-off-by: Y.C. Chen --- drivers/gpu/drm/ast/ast_mode.c | 32 +++++++++++++++++++++++------- drivers/gpu/drm/ast/ast_tables.h | 42 ++++++++++++++++++++++++---------------- 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 5389350..5533920 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -141,14 +141,30 @@ static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mo } refresh_rate = drm_mode_vrefresh(mode); - while (vbios_mode->enh_table->refresh_rate < refresh_rate) { - vbios_mode->enh_table++; - if ((vbios_mode->enh_table->refresh_rate > refresh_rate) || - (vbios_mode->enh_table->refresh_rate == 0xff)) { + do { + if ((vbios_mode->enh_table->flags & WideScreenMode) && + (((mode->flags & DRM_MODE_FLAG_NVSYNC) && + (vbios_mode->enh_table->flags & PVSync)) || + ((mode->flags & DRM_MODE_FLAG_PVSYNC) && + (vbios_mode->enh_table->flags & NVSync)) || + ((mode->flags & DRM_MODE_FLAG_NHSYNC) && + (vbios_mode->enh_table->flags & PHSync)) || + ((mode->flags & DRM_MODE_FLAG_PHSYNC) && + (vbios_mode->enh_table->flags & NHSync)))) { + vbios_mode->enh_table++; + continue; + } + if (vbios_mode->enh_table->refresh_rate < refresh_rate) { + vbios_mode->enh_table++; + } + if ((vbios_mode->enh_table->refresh_rate_index > 1) && + (vbios_mode->enh_table->refresh_rate > refresh_rate)) { vbios_mode->enh_table--; break; } - } + } while (vbios_mode->enh_table->refresh_rate != 0xff); + if (vbios_mode->enh_table->refresh_rate == 0xff) + vbios_mode->enh_table--; hborder = (vbios_mode->enh_table->flags & HBorder) ? 8 : 0; vborder = (vbios_mode->enh_table->flags & VBorder) ? 8 : 0; @@ -419,8 +435,10 @@ static void ast_set_sync_reg(struct drm_device *dev, struct drm_display_mode *mo struct ast_private *ast = dev->dev_private; u8 jreg; - jreg = ast_io_read8(ast, AST_IO_MISC_PORT_READ); - jreg |= (vbios_mode->enh_table->flags & SyncNN); + jreg = ast_io_read8(ast, AST_IO_MISC_PORT_READ); + jreg &= 0xC0; + if (vbios_mode->enh_table->flags & NVSync) jreg |= 0x80; + if (vbios_mode->enh_table->flags & NHSync) jreg |= 0x40; ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg); } diff --git a/drivers/gpu/drm/ast/ast_tables.h b/drivers/gpu/drm/ast/ast_tables.h index 05c01ea..28ce659 100644 --- a/drivers/gpu/drm/ast/ast_tables.h +++ b/drivers/gpu/drm/ast/ast_tables.h @@ -35,14 +35,18 @@ #define HalfDCLK 0x00000002 #define DoubleScanMode 0x00000004 #define LineCompareOff 0x00000008 -#define SyncPP 0x00000000 -#define SyncPN 0x00000040 -#define SyncNP 0x00000080 -#define SyncNN 0x000000C0 #define HBorder 0x00000020 #define VBorder 0x00000010 -#define WideScreenMode 0x00000100 -#define NewModeInfo 0x00000200 +#define WideScreenMode 0x00000100 +#define NewModeInfo 0x00000200 +#define NHSync 0x00000400 +#define PHSync 0x00000800 +#define NVSync 0x00001000 +#define PVSync 0x00002000 +#define SyncPP (PVSync | PHSync) +#define SyncPN (PVSync | NHSync) +#define SyncNP (NVSync | PHSync) +#define SyncNN (NVSync | NHSync) /* DCLK Index */ #define VCLK25_175 0x00 @@ -72,6 +76,7 @@ #define VCLK119 0x17 #define VCLK85_5 0x18 #define VCLK97_75 0x19 +#define VCLK118_25 0x1A static struct ast_vbios_dclk_info dclk_table[] = { {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */ @@ -100,6 +105,7 @@ static struct ast_vbios_dclk_info dclk_table[] = { {0x77, 0x58, 0x80}, /* 17: VCLK119 */ {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ {0x6a, 0x6d, 0x80}, /* 19: VCLK97_75 */ + {0x3b, 0x2c, 0x81}, /* 1A: VCLK118_25 */ }; static struct ast_vbios_stdtable vbios_stdtable[] = { @@ -246,8 +252,10 @@ static struct ast_vbios_enhtable res_1360x768[] = { static struct ast_vbios_enhtable res_1600x900[] = { {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */ (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x3A }, - {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* end */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x3A } + {2112, 1600, 88,168, 934, 900, 3, 5, VCLK118_25, /* 60Hz CVT */ + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x3A }, + {2112, 1600, 88,168, 934, 900, 3, 5, VCLK118_25, /* 60Hz CVT */ + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x3A }, }; static struct ast_vbios_enhtable res_1920x1080[] = { @@ -261,11 +269,11 @@ static struct ast_vbios_enhtable res_1920x1080[] = { /* 16:10 */ static struct ast_vbios_enhtable res_1280x800[] = { {1440, 1280, 48, 32, 823, 800, 3, 6, VCLK71, /* 60Hz RB */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 35 }, + (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x35 }, {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x35 }, + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x35 }, {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x35 }, + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x35 }, }; @@ -273,24 +281,24 @@ static struct ast_vbios_enhtable res_1440x900[] = { {1600, 1440, 48, 32, 926, 900, 3, 6, VCLK88_75, /* 60Hz RB */ (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x36 }, {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x36 }, + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x36 }, {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x36 }, + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x36 }, }; static struct ast_vbios_enhtable res_1680x1050[] = { {1840, 1680, 48, 32, 1080, 1050, 3, 6, VCLK119, /* 60Hz RB */ (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x37 }, {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x37 }, + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x37 }, {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x37 }, + (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x37 }, }; static struct ast_vbios_enhtable res_1920x1200[] = { - {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz */ + {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz RB*/ (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x34 }, - {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz */ + {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz RB */ (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x34 }, };