From patchwork Mon Aug 13 21:30:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10564839 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7BB4313B4 for ; Mon, 13 Aug 2018 21:31:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E230295DE for ; Mon, 13 Aug 2018 21:31:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 625EF29676; Mon, 13 Aug 2018 21:31:38 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 20C8B295DE for ; Mon, 13 Aug 2018 21:31:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4663989F8E; Mon, 13 Aug 2018 21:31:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc42.google.com (mail-yw1-xc42.google.com [IPv6:2607:f8b0:4864:20::c42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2ABAB6E0F7 for ; Mon, 13 Aug 2018 21:31:34 +0000 (UTC) Received: by mail-yw1-xc42.google.com with SMTP id c135-v6so14727836ywa.0 for ; Mon, 13 Aug 2018 14:31:34 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=E+vhpvecOJ7VcV21WSJwNJ7/CfFHI2R69sCNjbs+Szg=; b=WRhbbAV8HBlsIAaAMtBA82TssPd3KDNNBY9BMO18KDwiLgcAqW+JWUcMk6xUUkP5uq xpgRZRxRh7ouhL0X30HWNfA2uBRVO7W0me+hyT2npsRJrdWUcOAHYnFw8wPclVdHq5dO youm5Pl2pBscWTyFO/G2Qjho/pviVW/e5IBRIt02b4KR0+HK8DSg6jCf30oIS08qya6N eikutmlOshkz5RgfzvamKRIt6AHOcUdN+VcKVYGLuiij8A16K/A3JGpUjrLP6O04d5uE AlPLTUxy6q1P7UaYgn5b0yDcoggwFmHI/1U+JC+JkHPJ0IQvL+3WCcZiB/AMhS2BX+Az qDsg== X-Gm-Message-State: AOUpUlFOQMEXxYkxy6n/b0D4tDBWYyPp2vwaIWjWFP7SoQsP+QBN19ja kiBNsgTFwDtGI4Rg2GrjFKQndfuJddM= X-Google-Smtp-Source: AA+uWPzZpiaq5ZsbAk29MmDOBp2GO7qz0nuShC/PK04wjlHjkGecEg8iC4Jq8cbRw7uz3AzTRSYt9Q== X-Received: by 2002:a81:ad12:: with SMTP id l18-v6mr10166664ywh.505.1534195893234; Mon, 13 Aug 2018 14:31:33 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id m82-v6sm26715319ywm.19.2018.08.13.14.31.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Aug 2018 14:31:32 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 5/7] drm/bridge: ti-sn65dsi86: Poll for DP PLL Lock Date: Mon, 13 Aug 2018 17:30:44 -0400 Message-Id: <20180813213058.184821-6-sean@poorly.run> X-Mailer: git-send-email 2.18.0.597.ga71716f1ad-goog In-Reply-To: <20180813213058.184821-1-sean@poorly.run> References: <20180813213058.184821-1-sean@poorly.run> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sandeep Panda , Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Instead of just waiting and hoping, actually poll for the pll lock to be acquired. As a bonus, this should be significantly faster than the sleep. Changes in v3: - Added to the set Cc: Sandeep Panda Signed-off-by: Sean Paul Reviewed-by: Sandeep Panda --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index d2119ab546147..f02bdedae1e5e 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -456,6 +456,7 @@ static void ti_sn_bridge_enable(struct drm_bridge *bridge) { struct ti_sn_bridge *pdata = bridge_to_ti_sn_bridge(bridge); unsigned int val; + int ret; /* DSI_A lane config */ val = CHA_DSI_LANES(4 - pdata->dsi->lanes); @@ -472,7 +473,14 @@ static void ti_sn_bridge_enable(struct drm_bridge *bridge) /* enable DP PLL */ regmap_write(pdata->regmap, SN_PLL_ENABLE_REG, 1); - usleep_range(10000, 10500); /* 10ms delay recommended by spec */ + + ret = regmap_read_poll_timeout(pdata->regmap, SN_DPPLL_SRC_REG, val, + val & DPPLL_SRC_DP_PLL_LOCK, 1000, + 50 * 1000); + if (ret) { + DRM_ERROR("DP_PLL_LOCK polling failed (%d)\n", ret); + return; + } /** * The SN65DSI86 only supports ASSR Display Authentication method and