From patchwork Fri Dec 19 02:00:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 5517001 Return-Path: X-Original-To: patchwork-linux-fbdev@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 3BE36BEEA8 for ; Fri, 19 Dec 2014 02:03:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F6722011D for ; Fri, 19 Dec 2014 02:03:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8CA1520117 for ; Fri, 19 Dec 2014 02:03:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752322AbaLSCDh (ORCPT ); Thu, 18 Dec 2014 21:03:37 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:42805 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751680AbaLSCBF (ORCPT ); Thu, 18 Dec 2014 21:01:05 -0500 Received: by mail-pa0-f42.google.com with SMTP id et14so158012pad.15; Thu, 18 Dec 2014 18:01:04 -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=RIwKC1Dzb5rlzOR5jCXv1VDitNqNVRDqRc9SYE298VIXY3Sb53GndcF5cwuXYqhPUV 3B+0Gi29K+NVk9QFIH4IWaCQTxerMDU6YgHHiVTxBoY9Bc2jX+CQ57Y/VE7j8ajZ5V97 lod6iGmvarayLJIGd6RNX9VxyOQwe2xINatqbuiLQpx3UenJSs5QaC8ncum0tOC7dBMd AEx04TMqTkEcDIMNWviDenlOipPKk/5PKd0NautMrclz87Z93AnDHV8+QMlD0iHRy/Wo cP09Frm/Vyd+UkzUjd8OECC7M4iRYGqkS80GmymFyBNR521U3ZQHS1X9wOY2HC3Bm4i9 gu3g== X-Received: by 10.67.3.36 with SMTP id bt4mr8186949pad.99.1418954464734; Thu, 18 Dec 2014 18:01:04 -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 pd9sm7959386pdb.35.2014.12.18.18.01.03 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 18:01:04 -0800 (PST) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, David Airlie , Philipp Zabel , Jean-Christophe Plagniol-Villard , Tomi Valkeinen Cc: Russell King , Fabio Estevam , Shawn Guo , Denis Carikli , Jiada Wang , Deepak Das , Steve Longerbeam Subject: [PATCH v2 1/7] gpu: ipu-di: Add ipu_di_adjust_videomode() Date: Thu, 18 Dec 2014 18:00:20 -0800 Message-Id: <1418954426-21909-2-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1418954426-21909-1-git-send-email-steve_longerbeam@mentor.com> References: <1418954426-21909-1-git-send-email-steve_longerbeam@mentor.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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