From patchwork Wed Aug 30 18:07:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111337 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp1324958qge; Wed, 30 Aug 2017 11:07:49 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4KK4EJiV0aR72/RgbdpTFI4V+RObR/PTv1pP+yuT3Dmd8VRiaMzPe3FoVQ8hrWITmqqzMk X-Received: by 10.98.130.134 with SMTP id w128mr2419661pfd.112.1504116469040; Wed, 30 Aug 2017 11:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504116469; cv=none; d=google.com; s=arc-20160816; b=q89G2AogGfgJxWplmyFZ1F5pypqvNqCQsvdYqUN74hEMLKD/X8ndHYCbM9ydEvkoLm 6kqNxXS7XcTzdChhd/wi18yc7ri1CJo0Rypoe3xbtEz5vhbts0+2m+RRHlBWCxTuwr0e 8aFk3GiJzBEd7royVug1APSK8SyIWPtOkuX+gD1QQb6x9onSpvUeHtRhJGeP3DShAJT4 cNXnKRa9pVren4Vaq1nEtMbElZZ50VUvO2SuExVW+1Rr98yBvFgFN0MXeO5qTFMWGmNa xaNlpEasw1OcsQb1m9rdWCuhhDeRExrXl6iw9py7kr1zXnP1liwf8qkw9UdKnYqWWd6e QUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=NGLflw/jNSys2DfaDKAeR6tRu687Ridu+bIcPAqg7AM=; b=pMP3PCPTtd3zq21sLC1dlPgbLloT67lBHdVzgXOItTMHdGjSu2/qbVrvuzdQfOcdB6 +va1YnoQtVTIMobTpcN6Slu6C7mAB+nkgb/zDCi9y1iJwonu4E+eSn3l4T6pvpW+WOTK Irw68ugO5RT/6ClHm3khLiCcL50cEt6JwyiC09DERjnn4/OaNk0IA9rxxLJRU9p8gbs+ Dx0SJb6Zos85p82971pg9QwPIE52Rf+eMTjrY+D54MiPEOmec3y1IQEGHMcjkwMEzLL7 H/vdD+m37KE5gNi/X0tc7jLngHr8fnZ4d77g6+k/qzXeMluheSd1pkNFs+BaSYnmznQs eHrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jkNLKjqj; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id k17si4702585pfe.473.2017.08.30.11.07.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Aug 2017 11:07:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jkNLKjqj; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 550246E4D5; Wed, 30 Aug 2017 18:07:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com [IPv6:2a00:1450:4010:c07::22f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 278EE6E486 for ; Wed, 30 Aug 2017 18:07:38 +0000 (UTC) Received: by mail-lf0-x22f.google.com with SMTP id d202so27395993lfd.5 for ; Wed, 30 Aug 2017 11:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=V4iiFpLcwGn3TYJ3/a29nUpHSvcCwXzP2Z+QIu0psMs=; b=jkNLKjqjKa76WGaT5C9iI2Ecs0qH3udn7nJWx7IK4FVqwjxsu0705tfozSH9I2cAsH RvZgi4SpipIC46dhJPu1wNbngTPZNQiHjGaj5XBr365qaCXiXbyxyv8n7ax9/G7QocQE ejpaFWKmDejMUjblBQYUxBS0l9M38OXuAJea0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=V4iiFpLcwGn3TYJ3/a29nUpHSvcCwXzP2Z+QIu0psMs=; b=fZWwpPQOXwxvHlsoBbcS6JdqH7Ij3Euw2NcQb7eRGFF6/9r7tArt900OOupXDtfjP1 AKtugzTbee2urnKEV7lQ3L+PEnuwB9+YMcy9vASpnSVdLIjUHZH1/RVwXue7LLyOHwIH +GFVsyHKFAhuD95PS3bVUFYjBtGmgw56UMcPuOeuOImrHWOMeUwQtZQ2x0zCzamG5rSC j2/65hOjMMS/HNrmySVZ1U7Vk3fE5tlTlatty5uThZlP3kak/X/tB3uLVwwBW5+VEPrI D0oA+qLQqfMhhJsgM2Q2s9/740OopYQO9aoXmSTF2Ost5SxVXv5ZRD4UOI0u8N2R7g52 3h8w== X-Gm-Message-State: AHPjjUhLj9K13/iG9QItj/lplDnWQ8hD9CH/4tA4U2KrFKuB5zYc0qxf YKCcT2nid3zLJOO6 X-Received: by 10.25.99.23 with SMTP id x23mr895643lfb.180.1504116456558; Wed, 30 Aug 2017 11:07:36 -0700 (PDT) Received: from genomnajs.bredbandsbolaget.se (c-287571d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.117.40]) by smtp.gmail.com with ESMTPSA id 123sm1177067ljf.80.2017.08.30.11.07.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Aug 2017 11:07:35 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 5/7] drm/pl111: Insert delay before powering up PL11x Date: Wed, 30 Aug 2017 20:07:09 +0200 Message-Id: <20170830180711.2791-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170830180711.2791-1-linus.walleij@linaro.org> References: <20170830180711.2791-1-linus.walleij@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org 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" The old codebase has a delay between enabling and powering up the PL11x. According to the manual for PL110, ARM DDI 0161E page 1-5 and the PL111 manual ARM DDI 0293C page 1-6, the power sequence should be such that once Vdd is stable (which we assume it is at boot) LCDEN is enabled first and then CLPOWER should be enabled "after the signals have stabilized" and this is said to be display-dependent. The old codebase uses 20ms. The delay construction in the old code is not to be trusted: it was likely assuming a certain hard-coded display (such as the Versatile PROSPECTOR display) and the PL11x blocks are used in several designs with different displays. Instead rely on the display driver to provide the proper delay in response to the drm_panel_prepare() and drm_panel_enable() as well as the drm_panel_disable() and drm_panel_unprepare() calls, but make sure to set the LCDEN before these calls and then CLPOWER after calling them (and the reverse for disabling). Signed-off-by: Linus Walleij --- drivers/gpu/drm/pl111/pl111_display.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 6447f36c243a..39106068b158 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -157,8 +157,8 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, drm_panel_prepare(priv->panel); - /* Enable and Power Up */ - cntl = CNTL_LCDEN | CNTL_LCDTFT | CNTL_LCDPWR | CNTL_LCDVCOMP(1); + /* Hard-code TFT panel */ + cntl = CNTL_LCDEN | CNTL_LCDTFT | CNTL_LCDVCOMP(1); /* Note that the the hardware's format reader takes 'r' from * the low bit, while DRM formats list channels from high bit @@ -201,10 +201,19 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, break; } + /* Power sequence: first enable and chill */ writel(cntl, priv->regs + priv->ctrl); + /* + * We expect these calls to enable and stabilize the contrast + * voltage Vee as stipulated by the manual + */ drm_panel_enable(priv->panel); + /* Power Up */ + cntl |= CNTL_LCDPWR; + writel(cntl, priv->regs + priv->ctrl); + drm_crtc_vblank_on(crtc); } @@ -213,16 +222,27 @@ void pl111_display_disable(struct drm_simple_display_pipe *pipe) struct drm_crtc *crtc = &pipe->crtc; struct drm_device *drm = crtc->dev; struct pl111_drm_dev_private *priv = drm->dev_private; + u32 cntl; drm_crtc_vblank_off(crtc); + /* Power Down */ + cntl = readl(priv->regs + priv->ctrl); + if (cntl & CNTL_LCDPWR) { + cntl &= ~CNTL_LCDPWR; + writel(cntl, priv->regs + priv->ctrl); + } + + /* + * We expect these calls to disable the contrast voltage Vee as + * stipulated by the manual + */ drm_panel_disable(priv->panel); + drm_panel_unprepare(priv->panel); - /* Disable and Power Down */ + /* Disable */ writel(0, priv->regs + priv->ctrl); - drm_panel_unprepare(priv->panel); - clk_disable_unprepare(priv->clk); }