From patchwork Tue May 28 08:27:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165242 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8168642ili; Tue, 28 May 2019 01:28:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1k7rqErSFND6wbar7CtmlqPEq5loL5VhghN5/cbNV/PTxYd2n1P6SIoFabrhYzOM4OUwZ X-Received: by 2002:a17:90a:77c4:: with SMTP id e4mr4068270pjs.86.1559032094300; Tue, 28 May 2019 01:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032094; cv=none; d=google.com; s=arc-20160816; b=b4YbIHmUwMGGHL7D1PCbeMm+Yc67dEw7quT5ZDx4N4rkVKGP25YTReRB+dQlMd5c8Q AqZUIekFKYOvdBrg9hcc+qSR7Mb/ekxEZdLvvQEKvuxThdifNReQBenZpbA1uiLW1JSi Z+fgnK/nt3K8tfXizVvUJITzlcxmHLnGyr3KKCB3omzDFDFMHmeqGUsubHbWY3uwSzTn 0s4xOujf1nVsrgUPnL/eGNwpIKs4GXDQ+AaJYdbEIlkGML8vmM/kDgRDvxNkAHSsEcZw fx6OPZVo9vRFOzKor4EDIUyL017Pe2hvUAzRqiQBAuX8MAjlSeitHK+4keXPiODn/Uj0 OfLA== 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=VV8EHg91CnOuYOkFZPeOIo9B/xRVt0kxeChqyacsjQ4=; b=j8kKnmUaL9bZ2z/kUZQrKklAwatk7xd4rAqD+oZiwL24FonFZEWdZqrlhZ8rBnQCY6 TF4/qM13LY+Fbk6eDoJ3cBwA+ezpsfvL1Ficw73uJDbMUhRcxu2KnjaHIz6fXMsMsBJ/ EWCOfTuzqCJLJOkTeUCFIe4FCAGie/rVOlr5QyoPuP3AHzUyNbuN7xEYzeXAp7/IbP89 8EZ+Lv55+DK9i2hOvtNixn51Nm3jJKKZ/+X+iDhrcFmWSTe920ev5Q9IqM8U04IoYbHP 3z9jUlqdsXIn3O6ZJbc+Rq/boyQZVtiqKqXtSjgXoA67C+OJN0Guw3bxLrlZKrHbkx1M DLHQ== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id h34si22561104pld.42.2019.05.28.01.28.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 7989289C21; Tue, 28 May 2019 08:28:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by gabe.freedesktop.org (Postfix) with ESMTPS id 769EC89C37 for ; Tue, 28 May 2019 08:28:08 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8S55A036533; Tue, 28 May 2019 03:28:05 -0500 Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8S5hm007988 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:05 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE105.ent.ti.com (10.64.6.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:04 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE108.ent.ti.com (10.64.6.29) 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:04 -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 x4S8RxuV125039; Tue, 28 May 2019 03:28:02 -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 01/24] drm/bridge: tc358767: fix tc_aux_get_status error handling Date: Tue, 28 May 2019 11:27:24 +0300 Message-ID: <20190528082747.3631-2-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=1559032085; bh=mue3dbtuKYVRrYReTQ5hjO+JVZtPfyL/5kZXHvJLjfk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=NZ5NQ71uvhT/0F+7bll7Jt2DbtxIbce9yGSadmYPZzup4buzU5jWY3+ZF5q5doXz1 0j6eVIEys4LgIsOH2wU4hT6xtjIfz3VmWOofbOonRAriMCB5+AodA3+SDa37PZAjLd 1+MRBukXeACYkAWWRzbb+QwXFiZGnFnNqsvN/qUk= 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" tc_aux_get_status() does not report AUX_TIMEOUT correctly, as it only checks the AUX_TIMEOUT if aux is still busy. Fix this by always checking for AUX_TIMEOUT. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index e570c9dee180..b6c4d1063ccb 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -286,14 +286,17 @@ static int tc_aux_get_status(struct tc_data *tc, u8 *reply) ret = regmap_read(tc->regmap, DP0_AUXSTATUS, &value); if (ret < 0) return ret; + if (value & AUX_BUSY) { - if (value & AUX_TIMEOUT) { - dev_err(tc->dev, "i2c access timeout!\n"); - return -ETIMEDOUT; - } + dev_err(tc->dev, "aux busy!\n"); return -EBUSY; } + if (value & AUX_TIMEOUT) { + dev_err(tc->dev, "aux access timeout!\n"); + return -ETIMEDOUT; + } + *reply = (value & AUX_STATUS_MASK) >> AUX_STATUS_SHIFT; return 0; } From patchwork Tue May 28 08:27:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165243 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8168671ili; Tue, 28 May 2019 01:28:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7NSvIlGBmVmgY3zSuyGhb2yliwI5QEKY7uoCunj6hrj5IiHMevrckoAqvjqyGEJsBxJC6 X-Received: by 2002:a63:700b:: with SMTP id l11mr74338552pgc.449.1559032096603; Tue, 28 May 2019 01:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032096; cv=none; d=google.com; s=arc-20160816; b=qeDTGsCoU18RM7VlY6PuA7yO9BItCF/ASlc2ECZFbv2LaAHMzUaDziS3o6WTLoJ+pb 5LhTtHeFKIcshgZdQuG8vUlJ0G4KN91uzTJNErz5eIAcuUTjfudlRmrkywGicqeBzPsK khXSefsihL1ovnKesfw8RitpE7OvfB5H0cLPogkbWLJUpfjvVhEHcVAXKwtcycsWx+Ng Q2E3l0vhe/dwqXQl+khicQktLoTYRbdHqCjF0C6H39jm6fOf7cHyb+hZJ1RUQunHOnLM 1kaON0tS7Ag/6N0ghiuHNWJoYkgWyM1KXBB6UzPJowcy0RBjLVotPiaolItyhDNK6Rlw hEPg== 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=7B1ZDTn6l2RwaMHeG7lk6SexhInEVOAFlzgdGpH+8+c=; b=K2qq6WYfpmioKDDkFMOyxH187ZW2XCh11JCap2ak5DiEuHjJXAgBUOgJkjrdUxDdD7 CNW4H6Zr0mQbMB/mmyiRTeogxD4i4Sl+ngwAyS4v57WBfnSos52aQne0vspdq7a+JUC+ iZUGGKWM7bY1UFzItr3apj/sBrzfsVVwzKcZpyq06BH9cLWUhaqurv8xqM/lsNKRYZgB VccJuDgob1re0l3jHrs4NyHqPSRKK1uQjGhSAU6PdZb2CLKhMbtcnojL1gVifdjdVckd TSuZCZ5uH7E5BUAQYQUk+FEhFSsWJc5C7OyFNQxj2EpgmJ8bqva12u9V6oBmx+hrrMRK ztqg== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id m8si21082702pls.412.2019.05.28.01.28.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 972AC89C37; Tue, 28 May 2019 08:28:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by gabe.freedesktop.org (Postfix) with ESMTPS id 58FFA89C21 for ; Tue, 28 May 2019 08:28:10 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8S7l0055231; Tue, 28 May 2019 03:28:07 -0500 Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8S79q082400 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:07 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) 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; Tue, 28 May 2019 03:28:06 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE111.ent.ti.com (157.170.170.22) 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:06 -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 x4S8RxuW125039; Tue, 28 May 2019 03:28:04 -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 02/24] drm/bridge: tc358767: reset voltage-swing & pre-emphasis Date: Tue, 28 May 2019 11:27:25 +0300 Message-ID: <20190528082747.3631-3-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=1559032087; bh=YyyGfoBNgg9NBCusJmpiXF4UBG9Bb/du7Yi65Y83ykg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=EKqn7IqwgvKneOy+ZZFaLvslowRpFhfKQLmKuF0bT4Mdu38b2BBgvXvQJZj3VVszh rKI01odeJC5S9BQGF62kqiFkyOnSqXOUq6F/ZYyvtPKb8awUECXZx8inGoLAvdSkY0 WzOyV5InNCJMofjtBitMrG/6Y4kiJbZGd9PVO7Fg= 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" We need to reset DPCD voltage-swing & pre-emphasis before starting the link training, as otherwise tc358767 will use the previous values as minimums. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index b6c4d1063ccb..c8b04f711db3 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -956,6 +956,13 @@ static int tc_main_link_setup(struct tc_data *tc) if (ret < 0) goto err_dpcd_write; + /* Reset voltage-swing & pre-emphasis */ + tmp[0] = tmp[1] = DP_TRAIN_VOLTAGE_SWING_LEVEL_0 | + DP_TRAIN_PRE_EMPH_LEVEL_0; + ret = drm_dp_dpcd_write(aux, DP_TRAINING_LANE0_SET, tmp, 2); + if (ret < 0) + goto err_dpcd_write; + ret = tc_link_training(tc, DP_TRAINING_PATTERN_1); if (ret) goto err; From patchwork Tue May 28 08:27:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165244 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8168717ili; Tue, 28 May 2019 01:28:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwU8XU08qItGCIZrwsQMRRmxdMtUb4c1xlSDuRZkns1fcCL7EK8RJI9tg0qZWbwHXogf4qq X-Received: by 2002:a65:5202:: with SMTP id o2mr26117062pgp.199.1559032099408; Tue, 28 May 2019 01:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032099; cv=none; d=google.com; s=arc-20160816; b=tv09nW30NpqvAYIovvSKz2ILr2U1UgH5EMTnhBKWs5z6S/1D2nysrXPwwwjWYtqlEC A5Ygfe2cRkdeqWl3e2Ygady0xUV5/YTIbdbVN+3C6Qs3u3NShzgNlRjAQitUcNZ6nXYy oIZ1xLnh61quyeGEazTE9xiKP8B9y7+68k4UmpB8WKCRKm/el2fmSsSV99o4Hgf9iJbl 6zbXkUaHgYp1h9Ev9HIffGw+PI3xMA6dKHq7zLSzwvX++Sm0qkhIa+v9K/X0Ou2GJtGX w8v5C8yPAhauGunCNMH5pLpHdb2gb44nJHZnQRIQWP1f+xUpPcS4IfrkpeEIfRljuMjk OAgg== 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=o7Nofwa4TA+DF0d8EBjU/QJy/dEspBU3pFr3ultqpTo=; b=S2sGPQ955zaY18sTUaG2BSsqK/sSJUtvJiAONBq4gHiSZCFtOfZlEoZ8A9jamuXKUZ MFvIwpUZBExOoSoH2dER2k50f+PMx6FCaHwAhbFodo9Uk8AJmz+6rqIQ3tqDU/5OgYxK oMGndAHc71JNqLyCvJjAICTkJ/WIZ457xGwNA3o9OC5L20oFWCu2yzDLVUN8bVbiJojB KbqSXOCokw6/rr5GttuEF2lEBJvz+A+gyAksrpgt1NPhAVlr0GhxbwJIQ+vC5Wq5RET9 vPN3kg8w7FtZj7TrFrZ1amW/wL+WymXiddtqQGRHUN54++opey7tzOV27nyFrUk6hOAX rc7A== 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 k6si20434407plt.204.2019.05.28.01.28.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:19 -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 F360689C80; Tue, 28 May 2019 08:28:16 +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 8C4BE89C6C for ; Tue, 28 May 2019 08:28:15 +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 x4S8SBrx031725; Tue, 28 May 2019 03:28:11 -0500 Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SBif114485 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:11 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE114.ent.ti.com (157.170.170.25) 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:09 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) 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 via Frontend Transport; Tue, 28 May 2019 03:28:09 -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 x4S8RxuX125039; Tue, 28 May 2019 03:28:07 -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 03/24] drm/bridge: tc358767: fix ansi 8b10b use Date: Tue, 28 May 2019 11:27:26 +0300 Message-ID: <20190528082747.3631-4-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=1559032091; bh=01vlQ9vCZK2Vfub0eQ745iqI/5NB12jv2APDmow4cKY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=uQv5QP4Gd7lpHe5EXxiPb8zxG2Mw3DQM4cvFAhrHdyrWlJ/Jp6myM1RuuvQNvVJ1K 94JRtI721QzjLSKQpFW7vflKQ1tUdWM9xAX9KpGvFslfdHEkHh0G60Dq3/iemLBmg9 Ezlgbg6qGQj+pFJUh2iom69ESZEXuzYtZNxFeYz0= 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" DP always uses ANSI 8B10B encoding. Some monitors (old?) may not have the ANSI 8B10B bit set in DPCD, even if it should always be set. The tc358767 driver currently respects that flag, and turns the encoding off if the monitor does not have the bit set, which then results in the monitor not working. This patch makes the driver to always use ANSI 8B10B encoding, and drops the 'coding8b10b' field which is no longer used. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index c8b04f711db3..33e27dc2f0b4 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -188,7 +188,6 @@ struct tc_edp_link { u8 assr; int scrambler_dis; int spread; - int coding8b10b; u8 swing; u8 preemp; }; @@ -390,13 +389,10 @@ static u32 tc_srcctrl(struct tc_data *tc) * No training pattern, skew lane 1 data by two LSCLK cycles with * respect to lane 0 data, AutoCorrect Mode = 0 */ - u32 reg = DP0_SRCCTRL_NOTP | DP0_SRCCTRL_LANESKEW; + u32 reg = DP0_SRCCTRL_NOTP | DP0_SRCCTRL_LANESKEW | DP0_SRCCTRL_EN810B; if (tc->link.scrambler_dis) reg |= DP0_SRCCTRL_SCRMBLDIS; /* Scrambler Disabled */ - if (tc->link.coding8b10b) - /* Enable 8/10B Encoder (TxData[19:16] not used) */ - reg |= DP0_SRCCTRL_EN810B; if (tc->link.spread) reg |= DP0_SRCCTRL_SSCG; /* Spread Spectrum Enable */ if (tc->link.base.num_lanes == 2) @@ -635,7 +631,7 @@ static int tc_get_display_props(struct tc_data *tc) ret = drm_dp_dpcd_readb(&tc->aux, DP_MAIN_LINK_CHANNEL_CODING, tmp); if (ret < 0) goto err_dpcd_read; - tc->link.coding8b10b = tmp[0] & BIT(0); + tc->link.scrambler_dis = 0; /* read assr */ ret = drm_dp_dpcd_readb(&tc->aux, DP_EDP_CONFIGURATION_SET, tmp); @@ -649,7 +645,6 @@ static int tc_get_display_props(struct tc_data *tc) tc->link.base.num_lanes, (tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) ? "enhanced" : "non-enhanced"); - dev_dbg(tc->dev, "ANSI 8B/10B: %d\n", tc->link.coding8b10b); dev_dbg(tc->dev, "Display ASSR: %d, TC358767 ASSR: %d\n", tc->link.assr, tc->assr); @@ -951,7 +946,7 @@ static int tc_main_link_setup(struct tc_data *tc) /* DOWNSPREAD_CTRL */ tmp[0] = tc->link.spread ? DP_SPREAD_AMP_0_5 : 0x00; /* MAIN_LINK_CHANNEL_CODING_SET */ - tmp[1] = tc->link.coding8b10b ? DP_SET_ANSI_8B10B : 0x00; + tmp[1] = DP_SET_ANSI_8B10B; ret = drm_dp_dpcd_write(aux, DP_DOWNSPREAD_CTRL, tmp, 2); if (ret < 0) goto err_dpcd_write; From patchwork Tue May 28 08:27:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165245 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8168745ili; Tue, 28 May 2019 01:28:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxeYF5tElOA3ge+bXNyS15MXGTmnYOA74q7eh99y89VBgY7s96lx6NY3LMDowkPbiTf6Yf4 X-Received: by 2002:aa7:864e:: with SMTP id a14mr26682741pfo.132.1559032101378; Tue, 28 May 2019 01:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032101; cv=none; d=google.com; s=arc-20160816; b=MgO8AhSTKr4VE/Ye1TU8BIbETeB103zhR5qRzUkP4GLMpj9VWGOWnsqhaSft0oTC9m UtwWRe1M8qOcc+dlUQz2/9up/qgmUzxkh2pJeQeleodPHia0Pflcd+4D/10v9cvRr+ru qPWkA3Xupf9VTIECByAcjl4g2t8pQAVpIdgvjXpg8SEyIrWuemBYzzkTRrlq7DyNPIZG Zs1wIxkrntRscOoVlYsCjhLDEYBaJiNVhYn1utAPrKowMEaSadVNssvn5Vza8wwJFHog T0J8HJRCx0BkvI2e1cYVUwPvhuuCZvTa1z+x4RFnwsDJgonAH8UlW0sKHNRuCjB2jV8W R51g== 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=JoqCA6aNqneiS17/sj1CEyFTwjUgqX+69JVCdgoFwr8=; b=kSXFZ7DREYcyOXlbCe5y/zSUzYotiNUau0YPyHJA/G+aDYGQNSuOx0Xv3ALs6BjQao q2u5U25dppGjiz0PR/8JF9iuzJzdU2zqnIK6e9Kz/wiKA1zoLXjZQSFffmE5pcnsgtZE tbDqjWG6Ju5WwSJwCg/hXCpYTg7rwPFEq+sRj8Hl+EDXfq2n0IPgYoISen8OOi37KLif 9NVuOTWje9aA93RvmZ/SEt4ndS/0dfl0Z95IeswcGKroofUu8ZjSOudwxQCwcnU6pFtU bOZegMEvHDhZeE/ipNPwrEOHLiwL4Cd7P1cQo5uD8+XYYRK6SDvX78u6Yzih6r+3yL1W Uh+A== 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 4si20037611plh.289.2019.05.28.01.28.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:21 -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 36A3C89C82; Tue, 28 May 2019 08:28:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by gabe.freedesktop.org (Postfix) with ESMTPS id 800B889C6A for ; Tue, 28 May 2019 08:28:15 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SCAb036557; Tue, 28 May 2019 03:28:12 -0500 Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SCdV082532 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:12 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE103.ent.ti.com (10.64.6.24) 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:11 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE111.ent.ti.com (10.64.6.32) 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:11 -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 x4S8RxuY125039; Tue, 28 May 2019 03:28:09 -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 04/24] drm/bridge: tc358767: cleanup spread & scrambler_dis Date: Tue, 28 May 2019 11:27:27 +0300 Message-ID: <20190528082747.3631-5-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=1559032092; bh=zglgFLpVP4JL3MMpBceWdoerjXngY6ehqc4ay5h7RXs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=PgHjMF74eQyVCGXllr2BNFXXZp4QvOM3/MQhiCoqmOPVb8ryWH7vtVC7U0+5dx/kf 5OMAG51cZo5C9VcsOOovqkGCjkoZ5tJPS7JTkDKRa1oLHn7Iv2teF4mUhQ3EHJD2OX nqtk0PF+N9DHF0Agu6L6xeA8wZWfWE+7Fkll/eME= 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" Minor cleanups: - Use bool for boolean fields - Use DP_MAX_DOWNSPREAD_0_5 instead of BIT(0) - debug print down-spread and scrambler status Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/tc358767.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 33e27dc2f0b4..c4d9834d4b32 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -186,8 +186,8 @@ module_param_named(test, tc_test_pattern, bool, 0644); struct tc_edp_link { struct drm_dp_link base; u8 assr; - int scrambler_dis; - int spread; + bool scrambler_dis; + bool spread; u8 swing; u8 preemp; }; @@ -626,13 +626,13 @@ static int tc_get_display_props(struct tc_data *tc) ret = drm_dp_dpcd_readb(&tc->aux, DP_MAX_DOWNSPREAD, tmp); if (ret < 0) goto err_dpcd_read; - tc->link.spread = tmp[0] & BIT(0); /* 0.5% down spread */ + tc->link.spread = tmp[0] & DP_MAX_DOWNSPREAD_0_5; ret = drm_dp_dpcd_readb(&tc->aux, DP_MAIN_LINK_CHANNEL_CODING, tmp); if (ret < 0) goto err_dpcd_read; - tc->link.scrambler_dis = 0; + tc->link.scrambler_dis = false; /* read assr */ ret = drm_dp_dpcd_readb(&tc->aux, DP_EDP_CONFIGURATION_SET, tmp); if (ret < 0) @@ -645,6 +645,9 @@ static int tc_get_display_props(struct tc_data *tc) tc->link.base.num_lanes, (tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) ? "enhanced" : "non-enhanced"); + dev_dbg(tc->dev, "Downspread: %s, scrambler: %s\n", + tc->link.spread ? "0.5%" : "0.0%", + tc->link.scrambler_dis ? "disabled" : "enabled"); dev_dbg(tc->dev, "Display ASSR: %d, TC358767 ASSR: %d\n", tc->link.assr, tc->assr); @@ -934,7 +937,7 @@ static int tc_main_link_setup(struct tc_data *tc) dev_dbg(dev, "Failed to switch display ASSR to %d, falling back to unscrambled mode\n", tc->assr); /* trying with disabled scrambler */ - tc->link.scrambler_dis = 1; + tc->link.scrambler_dis = true; } } From patchwork Tue May 28 08:27:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165249 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8168930ili; Tue, 28 May 2019 01:28:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKG4ZJ06ICxZpEtS1zmoGCNYyKd3DyQ22QYv1xB/Bs+Iu73jjGuiHmrlT6p2OqK73cICMD X-Received: by 2002:a17:90a:cf83:: with SMTP id i3mr4065218pju.71.1559032117750; Tue, 28 May 2019 01:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032117; cv=none; d=google.com; s=arc-20160816; b=vzQQEmfDHrusfhmCa15gOYTtMZYPnx341qU4COE9L0oXbPTKcCbIlxDHCjrU56MDGO vlXw79cUPvyIZuXnfQ2XClXXSt0BDQnew+WD003YLYg1jIQCywUnpW3JB74Kx+J3iqgn 2voXW6IFk7/KST8MLEal1pHsCg788dJif5xnj/dPOWeAe53Chm6puBMv4pFyULmLHzY2 mMunwLN21WH5yeKC+0e/Xj4xe3bctdKgF3J5TMeHd+isvjMdVmvvvFL4L1fjmqTBq+uh 6Fgmx/wmBQ435Eq2Tf41pFDCe/oJQ8x+sApP82Q1ZjzK+fb+ygfazD2Ch9Ky01iPFv3X DNWw== 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=0m1QZ9yVurgSMXIK6cmMqo4HygN0ZuMuoxsNqn6TG+c=; b=J8LdkLhZsytho3aV6dNom1ZgzIXCO4etOD6IpyMURWlS3cFKeEqK7/4RHCDpVsSt4z VfqIAvI6HC0Yb37TAjntIuNjX4kh5CcJV3xOyxGj7tozI1xMICUagRCJut0u2S+BamEl B89YAzr5vcgfDIP9Xv43urb3c9X8ay++d0d/MLPz5XJ7bXMpZi+23aVM+HG4Jy5Pcz4o cG4PpWyOThNthLNybpGyqNOs7PR5zXknazHMuRpGPReIBUo1N91VhlZjauvEvL4ua+Im eWmGNV8BFsYW4pCThmUKaFaOA2PfUXghxMhjOVfzWJwJg2RzOQoXbI9iFjnhte/VKhiU mckA== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id o4si21386393pls.391.2019.05.28.01.28.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 4458E89CB3; Tue, 28 May 2019 08:28:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by gabe.freedesktop.org (Postfix) with ESMTPS id E061289C83 for ; Tue, 28 May 2019 08:28:17 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SFnQ036563; Tue, 28 May 2019 03:28:15 -0500 Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SFpG114537 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:15 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE109.ent.ti.com (157.170.170.41) 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:14 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE108.ent.ti.com (157.170.170.38) 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:14 -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 x4S8RxuZ125039; Tue, 28 May 2019 03:28:12 -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 05/24] drm/bridge: tc358767: remove unused swing & preemp Date: Tue, 28 May 2019 11:27:28 +0300 Message-ID: <20190528082747.3631-6-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=1559032095; bh=3BvCVk0SRbIqkGzZVjzMU9V0hIbQiHn8+De2vYWEWXE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=xPoJrBuMiO3lbv69Pp10mMljGpGR1teijLohi8h7qSHIl935Hjh9WBTKoqbl5i4Pd ucn0oc7Bi2jlRRmgPEPFqg7T9zJOMZhr2RI3ifqBgcnN6bbF8yFivgfPAYwr51eBvr xu3ztmOgcPQs4pd6pvH8w91U9+pEqDZ5C/kdPf1o= 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" swing and preemp fields are not used. Remove them. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/tc358767.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index c4d9834d4b32..119cd8d14d4b 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -188,8 +188,6 @@ struct tc_edp_link { u8 assr; bool scrambler_dis; bool spread; - u8 swing; - u8 preemp; }; struct tc_data { From patchwork Tue May 28 08:27:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165248 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8168878ili; Tue, 28 May 2019 01:28:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzW2CvCQ5Q5kAJqqX7qP8egFPzVHGznwdtPkiU3Q9R+p1T559CfriJVpsVwzw6R6sL+xPvG X-Received: by 2002:a17:902:d896:: with SMTP id b22mr120604957plz.40.1559032113718; Tue, 28 May 2019 01:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032113; cv=none; d=google.com; s=arc-20160816; b=Vbe5zXGU+3wivpNOymmnA301z5FN7JB10+G9WShv6AxWmgmZ4kEqQ1gdTNL+3ugwgM f3RdramMOCK4zD1hEdIjD6gMre6xnS6cxf+VEtPwuspVM2zPog2wK6LSaitFbNx/XI5D WvI3ccVopLAPC/C3mXfgJTlddNPMKXJzHclSWbN1e/QLZ9zoyk81YUtjzFN4N9Dyi+DB x19RQfAX4YnlciTnDPYgDbfdaT/RzUse+Lb4Ou41WSeA/dBTUpP9XIXlJnuyeVkhBEYa oKhCfrdXEyqnR3Ez7C/nyzDhJkHysMq3Z2sbY/onNPVU/SQweZDcuYfo9UKaMpRkdvz9 36Jg== 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=hI4pkPk+Fy6cb+Db4DGkgTT7XGBZcjlxBgAyehvy0tA=; b=YqgWWI70IPs9k7dzpY8aaiYZ3qsx7cWWsrpd8w8SyrBc7AoWFZrajSPt7nTuewDUBA rnwcr6gWUBXAU/ek1co5jxB4rT8dl3Z8DeYi+fyjMTcW1fVS6QOSiaqEJ32QOteNn5qH F9EoPx1pVmum3bbv8LdnBLSYHlAdHH8Z5hH2ObhGbhsIkvhapUpV7dxFW5hN8DOtmCnV AodAYvygTkRAEt0lmdwewo6C7MYOXwlZ7jeQgQFTHkH1xcQiYa0DlWH9hJhbcVy+/MpB q7ZILC940oMDUrI3XvgGy7L+h1vvl8RanP2tdM9ev+MX3oQCW9pz1xTnHJUqIPQnTawb v1XQ== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id d5si22405221pla.376.2019.05.28.01.28.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 0ABC689C9A; Tue, 28 May 2019 08:28:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5DC3289C93 for ; Tue, 28 May 2019 08:28:21 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SH2S036580; Tue, 28 May 2019 03:28:17 -0500 Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SHCJ114654 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:17 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE104.ent.ti.com (10.64.6.25) 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:17 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE107.ent.ti.com (10.64.6.28) 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:17 -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 x4S8Rxua125039; Tue, 28 May 2019 03:28:14 -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 06/24] drm/bridge: tc358767: cleanup aux_link_setup Date: Tue, 28 May 2019 11:27:29 +0300 Message-ID: <20190528082747.3631-7-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=1559032097; bh=JA81L4DZF+VT1/si/AaH2gVLTQtIvC+v133rQ78YOJI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ymcvbDnYJt3AOdKyl1PlSX/VWic7R7XV3ES5aYld1EtyriJv6q9rchSQq29tfNYrN 2pdEHeWG73FvGKHzzFY6B1cq4vSkmSQ0l/6Gu1lxgOSwm24NWoq4FFZ2atdvyl0ysV IPlKo1qQsuSQZ0HiTx6qGk0DG/e4W3mJKLXtojeE= 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" The driver sets up AUX link at probe time, but, for some reason, also sets the main link's number of lanes using tc->link.base.num_lanes. This is not needed nor correct, as the number of lanes has not been decided yet. The number of lanes will be set later during main link setup. Modify aux_link_setup so that it does not use tc->link, and thus makes aux setup independent of the link probing. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/tc358767.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 119cd8d14d4b..39a9de880e5a 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -542,7 +542,6 @@ static int tc_aux_link_setup(struct tc_data *tc) unsigned long rate; u32 value; int ret; - u32 dp_phy_ctrl; rate = clk_get_rate(tc->refclk); switch (rate) { @@ -567,10 +566,7 @@ static int tc_aux_link_setup(struct tc_data *tc) value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2; tc_write(SYS_PLLPARAM, value); - dp_phy_ctrl = BGREN | PWR_SW_EN | PHY_A0_EN; - if (tc->link.base.num_lanes == 2) - dp_phy_ctrl |= PHY_2LANE; - tc_write(DP_PHY_CTRL, dp_phy_ctrl); + tc_write(DP_PHY_CTRL, BGREN | PWR_SW_EN | PHY_A0_EN); /* * Initially PLLs are in bypass. Force PLL parameter update, @@ -587,8 +583,9 @@ static int tc_aux_link_setup(struct tc_data *tc) if (ret == -ETIMEDOUT) { dev_err(tc->dev, "Timeout waiting for PHY to become ready"); return ret; - } else if (ret) + } else if (ret) { goto err; + } /* Setup AUX link */ tc_write(DP0_AUXCFG1, AUX_RX_FILTER_EN | From patchwork Tue May 28 08:27:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165247 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8168852ili; Tue, 28 May 2019 01:28:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyacT/q5v/fJ4k8kvTJ981j5comxFd6KZL4X0FOaRCDu6TY2lvzyrhB/pU5oJZSO9pAXyND X-Received: by 2002:a17:902:ab8c:: with SMTP id f12mr29766487plr.216.1559032110538; Tue, 28 May 2019 01:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032110; cv=none; d=google.com; s=arc-20160816; b=L/qdFTxJpnt/JTykOCjZ7J/FEhQACSSE69edOSWtBbF9x5+bmg7p/s/MIefEzEbLqA YxO9OEjHj8cnoHS6zd29Gdyp5s5eBLOtZab/lMUxHXrUAhC8BtAFZLGL8Y2UHhjGRoaJ Y6RqoMxglZWEnCusAe1FIoETWzSPllMSm2NhvvOj9H9vEWgegCcX6vaGHQs5dWXTDh0F 1/QswDRBzIX6bOSExw0HyKPJUbsnt8cZ5Z0WZU4v7R5pYENcqrJHw2uQPss34UhLeWdY 60pbyqLpMkrsVXPYpGYq3MXE/k3elvt1g0g+t3pE55viUX87TyLXVIHDqP3MBktSVF5e ok8g== 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=OFups87YcGb1Xkdbw/kuX4W72Tu2+zvybrhRhTZsMJY=; b=I2y7wFqFQIddBQeD8Pm4i7SsVttNwkorGQT21JKvBDNiLK4a8q69RSBISEvNB5MBl5 y8Uk25rOhzgqCPoX5ZaM1/F8UfToZ6XlPI9fKQ4bBud59JS81pdkD+PUZIj3WGg+pBJW ZkyM4wLuShmNOCIdohnFMl1Y2YUBHFXVw7TMuj4vSv7FnmDII6ywZoUbF39niE6cS8VJ SLF6TvXm93qaxez/dopoSgJWZ2kkhb02olHhTRIKpYIXEGP9IwGiUdwL3F9Y6dPVOlZz bkd6VHN7VGHV8hSsHOq2iCcY2q3hELxRHnOs82ORvyNrM10H8By3zPtw1kGFNxF0I1QY TSKA== 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 31si22500230plb.30.2019.05.28.01.28.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:30 -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 6F1EC89C99; Tue, 28 May 2019 08:28:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9821189C96 for ; Tue, 28 May 2019 08:28:23 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SKqr125154; Tue, 28 May 2019 03:28:20 -0500 Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SKwn008473 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:20 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE112.ent.ti.com (10.64.6.33) 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:19 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE102.ent.ti.com (10.64.6.23) 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:19 -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 x4S8Rxub125039; Tue, 28 May 2019 03:28:17 -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 07/24] drm/bridge: tc358767: move video stream setup to tc_main_link_stream Date: Tue, 28 May 2019 11:27:30 +0300 Message-ID: <20190528082747.3631-8-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=1559032100; bh=ubQKBchvHb1DbHv0IZwtMtXBvY0Jz1i/ykl/EdWvH34=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Nn3qXxuCDJTFfWL1w+GK3UqddweV95T9nqZmgpXvicg/qBky4mPHXMbEaYXh8Xv3n vG9eetTtXBvzplZijFl5O8x5LOymG2eNMvtyCdwNhzIHNPkQmHe56UYqCR8GIAYJ2u anUuZPrS0SZZY1WmjYNdc3kXaA5UQ+7BfMMt8WAE= 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" The driver currently sets the video stream registers in tc_main_link_setup. One should be able to establish the DP link without any video stream, so a more logical place is to configure the stream in the tc_main_link_stream. So move them there. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/tc358767.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 39a9de880e5a..4de21c3883d8 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1004,15 +1004,6 @@ static int tc_main_link_setup(struct tc_data *tc) return -EAGAIN; } - ret = tc_set_video_mode(tc, tc->mode); - if (ret) - goto err; - - /* Set M/N */ - ret = tc_stream_clock_calc(tc); - if (ret) - goto err; - return 0; err_dpcd_read: dev_err(tc->dev, "Failed to read DPCD: %d\n", ret); @@ -1031,6 +1022,15 @@ static int tc_main_link_stream(struct tc_data *tc, int state) dev_dbg(tc->dev, "stream: %d\n", state); if (state) { + ret = tc_set_video_mode(tc, tc->mode); + if (ret) + goto err; + + /* Set M/N */ + ret = tc_stream_clock_calc(tc); + if (ret) + goto err; + value = VID_MN_GEN | DP_EN; if (tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) value |= EF_EN; From patchwork Tue May 28 08:27:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165246 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8168836ili; Tue, 28 May 2019 01:28:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxyqXqZ734PQjATFa3/+YB/RKgbYJciGMxBq8RE1Ishv0V0P6Pn1bKrMiJvangf/4qJYNHY X-Received: by 2002:a17:902:20eb:: with SMTP id v40mr8751078plg.239.1559032108876; Tue, 28 May 2019 01:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032108; cv=none; d=google.com; s=arc-20160816; b=FPtvLKwl6Nu/Qw9WFh5HIIVW01HZUtKjV15uPiNeFlx891w9tF6EeXtbxNIWuFgLVp 7Xqm6Ee9wTf6GvDcBRU8qCfRlm59B+shfdYkcvLB3Y4xd5ilWMkKOw4dwNeN76ll0nBF nUres7ygo6x7/OdNZCsNbUGcWVYNuQT0CvZdN9Xf6FkIHCo5Q7NzuNMS7OfWHB3Dx1fm lE4QeAyqpXQfP5PbmmiZxNLNciqBeX5KF2jyk+riaIeAhwBP6dnKEPgR2v2VUJLwksUz Q1RyqTs2AdlMQrfNv6mClhsZLWbDMio0bl6GaeB+WlrkAJ+kug74N5bmFZPw5AxD/hKS S0cw== 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=yJaqt/mDe5Uvwu0Ja6H5rQH65KJ4VjKs7oEcTPqZywo=; b=DCJi96XuvhiVToS4xBpf/1cU1jmDC0Jifh0sCZxUm9PINV0mTB7rvxHPcdxqNhkEBw QZ1ycdg8ibkfNfKXjAE/WVea40h2BpkshhOMaB/Lar0mDWG+IaYw2+RFVy4nX9XR0/LW gLCRCaN5Sm43mJ68KuJf5I+7qwDL99PlyqxMqIFopXVR5TscuY18amvs0GE9EXHBxfAQ 38JOpwg29eDFbi9GX0BG/c4EMa+5N8m7zfd0/Sc+/xhKQgse0yGjKHXD9LlMOf9cR9as AAxeTopDL2eavb9R1c5Q5WV7PjxbTc5qfQdIoqjSaq8gzWASD32D5qrNX91bQ4cYP4sZ OJ5w== 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 g31si16830860plb.241.2019.05.28.01.28.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:28 -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 A090689C97; Tue, 28 May 2019 08:28:27 +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 89C0989C97 for ; Tue, 28 May 2019 08:28:25 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SMQb031798; Tue, 28 May 2019 03:28:22 -0500 Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SMM3008527 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:22 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE109.ent.ti.com (157.170.170.41) 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:22 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE100.ent.ti.com (157.170.170.30) 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:22 -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 x4S8Rxuc125039; Tue, 28 May 2019 03:28:19 -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 08/24] drm/bridge: tc358767: split stream enable/disable Date: Tue, 28 May 2019 11:27:31 +0300 Message-ID: <20190528082747.3631-9-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=1559032102; bh=UBp4HzgSWnsLS3Nsd3+l4jRI+ThOve9T8Hu2uGbDU6I=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ot+2+xLBl5x00NKiqMdnzYhzjZDt4OBI8cCNcRpExRP5pEl93lStg+4ZPYNURvJEn VimVijabPHO3Um3nY11dK6fnAo0darllThYbjeNrXCOpVFYz4RRGhfal+hI/mDRghU 2gpZdv6Rsy4EDsFC3V3yX9OLP6vHdh/NO8tza8Gc= 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" It is nicer to have enable/disable functions instead of set(bool enable) style function. Split tc_main_link_stream into tc_stream_enable and tc_stream_disable. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 81 +++++++++++++++++-------------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 4de21c3883d8..a379b6368157 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1014,47 +1014,56 @@ static int tc_main_link_setup(struct tc_data *tc) return ret; } -static int tc_main_link_stream(struct tc_data *tc, int state) +static int tc_stream_enable(struct tc_data *tc) { int ret; u32 value; - dev_dbg(tc->dev, "stream: %d\n", state); + dev_dbg(tc->dev, "enable video stream\n"); - if (state) { - ret = tc_set_video_mode(tc, tc->mode); - if (ret) - goto err; + ret = tc_set_video_mode(tc, tc->mode); + if (ret) + return ret; - /* Set M/N */ - ret = tc_stream_clock_calc(tc); - if (ret) - goto err; + /* Set M/N */ + ret = tc_stream_clock_calc(tc); + if (ret) + return ret; - value = VID_MN_GEN | DP_EN; - if (tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) - value |= EF_EN; - tc_write(DP0CTL, value); - /* - * VID_EN assertion should be delayed by at least N * LSCLK - * cycles from the time VID_MN_GEN is enabled in order to - * generate stable values for VID_M. LSCLK is 270 MHz or - * 162 MHz, VID_N is set to 32768 in tc_stream_clock_calc(), - * so a delay of at least 203 us should suffice. - */ - usleep_range(500, 1000); - value |= VID_EN; - tc_write(DP0CTL, value); - /* Set input interface */ - value = DP0_AUDSRC_NO_INPUT; - if (tc_test_pattern) - value |= DP0_VIDSRC_COLOR_BAR; - else - value |= DP0_VIDSRC_DPI_RX; - tc_write(SYSCTRL, value); - } else { - tc_write(DP0CTL, 0); - } + value = VID_MN_GEN | DP_EN; + if (tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) + value |= EF_EN; + tc_write(DP0CTL, value); + /* + * VID_EN assertion should be delayed by at least N * LSCLK + * cycles from the time VID_MN_GEN is enabled in order to + * generate stable values for VID_M. LSCLK is 270 MHz or + * 162 MHz, VID_N is set to 32768 in tc_stream_clock_calc(), + * so a delay of at least 203 us should suffice. + */ + usleep_range(500, 1000); + value |= VID_EN; + tc_write(DP0CTL, value); + /* Set input interface */ + value = DP0_AUDSRC_NO_INPUT; + if (tc_test_pattern) + value |= DP0_VIDSRC_COLOR_BAR; + else + value |= DP0_VIDSRC_DPI_RX; + tc_write(SYSCTRL, value); + + return 0; +err: + return ret; +} + +static int tc_stream_disable(struct tc_data *tc) +{ + int ret; + + dev_dbg(tc->dev, "disable video stream\n"); + + tc_write(DP0CTL, 0); return 0; err: @@ -1079,7 +1088,7 @@ static void tc_bridge_enable(struct drm_bridge *bridge) return; } - ret = tc_main_link_stream(tc, 1); + ret = tc_stream_enable(tc); if (ret < 0) { dev_err(tc->dev, "main link stream start error: %d\n", ret); return; @@ -1095,7 +1104,7 @@ static void tc_bridge_disable(struct drm_bridge *bridge) drm_panel_disable(tc->panel); - ret = tc_main_link_stream(tc, 0); + ret = tc_stream_disable(tc); if (ret < 0) dev_err(tc->dev, "main link stream stop error: %d\n", ret); } From patchwork Tue May 28 08:27:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165252 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169031ili; Tue, 28 May 2019 01:28:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxs7S1IytagJxVCxMis65/OOgLj7T8P+PObL8LRkl30A8bBKrXVcHkg9s+Htl87MfCWVkv/ X-Received: by 2002:a17:902:a98b:: with SMTP id bh11mr59971991plb.8.1559032124631; Tue, 28 May 2019 01:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032124; cv=none; d=google.com; s=arc-20160816; b=TrqOMffs3GJIJxUEhz5KPp8abkF2oGgqRSY5IaAKqnpZXlodW0NggwtTH21HQaUG0I TgKiof5GiRROQ58CUbNNr91B41fKlYCjLrhPLuviLqV6UKohKhJhqjN7px7YRITEArvS uMnVWr9QPr4/N87GfBwP33YbwmG7QVVM+eRZO5G6m8406ICoFk/d/7CEaQL8WBpiFksF xzBdRVyWIyn55f7YPWq9A0WOf1dnUvstOKRUKZNUHEtqoaGnJ95Mqgsid8W+RYGZdWg+ 1Yzt0HFMbwAEMpy82jmXEkNJQrK9JEfUFPGRpca8eC0lij/vkiMHmNikRZHBF1d4/7/z tOsQ== 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=uyoqYudtoMmM5S9GCgKZrYMJRjuYeSJt6TTtfLZLq2E=; b=AVFZva5yirfohighmPlfAtan0wrlfjiqFmIsg7Z0YKIu21j471N7ZeSxT75Jg2JpLf ZM9aYUHy/xV7SemdmP0l2i805RKxdog5KLuKOC1o6lZAd58xdc3HsNVWCyEPb4VeImKe 1pVrUQI/7HTqetHF99yBLy+DUlTpDdfn3iTngvh71KOJcz/dhWRW4vU5LdzoVOcIGD0Z OCdn/Rf1cNZfcSipdH+SvFGXyZrkn4r0dUXGosGyFy4i/zq0McJNG/8d2jGvwkhtjfGi 459dMs4qiBvg5o5hVlXVOC0NOQtAGmwB7rIjr/jsnsHXBcisxBiaUou+q72T+lsAQ+Ts UWKg== 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 h25si22329687pfn.209.2019.05.28.01.28.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:44 -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 5886789CC9; Tue, 28 May 2019 08:28:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id ED2F389C99 for ; Tue, 28 May 2019 08:28:27 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SP8S125202; Tue, 28 May 2019 03:28:25 -0500 Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SPod114839 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:25 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE108.ent.ti.com (157.170.170.38) 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:24 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE114.ent.ti.com (157.170.170.25) 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:24 -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 x4S8Rxud125039; Tue, 28 May 2019 03:28:22 -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 09/24] drm/bridge: tc358767: move PXL PLL enable/disable to stream enable/disable Date: Tue, 28 May 2019 11:27:32 +0300 Message-ID: <20190528082747.3631-10-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=1559032105; bh=WAmCS1k13oHgP0LQKJWkZ2w9WvxO5BOLr26olZEsKNI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=jpy21kwi6iT1Q4b3+8yzbNsWSE3DiOKn96AGgjFTUSZjM9G1Jn2IpooZCXhqYcFa0 g1jOspZqp5Fgqu41KlTog2yyDoEjVxuNc1gkYOLhfTvGopqk7JcjbjB28EV6bHn6cv Nuoj5WNpxh1kPK6UbVsj2cXI7JQZE6Dq5g/pSelQ= 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" We set up the PXL PLL inside tc_main_link_setup. This is unnecessary, and makes tc_main_link_setup depend on the video-mode, which should not be the case. As PXL PLL is used only for the video stream (and only when using the HW test pattern), let's move the PXL PLL setup into tc_stream_enable. Also, currently the PXL PLL is only disabled if the driver if removed. Let's disable the PXL PLL when the stream is disabled. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/tc358767.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index a379b6368157..46975676c88c 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -877,14 +877,6 @@ static int tc_main_link_setup(struct tc_data *tc) tc_write(DP1_PLLCTRL, PLLUPDATE | PLLEN); tc_wait_pll_lock(tc); - /* PXL PLL setup */ - if (tc_test_pattern) { - ret = tc_pxl_pll_en(tc, clk_get_rate(tc->refclk), - 1000 * tc->mode->clock); - if (ret) - goto err; - } - /* Reset/Enable Main Links */ dp_phy_ctrl |= DP_PHY_RST | PHY_M1_RST | PHY_M0_RST; tc_write(DP_PHY_CTRL, dp_phy_ctrl); @@ -1021,6 +1013,14 @@ static int tc_stream_enable(struct tc_data *tc) dev_dbg(tc->dev, "enable video stream\n"); + /* PXL PLL setup */ + if (tc_test_pattern) { + ret = tc_pxl_pll_en(tc, clk_get_rate(tc->refclk), + 1000 * tc->mode->clock); + if (ret) + goto err; + } + ret = tc_set_video_mode(tc, tc->mode); if (ret) return ret; @@ -1065,6 +1065,8 @@ static int tc_stream_disable(struct tc_data *tc) tc_write(DP0CTL, 0); + tc_pxl_pll_dis(tc); + return 0; err: return ret; @@ -1391,8 +1393,6 @@ static int tc_remove(struct i2c_client *client) drm_bridge_remove(&tc->bridge); drm_dp_aux_unregister(&tc->aux); - tc_pxl_pll_dis(tc); - return 0; } From patchwork Tue May 28 08:27:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165251 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169001ili; Tue, 28 May 2019 01:28:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxeaNXSZzLSuIk5E+BiFG/Pkh5EEePmfD/NZC06KlN8Ewv9CnrZ4/hidrc4v3h0y34LDL/z X-Received: by 2002:a17:902:6bc8:: with SMTP id m8mr130682720plt.227.1559032122478; Tue, 28 May 2019 01:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032122; cv=none; d=google.com; s=arc-20160816; b=qdgv9wdlNyMrhTtr0kPcCaU+Wq9J4XCFR7Z6+88UGnb8LL6zQgBhrVaJDLDOxmw70R dpaTd/1EAQxzmbea8dsvmqJkUqOMchj/uIpB3BP5TkveolJfl7SMl2v7GrBTVy9VfO0m H7YjG2/1KgjzWM0tCj9liCK9lw8YKcFKp1YWKSctg/YA7OnIZ678k9W4U68HyJo+jiKZ sVAbvbQGi4rk5VKaPBLuSrXTgjUqTFp6RF8VvrQsjwVGAYsjC6/R5zmxAOhGYxPOMXE+ JCDSjAbpjSIRjvaqQgEA7o1TkKItfGGuAu01XiQxRK8lyebYe5SFXjJgWptKOR0yI5c+ DyNA== 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=NE7bkQRPXGKJpSBzjqqbFAdmBc7OWkaP7sjo1JWrMeU=; b=vb605NQvqViNgjWd/t6r0I3OqSKrQfbxQ2U7N1mhQdhpZ03rN9xhOIZEo9PJlAeX3y YFejWOW6J/4fEFqUk+H8ycRiePp8kk2kMGuAOdqrh2SVh/JsdYQsq+Yagz/tlZV6u4AI +Me5Vk7vPlQ9aASaroIbYSSTEgLDC43dUM0FdQ9doa7qfMfo0AD3gNlzYnPAds268vfl mrF0x+DfQsVLna1USdZ9126DWM2lRVV1wKB6TUzqcJxyFXBaV6MrwVkK0P05QTL7Jvc2 WPnTEKdI3IE93XBQ2BWkH8fKPRrTGMJwNwavI6QRJoYPTGMmA+KkhfF4BUUZu/To/m/T fpNA== 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 g3si20865599pgc.156.2019.05.28.01.28.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:42 -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 A69B389CB8; Tue, 28 May 2019 08:28:36 +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 2907589CAF for ; Tue, 28 May 2019 08:28:33 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SR8K031905; Tue, 28 May 2019 03:28:27 -0500 Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SR7Y082845 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:27 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE115.ent.ti.com (10.64.6.36) 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:27 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE110.ent.ti.com (10.64.6.31) 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:27 -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 x4S8Rxue125039; Tue, 28 May 2019 03:28:25 -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 10/24] drm/bridge: tc358767: add link disable function Date: Tue, 28 May 2019 11:27:33 +0300 Message-ID: <20190528082747.3631-11-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=1559032107; bh=E9OK9geYrWh2r44XMJ6sVAh6zf+T0He0OZJ9NtE9SI0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tVmBqlHQLwnO5fnXpKKqZfrn7lKOatqGD8L755TtzmRLTdpm0MJFkWKfYM4orVkKN vmJ32mm3u+PHQR3rn06y0hyBDuaMn2kXhVRPWywbhfv/pvbt//9HgPKTpcKXDcQL39 XecYxGsU+MH2jjbBPzEM7hZ2+HW5lLh/K6MIq7hk= 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" Currently we have tc_main_link_setup(), which configures and enabled the link, but we have no counter-part for disabling the link. Add tc_main_link_disable, and rename tc_main_link_setup to tc_main_link_enable. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 46975676c88c..2323a22656e8 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -822,7 +822,7 @@ static int tc_link_training(struct tc_data *tc, int pattern) return ret; } -static int tc_main_link_setup(struct tc_data *tc) +static int tc_main_link_enable(struct tc_data *tc) { struct drm_dp_aux *aux = &tc->aux; struct device *dev = tc->dev; @@ -837,6 +837,8 @@ static int tc_main_link_setup(struct tc_data *tc) if (!tc->mode) return -EINVAL; + dev_dbg(tc->dev, "link enable\n"); + 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, @@ -1006,6 +1008,20 @@ static int tc_main_link_setup(struct tc_data *tc) return ret; } +static int tc_main_link_disable(struct tc_data *tc) +{ + int ret; + + dev_dbg(tc->dev, "link disable\n"); + + tc_write(DP0_SRCCTRL, 0); + tc_write(DP0CTL, 0); + + return 0; +err: + return ret; +} + static int tc_stream_enable(struct tc_data *tc) { int ret; @@ -1084,15 +1100,16 @@ static void tc_bridge_enable(struct drm_bridge *bridge) struct tc_data *tc = bridge_to_tc(bridge); int ret; - ret = tc_main_link_setup(tc); + ret = tc_main_link_enable(tc); if (ret < 0) { - dev_err(tc->dev, "main link setup error: %d\n", ret); + dev_err(tc->dev, "main link enable error: %d\n", ret); return; } ret = tc_stream_enable(tc); if (ret < 0) { dev_err(tc->dev, "main link stream start error: %d\n", ret); + tc_main_link_disable(tc); return; } @@ -1109,6 +1126,10 @@ static void tc_bridge_disable(struct drm_bridge *bridge) ret = tc_stream_disable(tc); if (ret < 0) dev_err(tc->dev, "main link stream stop error: %d\n", ret); + + ret = tc_main_link_disable(tc); + if (ret < 0) + dev_err(tc->dev, "main link disable error: %d\n", ret); } static void tc_bridge_post_disable(struct drm_bridge *bridge) From patchwork Tue May 28 08:27:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165250 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8168962ili; Tue, 28 May 2019 01:28:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwrug/BKEMWUMaw7vnb+EuCikDMOrETMI99USlRI6AV0AA5FZKmUPxdOZ5MIy3pjAHfB5FF X-Received: by 2002:a63:2d6:: with SMTP id 205mr130617527pgc.114.1559032119896; Tue, 28 May 2019 01:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032119; cv=none; d=google.com; s=arc-20160816; b=AKoqkAA4ONgSuDo5vbFTReJ50oSc7PImxIN0XnyhZx/avvn3dY/8LWlaLtDEOKVlxV NsbMLXOq9302M/d1bcRslQKP0KjL60J1sBUclES9PruhOEJd7NcJAULQ40HNL0TYe1yu t3Jlb4P9f27EnkmpMPRmEmQFJ3IcGllOJZBMNTBOcME5gK4WMnK4/1EIimbatEl+5u3Q hm7sLTxn9FHrgyTAvXhHX9n+/MxFTFAOTHk04Eu5Vc6AxqaurE29pFgaYAQfFasJWTaN kk/0OlH6LFEQW4UJGg/WDHqrNRhVUcK8Shka937qUpkMl+3m/2mcd9/lhx4aeAjl9A1Y Uv3w== 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=qLYPduCEFF7/t5rCp3xYcjHy4JzYG1bkVWjhiNUQdDU=; b=wC8IzBNp4CilsjIVrxwK+1niHjhzi7Ya2xNDuOMgmaZVRZEQUzBv4MbSmNm0mVqM7x HMyL75eesUYZWwzzndXbsnsxXLUYvxvvlDtL7oiplJQBH2189ogaTg+E8S8AsimweepD Q4LMNBe8S7r9C3ydz9II5zd7gfFp3b2XPF0eLin3m38mVog8tub7wQyD59jQ1etxcPQO mZwQgCHCXf98qGK/YLz0gvXSWRx8DiSFgFRGx2Bn2CImrcITyBYJ/JrhH8YfB3d/qhH2 y+F0hoTm7mo0e13l2J1lImTDoV5PxtcYjUFbNflZ45wrmgwjooGUULaLh84dGcg7jWqj Wlyw== 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 f127si15973839pfa.221.2019.05.28.01.28.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:39 -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 685EB89CB5; Tue, 28 May 2019 08:28:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by gabe.freedesktop.org (Postfix) with ESMTPS id 62EA089CA4 for ; Tue, 28 May 2019 08:28:33 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SUtV036730; Tue, 28 May 2019 03:28:30 -0500 Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SUQP008684 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:30 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE104.ent.ti.com (10.64.6.25) 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:29 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE109.ent.ti.com (10.64.6.30) 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:29 -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 x4S8Rxuf125039; Tue, 28 May 2019 03:28:27 -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 11/24] drm/bridge: tc358767: disable only video stream in tc_stream_disable Date: Tue, 28 May 2019 11:27:34 +0300 Message-ID: <20190528082747.3631-12-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=1559032110; bh=SedRjre2xTL1u2YwW9+kMyaMm6yrXa2oF99ONnZ7j+8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=y6VEsHclFKHxDX0qQrZwvFEXK12ECUBxTV0P9AQX2QRvD3mYi5LpU2MOlesbOapzx dfb1F9Q9SSW3TLa+EC/fs7inkJGTeW4qPd5dCoUHkSLI1qSoIPx0yDOOsAiLdK+cFg ermbHJrDbXux9WM9p4Q4O0Z3VYBxhaohFz2c8fyE= 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" Currently the code writes 0 to DP0CTL in tc_stream_disable(), which disables the whole DP link instead of just the video stream. We always disable the link and the stream together from tc_bridge_disable(), so this doesn't cause any issues. Nevertheless, fix this by only clearing VID_EN in tc_stream_disable to stop the video stream while keeping the link enabled. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 2323a22656e8..f004db06dee9 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1076,10 +1076,13 @@ static int tc_stream_enable(struct tc_data *tc) static int tc_stream_disable(struct tc_data *tc) { int ret; + u32 val; dev_dbg(tc->dev, "disable video stream\n"); - tc_write(DP0CTL, 0); + tc_read(DP0CTL, &val); + val &= ~VID_EN; + tc_write(DP0CTL, val); tc_pxl_pll_dis(tc); 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, From patchwork Tue May 28 08:27:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165262 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169458ili; Tue, 28 May 2019 01:29:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLUBLwTgoRb25+Ys1Fj9elv+JvUmKyv4fggmqSoA0drJVIMtlZebp2HxeiP/5Jgi4uLCCw X-Received: by 2002:a63:4419:: with SMTP id r25mr36026456pga.247.1559032152164; Tue, 28 May 2019 01:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032152; cv=none; d=google.com; s=arc-20160816; b=WrXIy3ycBR5EZmGVJ82Z0JqEQ4mA53xM4oY8olZQ/jZmdS1ubIJpW6i4xQljHCZnNR MVrCgNxLhd4t6uGZlNJYAO2MHjy6D8IqqBZc2mFrAnC2y14sniFgfn1AuSfLNo5ycfIY RN5Rg/k2U6GZpYb1HzuAKmYVjo7DteDcrYwKIa4Lo/Uk1TA8yMIOaE7Xwo1D2z+yuvRp LBacWcl5fZbh/jsIZmk5ayTFvlHW3cNLe938CEsnH/AnhkSEqRCK5798TTdauUUVAFim x2sNqZ6wbWzHrL1HAbFS/81TSc84RChvYm0TaPFRJmBKq2N4PvqqH3Fiuk3rpHM6xDDo x8Hg== 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=Ap6/SpkRqsBYOPHAH+yk0a6SNpilyiR8DRw7rsD/dXs=; b=sSSLuVHdHMuVJgEvztnW35Y+1J35PSKArtLfzoajL8QeIgmsvevQloYkEBk5kwdPXt a6kCp9uXmnhDiG1Tx1Wc701YQZA7Gbs5D4CneLu0ChZvf2AdV07bV3YghgFQUgBWVrT7 IlhnHTk8N82ze2BffVqWJBZ8Be2AyYdaMt2NLQ51T6JxeCXYZahYyUcigzFsCftZGPVT bG2p61nxt0hslXkSCYA0u+bftIwFNSNnQBEj7aW78LbfiRuUXXwaxGzd+gXKG7NEVqg6 okBcWVrp6T39dx/FXRwtbsSwt1RztC/auwjKhoygTv6zRpy0K7RfUzLob8iBUU5sBlrQ eOvw== 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 l75si2781309pje.36.2019.05.28.01.29.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:29:12 -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 E7B7189D57; Tue, 28 May 2019 08:28:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by gabe.freedesktop.org (Postfix) with ESMTPS id C4A3C89CCE for ; Tue, 28 May 2019 08:28:40 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8Sa2n036756; Tue, 28 May 2019 03:28:36 -0500 Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8Sai2008861 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:36 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE114.ent.ti.com (10.64.6.35) 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:34 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE107.ent.ti.com (10.64.6.28) 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:34 -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 x4S8Rxuh125039; Tue, 28 May 2019 03:28:32 -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 13/24] drm/bridge: tc358767: remove unnecessary msleep Date: Tue, 28 May 2019 11:27:36 +0300 Message-ID: <20190528082747.3631-14-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=1559032116; bh=rjeMkPPUuniWdBO118d7iYIbarrUJBppNtPQU91XNpg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=yECYQIJALN9zXs3zaV2SuGLwap1JLUrHRPBHw0BmCAfTcrpkHkpeGSvvtxAZahowX Y8Uebli0eNYcNAhc282u2s+mL4L0uXdk5uf7vivn9EZSdMqLwh8ZWUB5jE7QOXIvCv GxeiJF07huKBc9yGZVJN9IPLrMgjA/PNJW68O8NQ= 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" For some reason the driver has a msleep(100) after writing to DP_PHY_CTRL. Toshiba's documentation doesn't suggest any delay is needed, and I have not seen any issues with the sleep removed. Drop it, as msleep(100) is a rather big one. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda Reviewed-by: Andrey Gusakov --- drivers/gpu/drm/bridge/tc358767.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index ccf4c8cfbb52..a60a2e65e468 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -874,7 +874,6 @@ static int tc_main_link_enable(struct tc_data *tc) if (tc->link.base.num_lanes == 2) dp_phy_ctrl |= PHY_2LANE; tc_write(DP_PHY_CTRL, dp_phy_ctrl); - msleep(100); /* PLL setup */ tc_write(DP0_PLLCTRL, PLLUPDATE | PLLEN); From patchwork Tue May 28 08:27:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165255 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169274ili; Tue, 28 May 2019 01:29:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyT9JThQLj3docNDHIyUfdyAmDNyf5rlMIvE5qnCH7x9A2QBiZmF8+cJrB4N6JsGjSOKLA7 X-Received: by 2002:a65:550b:: with SMTP id f11mr33724419pgr.311.1559032141245; Tue, 28 May 2019 01:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032141; cv=none; d=google.com; s=arc-20160816; b=xd+pUwo5ODHX6xM0BE9b+sTWve4UdIUVZLTkZOfVfhVroXsQ7QSIRi8LXZJv5jgzss 5uSNE1I5dC3w5XQaCeu2XldIiTK3jwdaeFrXW+Qhd7M/IDi6YcUTpQDXpVIgoI/lJfhA Da2K6npf4fL+HdHe7ZvhmrXU/p3y7abw6V9KnNCpE+M9qxsh38+skO23Hqzcbdefo0KP hzAEzahFEdOOHmR9PSMlE5fxY0nG5N5BAXiMuG6bz8vwjGJLa9oWrMGcdaCRh2WnyfqV fwafORc4f5T2TIoHC4OJKufHGd2ShJGqegFGsez6pDYxxErV+yuVt1NEEuN44DzODq7d /OWg== 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=auR9HoxIGDbjwjQNot+JJh84Xdua0peyn2ifUJIDh3o=; b=02M9IT42LAj06uTyHIZIWmdcphetwBC+51FR/9uU9U+eCR/kLfUR2m/NfqMuIdh6k5 3gJuO/9/aUxKdISD1zpAGBWf8Qc90cAlegHYdrvUKo3/t5ZhS73A3Od667SQX3zfHySW gojR5bR+DxtKxiuwv0D1C9kelfZy2cQKq/8TMAUao+EiiLw76iZgkEn3mbVnnmq1ddAH JTD+xVcqRsJbhA9I7Tb/UYg+49dNl8BLHbNHfEi8Gqdb8zbEHiiSlASfbyfAjk5Q9uWy 5gsOE3dl7gdsykPGNiANlPEkxEOi1E4UYTgSm2o9HR7NXAVpjxhhaDObsxL2FM/t3qUp /BSg== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id h21si20614456pgv.266.2019.05.28.01.29.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:29:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 6D76289CAF; Tue, 28 May 2019 08:28:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 863C989CF9 for ; Tue, 28 May 2019 08:28:41 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8Sc69125286; Tue, 28 May 2019 03:28:38 -0500 Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SbQE083025 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:37 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE110.ent.ti.com (10.64.6.31) 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:37 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE112.ent.ti.com (10.64.6.33) 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:37 -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 x4S8Rxui125039; Tue, 28 May 2019 03:28:35 -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 14/24] drm/bridge: tc358767: use more reliable seq when finishing LT Date: Tue, 28 May 2019 11:27:37 +0300 Message-ID: <20190528082747.3631-15-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=1559032118; bh=I0qHcVhPYKdpjSqR6xuKYqzFyr4QxWqd0Vb32SyYoX8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=XmQ9/HudenOGCTnrHdL9qC8wL9XLnl5vizfg2cXITDrA6ZvAtaG85o0mzfPHMhQFD zSvTd+lBvQcSMszkPDPdSl87Ce1trjIqvarJargsiE9dtbkcKS3l3pckgGEwRoWEMx Y/u5esZXyEdUU0HkgS2Ni1FJpt3y3UbKietcgeOU= 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" At the end of the link training, two steps have to be taken: 1) tc358767's LT mode is disabled by a write to DP0_SRCCTRL, and 2) Remove LT flag in DPCD 0x102. Toshiba's documentation tells to first write the DPCD, then modify DP0_SRCCTRL. In my testing this often causes issues, and the link disconnects right after those steps. If I reverse the steps, it works every time. There's a chance that this is DP sink specific, though, but as my testing shows this sequence to be much more reliable, let's change it. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index a60a2e65e468..40f3efcade50 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -961,6 +961,18 @@ static int tc_main_link_enable(struct tc_data *tc) if (ret) goto err; + /* + * Toshiba's documentation suggests to first clear DPCD 0x102, then + * clear the training pattern bit in DP0_SRCCTRL. Testing shows + * that the link sometimes drops if those steps are done in that order, + * but if the steps are done in reverse order, the link stays up. + * + * So we do the steps differently than documented here. + */ + + /* Clear Training Pattern, set AutoCorrect Mode = 1 */ + tc_write(DP0_SRCCTRL, tc_srcctrl(tc) | DP0_SRCCTRL_AUTOCORRECT); + /* Clear DPCD 0x102 */ /* Note: Can Not use DP0_SNKLTCTRL (0x06E4) short cut */ tmp[0] = tc->link.scrambler_dis ? DP_LINK_SCRAMBLING_DISABLE : 0x00; @@ -968,9 +980,6 @@ static int tc_main_link_enable(struct tc_data *tc) if (ret < 0) goto err_dpcd_write; - /* Clear Training Pattern, set AutoCorrect Mode = 1 */ - tc_write(DP0_SRCCTRL, tc_srcctrl(tc) | DP0_SRCCTRL_AUTOCORRECT); - /* Wait */ timeout = 100; do { From patchwork Tue May 28 08:27:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165258 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169354ili; Tue, 28 May 2019 01:29:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9kkbzCmrWtZ8hc7KN50HPgUOmBtORpNuugJHHP/8x9LmW8/DzfYTiwSu6vYxHlOwm+oRI X-Received: by 2002:a17:902:521:: with SMTP id 30mr94469550plf.62.1559032146728; Tue, 28 May 2019 01:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032146; cv=none; d=google.com; s=arc-20160816; b=n7n3aYelAH1S0mXOaFIm84yOqaRxIymG4o+RHaN+gDucIH2WUinnpQxipffa3BBZbu A5mWi0/gx8c3EqpnMpYItEQquH+fwpGnPvxnK9a+JWJChjW8J/7D5htJaP969tYKw35X sIFu8dEQ4rvZr2mEob1Ula8RNRpjPIDtrmq2rG6NTefSGpxwZG4h3hYSGsOhbyHyY9aR jxonaj8wMiJs3aYMy9de564W9pQfYwckLaAVDnDVj5+oPOUh80oJuMEtq4cvzhYgXSW3 Q68fziuODRxW4/3biarvgXFy/VVFIwV6xt+syKY1zTjEsWQ10MKxX3vXKOK0+pv72gB2 6ufA== 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=hR02zkBaYEXpDS4+d9pAyDmx7WdH76SPorgwXWqDB2k=; b=o2oSu0A2jl2d24PSEYrJb1hXTvgybnXlBCH3c942PU2HSMDnLgOe60eJ1X5BulHcfQ z2Lj5D/vjLNcT+lO3TKwPH2MAspXHQlKv7cKsiJuFWl00EOd0yDvObOpkB84EqAfNMaa xeclDEPOQOCaCdujKLSr30MxtH4jUiFs4XspVCZKi0AaU2ImcvrfgwCno70hxjF9xtzS zNeC37efq7dRWOakc048IQ3Js0dyJAiJJgm7BRvxwbmH4NCnC5vJjGsOzwj/QcNxlW/H PYyzXKMR/1VOHSu8twfxyOfk06oi+w3L1DjT/6m9eewm43pqng/5bLFdMRWHDN936Bel Qp7Q== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id y2si18523027plp.79.2019.05.28.01.29.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:29:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 B579489C6C; Tue, 28 May 2019 08:28:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 74C3089C59 for ; Tue, 28 May 2019 08:28:44 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SeHi125327; Tue, 28 May 2019 03:28:40 -0500 Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8Seln008958 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:40 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE109.ent.ti.com (157.170.170.41) 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:40 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE107.ent.ti.com (157.170.170.37) 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:39 -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 x4S8Rxuj125039; Tue, 28 May 2019 03:28:37 -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 15/24] drm/bridge: tc358767: cleanup LT result check Date: Tue, 28 May 2019 11:27:38 +0300 Message-ID: <20190528082747.3631-16-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=1559032120; bh=JlsZ2PO14CosCIkb7J5yRi14vjS1dZt7kah/gxj8odc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=AnRSZps4eogS33UE64ZK9zxaARkJ0k0/E0R2P1pXRGreGXxNFdQd6CheVBHOWtRNX CydW91daj4nwhIzRufzgzERq4b5aPjJp0JiQQ1XZsgC6usL/axoOrGH9+7oD71tLyb QAFLFEMF0X7ToRwq8woYMNklbz7FUvuejd1tlYwo= 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" The driver has a loop after ending link training, where it reads the DPCD link status and prints an error if that status is not ok. The loop is unnecessary, as far as I can understand from DP specs, so let's remove it. We can also print the more specific errors to help debugging. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 62 +++++++++++++++++-------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 40f3efcade50..d79b1d0ca0db 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -980,34 +980,42 @@ static int tc_main_link_enable(struct tc_data *tc) if (ret < 0) goto err_dpcd_write; - /* Wait */ - timeout = 100; - do { - udelay(1); - /* Read DPCD 0x202-0x207 */ - ret = drm_dp_dpcd_read_link_status(aux, tmp + 2); - if (ret < 0) - goto err_dpcd_read; - } while ((--timeout) && - !(drm_dp_channel_eq_ok(tmp + 2, tc->link.base.num_lanes))); + /* Check link status */ + ret = drm_dp_dpcd_read_link_status(aux, tmp); + if (ret < 0) + goto err_dpcd_read; - if (timeout == 0) { - /* Read DPCD 0x200-0x201 */ - ret = drm_dp_dpcd_read(aux, DP_SINK_COUNT, tmp, 2); - if (ret < 0) - goto err_dpcd_read; - dev_err(dev, "channel(s) EQ not ok\n"); - dev_info(dev, "0x0200 SINK_COUNT: 0x%02x\n", tmp[0]); - dev_info(dev, "0x0201 DEVICE_SERVICE_IRQ_VECTOR: 0x%02x\n", - tmp[1]); - dev_info(dev, "0x0202 LANE0_1_STATUS: 0x%02x\n", tmp[2]); - dev_info(dev, "0x0204 LANE_ALIGN_STATUS_UPDATED: 0x%02x\n", - tmp[4]); - dev_info(dev, "0x0205 SINK_STATUS: 0x%02x\n", tmp[5]); - dev_info(dev, "0x0206 ADJUST_REQUEST_LANE0_1: 0x%02x\n", - tmp[6]); - - return -EAGAIN; + ret = 0; + + value = tmp[0] & DP_CHANNEL_EQ_BITS; + + if (value != DP_CHANNEL_EQ_BITS) { + dev_err(tc->dev, "Lane 0 failed: %x\n", value); + ret = -ENODEV; + } + + if (tc->link.base.num_lanes == 2) { + value = (tmp[0] >> 4) & DP_CHANNEL_EQ_BITS; + + if (value != DP_CHANNEL_EQ_BITS) { + dev_err(tc->dev, "Lane 1 failed: %x\n", value); + ret = -ENODEV; + } + + if (!(tmp[2] & DP_INTERLANE_ALIGN_DONE)) { + dev_err(tc->dev, "Interlane align failed\n"); + ret = -ENODEV; + } + } + + if (ret) { + dev_err(dev, "0x0202 LANE0_1_STATUS: 0x%02x\n", tmp[0]); + dev_err(dev, "0x0203 LANE2_3_STATUS 0x%02x\n", tmp[1]); + dev_err(dev, "0x0204 LANE_ALIGN_STATUS_UPDATED: 0x%02x\n", tmp[2]); + dev_err(dev, "0x0205 SINK_STATUS: 0x%02x\n", tmp[3]); + dev_err(dev, "0x0206 ADJUST_REQUEST_LANE0_1: 0x%02x\n", tmp[4]); + dev_err(dev, "0x0207 ADJUST_REQUEST_LANE2_3: 0x%02x\n", tmp[5]); + goto err; } return 0; From patchwork Tue May 28 08:27:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165254 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169213ili; Tue, 28 May 2019 01:28:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzav/q7Be+NZyR4aC6hVfMVfgW6kHoUgeMIP0RCPXmyTdUSQDYt8CbGBTV0R+cKk6YpzBfn X-Received: by 2002:aa7:9e89:: with SMTP id p9mr17582940pfq.151.1559032137431; Tue, 28 May 2019 01:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032137; cv=none; d=google.com; s=arc-20160816; b=IwX+fJj//zqSSpP5Zg3J/FZ0/4u055HmTr3pL6CaN+7DXBneHzDaDnYVr05Dy1cGDY ujsUMv9dOmwuXk7aqYFpoB8Q9BUHlPCrJPQ4PmUCXpOyWSMOk4+tza4lCWLSotjgxYxO vvlRdE0mRuzVhVzeWkeRTaOKdXGTBAGrZt/136BxCoPrfpr4Q/B59LBIeuH0vSdffCLx +kYKLMPr0V+8mY1a3mZq1TNo4eaHNu3/b8ZANPYgCO8QnVnnQsqiip+ziTy2L7izDm6Z Vw88ThjDLUpUth5aO2ZiJv7sDA6evuNZF5Y9Ub3gLjA7t69gEHRMP3mPw7OCDMIP54lf UzSw== 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=WVyCHOmD2azYYwFxZca5eQ1FjrURg/bWpafkD/qdoZo=; b=WF2I96Mcyfqw40P6bn9M8nxuAqgCvBLvopxkTl+RUmlrBEsG7asHLw3MH0UVSURWtU ZS2edW1KYtxECZMYzaJQAFuBvo2PYrTwTcM2OqkyTPKnjrguf/AYMDfLCIlag3LGRH8h SWcEXdvdWcWGK3KbdOvMaWqhk1TTdNLSbfcPg5ooEEwSNFseCkt6AA/LWVqD8g7Hn8DH CF76ThawRKuWqzmS7u1vmNI1AvoAMXTM9Zq8fcHItnmTX7bQmlHWJ6IIb+D6xfwlXVqH NbHippD3sQ8eoYlqCELQYuKaXrIkyoyUxUViTrl+pT4vo9mXfleQnDKSaoPsuBH6P8/f Z6nQ== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id 126si22836675pgc.2.2019.05.28.01.28.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 DA79B89C83; Tue, 28 May 2019 08:28:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 940F889D02 for ; Tue, 28 May 2019 08:28:47 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8Sh9c125353; Tue, 28 May 2019 03:28:43 -0500 Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8ShsE115108 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:43 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE105.ent.ti.com (157.170.170.35) 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:42 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE108.ent.ti.com (157.170.170.38) 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:42 -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 x4S8Rxuk125039; Tue, 28 May 2019 03:28:40 -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 16/24] drm/bridge: tc358767: clean-up link training Date: Tue, 28 May 2019 11:27:39 +0300 Message-ID: <20190528082747.3631-17-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=1559032123; bh=HagT0eq2gfjYNqJ2BnYyRsURVlC8Q50Jma7y0ziV7Ms=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=As8ojXEmJfPp4hmywxK31S254UX9PjNoL9upR15wTDDn3Cq8jkpt4AQBsj7qJKwt0 cIR3tplj02rp3UAIGkgeftCSYaXPwu0VjPWc99SwUPIikXvbzGPhoUFTF8KH4S2ie1 iISgmZstg2p+zUm0mMDUV4GwIP+d7ZeLkP2PuDuo= 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" The current link training code does unnecessary retry-loops, and does extra writes to the registers. It is easier to follow the flow and ensure it's similar to Toshiba's documentation if we deal with LT inside tc_main_link_enable() function. This patch adds tc_wait_link_training() which handles waiting for the LT phase to finish, and does the necessary LT register setups in tc_main_link_enable, without extra loops. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 136 +++++++++++++----------------- 1 file changed, 60 insertions(+), 76 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index d79b1d0ca0db..10a9b46de5f1 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -740,84 +740,24 @@ static int tc_set_video_mode(struct tc_data *tc, return ret; } -static int tc_link_training(struct tc_data *tc, int pattern) +static int tc_wait_link_training(struct tc_data *tc) { - const char * const *errors; - u32 srcctrl = tc_srcctrl(tc) | DP0_SRCCTRL_SCRMBLDIS | - DP0_SRCCTRL_AUTOCORRECT; - int timeout; - int retry; + u32 timeout = 1000; u32 value; int ret; - if (pattern == DP_TRAINING_PATTERN_1) { - srcctrl |= DP0_SRCCTRL_TP1; - errors = training_pattern1_errors; - } else { - srcctrl |= DP0_SRCCTRL_TP2; - errors = training_pattern2_errors; - } - - /* Set DPCD 0x102 for Training Part 1 or 2 */ - tc_write(DP0_SNKLTCTRL, DP_LINK_SCRAMBLING_DISABLE | pattern); - - tc_write(DP0_LTLOOPCTRL, - (0x0f << 28) | /* Defer Iteration Count */ - (0x0f << 24) | /* Loop Iteration Count */ - (0x0d << 0)); /* Loop Timer Delay */ - - retry = 5; do { - /* Set DP0 Training Pattern */ - tc_write(DP0_SRCCTRL, srcctrl); - - /* Enable DP0 to start Link Training */ - tc_write(DP0CTL, DP_EN); - - /* wait */ - timeout = 1000; - do { - tc_read(DP0_LTSTAT, &value); - udelay(1); - } while ((!(value & LT_LOOPDONE)) && (--timeout)); - if (timeout == 0) { - dev_err(tc->dev, "Link training timeout!\n"); - } else { - int pattern = (value >> 11) & 0x3; - int error = (value >> 8) & 0x7; - - dev_dbg(tc->dev, - "Link training phase %d done after %d uS: %s\n", - pattern, 1000 - timeout, errors[error]); - if (pattern == DP_TRAINING_PATTERN_1 && error == 0) - break; - if (pattern == DP_TRAINING_PATTERN_2) { - value &= LT_CHANNEL1_EQ_BITS | - LT_INTERLANE_ALIGN_DONE | - LT_CHANNEL0_EQ_BITS; - /* in case of two lanes */ - if ((tc->link.base.num_lanes == 2) && - (value == (LT_CHANNEL1_EQ_BITS | - LT_INTERLANE_ALIGN_DONE | - LT_CHANNEL0_EQ_BITS))) - break; - /* in case of one line */ - if ((tc->link.base.num_lanes == 1) && - (value == (LT_INTERLANE_ALIGN_DONE | - LT_CHANNEL0_EQ_BITS))) - break; - } - } - /* restart */ - tc_write(DP0CTL, 0); - usleep_range(10, 20); - } while (--retry); - if (retry == 0) { - dev_err(tc->dev, "Failed to finish training phase %d\n", - pattern); + udelay(1); + tc_read(DP0_LTSTAT, &value); + } while ((!(value & LT_LOOPDONE)) && (--timeout)); + + if (timeout == 0) { + dev_err(tc->dev, "Link training timeout waiting for LT_LOOPDONE!\n"); + return -ETIMEDOUT; } - return 0; + return (value >> 8) & 0x7; + err: return ret; } @@ -927,7 +867,7 @@ static int tc_main_link_enable(struct tc_data *tc) if (tmp[0] != tc->assr) { dev_dbg(dev, "Failed to switch display ASSR to %d, falling back to unscrambled mode\n", - tc->assr); + tc->assr); /* trying with disabled scrambler */ tc->link.scrambler_dis = true; } @@ -953,13 +893,57 @@ static int tc_main_link_enable(struct tc_data *tc) if (ret < 0) goto err_dpcd_write; - ret = tc_link_training(tc, DP_TRAINING_PATTERN_1); - if (ret) + /* Clock-Recovery */ + + /* Set DPCD 0x102 for Training Pattern 1 */ + tc_write(DP0_SNKLTCTRL, DP_LINK_SCRAMBLING_DISABLE | + DP_TRAINING_PATTERN_1); + + tc_write(DP0_LTLOOPCTRL, + (15 << 28) | /* Defer Iteration Count */ + (15 << 24) | /* Loop Iteration Count */ + (0xd << 0)); /* Loop Timer Delay */ + + tc_write(DP0_SRCCTRL, tc_srcctrl(tc) | DP0_SRCCTRL_SCRMBLDIS | + DP0_SRCCTRL_AUTOCORRECT | DP0_SRCCTRL_TP1); + + /* Enable DP0 to start Link Training */ + tc_write(DP0CTL, + ((tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) ? EF_EN : 0) | + DP_EN); + + /* wait */ + ret = tc_wait_link_training(tc); + if (ret < 0) goto err; - ret = tc_link_training(tc, DP_TRAINING_PATTERN_2); - if (ret) + if (ret) { + dev_err(tc->dev, "Link training phase 1 failed: %s\n", + training_pattern1_errors[ret]); + ret = -ENODEV; goto err; + } + + /* Channel Equalization */ + + /* Set DPCD 0x102 for Training Pattern 2 */ + tc_write(DP0_SNKLTCTRL, DP_LINK_SCRAMBLING_DISABLE | + DP_TRAINING_PATTERN_2); + + tc_write(DP0_SRCCTRL, tc_srcctrl(tc) | DP0_SRCCTRL_SCRMBLDIS | + DP0_SRCCTRL_AUTOCORRECT | DP0_SRCCTRL_TP2); + + /* wait */ + ret = tc_wait_link_training(tc); + if (ret < 0) + goto err; + + if (ret) { + dev_err(tc->dev, "Link training phase 2 failed: %s\n", + training_pattern2_errors[ret]); + ret = -ENODEV; + goto err; + } /* * Toshiba's documentation suggests to first clear DPCD 0x102, then From patchwork Tue May 28 08:27:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165256 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169295ili; Tue, 28 May 2019 01:29:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/VV7mV4BUMUTKHPA15f4wSJXR+Yw3mZRIQNBGU507A8PvZfKQrF0Vv5fcAHTEdHblHhga X-Received: by 2002:a63:4346:: with SMTP id q67mr130433486pga.241.1559032142901; Tue, 28 May 2019 01:29:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032142; cv=none; d=google.com; s=arc-20160816; b=O0F8jCHrtZ/NW42z2IMk+ZYDlwuVamGuBurVqbnCZIsI9d5JKSEVMwY/Wz2XOTQhc9 ADtpnw1woysJsTiI94TDsc/FMXh7AgEq9+IpzbFit/cZvrFQvnyhBDuBKaHb3DN3dmhz EBqLKrTsiBZxwdvBUZteTdiogVYGyEg03cHpyW0xO0YCnib9xMpmBH3nXlI5/dh26SPL nQnnTZo5VTBdD2+MHko81Muk85mcub/XsTQkyONKa8eJH7U0qts7Bpj4farCeMqf06Zl O0Bz14WED6mzLoIg2lc8/rsHF3xp3f7YpYILEKw+WmH/z/8eSd7tbz2XLmOdLd+cb/PC Isyg== 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=l78rFxcGDlL6kd7ReXuWlKi3R32RoGnBwaZ9jNaGrgU=; b=rh03XNDekf3IjNc8GU2l6HjuVJfOE+CM5mAww0/69IrBPry1vuT/Z25XBQKiu0DQ24 rTNx1xdsu8WHNCGZQTa/eSf2xTxSq14sK4MhT5e4WU8cIwNUxyBD710aUSpzg6jh6uab BJwG0zxYzDvkxK97LxdN4Vktm9LhqsAQhSU6ywtyKwyY/tELDFexYDsyFwHKDKn0vUKc MtMCfTVk3+IgSqA0XmHiXEmqYrZgQHln4hsro7C+3KoqaC94zqUOegN7YChPx83swj/2 aMTr34avjHXznlZDmQ6a0ZvRgFLt3zA4ZGUiXpJ2grMe6N2tuW5jc8/dJFqmBRaGL45U 3PQg== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id p3si9900449plq.78.2019.05.28.01.29.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:29:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 CF4E889C6E; Tue, 28 May 2019 08:28:55 +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 5E76E89D02 for ; Tue, 28 May 2019 08:28:49 +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 x4S8Sjqb032200; Tue, 28 May 2019 03:28:45 -0500 Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SjAl115148 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:45 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE114.ent.ti.com (157.170.170.25) 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:44 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE109.ent.ti.com (157.170.170.41) 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:45 -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 x4S8Rxul125039; Tue, 28 May 2019 03:28:42 -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 17/24] drm/bridge: tc358767: remove check for video mode in link enable Date: Tue, 28 May 2019 11:27:40 +0300 Message-ID: <20190528082747.3631-18-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=1559032125; bh=37aqo7tEqJe/Zc3BOPvR4eqVx2flaYd7SUmzoNetNZ4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZfW+Nry7PMfQEN5tKQU/xk1p7qGp4hfKsmEC+CQtZj+jB60Cf8row0GS5dvjLRVT6 cXeDzBdDbjRN5iJUXqpaYBrc0sod+4ps7ekH1SzGG5yZ3RhpgT0E9rNwe01yJ/aN+d P9VgEKiZCjwC/12TlxWlWSOuPWTKixfh3VtjH3dw= 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" tc_main_link_enable() checks if videomode has been set, and fails if there's no videomode. As tc_main_link_enable() no longer depends on the videomode, we can drop the check. Also, while tc_stream_enable() does depend on the videomode, we can expect that a mode has been set before drm_bridge_funcs.enable is called, so we don't need the check there either. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 10a9b46de5f1..604e54b90b79 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -773,10 +773,6 @@ static int tc_main_link_enable(struct tc_data *tc) int ret; u8 tmp[8]; - /* display mode should be set at this point */ - if (!tc->mode) - return -EINVAL; - dev_dbg(tc->dev, "link enable\n"); tc_read(DP0CTL, &value); From patchwork Tue May 28 08:27:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165260 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169437ili; Tue, 28 May 2019 01:29:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwb8eXVsEvdXAcejFn3O8o8A6NiE9etOxURI42bBYWQnSxdg1lWB4RtT7ggX496FzFGcuRW X-Received: by 2002:a17:902:a613:: with SMTP id u19mr118531937plq.42.1559032151466; Tue, 28 May 2019 01:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032151; cv=none; d=google.com; s=arc-20160816; b=zatpDYRoXr9oW/ONWfuRGembuB0Hy1CB4hbkJ6JPO9lRc+jaagT1okLs+jeXkSES6J gPMDVlp8XVXEIry8PWcWDXay/id3Ci3u534YRfnTLKHENDq2IxJm5HsAVGWseCMC7nd2 FbejTBHDviNjFGKeVC9jJN5An+yU3xruK8zJsea4wn17/zDng93DO9iTUzr3o0LrfuRY RfLb6XXyid59nOR6gy68AtRjLQufRfUvuE98pZzhacRWVjyKEYhktSbuJeoyei1IKs6s cUsk6VBfIuc2ViP2U1dcEtUwM50V1S0xPvI2UkmfNLeskQEZGrFSlHjxZTuzPC+QFXMc U+vw== 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=oRLwt6LqEPKRdbJc1J2OVmnapjx6flupL7fZ87JJVeE=; b=vvRDO+3pl977I1BgZZptVeax6RoPiQ7Xa92a39Sglk3tMUc06goxkmOS1EZ1wdcv2g K+lOqoq/oAN48x45uQLvjXIbAPEo//8+1E9YU7V88mH3KqhiEQAHOv61aUtYxJbtuUFi 48abtQJdMlWxylHYA3OgFWOd0ZrA+AvoYa66ShnscgPUyDzQDZRwYqxFYdyZsGKS4HJA 2dvhNZDWQUGyrKDLV2bAVSQ3OVWsl/qW7vBLxEanMguONpJgrwpg12hLXOdez3cGSdEn tw818iH3TzCSCrT6pDdf8msi0rI4fbjeh0u866dQCHdLDST31ZqWr5jg25ucyJV6r8XF iM9w== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id x2si19767054pgk.223.2019.05.28.01.29.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:29:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 5659589D5F; Tue, 28 May 2019 08:28:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by gabe.freedesktop.org (Postfix) with ESMTPS id 47DDB89D40 for ; Tue, 28 May 2019 08:28:51 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8Sm8I036820; Tue, 28 May 2019 03:28:48 -0500 Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SmSP009103 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:48 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE100.ent.ti.com (10.64.6.21) 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:47 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE114.ent.ti.com (10.64.6.35) 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:47 -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 x4S8Rxum125039; Tue, 28 May 2019 03:28:45 -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 18/24] drm/bridge: tc358767: use bridge mode_valid Date: Tue, 28 May 2019 11:27:41 +0300 Message-ID: <20190528082747.3631-19-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=1559032128; bh=/T1LzXxtauTCa9x+NGjZvKSElcvoWs5REXjGyhKYZg4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=LwPFCaQXQbaOiMVav9CI0OFdgj7forYtSdCQZMkj/zkSYdQCKTuIgr9us1i/seUlK eF6YLK77BoAXkXPEyaeacWN996ju7CeXrA4qbB08AUJKqy+CVCtyJtZkwOV22H1lVZ TgBoB4Lth4tVlhyareFtyDvkwPTSWzoP0XzpR9D8= 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" We have tc_connector_mode_valid() to filter out videomdoes that the tc358767 cannot support. As it is a bridge limitation, change the code to use drm_bridge_funcs's mode_valid instead. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/tc358767.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 604e54b90b79..9ebe78e9562d 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1154,10 +1154,10 @@ static bool tc_bridge_mode_fixup(struct drm_bridge *bridge, return true; } -static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) +static enum drm_mode_status tc_mode_valid(struct drm_bridge *bridge, + const struct drm_display_mode *mode) { - struct tc_data *tc = connector_to_tc(connector); + struct tc_data *tc = bridge_to_tc(bridge); u32 req, avail; u32 bits_per_pixel = 24; @@ -1226,7 +1226,6 @@ tc_connector_best_encoder(struct drm_connector *connector) static const struct drm_connector_helper_funcs tc_connector_helper_funcs = { .get_modes = tc_connector_get_modes, - .mode_valid = tc_connector_mode_valid, .best_encoder = tc_connector_best_encoder, }; @@ -1269,6 +1268,7 @@ static int tc_bridge_attach(struct drm_bridge *bridge) static const struct drm_bridge_funcs tc_bridge_funcs = { .attach = tc_bridge_attach, + .mode_valid = tc_mode_valid, .mode_set = tc_bridge_mode_set, .pre_enable = tc_bridge_pre_enable, .enable = tc_bridge_enable, From patchwork Tue May 28 08:27:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165259 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169388ili; Tue, 28 May 2019 01:29:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMr/Wujeg4Eu91W6Vh+8d+nEIAdR2WEFb9J4wqjYd3UbuvMbhuSfPCApF7ttN2tLXa4UHF X-Received: by 2002:a17:90a:2042:: with SMTP id n60mr4066558pjc.8.1559032148612; Tue, 28 May 2019 01:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032148; cv=none; d=google.com; s=arc-20160816; b=CkVqqgAXB45De/WAwFQSbY03OoFt4Tirtq0O7NFT/sIPouP6iAwXSnlvPnVLCh8iNM ke8eHlFbfZW5kytt6YqNYrCVFnqoXdWPxNRfL+c+HBykOJ82gaPTyiO4BVtn8aZDx93f /m96/y0/8zywix4H++uiUY/7r3aUPRztJpAVHYf7cURHJ8Y5/z635oix10EmVHc8M96d hv8mOcQXIT82X+PALNwLjVXxjBbazJ9ZYOF0bin3ttq+mD7d/rf1boiWshhY5mig2FUA 7Fgj4Dadw7b46ZpIl4ssz0EknRMVjix5s5cjKwRTOtE61moP7vOg8brR7s8weIhrx+j/ CPzQ== 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=Wn+RV6h/oHa7CxlEyom+xBQmqjc1YM79cJ1bdkO7/5c=; b=KziF9wqnaYjzWMtvhhAMQmIbOEJI9GS6iTSew/PlXIr2YwUpPK7anMAQ5CzO8egDUw i/lx/Z3DC1tb3NDbjv6TqCGR9nza36jHiytXrmx915hhD9ddA/n3aarzZNe00xmBuYhW 0K5eJ+MGXTgkc+Gcxzk29XM5ZYvLnO/xoPNkQiS72zKoHzCNm6ZAqTvWW7PbF1mFZyhH O7Wgg7H/q9GxGJRB+aSNzg9BaAO7BhmHfhVB/aaS5QCOpIodpci61tXg9AS2rqjUbJ9o kvN+hBFF3kqw1eK975rvJVHpLDTQx1QK5umO//bBTTqnbie465BLplnuCE9NrtpKCh6A TKTg== 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 j38si21812268plb.308.2019.05.28.01.29.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:29:08 -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 EE00D89D42; Tue, 28 May 2019 08:28:56 +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 C2D1989C3B for ; Tue, 28 May 2019 08:28:54 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8Sqqf032226; Tue, 28 May 2019 03:28:52 -0500 Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8Sqgq009135 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:52 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE113.ent.ti.com (10.64.6.34) 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:50 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE103.ent.ti.com (10.64.6.24) 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:50 -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 x4S8Rxun125039; Tue, 28 May 2019 03:28:47 -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 19/24] drm/bridge: tc358767: remove tc_connector_best_encoder Date: Tue, 28 May 2019 11:27:42 +0300 Message-ID: <20190528082747.3631-20-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=1559032132; bh=JcH/k90K2NdKuQIhVQGBKUjUrh6l+7pWfnz67BreAG0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=b5fjyRJ9sh7ORIAGA/craZTfdVa/uRLyt3K/1n7sJk2mTGgeQCvN7VPAz6gCKOXjJ diFdlUCkad+Lo7tp6DJ/b2ZGE9sNkrUPA0jqBAYHk1U9b/0kS6J9WjAD/0ckRK7mwz 9STftAIPTBnQUqXgtD/irQt4T/GTh1ch+tpkoy+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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drm_connector_helper_funcs.best_encoder is only needed when the connector can have more than one encoder, and that is never the case here. So remove tc_connector_best_encoder. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/tc358767.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 9ebe78e9562d..83cb43af60e5 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1216,17 +1216,8 @@ static void tc_connector_set_polling(struct tc_data *tc, DRM_CONNECTOR_POLL_DISCONNECT; } -static struct drm_encoder * -tc_connector_best_encoder(struct drm_connector *connector) -{ - struct tc_data *tc = connector_to_tc(connector); - - return tc->bridge.encoder; -} - static const struct drm_connector_helper_funcs tc_connector_helper_funcs = { .get_modes = tc_connector_get_modes, - .best_encoder = tc_connector_best_encoder, }; static const struct drm_connector_funcs tc_connector_funcs = { From patchwork Tue May 28 08:27:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165257 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169333ili; Tue, 28 May 2019 01:29:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxL2u0tSF9gVids+d9oYUsZ3HfTQTCU6LqI3zB5qe9huV2Y1CEpHl7XDrPvYbl4ASx+wbZM X-Received: by 2002:a63:2ace:: with SMTP id q197mr45278953pgq.102.1559032144781; Tue, 28 May 2019 01:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032144; cv=none; d=google.com; s=arc-20160816; b=Xp27Dp1NC1vh29TlX+CTGQSY3O+j2OPnTNbMjtGJoWtyRI3nr8sTmS+HonyD3f7khY 07dKw8qnKvwBz+6oH/Mx9NhLe6mgzuAJTRFxvPM+CBTGq4ZyJgTYtPMVgJIrYJANjCNH 89mEmYB5XZzydR2i+9/OO75lAw50e5KcO6KDcWtqwQ8FattIRfQvaomVTf04F4iqGvCP QvArNM72+Uaf09TtVVjkrOZz0LkDZjOPrO2YSyOUjI0z1yoYxOVKtWkhWiqe7EqGC3Iq pb6fuXt8utny8obnh+wjeSSnI4z+C+Y/7KBdJrktBZUdNo7YP0VfzulA2TRfwPmHqnea h2Cg== 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=iLtR8QTjYpDNYYZOjj6mmJcL7j06sI7o060cpKsWZfY=; b=rG4JzQ5ERQ8BG37yTATQiKBLVe5e6wx4A6amVawIFS7Pe8e8Jq7bNfAkdKsf5Bz33t egcmRRv0MzDgOLNGJtKWFKWpov3XOFtSaXTELFtzcp68QgHqQZ3mgilrh2xf3J3P8p72 9Ey/3vTGacdZ9mpoJPxH8k8oOPscIrdkxNqf5e7JKBQv9i90jaTfDSK8itG44lpg8K2g oD4RbZKtLXbc/eVmqrNIlQULnyVV+L8LHs58YbADqol8WF2vd01J3+Y2mGsjux6/teZj YhGt8WWfhMJWKZijCrjmENN2wYGdrOo6hz7KpJEPCgK7YQPfcG7ySwhfyOlPiYFqbRUs GUKg== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id 90si7966076pld.231.2019.05.28.01.29.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:29:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 635E389D43; Tue, 28 May 2019 08:28:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id A53FF89C3B for ; Tue, 28 May 2019 08:28:55 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SraM125394; Tue, 28 May 2019 03:28:53 -0500 Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8Srke115204 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:53 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE114.ent.ti.com (157.170.170.25) 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:52 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE102.ent.ti.com (157.170.170.32) 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:52 -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 x4S8Rxuo125039; Tue, 28 May 2019 03:28:50 -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 20/24] drm/bridge: tc358767: copy the mode data, instead of storing the pointer Date: Tue, 28 May 2019 11:27:43 +0300 Message-ID: <20190528082747.3631-21-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=1559032133; bh=+lAsyVO4v/OgZEzF3vopHPTns+I7De0g6CNbzAnhPgg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tYPYAZiF56kwhZxDZXRqOgFtIXL6jb127BRDosCuAj9Pu8XR8pvIz4V6xKp1gA4KA LTtt4oKwHaB6ctB+RhoqrChaBQI9FKoX8yNhE3Nj2jSlCHL1jp5fpx1PR0mp/HnyyF cDCvjwVFnbPdIybBGb4Y5Bg1Hf6MuWnEz84MeoZw= 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" In tc_bridge_mode_set callback, we store the pointer to the given drm_display_mode, and use the mode later. Storing a pointer in such a way looks very suspicious to me, and I have observed odd issues where the timings were apparently (at least mostly) zero. Do a copy of the drm_display_mode instead to ensure we don't refer to freed/modified data. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 83cb43af60e5..ffcbecf69d40 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -205,7 +205,7 @@ struct tc_data { /* display edid */ struct edid *edid; /* current mode */ - const struct drm_display_mode *mode; + struct drm_display_mode mode; u32 rev; u8 assr; @@ -1032,12 +1032,12 @@ static int tc_stream_enable(struct tc_data *tc) /* PXL PLL setup */ if (tc_test_pattern) { ret = tc_pxl_pll_en(tc, clk_get_rate(tc->refclk), - 1000 * tc->mode->clock); + 1000 * tc->mode.clock); if (ret) goto err; } - ret = tc_set_video_mode(tc, tc->mode); + ret = tc_set_video_mode(tc, &tc->mode); if (ret) return ret; @@ -1180,7 +1180,7 @@ static void tc_bridge_mode_set(struct drm_bridge *bridge, { struct tc_data *tc = bridge_to_tc(bridge); - tc->mode = mode; + tc->mode = *mode; } static int tc_connector_get_modes(struct drm_connector *connector) From patchwork Tue May 28 08:27:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165263 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169492ili; Tue, 28 May 2019 01:29:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9GNjU89qKpWWk6fLFbTHqcNQKv2TahHsY3zbdhCAIqkeO2nXXxQ8JdeoG+jzMm2afckHq X-Received: by 2002:a17:90a:8b91:: with SMTP id z17mr4019473pjn.61.1559032154139; Tue, 28 May 2019 01:29:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032154; cv=none; d=google.com; s=arc-20160816; b=zzfFTh1ZbRQVE0i37VY8REnenbpNw55y19ozPabedwD2t7IcFC4AN5rHiolZij060L 36y5iDLWr8DvVdLhT0bb8G2KtCvZrypnzEztRvpY0n53m5rnIN4LY1nYO5szvGVwDzb1 7YgracgFOM1l1Y7AOZ6jYnAO+yOZc8IxyOxNiP8ZocmXdhr0oN7d43bXILwkoJ2cW32O 2cRx41BMjWuiGDWpBfnyudmXT2RisLGbzCV/B9JlKDPtWQ/MmTd1BlAnvhEIR/z3qvZP 1Ko1CJLYUXJGgLstD4iefd+WuHrq7vEBb/M9IIl7rxYzzXPGcweb7kSiwbHf/V03HUAK vpVw== 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=FWF7EA9ixPI4xCHL71IuRcSRQGIv/rOhexmnqlL561o=; b=JBBzMQJPg02Kni4ecFCSFJ+J1vowvBSNPUEufgSvMPHSubeudQv6xXdtqj0eQdCpsi 1vDA1JH4n5i6W5ZS/G2m0uT7swLhyjS4vFOmMoOp7Q96oKY23XPqGxnewpfT80uAz2oM u/AWDjYDwUkTAz7IcovBrkWiPKHk/rYHF9OrBRBfUfyDuJmTA9Ju5ToHV6E3HVfjp3b+ mZOiVg4oi8DWy/DBjR7WRU4YB8p59eTM3pJU62GsvjrMCq4OAXA6+D3t/k2Y37DPPqmA yzdBEohlXm/B3g5Z4etQcM39qYa1UmUihEkm3P4+/9DH89MJMOgP+8LErasZfo2K7bVm q9QQ== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id t4si20339729pgu.316.2019.05.28.01.29.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:29:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 8EA9589C25; Tue, 28 May 2019 08:29:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6DDDE89D64 for ; Tue, 28 May 2019 08:28:59 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8Std2125404; Tue, 28 May 2019 03:28:55 -0500 Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8StrN083285 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:55 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE104.ent.ti.com (10.64.6.25) 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:55 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE108.ent.ti.com (10.64.6.29) 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:55 -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 x4S8Rxup125039; Tue, 28 May 2019 03:28:53 -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 21/24] drm/bridge: tc358767: read display_props in get_modes() Date: Tue, 28 May 2019 11:27:44 +0300 Message-ID: <20190528082747.3631-22-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=1559032135; bh=yt4VDSoNH82XtsNMbNMIAFZDhlRk/3y3DEaVtQfNor8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MZk75ZZHU8VIWxiWl2AaAKuG8FtGIKlzIySNQ6vl/TLZeTTn87eHs9YzrNV+JqrA/ 8egI/HjPOx6ExaKIVPaYIk8zQrrTSC9vAXQj199fJQIi9U6YwpEUlMB9ybq4GMJzF9 ShbU6uJeYm8CQJjMlXx0G7/ESi0oNntWOTZx2CbY= 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" We need to know the link bandwidth to filter out modes we cannot support, so we need to have read the display props before doing the filtering. To ensure we have up to date display props, call tc_get_display_props() in the beginning of tc_connector_get_modes(). Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index ffcbecf69d40..2b9d6046d76e 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1188,6 +1188,13 @@ static int tc_connector_get_modes(struct drm_connector *connector) struct tc_data *tc = connector_to_tc(connector); struct edid *edid; unsigned int count; + int ret; + + ret = tc_get_display_props(tc); + if (ret < 0) { + dev_err(tc->dev, "failed to read display props: %d\n", ret); + return 0; + } if (tc->panel && tc->panel->funcs && tc->panel->funcs->get_modes) { count = tc->panel->funcs->get_modes(tc->panel); From patchwork Tue May 28 08:27:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165266 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169782ili; Tue, 28 May 2019 01:29:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwny6csHWMEAOp3Fj7eh1EWnzfzbt5XRxDJ9UfcVsJY7mTqhrx+PuG/2QAHxfsa2uopw1qk X-Received: by 2002:a17:902:b202:: with SMTP id t2mr731212plr.69.1559032172885; Tue, 28 May 2019 01:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032172; cv=none; d=google.com; s=arc-20160816; b=ESXhME8pjnEGLRQ3EPKPdZJ92xh+ocRFzh3bs/Oxa9E20zwkyX3tDf+XRiA9DSRPl/ 5ScJYRda10B6hKwlc7Q8xT+o+WuQd39d3iFXf0bi6m9Ensz3TaAStb8PZKTuGUnjS0w2 I2IhXA9iw+nHCe08LLouqKYRD4inNVamwJtCv77pdpd2qgQw4R7NaBOh2Ye8TJFOkbeR OnLV6PWBEZdxSdBS9xMvDTSl4cFs5MPLkEPBqvBxcOaswym7ltsibFGEdPLaQBQK1Ksd WrBq9Hh1zvn2/5kb2046nSlcj5QGYIEmt5DHzttaljTgGB1xT+bGg3C+3jGztwbe9JQV 5pRQ== 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=sdlR/FjJP6UDNFjYZDv3oAYDZHFuDVzT8lEy0f1DSCk=; b=SeKbCbk/U56uM+mXWhtOjFLVfyqWFQZGg0IvvEol7sat+sjRqutiO343QOnjgmYydV RRHcelNVWRlJJ6Ez/1hYucx/CgpIlgwC1gSvVVaGZt6XHT52DEf8jEhZTrpH3yfFW8xp sKVMNnrjvsSzI3NFkVhqQ3LOO78dwT2OLFPp6/mGPfGmg8kyvL0Mc5OW4SN+qVZ2wXJB 6SmAP5UvSUWH1xO/pb+4PMBxCUA5hFGjyxZbadLbXNcXgyDNqGLGkCzLKZha3TaW25Ed vj8l8EtZQrFLJxPxFf4MzLXoUA4d5XjKkfTYCJTyQNZQCFOYJf8WM5BZHBWenRiwtyCF orkQ== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id f6si22373802pgg.207.2019.05.28.01.29.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:29:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 ABBA689DFA; Tue, 28 May 2019 08:29:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id D41F089D99 for ; Tue, 28 May 2019 08:29:00 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8Sw9T125410; Tue, 28 May 2019 03:28:58 -0500 Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8Sw7o009283 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:58 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE104.ent.ti.com (10.64.6.25) 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:57 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE103.ent.ti.com (10.64.6.24) 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:57 -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 x4S8Rxuq125039; Tue, 28 May 2019 03:28:55 -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 22/24] drm/bridge: tc358767: add GPIO & interrupt registers Date: Tue, 28 May 2019 11:27:45 +0300 Message-ID: <20190528082747.3631-23-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=1559032138; bh=nvyELmXEHZaDUmCg7ITmab5FiyM78sMBHddm0Y6hPv0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=PJnEVF5Smukh8zwkDso5hb0CJ1M/7GJKH/naIev7rVfVwYTLwRjDJ5IgD9foLmtH0 H6KI1ky8oVB8kCfq46JAFC2q4c6hcZaa/msGWMGIlQZ8W1HxEaCbOxCYR8dmQW0QOj bVTYad+9k4yd9LyiD/nOM3GGZ0CW/XCsiX8C49vs= 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" Add GPIO and interrupt related registers for HPD work. Mark INTSTS_G and GPIOI as volatile. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 2b9d6046d76e..b820a59ef29e 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -78,6 +78,12 @@ #define DP0_VIDSRC_DSI_RX (1 << 0) #define DP0_VIDSRC_DPI_RX (2 << 0) #define DP0_VIDSRC_COLOR_BAR (3 << 0) +#define GPIOM 0x0540 +#define GPIOI 0x054c +#define INTCTL_G 0x0560 +#define INTSTS_G 0x0564 +#define INT_GP0_LCNT 0x0584 +#define INT_GP1_LCNT 0x0588 /* Control */ #define DP0CTL 0x0600 @@ -1286,6 +1292,8 @@ static const struct regmap_range tc_volatile_ranges[] = { regmap_reg_range(DP_PHY_CTRL, DP_PHY_CTRL), regmap_reg_range(DP0_PLLCTRL, PXL_PLLCTRL), regmap_reg_range(VFUEN0, VFUEN0), + regmap_reg_range(INTSTS_G, INTSTS_G), + regmap_reg_range(GPIOI, GPIOI), }; static const struct regmap_access_table tc_volatile_table = { From patchwork Tue May 28 08:27:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165265 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169702ili; Tue, 28 May 2019 01:29:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqx31EVHqXnRw/WFM/+ck4jomw6w26awYm93Cbex1Z+P5OHpdFr+g3exMVxBUV9fSIRoyX0Z X-Received: by 2002:a17:90a:2561:: with SMTP id j88mr3997875pje.121.1559032168181; Tue, 28 May 2019 01:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032168; cv=none; d=google.com; s=arc-20160816; b=T3YW3UVk1FINDZFAqEAWiF3VrcCeh1Eysb7f6lqbO/26Kk3gA9Gw7oksRPWA1igdrd AtTqtERfAUnkFDDt4wKxQkFpgGyR5/tZd0Ny2GZ0ORl+ZqOvBGWkeNJLFjDaG0e34/nR FVgrUwohz343mTlTjbq+rDXogZtoh9b/Suijt36EKWmDypmRtMYTRxMn3AOUjW7MZabH i6+W2FupmjVUBl5MR8NVebwCOVExWxb0Hah4k1oizQNpirQNtmwCYUdo/hY07AlKpWlF L6JS5ilW12cjudmpAQw+Gral8Wri+nAf4VHD6xjUxyKTuTco8Jj9LjLicJtdHZyLNJSn 0LBA== 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=QqS5bz6OT/8NQWwISiluMXUMqDHukPpclqvhXtU0ZXo=; b=LGKahrpQ8XZUp16T3GblS8JNoH9Edv3yKqNEGgddr3/5/KkGybqmlzhKv3S47xO+6+ f/ELcSIBhONwP5Ku09jbebxVHPSbTrKD0wDDxFnZutOZ3DHGGx8f6h/b+a4oNmDbCC+9 ecl8ghaPai3Zu9Aaf/pWni1tXgbQynP+H/3YBZD2SQss8pkTBFkBeMhOlbnmXOhW+yvb BMPsKbUw8dPtRTFXraiT63My3iArje4WPj36EEVUOrpPJ4GMvew810gEugXr90PswODc fRaTIoEy3MsSBEg9yPCjCLVo19F5STVYzgNUsAGmUA5NS103a42yZw4MkCuw2ZLa99gZ WUiw== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id j12si19645129pgp.118.2019.05.28.01.29.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:29:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 B090989CC1; Tue, 28 May 2019 08:29:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B11E89D7F for ; Tue, 28 May 2019 08:29:05 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8T0cd055634; Tue, 28 May 2019 03:29:00 -0500 Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8T0DF009307 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:29:00 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE104.ent.ti.com (10.64.6.25) 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:29:00 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE103.ent.ti.com (10.64.6.24) 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:29:00 -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 x4S8Rxur125039; Tue, 28 May 2019 03:28:58 -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 23/24] drm/bridge: tc358767: add IRQ and HPD support Date: Tue, 28 May 2019 11:27:46 +0300 Message-ID: <20190528082747.3631-24-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=1559032140; bh=77d0+pEjam8yNhyHp4QaManWDWY4Busn/6BA4XOSGqY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=kD1mNLElPKdmMl4yh0ZovtS22NXTRbaLtsphxFAdvvdp6Daxhw0u98gIyR4z47wt4 7mvMsstVfB6HmfiYViACDF+GxluqvcWlGuUYG6m8yiaK0cO/Q6xFCbNL27FjgAl9hy XPooXyqGKfD9VyJsTrsz01Jxgj22EKCgdrT7p+1k= 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" Add support for interrupt and hotplug handling. Both are optional. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 163 ++++++++++++++++++++++++++---- 1 file changed, 145 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index b820a59ef29e..72666e07007a 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -71,6 +71,7 @@ /* System */ #define TC_IDREG 0x0500 +#define SYSSTAT 0x0508 #define SYSCTRL 0x0510 #define DP0_AUDSRC_NO_INPUT (0 << 3) #define DP0_AUDSRC_I2S_RX (1 << 3) @@ -79,9 +80,16 @@ #define DP0_VIDSRC_DPI_RX (2 << 0) #define DP0_VIDSRC_COLOR_BAR (3 << 0) #define GPIOM 0x0540 +#define GPIOC 0x0544 +#define GPIOO 0x0548 #define GPIOI 0x054c #define INTCTL_G 0x0560 #define INTSTS_G 0x0564 + +#define INT_SYSERR BIT(16) +#define INT_GPIO_H(x) (1 << (x == 0 ? 2 : 10)) +#define INT_GPIO_LC(x) (1 << (x == 0 ? 3 : 11)) + #define INT_GP0_LCNT 0x0584 #define INT_GP1_LCNT 0x0588 @@ -219,6 +227,12 @@ struct tc_data { struct gpio_desc *sd_gpio; struct gpio_desc *reset_gpio; struct clk *refclk; + + /* do we have IRQ */ + bool have_irq; + + /* HPD pin number (0 or 1) or -ENODEV */ + int hpd_pin; }; static inline struct tc_data *aux_to_tc(struct drm_dp_aux *a) @@ -1109,6 +1123,12 @@ static void tc_bridge_enable(struct drm_bridge *bridge) struct tc_data *tc = bridge_to_tc(bridge); int ret; + ret = tc_get_display_props(tc); + if (ret < 0) { + dev_err(tc->dev, "failed to read display props: %d\n", ret); + return; + } + ret = tc_main_link_enable(tc); if (ret < 0) { dev_err(tc->dev, "main link enable error: %d\n", ret); @@ -1221,19 +1241,40 @@ static int tc_connector_get_modes(struct drm_connector *connector) return count; } -static void tc_connector_set_polling(struct tc_data *tc, - struct drm_connector *connector) -{ - /* TODO: add support for HPD */ - connector->polled = DRM_CONNECTOR_POLL_CONNECT | - DRM_CONNECTOR_POLL_DISCONNECT; -} - static const struct drm_connector_helper_funcs tc_connector_helper_funcs = { .get_modes = tc_connector_get_modes, }; +static enum drm_connector_status tc_connector_detect(struct drm_connector *connector, + bool force) +{ + struct tc_data *tc = connector_to_tc(connector); + bool conn; + u32 val; + int ret; + + if (tc->hpd_pin < 0) { + if (tc->panel) + return connector_status_connected; + else + return connector_status_unknown; + } + + tc_read(GPIOI, &val); + + conn = val & BIT(tc->hpd_pin); + + if (conn) + return connector_status_connected; + else + return connector_status_disconnected; + +err: + return connector_status_unknown; +} + static const struct drm_connector_funcs tc_connector_funcs = { + .detect = tc_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = drm_connector_cleanup, .reset = drm_atomic_helper_connector_reset, @@ -1248,7 +1289,7 @@ static int tc_bridge_attach(struct drm_bridge *bridge) struct drm_device *drm = bridge->dev; int ret; - /* Create eDP connector */ + /* Create DP/eDP connector */ drm_connector_helper_add(&tc->connector, &tc_connector_helper_funcs); ret = drm_connector_init(drm, &tc->connector, &tc_connector_funcs, tc->panel ? DRM_MODE_CONNECTOR_eDP : @@ -1256,6 +1297,15 @@ static int tc_bridge_attach(struct drm_bridge *bridge) if (ret) return ret; + /* Don't poll if don't have HPD connected */ + if (tc->hpd_pin >= 0) { + if (tc->have_irq) + tc->connector.polled = DRM_CONNECTOR_POLL_HPD; + else + tc->connector.polled = DRM_CONNECTOR_POLL_CONNECT | + DRM_CONNECTOR_POLL_DISCONNECT; + } + if (tc->panel) drm_panel_attach(tc->panel, &tc->connector); @@ -1322,6 +1372,49 @@ static const struct regmap_config tc_regmap_config = { .val_format_endian = REGMAP_ENDIAN_LITTLE, }; +static irqreturn_t tc_irq_handler(int irq, void *arg) +{ + struct tc_data *tc = arg; + u32 val; + int r; + + r = regmap_read(tc->regmap, INTSTS_G, &val); + if (r) + return IRQ_NONE; + + if (!val) + return IRQ_NONE; + + if (val & INT_SYSERR) { + u32 stat = 0; + + regmap_read(tc->regmap, SYSSTAT, &stat); + + dev_err(tc->dev, "syserr %x\n", stat); + } + + if (tc->hpd_pin >= 0 && tc->bridge.dev) { + /* + * H is triggered when the GPIO goes high. + * + * LC is triggered when the GPIO goes low and stays low for + * the duration of LCNT + */ + bool h = val & INT_GPIO_H(tc->hpd_pin); + bool lc = val & INT_GPIO_LC(tc->hpd_pin); + + dev_dbg(tc->dev, "GPIO%d: %s %s\n", tc->hpd_pin, + h ? "H" : "", lc ? "LC" : ""); + + if (h || lc) + drm_kms_helper_hotplug_event(tc->bridge.dev); + } + + regmap_write(tc->regmap, INTSTS_G, val); + + return IRQ_HANDLED; +} + static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device *dev = &client->dev; @@ -1373,6 +1466,33 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) return ret; } + ret = of_property_read_u32(dev->of_node, "toshiba,hpd-pin", + &tc->hpd_pin); + if (ret) { + tc->hpd_pin = -ENODEV; + } else { + if (tc->hpd_pin < 0 || tc->hpd_pin > 1) { + dev_err(dev, "failed to parse HPD number\n"); + return ret; + } + } + + if (client->irq > 0) { + /* enable SysErr */ + regmap_write(tc->regmap, INTCTL_G, INT_SYSERR); + + ret = devm_request_threaded_irq(dev, client->irq, + NULL, tc_irq_handler, + IRQF_ONESHOT, + "tc358767-irq", tc); + if (ret) { + dev_err(dev, "failed to register dp interrupt\n"); + return ret; + } + + tc->have_irq = true; + } + ret = regmap_read(tc->regmap, TC_IDREG, &tc->rev); if (ret) { dev_err(tc->dev, "can not read device ID: %d\n", ret); @@ -1386,6 +1506,22 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) tc->assr = (tc->rev == 0x6601); /* Enable ASSR for eDP panels */ + if (tc->hpd_pin >= 0) { + u32 lcnt_reg = tc->hpd_pin == 0 ? INT_GP0_LCNT : INT_GP1_LCNT; + u32 h_lc = INT_GPIO_H(tc->hpd_pin) | INT_GPIO_LC(tc->hpd_pin); + + /* Set LCNT to 2ms */ + regmap_write(tc->regmap, lcnt_reg, + clk_get_rate(tc->refclk) * 2 / 1000); + /* We need the "alternate" mode for HPD */ + regmap_write(tc->regmap, GPIOM, BIT(tc->hpd_pin)); + + if (tc->have_irq) { + /* enable H & LC */ + regmap_update_bits(tc->regmap, INTCTL_G, h_lc, h_lc); + } + } + ret = tc_aux_link_setup(tc); if (ret) return ret; @@ -1398,12 +1534,6 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) if (ret) return ret; - ret = tc_get_display_props(tc); - if (ret) - goto err_unregister_aux; - - tc_connector_set_polling(tc, &tc->connector); - tc->bridge.funcs = &tc_bridge_funcs; tc->bridge.of_node = dev->of_node; drm_bridge_add(&tc->bridge); @@ -1411,9 +1541,6 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) i2c_set_clientdata(client, tc); return 0; -err_unregister_aux: - drm_dp_aux_unregister(&tc->aux); - return ret; } static int tc_remove(struct i2c_client *client)