From patchwork Tue Dec 16 00:29:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 5499141 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 9E1E89F456 for ; Tue, 16 Dec 2014 01:09:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D28B0209D3 for ; Tue, 16 Dec 2014 01:09:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BAA1F209C7 for ; Tue, 16 Dec 2014 01:09:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B12526E672; Mon, 15 Dec 2014 17:08:38 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by gabe.freedesktop.org (Postfix) with ESMTP id C37126E5AB for ; Mon, 15 Dec 2014 16:31:10 -0800 (PST) Received: by mail-pd0-f180.google.com with SMTP id w10so12779000pde.39 for ; Mon, 15 Dec 2014 16:31:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KxBy63JqXrz6yNTzHwK4Z8YvSMzqdE8oapYS/V0ZXZI=; b=mSeSNv18IVp/bPCz3/gJD5uFMY+7C2fsbGKEjmC7jcoaNNyYsW8e9ebsggLgaIWJIl cmaVdq2yw5UjERb2COtMLtw88phSVDPXDEf4l6ESEy5GNBqMYTvDE8IPO61FKAZmr5w8 nut+NsHXK9qSha6hJJy4tt/vFaW6MR0WIrzQnOEzVF3/QmDFoRYvpojcMDcR20Gco61A HKRIc+pX0ZaazbgdpgBMN2Hr9QvZwjqyu5o5ubKunC0/UtYkM1Plfhbp0Mkl6coJB8/d iUa7mM8R3ABw1xx+KLZCvnVPZR5W0ZP0gNplz6woFTXdQ1J3MeilUazV1RcsG+pYDNRk Xu4Q== X-Received: by 10.66.246.130 with SMTP id xw2mr55178422pac.55.1418689870566; Mon, 15 Dec 2014 16:31:10 -0800 (PST) Received: from mothership.mgc.mentorg.com (c-50-152-159-227.hsd1.ca.comcast.net. [50.152.159.227]) by mx.google.com with ESMTPSA id bq7sm10393786pdb.50.2014.12.15.16.31.09 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Dec 2014 16:31:10 -0800 (PST) From: slongerbeam@gmail.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/6] gpu: ipu-di: Add ipu_di_adjust_videomode() Date: Mon, 15 Dec 2014 16:29:19 -0800 Message-Id: <1418689764-11276-2-git-send-email-slongerbeam@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1418689764-11276-1-git-send-email-slongerbeam@gmail.com> References: <1418689764-11276-1-git-send-email-slongerbeam@gmail.com> X-Mailman-Approved-At: Mon, 15 Dec 2014 17:08:29 -0800 Cc: Deepak Das , Steve Longerbeam 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.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 From: Jiada Wang On some monitors, high resolution modes are not working, exhibiting pixel column truncation problems (for example, 1280x1024 displays as 1280x1022). The function ipu_di_adjust_videomode() aims to fix these issues by adjusting a passed videomode to IPU restrictions. The function can be called from the drm_crtc_helper_funcs->mode_fixup() methods. Signed-off-by: Jiada Wang Signed-off-by: Deepak Das Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-di.c | 29 +++++++++++++++++++++++++++++ include/video/imx-ipu-v3.h | 2 ++ 2 files changed, 31 insertions(+) diff --git a/drivers/gpu/ipu-v3/ipu-di.c b/drivers/gpu/ipu-v3/ipu-di.c index c490ba4..46f9570 100644 --- a/drivers/gpu/ipu-v3/ipu-di.c +++ b/drivers/gpu/ipu-v3/ipu-di.c @@ -511,6 +511,35 @@ static void ipu_di_config_clock(struct ipu_di *di, clk_get_rate(di->clk_di_pixel) / (clkgen0 >> 4)); } +/* + * This function is called to adjust a video mode to IPU restrictions. + * It is meant to be called from drm crtc mode_fixup() methods. + */ +int ipu_di_adjust_videomode(struct ipu_di *di, struct videomode *mode) +{ + u32 diff; + + if (mode->vfront_porch >= 2) + return 0; + + diff = 2 - mode->vfront_porch; + + if (mode->vback_porch >= diff) { + mode->vfront_porch = 2; + mode->vback_porch -= diff; + } else if (mode->vsync_len > diff) { + mode->vfront_porch = 2; + mode->vsync_len = mode->vsync_len - diff; + } else { + dev_warn(di->ipu->dev, "failed to adjust videomode\n"); + return -EINVAL; + } + + dev_warn(di->ipu->dev, "videomode adapted for IPU restrictions\n"); + return 0; +} +EXPORT_SYMBOL_GPL(ipu_di_adjust_videomode); + int ipu_di_init_sync_panel(struct ipu_di *di, struct ipu_di_signal_cfg *sig) { u32 reg; diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h index c74bf4a..d333d54 100644 --- a/include/video/imx-ipu-v3.h +++ b/include/video/imx-ipu-v3.h @@ -17,6 +17,7 @@ #include #include #include +#include