From patchwork Wed Mar 23 16:07:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Abreu X-Patchwork-Id: 8655401 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1073E9F3D1 for ; Thu, 24 Mar 2016 00:19:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F17020374 for ; Thu, 24 Mar 2016 00:19:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6940C202FE for ; Thu, 24 Mar 2016 00:19:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C81276E40A; Thu, 24 Mar 2016 00:19:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtprelay.synopsys.com (us01smtprelay-2.synopsys.com [198.182.60.111]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5B83B6E013 for ; Wed, 23 Mar 2016 16:08:22 +0000 (UTC) Received: from us02secmta1.synopsys.com (us02secmta1.synopsys.com [10.12.235.96]) by smtprelay.synopsys.com (Postfix) with ESMTP id B8CEF10C028E; Wed, 23 Mar 2016 09:08:19 -0700 (PDT) Received: from us02secmta1.internal.synopsys.com (us02secmta1.internal.synopsys.com [127.0.0.1]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 6A2A14E213; Wed, 23 Mar 2016 09:08:19 -0700 (PDT) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 2CB6D4E202; Wed, 23 Mar 2016 09:08:19 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 14258267; Wed, 23 Mar 2016 09:08:19 -0700 (PDT) Received: from joabreu-VirtualBox.internal.synopsys.com (joabreu-e7440.internal.synopsys.com [10.107.19.68]) by mailhost.synopsys.com (Postfix) with ESMTP id 66461245; Wed, 23 Mar 2016 09:08:15 -0700 (PDT) From: Jose Abreu To: dri-devel@lists.freedesktop.org Subject: [PATCH] adv7511: Set picture aspect ratio Date: Wed, 23 Mar 2016 16:07:47 +0000 Message-Id: <6291bd2d7940b78d0c476ab7ec28696c923dca4c.1458743880.git.joabreu@synopsys.com> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Thu, 24 Mar 2016 00:19:41 +0000 Cc: Jose.Abreu@synopsys.com, daniel.vetter@ffwll.ch, nariman@opensource.wolfsonmicro.com, CARLOS.PALMINHA@synopsys.com, wsa+renesas@sang-engineering.com, broonie@kernel.org, laurent.pinchart+renesas@ideasonboard.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 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.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 As of current version the picture aspect ratio and active aspect ratio are not being set when the video mode changes. This patch fixes this problem by setting the picture aspect ratio according to the current video mode and also sets the active aspect ratio to be the same as picture aspect ratio. Signed-off-by: Jose Abreu --- drivers/gpu/drm/i2c/adv7511.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c index a02112b..c9aa83a 100644 --- a/drivers/gpu/drm/i2c/adv7511.c +++ b/drivers/gpu/drm/i2c/adv7511.c @@ -672,7 +672,7 @@ static void adv7511_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *adj_mode) { struct adv7511 *adv7511 = encoder_to_adv7511(encoder); - unsigned int low_refresh_rate; + unsigned int low_refresh_rate, picture_aspect; unsigned int hsync_polarity = 0; unsigned int vsync_polarity = 0; @@ -754,6 +754,26 @@ static void adv7511_encoder_mode_set(struct drm_encoder *encoder, regmap_update_bits(adv7511->regmap, 0x17, 0x60, (vsync_polarity << 6) | (hsync_polarity << 5)); + switch (adj_mode->picture_aspect_ratio) { + case HDMI_PICTURE_ASPECT_NONE: + picture_aspect = 0x0; + break; + case HDMI_PICTURE_ASPECT_4_3: + picture_aspect = 0x1; + break; + case HDMI_PICTURE_ASPECT_16_9: + picture_aspect = 0x2; + break; + default: + picture_aspect = 0x3; + break; + } + + regmap_update_bits(adv7511->regmap, ADV7511_REG_AVI_INFOFRAME(1), + 0x30, (picture_aspect << 4)); + regmap_update_bits(adv7511->regmap, ADV7511_REG_AVI_INFOFRAME(1), + 0x0F, 0x08); + /* * TODO Test first order 4:2:2 to 4:4:4 up conversion method, which is * supposed to give better results.