From patchwork Mon Mar 10 03:44:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish S X-Patchwork-Id: 3808251 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2950A9F1CD for ; Mon, 10 Mar 2014 23:52:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49DDB202A1 for ; Mon, 10 Mar 2014 23:52:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C42A620221 for ; Mon, 10 Mar 2014 23:51:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF699FA904; Mon, 10 Mar 2014 16:51:46 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 21C97FA33F for ; Sun, 9 Mar 2014 20:44:30 -0700 (PDT) Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N2700L5WBQ4HR60@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 10 Mar 2014 12:44:28 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 42.AE.09028.C153D135; Mon, 10 Mar 2014 12:44:28 +0900 (KST) X-AuditID: cbfee68e-b7f566d000002344-9f-531d351c1a6f Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 71.47.28157.C153D135; Mon, 10 Mar 2014 12:44:28 +0900 (KST) Received: from chrome-server.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N2700FHJBPGCHK0@mmp2.samsung.com>; Mon, 10 Mar 2014 12:44:28 +0900 (KST) From: Shirish S To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [PATCH] drm/exynos: set the active aspect ratio as per mode Date: Mon, 10 Mar 2014 09:14:46 +0530 Message-id: <1394423086-21383-1-git-send-email-s.shirish@samsung.com> X-Mailer: git-send-email 1.7.10.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsWyRsSkWlfGVDbY4MQtXYsrX9+zWUy6P4HF YtrsjYwWTTsOsjmweMxuuMjicb/7OJNH35ZVjAHMUVw2Kak5mWWpRfp2CVwZB+/8YyvYK1Xx eFoXSwPjW9EuRk4OCQETiZ8v1rBA2GISF+6tZ+ti5OIQEljKKDFj9Qd2mKK1nbuYQGwhgemM EtNn1EAU9TJJnD/wmhUkwSagLnFx8mpmEFtEwFLiwdbfYDazgLXE6junGEFsYQEXiTOP1wAN 5eBgEVCVeNocCmLyCrhKtG5Wg1ilKNH9bALYDRICj9kkdmydwgaSYBEQkPg2+RALSL2EgKzE pgPMEPWSEgdX3GCZwCi4gJFhFaNoakFyQXFSepGRXnFibnFpXrpecn7uJkZgCJ7+96xvB+PN A9aHGJOBxk1klhJNzgeGcF5JvKGxmZGFqYmpsZG5pRlpwkrivIseJgUJCaQnlqRmp6YWpBbF F5XmpBYfYmTi4JRqYGSayLz78rU9943UvddvDsh+t+iA8TOhUI2EeMcVE+7t5Jk25yPn0o7L wh3Xe8q+KScem3SmbqMI/4lHuas2bszgj1xy/vstv41z5zDGOzp9im/+nzpVrfFq9a9cY5b3 WvG3Uzc3mB7Yslvo07IbrTyNq18+m7Lr0O3V8dfOtTwxK2hg/MlqF2mvxFKckWioxVxUnAgA WMdXwFcCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIIsWRmVeSWpSXmKPExsVy+t9jQV0ZU9lggwkbVC2ufH3PZjHp/gQW i2mzNzJaNO04yObA4jG74SKLx/3u40wefVtWMQYwRzUw2mSkJqakFimk5iXnp2TmpdsqeQfH O8ebmhkY6hpaWpgrKeQl5qbaKrn4BOi6ZeYA7VNSKEvMKQUKBSQWFyvp22GaEBripmsB0xih 6xsSBNdjZIAGEtYwZhy884+tYK9UxeNpXSwNjG9Fuxg5OSQETCTWdu5igrDFJC7cW88GYgsJ TGeUmD6jpouRC8juZZI4f+A1K0iCTUBd4uLk1cwgtoiApcSDrb/BbGYBa4nVd04xgtjCAi4S Zx6vYe9i5OBgEVCVeNocCmLyCrhKtG5Wg1ilKNH9bALbBEbuBYwMqxhFUwuSC4qT0nON9IoT c4tL89L1kvNzNzGCA/yZ9A7GVQ0WhxgFOBiVeHgPvJUJFmJNLCuuzD3EKMHBrCTCy2UoGyzE m5JYWZValB9fVJqTWnyIMRlo90RmKdHkfGD05ZXEGxqbmJsam1qaWJiYWZImrCTOe7DVOlBI ID2xJDU7NbUgtQhmCxMHp1QD43KR9Cf6u1yL5r39/1uJ97bxjprzbgFTeuem1wtw7PxzZd9u +Y7fl6/IK3LsOe6V3f7OvbBQ+toU9/ypD1OM8+vidtzXkbp1q+tIyM8jl3T+sk7bJFb8aamF j1up9Nzo2cum6XQzGU058ulc6LZyqdC1r2dzrJpY93Rj4aniiVlzPOuWze64Kq3EUpyRaKjF XFScCADB3T+htAIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Mon, 10 Mar 2014 16:51:37 -0700 Cc: shirish@chromium.org, Shirish S X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 now that the drm_display_mode also provides aspect ratio for all resolutions, this patch adds its usage to set the active aspect ratio of AVI info frame packets as per CEA-861-D standard's Table 9. This is also needed to abide by the 7-27 compliance test of HDMI. Signed-off-by: Shirish S --- drivers/gpu/drm/exynos/exynos_hdmi.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index c021ddc..8aca52a 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -53,8 +53,6 @@ /* AVI header and aspect ratio */ #define HDMI_AVI_VERSION 0x02 #define HDMI_AVI_LENGTH 0x0D -#define AVI_PIC_ASPECT_RATIO_16_9 (2 << 4) -#define AVI_SAME_AS_PIC_ASPECT_RATIO 8 /* AUI header info */ #define HDMI_AUI_VERSION 0x01 @@ -65,6 +63,12 @@ enum hdmi_type { HDMI_TYPE14, }; +enum active_aspect_ratio { + AVI_SAME_AS_PIC_ASPECT_RATIO = 8, + AVI_4_3_Center_RATIO, + AVI_16_9_Center_RATIO, +}; + struct hdmi_resources { struct clk *hdmi; struct clk *sclk_hdmi; @@ -162,6 +166,7 @@ struct hdmi_v14_conf { struct hdmi_conf_regs { int pixel_clock; int cea_video_id; + enum hdmi_picture_aspect aspect_ratio; union { struct hdmi_v13_conf v13_conf; struct hdmi_v14_conf v14_conf; @@ -668,7 +673,6 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, { u32 hdr_sum; u8 chksum; - u32 aspect_ratio; u32 mod; u32 vic; @@ -697,10 +701,25 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, AVI_ACTIVE_FORMAT_VALID | AVI_UNDERSCANNED_DISPLAY_VALID); - aspect_ratio = AVI_PIC_ASPECT_RATIO_16_9; - - hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), aspect_ratio | + /* + * Set the aspect ratio as per the mode, mentioned in + * Table 9 AVI InfoFrame Data Byte 2 of CEA-861-D Standard + */ + switch (hdata->mode_conf.aspect_ratio) { + case HDMI_PICTURE_ASPECT_4_3: + hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), aspect_ratio | + AVI_4_3_Center_RATIO); + break; + case HDMI_PICTURE_ASPECT_16_9: + hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), aspect_ratio | + AVI_16_9_Center_RATIO); + break; + case HDMI_PICTURE_ASPECT_NONE: + default: + hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), aspect_ratio | AVI_SAME_AS_PIC_ASPECT_RATIO); + break; + } vic = hdata->mode_conf.cea_video_id; hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(4), vic); @@ -1421,6 +1440,7 @@ static void hdmi_v13_mode_set(struct hdmi_context *hdata, hdata->mode_conf.cea_video_id = drm_match_cea_mode((struct drm_display_mode *)m); hdata->mode_conf.pixel_clock = m->clock * 1000; + hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio; hdmi_set_reg(core->h_blank, 2, m->htotal - m->hdisplay); hdmi_set_reg(core->h_v_line, 3, (m->htotal << 12) | m->vtotal); @@ -1517,6 +1537,7 @@ static void hdmi_v14_mode_set(struct hdmi_context *hdata, hdata->mode_conf.cea_video_id = drm_match_cea_mode((struct drm_display_mode *)m); hdata->mode_conf.pixel_clock = m->clock * 1000; + hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio; hdmi_set_reg(core->h_blank, 2, m->htotal - m->hdisplay); hdmi_set_reg(core->v_line, 2, m->vtotal);