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: 9930455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BDD07603B4 for ; Wed, 30 Aug 2017 18:08:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6B0428750 for ; Wed, 30 Aug 2017 18:08:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB52C2876A; Wed, 30 Aug 2017 18:08:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 195FC2875A for ; Wed, 30 Aug 2017 18:08:26 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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); }