From patchwork Fri Oct 31 22:53:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 5207271 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 B7D4A9F387 for ; Fri, 31 Oct 2014 23:56:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C35B220172 for ; Fri, 31 Oct 2014 23:56:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EE3722014A for ; Fri, 31 Oct 2014 23:56:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E8E46E84A; Fri, 31 Oct 2014 16:56:38 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by gabe.freedesktop.org (Postfix) with ESMTP id B2C2B6E849 for ; Fri, 31 Oct 2014 15:57:00 -0700 (PDT) Received: by mail-pa0-f49.google.com with SMTP id lj1so8559343pab.36 for ; Fri, 31 Oct 2014 15:57:00 -0700 (PDT) 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=4CGD/NCT/qUnZ4D4pOgR8zO8B1YIQH9QnnIXEt6KLEA=; b=P4EjbZF/O1DrPb9bI4luAaucsF0JVzxz5V8AXyrM3xILLKbusArUh8vY8XdujtyIY4 BznJkjIqAT/3g9zKFEUZ0yVMvwCDZq98aCwigaPQQTrApkl5jSvlm4KSyn6Br+s7cJn2 C5ULGPnt1tBYpZYDe9OGNcbbUNVF/6SlhkvThExIzdjvlC5bzhibvJkdqRJlSA5CeVt3 ArdV28xQo45dJ0nwdMvLtliSoFqmK1hz6LGuAHe44YIbyq1ddg9m4DGeeM3GfxZIV9mg k4OQfY+BI3FKfiPasIQdIUOVHVUvz2NPacc350O9O26wHl0gtw70bW2oHz0893FTr2tC OmKw== X-Received: by 10.70.93.65 with SMTP id cs1mr27707202pdb.80.1414796220556; Fri, 31 Oct 2014 15:57:00 -0700 (PDT) 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 ev8sm10870656pdb.28.2014.10.31.15.56.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 15:57:00 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: dri-devel@lists.freedesktop.org Subject: [PATCH 15/72] gpu: ipu-v3: fix HDMI timing issues Date: Fri, 31 Oct 2014 15:53:58 -0700 Message-Id: <1414796095-10107-16-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1414796095-10107-1-git-send-email-steve_longerbeam@mentor.com> References: <1414796095-10107-1-git-send-email-steve_longerbeam@mentor.com> X-Mailman-Approved-At: Fri, 31 Oct 2014 16:56:31 -0700 Cc: Deepak Das 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.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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, with high resolution(1920x1080), HDMI is not working, some resolution have pixel column truncation problem (shows 1280x1022 instead of 1280x1024), which will result in really strange picture on some monitors. This Patch aims to fix these HDMI timing issues. Signed-off-by: Jiada Wang Signed-off-by: Deepak Das --- drivers/gpu/ipu-v3/ipu-di.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-di.c b/drivers/gpu/ipu-v3/ipu-di.c index c490ba4..2fafb63 100644 --- a/drivers/gpu/ipu-v3/ipu-di.c +++ b/drivers/gpu/ipu-v3/ipu-di.c @@ -511,12 +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 adapt synchronous LCD panel to + * IPU restriction. + */ +static void adapt_panel_to_ipu_restricitions(struct ipu_di *di, + struct ipu_di_signal_cfg *sig) +{ + if (sig->v_end_width < 2) { + uint16_t diff = 2 - sig->v_end_width; + + if (sig->v_start_width >= diff) { + sig->v_end_width = 2; + sig->v_start_width -= diff; + } else if (sig->v_sync_width > diff) { + sig->v_end_width = 2; + sig->v_sync_width = sig->v_sync_width - diff; + } else + dev_warn(di->ipu->dev, "failed to adapt timing\n"); + + dev_warn(di->ipu->dev, + "timing adapted due to IPU restrictions\n"); + } +} + int ipu_di_init_sync_panel(struct ipu_di *di, struct ipu_di_signal_cfg *sig) { u32 reg; u32 di_gen, vsync_cnt; u32 div; - u32 h_total, v_total; dev_dbg(di->ipu->dev, "disp %d: panel size = %d x %d\n", di->id, sig->width, sig->height); @@ -524,10 +547,7 @@ int ipu_di_init_sync_panel(struct ipu_di *di, struct ipu_di_signal_cfg *sig) if ((sig->v_sync_width == 0) || (sig->h_sync_width == 0)) return -EINVAL; - h_total = sig->width + sig->h_sync_width + sig->h_start_width + - sig->h_end_width; - v_total = sig->height + sig->v_sync_width + sig->v_start_width + - sig->v_end_width; + adapt_panel_to_ipu_restricitions(di, sig); dev_dbg(di->ipu->dev, "Clocks: IPU %luHz DI %luHz Needed %luHz\n", clk_get_rate(di->clk_ipu),