From patchwork Tue May 28 08:27:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165253 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169049ili; Tue, 28 May 2019 01:28:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3r9RSglzFdYmLMMk+UUKDplC+0YXgBgdONBfH4H1wMCTBdXcIUd5d26ioXPsUWAAj7D1l X-Received: by 2002:a17:902:9a07:: with SMTP id v7mr133348998plp.180.1559032126043; Tue, 28 May 2019 01:28:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032126; cv=none; d=google.com; s=arc-20160816; b=b5zAlgz2HXNvVtlKVlvpqekHyDryWPDpBP4gp8wePCFCB60y8HOPB0BpjHQRfXdSuy F8vB95QhRfMb9ZDf/M5pfLrwExm1PPmpbJqsaj+mEV6mlkHEQYodUJqHkkaH5Pqn69YZ ptl5ztc1G/iuf76SAOu87iN+x+ySj557yuBbzAszrK9hsnTPNXOId6DmBBd3ZagsfaxB mpIxFKFWhO7BDQhH4GhsKsC5qi3umplFEBeYSCK+hAEVSsi8wUF0iBUYiP4l/oAzOHUK dplY3tyrGrBlV8TqJeRWWVOVT3wGEY0qAMWnxsXb+95KfzUtGG6BoPUSWAsPhVsjg1St 4QbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=aINXMvxeJgZCc1hU4dUEBWMb3DKFz5K72N67iPwlGLc=; b=syo9Fu95AM5Sr2V2Xi0drQbkDOxxv9sn+W6DQH24NQTWETE8FcZVeey3nIDDpU3eOp LInQcc7ldjngUom9y3owe/WUgnfdJLB68Jfv/iNINuD6n6KNz03DHq5ojc590pUOc3MR 4PzfhhO/bffcCoLfH+G398S9Zk0/IQBGfKJ+Ed5r8hpTW/59/ojfulT4o39iunmrGPYy 1VwIAfCfZGW0SHy3Niy0yyiFYyzer+jk6WvD+3GMtXplUJmSkzlabVaGuNTOGvzTYa/J mAEWu4T8ooCkROgR6FTE+6K2hIYnNy6w3PIAvWoozLQvfv8cw3SZvwfJpKkRY2tyZgfO xKSw== ARC-Authentication-Results: i=1; mx.google.com; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id a18si2635333pgk.150.2019.05.28.01.28.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:46 -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; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 88DCF89CBA; Tue, 28 May 2019 08:28:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by gabe.freedesktop.org (Postfix) with ESMTPS id 287E289CBA for ; Tue, 28 May 2019 08:28:37 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SYi4032114; Tue, 28 May 2019 03:28:34 -0500 Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SYSa114988 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:34 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 28 May 2019 03:28:32 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 28 May 2019 03:28:32 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x4S8Rxug125039; Tue, 28 May 2019 03:28:30 -0500 From: Tomi Valkeinen To: , Andrzej Hajda , Laurent Pinchart , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCHv4 12/24] drm/bridge: tc358767: ensure DP is disabled before LT Date: Tue, 28 May 2019 11:27:35 +0300 Message-ID: <20190528082747.3631-13-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190528082747.3631-1-tomi.valkeinen@ti.com> References: <20190528082747.3631-1-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1559032114; bh=3Cioh3lAnvpUlufOPRXi+91OrkzKbd2Fs9t8SDe6AwI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=vp0XHAboobLFGLGUXS7oScFNHVHp512DjhgC+hxjQxDG/plhIih5GYqIAnUxKjzId s8E1H0TWnSwzGqZwc/BtIFqDLSVXzAqPnRnciimS0JzqLUdnR1pm7p6RrYFpVIInHl FrNrr9NdfZZf6HZmSnK1MIqDVn7Dg18J4ro02QJ8= 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Link training will sometimes fail if the DP link is enabled when tc_main_link_enable() is called. The driver makes sure the DP link is disabled when the DP output is disabled, and we never enable the DP without first disabling it, so this should never happen. However, as the HW behavior seems to be somewhat random if DP link has erroneously been left enabled, let's add a WARN_ON() for the case and set DP0CTL to 0. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index f004db06dee9..ccf4c8cfbb52 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -839,6 +839,10 @@ static int tc_main_link_enable(struct tc_data *tc) dev_dbg(tc->dev, "link enable\n"); + tc_read(DP0CTL, &value); + if (WARN_ON(value & DP_EN)) + tc_write(DP0CTL, 0); + tc_write(DP0_SRCCTRL, tc_srcctrl(tc)); /* SSCG and BW27 on DP1 must be set to the same as on DP0 */ tc_write(DP1_SRCCTRL,