From patchwork Tue Mar 26 10:31: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: 161177 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038421jan; Tue, 26 Mar 2019 03:32:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxy9gBxAaAyQYi+k62RcrhOaeZonRoEASnsVXH7bVT+3eGjNGBhXvB1cVEuA6RIsn75cXf+ X-Received: by 2002:a63:694a:: with SMTP id e71mr28712863pgc.129.1553596357084; Tue, 26 Mar 2019 03:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596357; cv=none; d=google.com; s=arc-20160816; b=dwB1+VhxmPFm0JY4kn17nrvE6EmkVPsj2r3KaLCAYRtSVdHAsL32OPEM263RcE7OV3 sKBGjHvLuZRnxyIdKnrmsvNBKG3h2KWWlheo8urEygKanOfLGvCjRm1FQ8pxleu/bK0P XK+GGkXxhYDXS9u5Fxi2crlBXU3tKovbIVowT6XoUMJWepsbnyna8Y6wkQBFy003rg3K lNU6pgsPMpKQxtSfHD5tn9Arg0Q3/4Pmpm73jaXDfeQmsUvhPyaVEg0l7wDIf6vu+DSe 9rHpOpfbnxsHsKq5QeVijbtSGobZbd94UD6X7sQ2K2agglpSPY0v3uL6zyY3SlacJ2OC 3kUg== 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=WqyVrv84AFbIBLfEWD5/0enlT7dcqxDFuAC6h53RpSo=; b=JGie5LUFDiGywdWp9kvt6YmtHt1pluojMmYt9zymzZAAf30RxKC3AqMN2CEtAnE3cW eWNIjA0zWWIwnRuRwj8sfZ8+p7i6iHQjn4rHC9DyxnZ1wIp8QVawXljXLQEGzXntXEKh H3BIwA48tEYRCOrPVYTdpJyIvRt69J3jg9nRNTNKWbBw5buJhqVlfzKDfvhD75vZnFLo lW1ufDob3ulHCnEwKf4J7wbBxa7xQXAPWZIVWRCBxr+We0aT49HjXo3qyKKQ7NnF7AUE CMG2d+Os/Pz1DUaw62ImeWhGGh6mNIrpd2/w2Cw9ZTQcHPcFLmukt76OQaCsaI12Dmfl NzBw== 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 n5si15676982pgn.105.2019.03.26.03.32.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:32: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 0FDFB6E7DF; Tue, 26 Mar 2019 10:32:36 +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 E9E396E7DF for ; Tue, 26 Mar 2019 10:32:32 +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 x2QAWTjH081208; Tue, 26 Mar 2019 05:32:29 -0500 Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWTl1002600 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:29 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) 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, 26 Mar 2019 05:32:28 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:32:28 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN23071249; Tue, 26 Mar 2019 05:32:26 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 01/22] drm/bridge: tc358767: fix tc_aux_get_status error handling Date: Tue, 26 Mar 2019 12:31:25 +0200 Message-ID: <20190326103146.24795-2-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596349; bh=KpmV4wsUtpZXmBy1gNs1XdBpmyEcmJ2GQvQUmMElCDg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=YbjljOBXHWCUHsIIPFVGoGJzdasDq12URlt4XUNKyoK88KVYFzd5yYEYcE1fzRKFT dRtk/NCbXRoFp20dTwO0Yut7OSQkoZSWlaqUUewZh0sZnswQ3jUnkk6KuWfFhCVaPW glVWFo8MFVkO9BI5i0dtiAlcVob16jWt9K3Y7lqI= 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 888980d4bc74..7031c4f52c57 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 Mar 26 10:31: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: 161179 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038488jan; Tue, 26 Mar 2019 03:32:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfCAI/jixeALOK/aq0nFzA4n2FhR4/nFNJ5zd6PCvm8BhKMjHfQ9PPPTDop2e2oSjn9t3b X-Received: by 2002:a63:460a:: with SMTP id t10mr27525567pga.354.1553596361901; Tue, 26 Mar 2019 03:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596361; cv=none; d=google.com; s=arc-20160816; b=EYcsFSemQc/qrdVM1nnkipkeFA3cWWhgkh+ykbyPEVTJvU7wemBhxQvANgYfbgqaiL 7cam+0auxKrZwQl++y29ovRB1BGDwl3zLR9rjBfjHO3urd4HV6bHIsB88Eb8zcOFailV 782H6/WgQtXNkRs3mnITeBBe04MYLwZLtQfB7ETejBwxzdmcbOoxbE9wAHGNUqDpzsit JAVKORjSblKxdlr1eEOny825v6xEIk5QRqQ/jAaWZti/Wca66aF2VBLdrWSWLeGFWZjL lJWqSUn8/YL+MeyovnI4CEGS8tzEba0mlLwk2GHACz7WC6Pii05rskGaUi+0GEuD0vAN zU4w== 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=tI1aAQGa/t9wjTpIylFvYgABuHp5WHaFeD/zuBha4IE=; b=Y2K5t7LL1Z9NCFJojQmJW/f9aQwppqwe8OQGGEhyhIKGfZOKLr/1ZZCdJ9jXi4XAk9 ZX5w7HJEZHcPJz7jjjMIGVSDL56RGc9jUM3Er0GRFG6s7G2xE2LZp6AcGauLj8JjfbQB uSkGUsoI3UHJHPT1kGaM9DH/jkYajqzD2ZamRwfTXo0LH+knozxu3aK8N3A9O0n/f0ug iMqOi1AIn8XsFudOmT3lh3DuFivsSYoi2MPiyvw7bbpQQeMzI8zpY6kNkdvYx7REMI08 zeDFWdIUmIGmTrY8fQolFpIrReXG/uw8cRVCaDhZxLcfcPCG+372mpnt/EVbqCcekDg6 kO+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 25si15864494pgt.419.2019.03.26.03.32.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:32:41 -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 2793E6E7E2; Tue, 26 Mar 2019 10:32:39 +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 03BDF6E7DF for ; Tue, 26 Mar 2019 10:32:34 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWVGq018085; Tue, 26 Mar 2019 05:32:31 -0500 Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWVjj021653 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:31 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 26 Mar 2019 05:32:31 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:32:31 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN24071249; Tue, 26 Mar 2019 05:32:28 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 02/22] drm/bridge: tc358767: reset voltage-swing & pre-emphasis Date: Tue, 26 Mar 2019 12:31:26 +0200 Message-ID: <20190326103146.24795-3-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596352; bh=RBiYve0sqMIwLHB/hvGnz7fJAiy8tNJvOe+3FkqP8i0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=IY5BxZwa5OsG9d5GeTtyri8GnGvVJhHp72ZiRSClRhmX0NHcx1ez1pLhnpFFDWnBY IHQ3Bjk0ccbisbvatQfclN1zpl4ILz4xeCgU9reLtQmzNPHg8VwDcNpBh949hYIV1e kJGJLvYFpW4vzDNpqEmNn5dHZzkxsQXFZ9ukJ41I= 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 7031c4f52c57..11a50f7bb4be 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -956,6 +956,12 @@ 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 Mar 26 10:31: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: 161178 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038457jan; Tue, 26 Mar 2019 03:32:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLWnfLDgMukKy0kbPoNB/Vo/Zn0M8A/5jGuRDzJ+cp4/dgi6u7jVKUZ+fkw5fpdDXEuVvn X-Received: by 2002:a63:5d04:: with SMTP id r4mr18430745pgb.117.1553596359631; Tue, 26 Mar 2019 03:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596359; cv=none; d=google.com; s=arc-20160816; b=Vvd85fGCiy0rU4oHwkSpi2G+t1Xjwoo4OAGf95AjT0cS//r8vfOU3NXEMVRE/6HviP fp0jU9T9UfWXFwruu3533/H8YkY9rtLEGRwKZcLBxkWGc4rbJqjwn83MRrsbV9W+A0Qu OYRgy9S/Y3/wSQl3evFOITRYa7UyKh/ezYYaXm8JlQk529XBCc1G1Np/E5cZvnc0q+Xa p06VN56SYwv6BjewrxkOJc1Kvmk1Vdzh2fxrh0dpdcmfGEgTLFB2h0vRpAMARQKtTEmO SHFliVFQc0EAqUH90ssg0aE5vjwVBxmJsaZqcIYCSAwJO9lU0u9vw4a1+tBQvX4GDrxo lvLA== 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=2+av+YowFDphkyv4a3Y8RCqb3Z7NCElZbp1RcW8rCBs=; b=yXXpfpY4W05DFWrOZAMBzyvThFx+EERKAzMRbN6evlps9FtsqeyG5WG0tqCPi9IOZN B70CjTMgiYG43AQ1l6ILU3aTA7TU9FFKleMN5tiBOoF5yFxE8HdF8MR4ET5rkc5OA2XD OemO/2d8k1dfy6uaSglQ0te6xgyFqAR5UACQtjc05ef+ASo3IxnC/6yzQEPmzuJwCzIs uU+LQ8jOEjrczZQhYW5IdaE5cEyrK7ySPwjeGvIXJdovlYWdg9FIwHrubElIpVrPRmY5 enFDXokdnQ9+mplgTVgh8hNpNb7GdycFm7Yawa1ZjFcVK8em8Bjbjp9a3z/zcMvYvDjb KRaw== 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 r4si15125073pgp.581.2019.03.26.03.32.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:32:39 -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 747C86E7E0; Tue, 26 Mar 2019 10:32:38 +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 5E7B06E7E0 for ; Tue, 26 Mar 2019 10:32: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 x2QAWYCN043758; Tue, 26 Mar 2019 05:32:34 -0500 Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWYf4002670 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:34 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) 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, 26 Mar 2019 05:32:33 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:32:33 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN25071249; Tue, 26 Mar 2019 05:32:31 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 03/22] drm/bridge: tc358767: fix ansi 8b10b use Date: Tue, 26 Mar 2019 12:31:27 +0200 Message-ID: <20190326103146.24795-4-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596354; bh=GR+iFK9fpwKw0iLA2Q86EAhBm/eN6981/+g3Kvvk7rM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Y/8qpj6PEhnxADLiT0kaSiO12jTKW92vZEWNovmWK8JdSAvxf3BbvZQpk5Zz2XVep s7FLFMgFLmzBw/ViQimHojgr6LGTuUtM4NDDhijyrCHk/BAjiNgGv956GJJ6m/ZVxz Xry9dBKeK4Jc8vMC2XIexgzWyZUSJ1ptR72MCpEE= 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 Reviewed-by: Laurent Pinchart --- 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 11a50f7bb4be..163c594fa6ac 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 Mar 26 10:31: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: 161181 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038570jan; Tue, 26 Mar 2019 03:32:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqygdrW92EKMhce0ZGcn5+zBkBNNebTyLOrYLjl5BtnGWG4uJ+ZS7eKu/hkMbCp1ML+YWVFv X-Received: by 2002:a62:209c:: with SMTP id m28mr16103601pfj.94.1553596366932; Tue, 26 Mar 2019 03:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596366; cv=none; d=google.com; s=arc-20160816; b=sGfnaqIH/52YrnhMTNiQcOz2TU71oJNUZIq6SQHTarvJm/iK3IV6qG2TBJ6zTfTeZH b1KOPhPmCxcp9M43NgSpkWFbb7UHIBRh6M8bUP/EZAtErvFOF62Bltieadj1FCbu4U2H qkq8G4SAZAbppwIwx7tUhCq/PCbF+LkNyIUHFAMa5hk2hc+UKZDBpO0wu7sALmLs4DOv F0oJkQbQik1vVhIhLMhySVm8C8yg40LDgvjqZIYjPK6ZExEV/gxzNp+Nny+u18zT0+64 6BCbMgwB5SMEfzxxtVwNc5Eh2QESikESPV50cdyAZp3VvybBAeOBqDur5TN2Gjk19f4W m5hQ== 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=shrTW2hiHV8+u8FV+Yymd6GJyX33fg/cdwafmlMANPk=; b=d267aqwFY0rl3rp0E+iGFNGnkeX1Bribm2b74Zc0N38MjHpbkb3IRokhd4jIpv7Mfe ZCbQyMSctjZ2tZPfi/KgCEnMj6bSSs80W+FeMYCg4BV+brvm0ofMtG2rnUtz77lMVjv4 0GAIga26F3Gu9FxMPgbBT4+fN2/OBF30/xenOF194Zjf0axDvtd4e0/uNzDYvVon1yYM c4sqahMgbmlwJVSkDIzqHqFXAR/kuxauu8DpOLcb2L1/qSf1cwGKxhByCLh6mieZ64CR lG6f34jA71ZjbRFndFgaHVlOKURQyFxKlRioFb1QjnJGrrN8xvj1Ci26ApyK2BlbxQtu TcxA== 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 y1si17545761plb.276.2019.03.26.03.32.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:32: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 712166E7E3; Tue, 26 Mar 2019 10:32:44 +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 E3AB66E7F2 for ; Tue, 26 Mar 2019 10:32:41 +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 x2QAWcZP043772; Tue, 26 Mar 2019 05:32:38 -0500 Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWceQ044347 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:38 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) 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; Tue, 26 Mar 2019 05:32:36 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:32:36 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN26071249; Tue, 26 Mar 2019 05:32:34 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 04/22] drm/bridge: tc358767: cleanup spread & scrambler_dis Date: Tue, 26 Mar 2019 12:31:28 +0200 Message-ID: <20190326103146.24795-5-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596358; bh=nZCfvLQ8NY7yIYucSRjic5Cc3g+nz02wEATtGisyIV4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dTCGjjrhulBEkNM3kSG65Ey4uF8PnEe1cYfphZ52InRO7pYt1kdmlb5OK9IMHYQZ3 auF9encR54vViyz3s2OuJ3H+iQACCm7OZW+a55Z/zORGdpakO20iwrJoPVzO2+QWY6 ilq4oKoPUv4Q81GaTAOtQLAxePuFDNISfmun02Og= 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 163c594fa6ac..8e53073f0e35 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 Mar 26 10:31: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: 161180 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038539jan; Tue, 26 Mar 2019 03:32:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbWCIqJE5iaY2ahVOEbIEsvUO37tPK8gMHd4HEkH7jMaYm0nqIdFIStWwnJZtVeyLfc/3h X-Received: by 2002:a63:114d:: with SMTP id 13mr6958983pgr.216.1553596365476; Tue, 26 Mar 2019 03:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596365; cv=none; d=google.com; s=arc-20160816; b=rR+aZbHZcQsSR5zNMmvVYn+PdE8ssYIY6OeiDqh89OXtGc6WRVdL/47/ehafYCjfZQ a3bfdn2ihgr5Ouf6ylxk/l25M5ZmiGT9oka4s16UBmNcJQ/rfpLHkGyJPjVS36cuKb+c Sjor3dKhh14sf5h8BJsuVI5FpdH+oBHZlZcu4PbPYeNwT8F7NOl3MCkgmwLfCwRl5dwQ f4U3DaGPYzxxdhGksvXMXjONDqjb/lxlkqn9B+L3GjZIdzUQvJtKrXFFRsHJBYTIEsD7 FQFGhvy/GA5SjKzBRpzMJ2mJt9CRD12lim/1jos70RhNW+eCqGMYgzUepjtLEqM31xjK dLtw== 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=aoZyc7KrScV4hmuEBtpso/2bF5S6iq/X9KGccnGQzhI=; b=W8RfZcN1GXB41xQpfBeKu2wV8dSBO7mT9T5w4JchBBtNsNCxTQ16XZSap93gn746+F Nz5DAllynRq/DuXNAcd24d52APdn0AUdQ8AxAXLG4rpH83qD9lJ8XQKhtTpDmu65CKAO BMIdj80KCGJReWAUXH/D7w1/SyVw2BXl5zlVNI0zIZ63Mpi3ZetB5KTyMC3LZWykMjoq jJjoRyhbGU8/Jo9buRqNcm+FLzmZn/XJ+iA9FUGKV7eypTxJH2WwB2CcNlI61Eq73eiO D288zSZTz8u1dCgEtpe5n8kjGnU7BBXyzwu45nIiJnFDkErDEUgM7FzzBNbZhj/2Vwu6 NULQ== 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 v5si16139437plp.392.2019.03.26.03.32.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:32:45 -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 5CF526E7E1; Tue, 26 Mar 2019 10:32:44 +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 4D9886E7E4 for ; Tue, 26 Mar 2019 10:32:43 +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 x2QAWeN9086451; Tue, 26 Mar 2019 05:32:40 -0500 Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWe4Y002750 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:40 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) 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, 26 Mar 2019 05:32:39 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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 via Frontend Transport; Tue, 26 Mar 2019 05:32:39 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN27071249; Tue, 26 Mar 2019 05:32:36 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 05/22] drm/bridge: tc358767: remove unused swing & preemp Date: Tue, 26 Mar 2019 12:31:29 +0200 Message-ID: <20190326103146.24795-6-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596360; bh=HUMOvxrTSN8It4Bik1acycuiGHsnZOxCFs1frLC3qlY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=bS7gI6ubTLQQLulUSh0m3b0o2glh1GzFzsfvCQJflxDd0aP+vjYKXV7qDTu9iRKk8 V3ArvuTTzkM3qWAjbpBz6R7xwf2waVHE82TCItZvK2CnPcg29ywb3D4YIpLYOhlA4u 1gAhlmxEReJWtRdcRsleDArADZiOD19mz45q2Pmg= 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 8e53073f0e35..7ef8d754b4ff 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 Mar 26 10:31: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: 161182 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038654jan; Tue, 26 Mar 2019 03:32:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyM5zQ16ZQ+tmaLSLcpip9pZ0HkNY+qWrrbLnkl2APqKKTNRxObX3PoSjaoE8qgBqABORbe X-Received: by 2002:a17:902:123:: with SMTP id 32mr30174822plb.187.1553596371814; Tue, 26 Mar 2019 03:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596371; cv=none; d=google.com; s=arc-20160816; b=KNTT4GS7/yrO3WPTAvUXqfDoZsfWBodHhbPt17KWbYOnENrp29ja9DWMStO1o28jRL ccEbspNVCrejyHVaZVlRo/kFT7dnWRMD2uDoEz/7zC1UUhcJKa9sDfViy1E05XMsGKOU 9JNCz/mMBShz6qeFC05/1NVSJ5HaYOOSGr3HuI6RNxAbyZQPoLJquu0jHESdntgjBM40 9EcjcdnfRrGft5v+vzzDAg+m97vVi6s66gs3oIfPr7Zn5Sfv8jxGqoK0jwKgDbZOggjR DpwHt7zdobA9qm1B3cu1iLihnDJCLgYg9sj6sJtbRjxIVo2v83aOea5EXMQVObBeHqUA ObNw== 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=GXmprNVfVUAFT95/VEseq5rxHD9LJRvw8LHZ9MwJpyE=; b=VOhHkuVlTQUjfAziTn6JFnhRryQPV9o7OVi7aATKJF0dU9uU3wKdDF++Tsa2IvUUqf LCK+eh3KMRBDdPv9ORRldD5pkrioUy9/idyzmKyjWabr3/Q8Pnw+PWBeyVe/POT7wGyD G26qaJPgfH/u7MF3dlECrHAHd329/26XVPY2Q4qDKToIc8tm0oTCtSvF3o4BhFZuTM6L C5jxeR99abQmF37OTbc5OUS7fiCGZN7gFNMBHyFawCvBWcSBxLkqJyqTlyB/TSwqjBeO LFIW2M6baaChpqjdp0K/+Na+Lh2SOTs0Osd+PxWl89YgfytNiSWeg77ikmn6a0megDIF kmMw== 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 j8si15452133plb.86.2019.03.26.03.32.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:32:51 -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 AFCE46E7E5; Tue, 26 Mar 2019 10:32:50 +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 C47A06E7E6 for ; Tue, 26 Mar 2019 10:32:45 +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 x2QAWgdi081259; Tue, 26 Mar 2019 05:32:42 -0500 Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWgte002784 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:42 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) 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, 26 Mar 2019 05:32:41 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE101.ent.ti.com (10.64.6.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, 26 Mar 2019 05:32:41 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN28071249; Tue, 26 Mar 2019 05:32:39 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 06/22] drm/bridge: tc358767: cleanup aux_link_setup Date: Tue, 26 Mar 2019 12:31:30 +0200 Message-ID: <20190326103146.24795-7-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596362; bh=2zo6Xp49jlHLD1KAJyE9hz3qgK2MS8vm3VL3LYnaSSo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Ieqozo+4+lEr0bHQKHbEDegxg0uxbTcqE5L3ChYoNevmYhHNxDBNvW6h6APmAGRq6 JaFef0WQAwNhgZCvme8G0eKBXZps/3XZVYKB7dNNa2iSxVBwLTumy7KoRAXWfnsO+4 uMyFLqH3KnxWXv9lWeq+sP7h5zzj1vQKluJbg9Tk= 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" 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 7ef8d754b4ff..f5c232a9064e 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 Mar 26 10:31: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: 161185 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038806jan; Tue, 26 Mar 2019 03:33:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyW/qzk987toWLNU88tntV5diZN01ZH0MQ52lyu5EOzx0hwanFiPv5pL2fz2KDIaA4C9HmQ X-Received: by 2002:a65:65c4:: with SMTP id y4mr28015804pgv.305.1553596382456; Tue, 26 Mar 2019 03:33:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596382; cv=none; d=google.com; s=arc-20160816; b=fBFJaTM1LJr2Rs1+n/SPjcjRm1bIKF2mRhWL9PmATnx9EUHY9l2VIcm9EaxYUuddMD Tu11fxd6S2uwbetwwsWU338gYoZUIFDSH8jigFtA1Gt7YAnnR7ECL62wnUlSmHhR7BPV OAnkW/vQMB5PpUaM6AUIblmeA52IQfZq8d4lP5L7ac6S7j+snt0+dkTFJ5iBg33w8Q0d Mm1xyWuQUwV419mJb0g9edkQNQPDfJcjFfDWerhHfB8Ermj2wpmSf6uS2gC+WCIKGTQk Mcz+3bRSiJP38faGa63K8jlKXt4iJaCB/f+1BEG5jkpnjq4jiD6kaAAYtMnNtUYyUeGi 0M9A== 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=/4ZRbEfbDyVGdjLeJ9UNd4g924Wsh+EYT+FUlujJyl8=; b=X2bUYSlhwJC02wFSZqN9KkUrrKXLodr6wz3Fs1iHauDSPsOO5V/o7WLx91HFOUMXdF sD35QptsptqKci2slpxQfq2HYs2I3l0cEoTZu69ZNXoBXksIxIOSyFrWcmMx06cGpAa1 c3Rx4rWu4ilWEfmHs3+oQFVcZDhn+EE1V3Lq7P0KmxRtHuLMHOBti+JAHeG7+vb0oSU9 CjdXRq49lvVYiM7lIE1+QCxA8CHSwfz15nXYz3sMXCVZl7rvPa9yCmX6JSHe3A+UE5Bz AeqBpcthlEObpQ+MvkuTI1rHHgY+frz956rzTnn28l4k7soDZzWOzcpVerfKav27KDx6 Bkow== 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 f185si4447376pgc.182.2019.03.26.03.33.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:02 -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 BAA846E7E7; Tue, 26 Mar 2019 10:33:00 +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 C51C76E7E8 for ; Tue, 26 Mar 2019 10:32:58 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWtMo081320; Tue, 26 Mar 2019 05:32:55 -0500 Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWtwJ021870 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:55 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) 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; Tue, 26 Mar 2019 05:32:44 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE110.ent.ti.com (157.170.170.21) 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, 26 Mar 2019 05:32:44 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN29071249; Tue, 26 Mar 2019 05:32:42 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 07/22] drm/bridge: tc358767: move video stream setup to tc_main_link_stream Date: Tue, 26 Mar 2019 12:31:31 +0200 Message-ID: <20190326103146.24795-8-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596375; bh=LRQ6uuXI3P5Ckw+nSjXkfEM1OuTURIiUzBnH1mzwhtw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=OhBgTD4OA+23uUH0InQD6BH+IASnO6S1fWVeNnIYBVIa6wRBDfhUd15qLGCAgNFHs JrrDqRFa5gJTjt5DTOr3/HFik799VrgoOIzFAxJpc+ZrwUxXUr64WVQbd+5+Kx9Vs1 O7jFke3l/4CdyUBOEAMSZ+XGSei5udIg97qoRV+s= 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 f5c232a9064e..86b272422281 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1003,15 +1003,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); @@ -1030,6 +1021,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 Mar 26 10:31: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: 161187 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038849jan; Tue, 26 Mar 2019 03:33:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRN6eJ0IwI9Fqc7EVE/HI/3YkpfSzjaPLs91PJhc8TPXZMLD3bN7zYdtmP4hg0QQMJMCxu X-Received: by 2002:a17:902:8a4:: with SMTP id 33mr29178054pll.7.1553596385625; Tue, 26 Mar 2019 03:33:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596385; cv=none; d=google.com; s=arc-20160816; b=yczzI5/dr4or8AtOIBw/jtRuu3pQASiI3l0ubNLWEMjGALfQY0CARitwQG5sKr4Lco yQntcy9Wu+zQDOHy8qFeDKdN5ELUSk4GbBO9QQ7u+XsVOuLtvaQFXYrDNjfckqnsGUk7 xnIkXd+XJfeH04rk9oQqKm8d+EzX1xiwxCd/q15d8Pwki7KLYWrf79+jNQZYQUBm7bh9 4+k/aRbHFfmWsKQJRWdeMnZRAqpfYbKccM0szjlrsFJXaSQGvYgAW7uZKFIAGC+MxzSZ I/5QpUXF+mJ7xcipGW21NPBYdV00xzMaAfimCaI/ZEDmz1zi1DVbTZRXbhwMYbPqKUWb Jw8Q== 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=Hv1h+BfzvI1oWsQh2RO9CytCRIEsYOdQchhZdQUCpq0=; b=oL/VAgAIZEHPfQUwEWx+fZRlG/KwPrrZ2RQ4lm/B2/QVTunXIFpC9Re/2DlJrnvo2D J0nBIiTprExCX6OetrlrYEYmM6OeoOWJH9l8RyMlTvhYHu31RoVAop2ZA66rw7UFGk9Y 4RDJAUBLXJ+TIN9qX/P+5brOLEvm+czthAT5LezgCcx/DmUGCEENfaotGQsxbjG4H+/a vp7sWgVrjytisb3VbFzZiw3vZH+85EI2axzHzCHov0sL6oRUE9rA0bkfwn+G4TBMFpoR w0jsKl/VRz3DVbOEml+0NYOolZeVLnMdG7my5tfJpWX3CFjFgKMeX8qvPpUCX04iHMmN GcfA== 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 j30si356672pgl.338.2019.03.26.03.33.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:05 -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 DCE096E7E9; Tue, 26 Mar 2019 10:33:01 +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 44C206E7E9 for ; Tue, 26 Mar 2019 10:32:59 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWtdG018173; Tue, 26 Mar 2019 05:32:55 -0500 Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWtwK021870 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:55 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) 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; Tue, 26 Mar 2019 05:32:47 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:32:47 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2A071249; Tue, 26 Mar 2019 05:32:44 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 08/22] drm/bridge: tc358767: split stream enable/disable Date: Tue, 26 Mar 2019 12:31:32 +0200 Message-ID: <20190326103146.24795-9-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596375; bh=PnSO1l6z1S3hCWKpcIwDRiqEMT/ph/ydsP2ETMbtxLc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=OW9jhrcQA1uDJNtOTPEYMcoFDR4IWFCgouXgFi7Pt/zMCPncqSL3/s/e79ofNbIUF l3b5knZCV1guEkf/biGO7ALURv//5R5cGGSnCoGsXp8VCWTTGdYpF5qCR6rYwZByGI m0vdonS9ujCx54U+4vIPE0T+MTbdRbNgynmBLYw4= 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 Reviewed-by: Laurent Pinchart --- 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 86b272422281..bfc673bd5986 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1013,47 +1013,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, "stream enable\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) + goto err; - /* Set M/N */ - ret = tc_stream_clock_calc(tc); - 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; - 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, "stream disable\n"); + + tc_write(DP0CTL, 0); return 0; err: @@ -1078,7 +1087,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; @@ -1094,7 +1103,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 Mar 26 10:31: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: 161183 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038700jan; Tue, 26 Mar 2019 03:32:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwI3S7g0/x10EsMAUm2pLaDeQuSTRMHPa1F7uMx/o9xKqXLDp/n3NVPIaV8Mq/RHNOY8jvj X-Received: by 2002:a17:902:b48c:: with SMTP id y12mr30701789plr.280.1553596375894; Tue, 26 Mar 2019 03:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596375; cv=none; d=google.com; s=arc-20160816; b=VtH/Ex8F1VyKrU6vFQIdspo2mTpTDzuIOpzxXGQhu86z9xTXIgRV59h3sXrRBj7ls/ QYUEa+sAVymlTGuprYCj73cG/q5JtBW31wTgBBCBonHaJsK/43CqFwFjpa0NkVcSwP6y 1s1PW+bEHbzeYF03/cKVjV7pg5cxSuxOh1yB0XzePCkpFBVh1FdKnZTkkIlgtzhY/0nB ZEqJBy7mXT+d6szYJ5xQbC7nKfZv45tW585fl+yiYKisKXtdGuoe7pVAtPHnZdz+G6Al 7PO8OdkPNAR5/SCxO/4bieCSmfqsprOpvVutgVkDtiPA6DVxI3bVxBkXUppv5K6sCb/G E80w== 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=M/spZ8CbduvKh2UAJqUDsXNP72Au3ItBFbs78QxBD7o=; b=NZ+bAEdyOS/hROIU4UTbVdImdop4XQuiW43J7Dba5z+s0VAh18LDhNhYwMgPUR+bBl 1yitsvjJ2o4H7RVk6D8m5trtV+jRtKvX/fqnRPlGb5+CP5Jqvz6QiSW3V6osQkHWGL4s +1XMyYnNgicozRIS5d2AhF1aJSedWFDXGwbouyFMz4MZFaS/ZrBwEWbSc2qnUqX582ro 63/ZQ/AKLvQa0IWWKseNlL3/m3/E+uyluu94h5/ORPGpNUzoWeQm/iUpRMJzapczj3kS byAUSA9j7WDS2LyVfPhA+N/POVdZMEFSa1EVEflD57EyAlePdqSt7rLD8pafvj8KnaGT HoQw== 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 u8si15090556pfh.95.2019.03.26.03.32.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:32:55 -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 7DE056E7E6; Tue, 26 Mar 2019 10:32:54 +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 5A43D6E7E6 for ; Tue, 26 Mar 2019 10:32:53 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWoTU018156; Tue, 26 Mar 2019 05:32:50 -0500 Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWout002842 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:50 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 26 Mar 2019 05:32:49 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:32:49 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2B071249; Tue, 26 Mar 2019 05:32:47 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 09/22] drm/bridge: tc358767: move PXL PLL enable/disable to stream enable/disable Date: Tue, 26 Mar 2019 12:31:33 +0200 Message-ID: <20190326103146.24795-10-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596370; bh=AQ58xuTFGIqkxbp1wZsG2vgUFxKOGDdHq7aKCkIFraw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=GpBo77xVs8ZDxpee1FEQmVuRhOfk/zKTD6d/tImHHGCnoMjrq+PbcN0e1J53EcJVo kh3GXjNF3G8ag1UtfO/5KfzbKIcbK1dGJMUJRdqDseLRVJBB31RG2hHDz4linzCsa8 3CVa4d9TjsQkFGVL8JDpRbabF/DnZFL3n/ArWzNM= 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 bfc673bd5986..f8039149a4e8 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); @@ -1020,6 +1012,14 @@ static int tc_stream_enable(struct tc_data *tc) dev_dbg(tc->dev, "stream enable\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) goto err; @@ -1064,6 +1064,8 @@ static int tc_stream_disable(struct tc_data *tc) tc_write(DP0CTL, 0); + tc_pxl_pll_dis(tc); + return 0; err: return ret; @@ -1390,8 +1392,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 Mar 26 10:31: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: 161184 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038733jan; Tue, 26 Mar 2019 03:32:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAq0KyqbKcQa4G13uDxijZsHcJoeBALFTNra/QeiM7tlYHgcKA4lb/GaRGCGJAEcVkF2Lw X-Received: by 2002:a17:902:7786:: with SMTP id o6mr30218896pll.206.1553596378698; Tue, 26 Mar 2019 03:32:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596378; cv=none; d=google.com; s=arc-20160816; b=dOCtjrzkJCdjaFPiGrr6DWJ1nIM4PVgUgQx1Y3hheJl40YdKvam6xXxaW2x2pNavp2 H92TfMH/37v6V397/z/st2vof7Hu2lP4Ts1/o+IFOmB6sVwe/y1rdPPlRYmd4zc1uLQQ lcmFXm7knc5voGhsleibMm5s4Ck9ZEKMjb4oRNycbPmhbpwJR0WNDBLx1M4JZnSXgtpn cId+WhcmE+MH2EdIO9bq78Bt4V+pm6jW1xhV88lcyfMaPorVcq7mDqjEvFrZ0redGepb 2t3RRdrKN7AUegNYx4Tn4IR7dx7kXb84uZJ3oqoEh5t2AkqXwveMLIVl9nHaMQ3/BTyb hAkw== 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=LOSWJeZQYwe4MGk8KTf72tuC0LYNuC9OXyM6YD39IoI=; b=sguAFB+HlgMXv7LgW2WfBjMWUoqP36drAp+/maRwIBVwUomdZdBAl3yEOTSGiIk+I/ QuLLeqToj3zeO/oiFeuccE2gH2Jd2JgCbkL7XjG1SUdMIxp8ITDcDX16v2idlquIEWPH sHnjkLpHAnCG3SHiOy5imWnHvwGv4DuLxPE0VZQWg3TIp5zfbd5X5q3mdOabxqpFLTfF rQEzZrOgGC2QySRL1wjUMWKEyzDYGx01qGz54Na5AO3MouFmO7rADwO3U42d83OVWh7H SamhI7n+bxOF7U8cSH/KiMU9J8lFaBOO9az+iZb9eD3mf1h2fhg3omBp+5iWMKlzTof4 sjRg== 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 j8si15452323plb.86.2019.03.26.03.32.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:32:58 -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 6EFA06E7DB; Tue, 26 Mar 2019 10:32:57 +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 D5E6C6E7E7 for ; Tue, 26 Mar 2019 10:32:55 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWqbO018162; Tue, 26 Mar 2019 05:32:52 -0500 Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWqbv002868 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:52 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) 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, 26 Mar 2019 05:32:52 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:32:52 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2C071249; Tue, 26 Mar 2019 05:32:50 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 10/22] drm/bridge: tc358767: add link disable function Date: Tue, 26 Mar 2019 12:31:34 +0200 Message-ID: <20190326103146.24795-11-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596372; bh=4aOjJOyJsxU+WV+EV18L4tlHMhhxQ/PvzpEeXNkG7Sc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=oU/HK4TcWDGxWeAnO3TNTFYVXirzzugqyrdWQa276Jv1UMqXb/yeXr3w2KEaBUoYj DVrY4jQcWpl1Okm3We6n8ONC6cVHIdvBfDMPlBYgGhBk69oFEM86wxY2f93FIebadj bEfD4uLFDcYxsch/UyqV1qykAk95Da8+Mi4eUR/Y= 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 --- 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 f8039149a4e8..fe5fd7db0247 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, @@ -1005,6 +1007,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; @@ -1083,15 +1099,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; } @@ -1108,6 +1125,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 Mar 26 10:31: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: 161186 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038823jan; Tue, 26 Mar 2019 03:33:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyE2XTIQ92+ZqsHZH+5eCwtHzqtTPnMJhDe+n8rhgboFLZSnu4geswYe0cgDgoRS8BjVjyG X-Received: by 2002:a17:902:a506:: with SMTP id s6mr5711444plq.164.1553596383425; Tue, 26 Mar 2019 03:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596383; cv=none; d=google.com; s=arc-20160816; b=U35APGjeFC07PYX6hb54Ekop1J2qZsBy1/ACgypHBfOYeHGGm5fFOG/NZqM63GnnKb C1Fi63D8VPS5FfOIafxVHUmbQfrysQTV49r57aypxCFgTusGz28ZkT2HrAzTd0hXyDuL 63jqLnMP5KCBXgG42CqLG8QqLgzdUt2IYdEp1NWCAfhDI0BsJ1C7JEjACmy+uY8pAwQY U37dyuNIzvr7L5qW2P84DBi8VoPoz+f7KdOUDHj3J/G8veIF/dhvq1YMOcL1p5JQcuns n+o7C7/kNOPhMoU+yMuZ9SQWNsf9KFK7BGZUj7AK39sQh1T+EigojHiA4DiRLjSTZjUr i2SQ== 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=oxLG4f6oU4QzEV5RDQPm55Yv2hoT2k3oCd8ZRAax/Co=; b=fGErB0sT2RbSaDjfgkL8xum2rCSW+IvgYghCUReHkZuU2LGLCjeYvjSJCLOhrgrxu7 xN0zRmgS4/BuPAndTG5vq9yK5iJw1ehzXeJW7+JOSv1oEKOGNyFDEv9Xl14Ei2XZ9Xpm KonoBLnJq807E6umXTaNbKYVAs9sRWB/HNjuKHlhKkOHShXEPEjwsiD3hcSgEABNtVTW /FMUHP02wtOq3bRp8btzdDp2kHBrz55YmtnkGkT7XfOHi4Jr78AZCER6w/Ut4YQHP238 30cXfyU0K1VpIbwdM/OUjsWavmmsjlLMFjCqpu8vKTNGtPQhuPshRigMW3IMFz4vpgaw GxpQ== 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 1si17449629plw.390.2019.03.26.03.33.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:03 -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 132C86E7E8; Tue, 26 Mar 2019 10:33:01 +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 98F0F6E7E7 for ; Tue, 26 Mar 2019 10:32:58 +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 x2QAWt6q043834; Tue, 26 Mar 2019 05:32:55 -0500 Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWt5t044563 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:55 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) 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, 26 Mar 2019 05:32:55 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE106.ent.ti.com (10.64.6.27) 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, 26 Mar 2019 05:32:55 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2D071249; Tue, 26 Mar 2019 05:32:52 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 11/22] drm/bridge: tc358767: ensure DP is disabled before LT Date: Tue, 26 Mar 2019 12:31:35 +0200 Message-ID: <20190326103146.24795-12-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596375; bh=G8whvB5XNu5+1oZ0kK0Z1pXv14d/iWkdimHvxEYS8B0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gjMlgjSEinnUdpLgsoP9AU1jVO88D8LCjpRMmRhD3I9zJxpjq7gw6Y2T8yYGj+51J wZvmytOL4Lp6AvTy1Edt8f0B3z14c6rjnQVIU5MMfVAI7y5SAGTx1oUU6fU1UQJGCg SoLlyO+OCYmOjQddBxRVpVQIyPQf1PyIGASqkQlc= 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, for some whatever reason, enabled when tc_main_link_enable() is called. Ensure that the DP link is disabled by setting DP0CTL to 0 as the first thing. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/tc358767.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index fe5fd7db0247..f628575c9de9 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -839,6 +839,8 @@ static int tc_main_link_enable(struct tc_data *tc) dev_dbg(tc->dev, "link enable\n"); + 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 Mar 26 10:31: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: 161189 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038995jan; Tue, 26 Mar 2019 03:33:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCcLMnV6RD0TipBtSwZ9qz9icSJe/ZHY9s6o5fckgxk0/tZawZhkqw2CFKrEMCiJ4p2gI2 X-Received: by 2002:a63:69c2:: with SMTP id e185mr27751884pgc.4.1553596394114; Tue, 26 Mar 2019 03:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596394; cv=none; d=google.com; s=arc-20160816; b=UvNRwYwkf+6jJh9satRs351zxNDiYDRhVxYJOce0EEjGlOuHqZLMRAwJsNm2ziA+T8 yOGKYGrRlP5pQRVSTFVzPUoV4ufSNxnBm970w4wRcIQzUXfALICP4NOCQFdXaFo8uweZ /5+sCS61ADKCjhIaeKqHKKVWAQji2AR09pzgOEoowqpVhxc5R2T1ZzkNuzYpIOYGnWeM IOcwR/mJFwks1biFy7IdQockIUT36pZW17uoRWd3SA4F67dAQYhcxxQlAuoiDEZvbITf sSt/2MF7oiwdRfEvllq/+NdG9QeQA1AMFY7a+PHNVVtqw9i9NhDPPLdydfHaUjAqDvTi B3+A== 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=J3MNhoRcWU98H5u+ZXxkRqIy6j0S11+ZE49ro/uV5l4=; b=gy4f3XyLgy56Ird8PjrvlgvU2LVhikrF64qOrkO7s4lELJnRUpyOy4LnrtufWinf4G dMzu/Ear5+noo2r3PW4o84Fs+wwg6n4NvT4Yjbx0/1zZzURAOJmken56QTsG+MFWIQ5W xH/6cz2JGQ+3hD54LcNgovCGumV/kLKooIRaNdnTujSuR708aQYKVZlGBnRNPUZYtFQp 8+7TW/XWL8k1jMOaLwNXI1MnxX/okgczqkhMLMj+kfeYL8tFmG3wJqnV7LLUqKFrpEWW rKNCDx79FdcueXv404GDAbslCsHA/lRYLdCGrua8X6MVPafT0u2W2kIT57AqL02ABZtz zbEQ== 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 m2si4645026pgp.463.2019.03.26.03.33.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:14 -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 4F3B66E7EF; Tue, 26 Mar 2019 10:33: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 C2F956E7E8 for ; Tue, 26 Mar 2019 10:33:00 +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 x2QAWwfV086493; Tue, 26 Mar 2019 05:32:58 -0500 Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAWwhr044587 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:32:58 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) 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; Tue, 26 Mar 2019 05:32:57 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:32:57 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2E071249; Tue, 26 Mar 2019 05:32:55 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 12/22] drm/bridge: tc358767: remove unnecessary msleep Date: Tue, 26 Mar 2019 12:31:36 +0200 Message-ID: <20190326103146.24795-13-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596378; bh=Y/GI5YL+6+n4P6J+MriGtVKz9CfPUrpmszJbyAEyIDk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=UuRkVQDo0ZoB9NCO5C6HrUY//xp72sRWwwIKP1zZrfrRBllOupw7lLCCg4LBC3Ouc d40EEhpIDa7POdYVfuSg0phl/2rigeSr3rTBE84Ty+2aP2WAGhleJmqzzsHIzaXvoB OIYtohJbYY3ZUoAhQsZnHsDFbvAm9WDv0HOjmiIw= 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 f628575c9de9..2a6c0c0d47a6 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -872,7 +872,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 Mar 26 10:31: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: 161190 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5039018jan; Tue, 26 Mar 2019 03:33:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyouRRnQv0ctxGPlZkOhrRDupnw4Vrc0chufS9avVTi3GnJAM06NHNhQ8I0hqSpwLBszrud X-Received: by 2002:a63:5460:: with SMTP id e32mr28479020pgm.401.1553596395695; Tue, 26 Mar 2019 03:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596395; cv=none; d=google.com; s=arc-20160816; b=v63GAGedtE0g3Twi9yhoPwpw8auogatzkOu7CfM8bRbqBkh20lRyFD8vj3yH8NqlMw dIhCP2Yn3zwdvowrDzJarb2+PVwom3RVHAWIFffvojDUcPlmKBmrWV1To4MJxwig7NwK z/ptQz/exuTtTEHsBU9KcoU7E2dx/RFR+BTPPfyfUOKcHMWjzB98PhoZJG2d1uY0DfrG KtKdRFiEkJDVDZ8Iy8pQpj8226J82P4FTMXMDz+0NaxbIi48deglQUgIV0D8XwtJpaOE i212TKjV+w4YCK4Pk+o28+tAdgGBCYKuE6wAFoB8MqEifuuHnYF0tL3axHeFbCYaPQje wdXw== 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=XARWfW1ePXknZYiu+drpkyMmC8Xb7ludIzaKrF5XcKU=; b=hSvoXmIEU8YBGHLMadoLRg0Yz7o5rq2lXhM2spBzDJcR/ujL65K8JECiB+IP/uOQgu ILWLsc87DFa7k9X0uV/3CgXbhBebCaB/YrTs8vaDX4tcorkNzBvu9b4mmRvidVKxHYqY PEuB2eoB57dBWvRZ9d07sm2j6T7Vo5UHMFZUozRdzL476U8qc7OdonkF/n1STvObRcuz 3F0SmnP9/VqwF9K71S0yhSWuVHsh25164vj7mHfy8om3OIojsEB9DlI2Ql+3A1Xf5TLC Z5isd9mqSWT42Q44zGDzRnolSQJP7gaMgQebiui9UUMji8GBGNQkSD8roIZuPrWPSuVH 3eIQ== 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 m24si15864354pgh.485.2019.03.26.03.33.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:15 -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 4D07A6E7EE; Tue, 26 Mar 2019 10:33: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 B9AD66E7EB for ; Tue, 26 Mar 2019 10:33:04 +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 x2QAX0ad086499; Tue, 26 Mar 2019 05:33:00 -0500 Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAX0Kx044625 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:33:00 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 26 Mar 2019 05:33:00 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:33:00 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2F071249; Tue, 26 Mar 2019 05:32:58 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 13/22] drm/bridge: tc358767: use more reliable seq when finishing LT Date: Tue, 26 Mar 2019 12:31:37 +0200 Message-ID: <20190326103146.24795-14-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596380; bh=AguGsa/I/UDqeQ96kBs0q7R11wd1LweJn55lxYYq3YU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ogJXcH7nwBYsSRZHqJYhlpBjkgbNOJ4vcBpB0pShYzojfeNXJFzyX/yvwfSO84cxb Wv2qz71UYufry1S2i+cu3x9jzeIMDbnXEsmYUZW2VGswMMSUAv3sqcC0ULD5I95y3Z TLmOIpzirGoqlunP35WzbD7p8LwEonoDGNoE+uqE= 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 2a6c0c0d47a6..700e161015af 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -958,6 +958,9 @@ static int tc_main_link_enable(struct tc_data *tc) if (ret) goto err; + /* 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; @@ -965,9 +968,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 Mar 26 10:31: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: 161188 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5038934jan; Tue, 26 Mar 2019 03:33:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4F9ZH06zA5sHQSTWowfZ6pHemuy1w7VVEeh0ioV+5qwHMhLWy+xb3gnhtxtwZpzqhCUtf X-Received: by 2002:a63:6a42:: with SMTP id f63mr1627512pgc.207.1553596390322; Tue, 26 Mar 2019 03:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596390; cv=none; d=google.com; s=arc-20160816; b=zrOe5xLbYTrN0yrzUDaGCY6Ql0hYTOmouf4Kc6ESlhN8aOiQWanHwF7M8++jS9/c2q eoRzZYRNWODpvpAAw8rwb16k9QTDNPzIp/bXkEhkUN9z8OqktFeZv6mgdIi90Q9h6RWr OYk6GrjkBEi32xetxAYwe3Cg9kfJKm/u84z6Lh2oBLsc3vPwAMStXE3d4dUvJ1Dfrkgq XW9drCRLvoSns3FGXtOAzhsSlpdV0LU74SmKf8NbEJrSxqw6bUpdm7T8nxsFHDrT0kQq LWmqAUzxsl29FBVu7rB2f86Pvy3B3NtQm2hhTfH3z2Hw05YkvtJ0KA0wBKTQf4gzQFd8 3apQ== 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=/JtDDVDSGR0kMzxgX2yt8W+FI7JA0Bw39LuU5i76rdc=; b=udaCRxHNQPPkDRvMzWWqFjjsU1WCTrrkGGxce0dwxXdKzOHhKqx121Ya8aVgi5syjn UavVBmNFvow082NND+MHRuHXiJvvRhB3bMm9OrpdGX/5zsMwVPE25brvBTu+VT1HuPba rJx0fXTrBks59SpZPJkqPr+OIDjpoFJp+C4w5olb/jK6zqXvprWzM4aeZiqrY9H0DkVD mTK2TEcRtxRMJKfkkFAb2roROo2Y+rvDt1UIY9zIMml9AMkBhtthhBTfvpCNAmV6qWWn PKsGYlO25oQdblDTJvfWADE6CQ54iJv1tVNNM4otqdRHWdw7eW1vRmadgZfhr3+f8BXF 5jfQ== 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 i6si12486515pgj.329.2019.03.26.03.33.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:10 -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 7D9746E7EB; Tue, 26 Mar 2019 10:33:08 +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 BE4936E7EB for ; Tue, 26 Mar 2019 10:33:06 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAX3Cq018221; Tue, 26 Mar 2019 05:33:03 -0500 Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAX3mF022094 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:33:03 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 26 Mar 2019 05:33:02 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:33:02 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2G071249; Tue, 26 Mar 2019 05:33:00 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 14/22] drm/bridge: tc358767: cleanup LT result check Date: Tue, 26 Mar 2019 12:31:38 +0200 Message-ID: <20190326103146.24795-15-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596383; bh=AHd1q7LqL9AV/Sfd0C4WJdD+dqxMY7vBEQ80333UpRE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=CZ9wYqdb/DjmaPPs+bvjbpbOOCHIKiI4j1D0tZMH9jOzZTrLNTQbOYFNe72U7ItG+ nknk1glvhdqb+stohZp4faGLFIWaLZd/qe+yHbk3CmuSiIOLA4oMrF+XvQvc5KMnGD C6fmGvZEE6hR7gPn87Vbezx0VlYprrWur3juCg9U= 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 700e161015af..220408db82f7 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -968,34 +968,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 Mar 26 10:31: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: 161194 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5039199jan; Tue, 26 Mar 2019 03:33:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfVWFhaYV04VI0ulRupgJluY/k+I300ZAJA2XJtyhcDMln6fj7j/xe2tPP8HNqV9tEXxIe X-Received: by 2002:a17:902:8c8a:: with SMTP id t10mr30891211plo.160.1553596406735; Tue, 26 Mar 2019 03:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596406; cv=none; d=google.com; s=arc-20160816; b=WwkNhBuTGtSSpC8Dbl30x1pLTZMPJ0iKgWLHpLvq7kFdquDErnwXMX98WpkL9mrzR5 B4Rl/zk4Rb7nrX8/bDs689W8Act8jLTnaywAotsceqk+SZ6xyin9V/j/9/x0KRaItw4o qwenFgjj1L8JmllZxdMdub6f45nnDOnV0W0XZONgfmqSEjnGOPsBvXz2C+lVfbRHmVeE KtSst0T2oCYXJfb46Jx5ec2CLSVB4vsjSJLspLGVIxqOi+eYjwzIRNZQmhFCr9uPwAoG WkznuVvzvSesuTA5tulHA20Q3liOXNAw8fSTJobNVMnZ/TiuqqygObE2FoUUz+IDzM3X 3Iyg== 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=JhDp74T30t/V3WmVoRb4z4TOKwW0DrKUaRkLqfkMwrs=; b=CNIj2I6D21tbRNl9UhaF2mqgJ+fWFb1lazmkkhgriqx4ftTQiT71D3cZKlgtgQE4XM iudKP7hN66fmQHyInpWrT5aaV96icXxNQwA+uW3UJ/wfW8ffxyZzafYCLlmc4bg04b6h 1+lL0X9cmLRaCXPm5PC07wyPsA2xi0phACLvmdrj4f8rLB84mDkQeG1IKaZM8VofUBTC SSpUttZ6R1PwOQu9+w3tZi5DfF1a6dbWIiSwuKsGe2+Bc6Ugo/xCbUjDsdwWFGRvdCcp wHpvhDAPF2cNuAUGzOmfeSTEYKGi77OhMPI5WAknjyqpcrU0/0WmGAYU2Zmq+aFEPHUV qRXA== 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 m90si15479281pfj.271.2019.03.26.03.33.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:26 -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 551606E7F3; Tue, 26 Mar 2019 10:33:22 +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 627BC6E7F0 for ; Tue, 26 Mar 2019 10:33:13 +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 x2QAXAGf086595; Tue, 26 Mar 2019 05:33:10 -0500 Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAXAbA003320 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:33:10 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 26 Mar 2019 05:33:05 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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 via Frontend Transport; Tue, 26 Mar 2019 05:33:05 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2H071249; Tue, 26 Mar 2019 05:33:03 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 15/22] drm/bridge: tc358767: clean-up link training Date: Tue, 26 Mar 2019 12:31:39 +0200 Message-ID: <20190326103146.24795-16-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596390; bh=obAY8AyHfzzWP8mtXrDAZNmMCcmZJ9004aENP2tc+g4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=XppdJtfC2XulE+eyJ+41EUBHQJEVlG7+KvhUfHxdHmdPgv8JsWjDlgMAmg6i0aTaP wt+HaP8azaxzpKG8oIRvRTB6jDoUOu/UVSrFtZWVKeKm3Ismu6ssr8jQZytyLV68Gy Wmb1oWsZUBkvZt2lZx66YDV8QOCQO74RSpb1ux6g= 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 | 129 +++++++++++++----------------- 1 file changed, 57 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 220408db82f7..1c61f6205e43 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -740,83 +740,25 @@ 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, u32 *error) { - 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"); + ret = -ETIMEDOUT; + goto err; } + *error = (value >> 8) & 0x7; + return 0; err: return ret; @@ -832,6 +774,7 @@ static int tc_main_link_enable(struct tc_data *tc) u32 value; int ret; u8 tmp[8]; + u32 error; /* display mode should be set at this point */ if (!tc->mode) @@ -950,14 +893,56 @@ 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); + /* LINK TRAINING PATTERN 1 */ + + /* 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, &error); if (ret) goto err; - ret = tc_link_training(tc, DP_TRAINING_PATTERN_2); + if (error) { + dev_err(tc->dev, "Link training phase 1 failed: %s\n", + training_pattern1_errors[error]); + ret = -ENODEV; + goto err; + } + + /* LINK TRAINING PATTERN 2 */ + + /* 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, &error); if (ret) goto err; + if (error) { + dev_err(tc->dev, "Link training phase 2 failed: %s\n", + training_pattern2_errors[error]); + ret = -ENODEV; + goto err; + } + /* Clear Training Pattern, set AutoCorrect Mode = 1 */ tc_write(DP0_SRCCTRL, tc_srcctrl(tc) | DP0_SRCCTRL_AUTOCORRECT); From patchwork Tue Mar 26 10:31: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: 161191 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5039045jan; Tue, 26 Mar 2019 03:33:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTc2vGLV0hKh6ht9aRMAyqXfvjQnaCsccte8ihmSKasoPKRgBVgBx7d0sMZ5FWoR/9glpC X-Received: by 2002:a62:449b:: with SMTP id m27mr29250639pfi.79.1553596397566; Tue, 26 Mar 2019 03:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596397; cv=none; d=google.com; s=arc-20160816; b=P8x8ixDaRod6Rp2+LwG6duDMBLTeMfPiWcqyWqw+ENScwIKw0wsj4gup9vcdgIDMzD grr4NwLFMsyLoCjTuo0HfNGs5qfN7EUWDfw1qXQX+VDlpRQW7/4PC8Ef9kRMndNmh2FG XhlenEiOMLzHlO0Y1wMyuzEgeJr2SzJKW5eN0tAZpWKVKzM3bZKnKZMIQH3oBmVa27RM dfFDxv4WJ8rl/3Z/QyI0v+Coa2eyz29HJYgusCa98/bHOsK/OxoaXn7bzx3XfqOQJD6g YkgU1ox42uBklLWU4co5Xt4fYbiwjx49Yhj8aEHwX/uPr49ua+rUmYXaFG4Ew+fA3+uX PTEg== 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=tdQ1tfSAv5S97OFUBkoiIvUcbudsZFm6EWeZAlD9KdY=; b=q7DqCXiDFk1FNJjmrifxrSLknPHSePrqYtnTOQmDi4xobeInAYCu9VQKPDrJHZuY// Z7z/yBJS9nOH3Tr8KYM7VQk74KqbwZMCmKj1oX2MvOPfbeGjbhPriBa3T8v/vQKjzs0j sxSM6OnSRl1GNufdcLi1hP/1aiCLbqrEUAItI8i0UwVzbtjCOFmdr8GKFL4HVhakTwEz r5CBpQPwJ+xXw2MV+fZ/scIzd9RxA4YpcGqYhwlPqO0f78CreyCTNoyQq3YxIomfl9gg NCW0k02+qNcVTZDHSXjtpW2a9VM/GkkNNNvbcAakp/NOxn1ezZS/yhl7LufZVzR/KsAu tM4A== 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 65si16843226plf.288.2019.03.26.03.33.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:17 -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 B77246E7F4; Tue, 26 Mar 2019 10:33:13 +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 AE5A26E7F0 for ; Tue, 26 Mar 2019 10:33:12 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAX9Ip086586; Tue, 26 Mar 2019 05:33:09 -0500 Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAX9lX022288 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:33:09 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) 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, 26 Mar 2019 05:33:07 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:33:08 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2I071249; Tue, 26 Mar 2019 05:33:05 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 16/22] drm/bridge: tc358767: remove check for video mode in link enable Date: Tue, 26 Mar 2019 12:31:40 +0200 Message-ID: <20190326103146.24795-17-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596389; bh=nuPjGNDQucSqyqC9jIbY/YGUkJUg+ggSWs9ID4Bafd0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dQLUiACOKuG7BEp0KBC5wWc3RIkzB4hOle/+Ww6+Hmn+phsocgQJH6EgCiSUzF3C1 Lr4UzsNDR5x0BYjcPIH04Gbc6q2vLMI1GqQTt7vCYHMZ00WCVyPdC8ig6wbPom+Msr ghsMsoSUzV4s+JFIqli9ofjiQgXZ+1mucxnXEnvA= 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. 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 1c61f6205e43..ece330c05b9f 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -776,10 +776,6 @@ static int tc_main_link_enable(struct tc_data *tc) u8 tmp[8]; u32 error; - /* display mode should be set at this point */ - if (!tc->mode) - return -EINVAL; - dev_dbg(tc->dev, "link enable\n"); tc_write(DP0CTL, 0); From patchwork Tue Mar 26 10:31: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: 161198 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5039363jan; Tue, 26 Mar 2019 03:33:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGNFY8h5WW+C9QJkHE66dqq1lT/kosjQNDF/GJg7Q1VwwvbLsbtXbBi5PvNRieDo1/WVZT X-Received: by 2002:aa7:83ce:: with SMTP id j14mr1278976pfn.57.1553596417242; Tue, 26 Mar 2019 03:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596417; cv=none; d=google.com; s=arc-20160816; b=eRkhMllpE3RQnaZMINrjtY6Z4CLq5ThCNEDQpvKi1VUrE+V9IYtwqbzPQfwibSv3qW WlczTLZhcn6B5msrVxYeKSki/eSiY6QHZfRCAYP+e6D9lGXFlR6YsXd6S4AVoX2AiIW8 RvCLzuj0iYGwHLUVck2q5DleuVqkGjp7Qk9hL4Lsae94z9H9ykURZkg3djD2rQcxjqyW db2tEc0pit+A/qiYb3mpE9t/r8FBKNtcU3t5TQU0xdtURu2/pMR6rZo7YzuiaCLBBLmC pNC5sIhVaFFR6sCXaC4dLQgQ88bNylQTSmu5dF5E07/aysC7H3ml8D7blEC+D6JQsOJG TpmQ== 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=XdOwPncEar7NpSG2Flb1fihtyQVf6EpFGFB6UlbUKeU=; b=aado4aN3iowQZWqmL5yZyewBaBBstIwpjVhGGfJQfzqEYah1j0YdzHBXr23pRNf6mX PZJNgi1dKUwbWQ7WcfMDwOYHGwuE4hUx86XcChjTE3Oi2CLgT+NDUK48eRWkuyY//oWC 8XZQJ7sksigYsxH9EeXW4bkDvNYR7I3+O0F4zwX8nNvf3LJBeYJkWo1FyL0hyZo7riKD Iv5d9wPq4RmK3rQalEnDHJSYePd9QHn6GwFrNL5k7Zoq5KptjkJWitT/PEtM5u+r343l PlMDopUQ/qNsCCI1kphzx/iznbQWbdiz429V8aMZtFc5grZ1a58PntjGUdHx3R97G/7G UEeg== 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 f191si4524644pgc.570.2019.03.26.03.33.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33: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 D18426E7F8; Tue, 26 Mar 2019 10:33:31 +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 9D7426E7F0 for ; Tue, 26 Mar 2019 10:33:14 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAXB2a043954; Tue, 26 Mar 2019 05:33:11 -0500 Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAXBOf022340 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:33:11 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) 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, 26 Mar 2019 05:33:10 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:33:10 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2J071249; Tue, 26 Mar 2019 05:33:08 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 17/22] drm/bridge: tc358767: use bridge mode_valid Date: Tue, 26 Mar 2019 12:31:41 +0200 Message-ID: <20190326103146.24795-18-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596391; bh=eRDO7BsvS+SWC7QajffwZCvmk91Hw+V09z6Gp9ugOE4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Qg0vCWZ3jYAXIMlQN8p4ZR0FDgV+oRGsU2dvLFIoyOJbtU/qZuE3LQy9Xw+nO7LQV kJbtCBS0RMPHagwIpybhIiKTiyA4+1UKNA+AtoNvCBtdYnwHEGd7wypRhlgsHTD913 YuGXGXvsj+ue1bCC2qtsdTCI4hdRefEY5jbyJahU= 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 ece330c05b9f..9fbda370a4c2 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1140,10 +1140,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; @@ -1212,7 +1212,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, }; @@ -1255,6 +1254,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 Mar 26 10:31: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: 161192 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5039148jan; Tue, 26 Mar 2019 03:33:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCCtpIhvQ5Z8XTWFe5v6FxDCDtwJ7tZfqPoO+G4zXchjZQQNU2JaDnjMKL1YUXjlZw8VfY X-Received: by 2002:a63:db14:: with SMTP id e20mr4605792pgg.437.1553596403820; Tue, 26 Mar 2019 03:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596403; cv=none; d=google.com; s=arc-20160816; b=HjZ6uarXWWu+CdqlMysBwOIQFlD3V86dnj0BUz0/anQ8DqG3aKb+YTfiFWzbEawCV4 jkHfik8UT7kYgHwF5z9LnOFA1M6KCi2rVMFisu2EUftgc2gQgFH/1FGJq81jj7IomocJ Hd3RFcv2AIlQl0aljCn+6k+v0hzH7yT7sA2clReLa3DzEtr/yjLdVhJ7UPd+O0/lNNog oRgxyQRKqklG1H9kfMW9Eq6oQNbE9Q85t/eStrhLoe4Sdj2j1gV12Popo6Kf/TKACJEi Gvrt0vTAjalCOus4UtIFNtsKT2EeiuU1sLBmKpO79St0PHfZ+/LSYAipbiQNdB5zJVJt GPHg== 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=mhkV5igKQcFqTlxryzZXgBmX66tlDVv/fCVDaVzh/2U=; b=J3IM/4s8aK4rgIZop4avsEd1DBzfwdUPDZd31qHIrrxrJVc/8Kyr/sRRfQ6Tp+hHpQ sFIlp0rCjr2ieTtkXWDbVpAR2h//OnasXoWUp5Ybge2I12mI6Xu2AD1bNFNDzqDmD71N dRdoXvFoPW41ZVAJpYmJmwSzG+0pZwVPGprmd/K9zFAvKasfAiDO02JxELT4xdtXizPD P6h0FWGtM9vBqbkyxC67hKFt+6L6Piy1RObNOX6sBla4S50owObxj9jlOBMpU8i/l0ik cJE7QZBRm14RFKekjqeWwbaqiq8f7olkht+jKetmO2im18KbdHpF7IgBodBdLYKcDHm+ 9AVQ== 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 m184si15821997pfb.73.2019.03.26.03.33.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:23 -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 04C276E7ED; Tue, 26 Mar 2019 10:33:22 +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 4338A6E7ED for ; Tue, 26 Mar 2019 10:33:18 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAXEpW018284; Tue, 26 Mar 2019 05:33:14 -0500 Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAXEDD022388 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:33:14 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) 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, 26 Mar 2019 05:33:13 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:33:13 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2K071249; Tue, 26 Mar 2019 05:33:11 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 18/22] drm/bridge: tc358767: remove tc_connector_best_encoder Date: Tue, 26 Mar 2019 12:31:42 +0200 Message-ID: <20190326103146.24795-19-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596394; bh=VBEKMJMJvRZMXQb5FvC1b0EXg7hoNaDlcHhkAgsFFsY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tpI33Ehn+H1sNTMKZniloIk99itehMZ3O61d91Rh9FZhm6XHOoZwrdCeKO5uLZVbd qBwrD9dIaiPUNJaz0GxwmP4H+vPysFk2g8PYBirPxGs+BtcRGPhKOehoemwadDZX4R KvQdxGegMkqPiDP86F0YMqqrZdF1BiIGtmSTIhJc= 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" As far as I know, drm_connector_helper_funcs.best_encoder is not needed in a trivial case as we have 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 9fbda370a4c2..114d535c296b 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1202,17 +1202,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 Mar 26 10:31: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: 161193 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5039159jan; Tue, 26 Mar 2019 03:33:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyj10HCFNhW5FjTXfxTaplmHU32IEAGmVsue5aG0rwLL/ShsyKJDRCodzYaUUhC3YSaErg9 X-Received: by 2002:a63:bd42:: with SMTP id d2mr11586609pgp.319.1553596404487; Tue, 26 Mar 2019 03:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596404; cv=none; d=google.com; s=arc-20160816; b=RTMsycULK+rFW+k+mdrjiOUtNG5bTJ5D6XNeE+/8udzVKkR1NAc5QUufaGa2DmfZLl oGk+wvqmUYRh8wzI3E7qSdCR/3XlbQmGSfi2ZvXuQ/YYT+SDllN3pVPp7i3LtS2WOc4M egBx++nNIlu0hsSYq9PpAwv0IzPNCq5Hcdn6tC74WoOXD5r2nUOy4ZKCA3OAg2Pp50o1 VTpehRGJdEZdv86rdLwUOzJ6CKHvOz2lCaVyhVrWksZqd8XeQc0q1laP5NYIKEyV5C41 acYYGl12tlCyF4pkLgpzd1t+CaqCDHShjlI9NNWEABBdEKQDHwDZZtDCKeWSngUzl+My vwpw== 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=AD75nBhV3txtbuxsRhjTpOUFOEFTJrHZN+VADjTYda0=; b=J+ax0b/SbaiXT11l8zo3qfpC2VHSN4KJW3YI9KIqaBUq6b4JhigaIwtjP6p/IuYg79 2Llbt3LBtPbis56MGBMV9pda5kcv5XhiJQz0ZKhM1tKBuI51WevW4lPjyubtqxDB8WlZ 5iKepc0JuN28oT2EhsVd+E7nDXJMFhBxCAYSw8wf1WfbnfZUEhAo9S2CaJnJIS0W965X No3zdO/LaTBpUu9zhmJ2Ju0T2VXyaU07rtEx+w+uTkXobEwHZ3YV9/iH+vHnEO7c2Spx oSSkreiA1wD7q4TVX16bbDRICezLHlwcT2lQjYJiba5dgk2ADrAdWgJsCyeHoca2GxFZ 3KtA== 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 61si16756172plq.154.2019.03.26.03.33.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:24 -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 0D9736E7F2; Tue, 26 Mar 2019 10:33:22 +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 449286E7F0 for ; Tue, 26 Mar 2019 10:33:19 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAXGfc044107; Tue, 26 Mar 2019 05:33:16 -0500 Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAXGhX022438 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:33:16 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 26 Mar 2019 05:33:16 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:33:15 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2L071249; Tue, 26 Mar 2019 05:33:13 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 19/22] drm/bridge: tc358767: copy the mode data, instead of storing the pointer Date: Tue, 26 Mar 2019 12:31:43 +0200 Message-ID: <20190326103146.24795-20-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596396; bh=Mg8a+Ef+AE8FV7gpcCtx0I5JJgvwtNOCus0ientVzuw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=i/3rCJbvpgzC8XyfouruE+0+TwLiUXevlr13AkoQ0ewyHiQqGelaU2MWdNm1vRmNH Xyh7wUaGV/F/r3HYuAUlXkSurJPBPRyWTL/WBjZqkVspJE8qScRh3X7E9QcvainV5j jPromiZFPnE1g8WQWdN+4N4JWLS9u/SB8eTYOP8M= 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 --- 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 114d535c296b..8732d5b05453 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; @@ -1021,12 +1021,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) goto err; @@ -1166,7 +1166,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 Mar 26 10:31: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: 161195 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5039281jan; Tue, 26 Mar 2019 03:33:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQo2/3/3CzXTsr1hNtiL9Vdz0L8nCeXfS6UblfXpQtfKLD0ZJTkLP33DWAL9G1wuTluC7Z X-Received: by 2002:a65:614a:: with SMTP id o10mr28498672pgv.51.1553596412374; Tue, 26 Mar 2019 03:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596412; cv=none; d=google.com; s=arc-20160816; b=MAksxpyYgSePS/ZOQb50qQ/bxWQe9qZzzY0CTh8pqwPrGVeOtSB0CmtBOkaoJWmjo/ 35C+zSDxb/VD9atoztKOgoRBMg6H81DpNBra6hxfAwTUEROLHl+0GKULBr6Yh15t2BB9 NnScDk6Nhpuz4iQygToMngV4PrRc9PD0HeXk2GJAPaFPicch/KIC+C8osDMBmRy1J4qS 3Fb6Ot2LAvKm6y+4x006iPwITWe0nXfYw14oZ52uZ42/b0HwkAN0sdPmxSMyjuNFVyxJ 190CRUriGnApvGvT+OuLcnETrY6QIOmh8iGEQq2OkSRFf5Jl8br6TwaVZEnqjBMYdFWJ 37Sg== 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=4NQEVQKg2/fgD+m1ZFoCGX9YcWEul9BDmfQ8PXCHA5k=; b=f3iub04NWbhaPKYd//URYtWQjAAGIdSdyh8btSaBlXoa9KLldabMx8UoZRl6L9T/zC B9G8kAhOWcYxDVaps86+PtNRQbK2xCgg2uFis7f63+n1GQkmDgkmXTLuvuv0JT2HvNHQ ZwEcdHUg9BkkIpbDWBk/aBAVY371a7QOOCRypo03Qsa3WZisNThRsKi8aWQFPUUlpPdN Ov8Yi01kOedwXM6q7jHHhBS3/FNGUgNp14FA7rFQVZ+Mce3+UcrLcbhjK19yKCHoGIjQ F5QM1tFpErS7zv92JU6VTyXUs6/C6jY1n17zM6K2EIyxihxJVp25/RR/DGVHN2CQwWcT 0BSw== 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 ct1si17117379plb.419.2019.03.26.03.33.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:32 -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 154B86E7F5; Tue, 26 Mar 2019 10:33: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 9BF6B6E7F5 for ; Tue, 26 Mar 2019 10:33: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 x2QAXKLa081418; Tue, 26 Mar 2019 05:33:20 -0500 Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAXKXw094924 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:33:20 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) 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; Tue, 26 Mar 2019 05:33:18 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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 via Frontend Transport; Tue, 26 Mar 2019 05:33:18 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2M071249; Tue, 26 Mar 2019 05:33:16 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 20/22] drm/bridge: tc358767: add GPIO & interrupt registers Date: Tue, 26 Mar 2019 12:31:44 +0200 Message-ID: <20190326103146.24795-21-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596400; bh=tqvo2a0c+o3K5W1o09TVyDDr9v44E14hA5FoiHiPyqQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=VOxeDypuLjXaHrh7Bk4DsNNs3nLKWNivNvniJU8IObsu9DmBXQ7Gad6jQjQx4vd08 PasIHAc2Gfy4pAnl3Eho+4d1D/B7JZ9Tnq2zzt9XIjAA529bxm/IVy4Q9LAuNxYwmr 2Ikk7VrRDpaI8QqtFMF1TqvCZrgds3eOlZlG/dxo= 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 8732d5b05453..8606de29c9b2 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 @@ -1265,6 +1271,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 Mar 26 10:31: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: 161197 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5039351jan; Tue, 26 Mar 2019 03:33:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/dZRFN2Sr47uOIlN31RR80Vw7E4h06ZKfhLIFIX3YqurSSyQURJMG3Q6NH0fB2kpRrcIC X-Received: by 2002:a17:902:32b:: with SMTP id 40mr29213411pld.122.1553596416250; Tue, 26 Mar 2019 03:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596416; cv=none; d=google.com; s=arc-20160816; b=ZBpKVZdhWr/ZAY7hoi/EGJJB8L30FFDsZwxhflxC31bx/1etjENocEscmWJT/g7Hwr mf6fTOk0WEmHw8dYDiKCT4vfNjQlzxo99s/Pn6SVPiBqXm1A+zx00pGYdugCKDA5vSlM 2PweMBvKTBPx+78Y/Q48foW/u5IbF7Bc2Ba70PRmXZIN2cjQjLvqCDoXGAcjyO5xC4+0 oWvYo8nZ2IgsiqaCq+bT4FmiZsaB9ZAmmzQOSyfIPZC8OvdsTx3dqLHnPd/wZwnl5O+O N9fX/3EBDyVycGKGby0GOtEJB4lo/tQnjIB2u/2/7H+wARcPlvGrS4AIctZ+IcLWFdil X1QA== 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=zU8xE6FUr5fjaCGpT1hp3RodTMlQ/dwH5RmUTXAYqSI=; b=UgxkC0vLFQg7oik25+XTtpd4uLrhGcMscGgwqz+TJf9WvBXEEDZlJRfuTMT1+JwG+P BxbC7DPx+qr2z7i+FNtujQTYgPBDE4Vf61i29M8E8cp/hjgO2wGPP/diBC2FSyURjUok eZhYnjN2mkFJhz9hJ+0pmqsIwaX/gp70AdEnxwOPex66z5xYuWlINXZP0J8EVjfqnnJQ w9b1fZ6bibFBRjrhOsVLvjripY7j/WY6hLO4141Ui/ENU0USKTxfHIX6oNtuHjQWzDXf yOGde7pNfK1gA+XtynYeeFVlD8MmfGEbWIeW0zt+pBfQB7oEHUVWrKtSQVL3apd6VZ+p A6FA== 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 s34si3067098pgl.97.2019.03.26.03.33.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33:36 -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 A4E726E7F7; Tue, 26 Mar 2019 10:33:31 +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 AA60E6E7F6 for ; Tue, 26 Mar 2019 10:33:26 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2QAXLV9018330; Tue, 26 Mar 2019 05:33:21 -0500 Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAXLLm003596 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:33:21 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) 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; Tue, 26 Mar 2019 05:33:21 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:33:21 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2N071249; Tue, 26 Mar 2019 05:33:18 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 21/22] drm/bridge: tc358767: add IRQ and HPD support Date: Tue, 26 Mar 2019 12:31:45 +0200 Message-ID: <20190326103146.24795-22-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596401; bh=XF5PYGEMMZLWE9Ae/HqdhW/PuKsRs3IcOUQa8XqX19A=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Sd/qWToLSCgFuk56mwVN6m8XUHqJhSczGLLdyhltWRpL7tdF5pL19f2ReXv7o+sJR rm5/8VSFEG3eQRKEbwdoVcbRDrOP4TspVg3vnDvLPRyfn0M0b5n/O1J8bg43ab6LCL ip/dtbNqhmgW+ISAL5KWnHd+TX+QN5KwMP67CD0s= 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 Tested-by: Andrey Smirnov --- drivers/gpu/drm/bridge/tc358767.c | 157 ++++++++++++++++++++++++++---- 1 file changed, 139 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 8606de29c9b2..6978129428a8 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_num; }; static inline struct tc_data *aux_to_tc(struct drm_dp_aux *a) @@ -1095,6 +1109,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); @@ -1200,19 +1220,42 @@ 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_num < 0) { + if (tc->panel) + return connector_status_connected; + else + return connector_status_unknown; + } + + tc_read(GPIOI, &val); + + conn = val & BIT(tc->hpd_num); + + if (force && conn) + tc_get_display_props(tc); + + 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, @@ -1227,7 +1270,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 : @@ -1235,6 +1278,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_num >= 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); @@ -1301,6 +1353,43 @@ 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_num >= 0 && tc->bridge.dev) { + bool h = val & INT_GPIO_H(tc->hpd_num); + bool lc = val & INT_GPIO_LC(tc->hpd_num); + + dev_dbg(tc->dev, "GPIO%d: %s %s\n", tc->hpd_num, + 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; @@ -1352,6 +1441,31 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) return ret; } + ret = of_property_read_u32(dev->of_node, "hpd-num", &tc->hpd_num); + if (ret) { + tc->hpd_num = -ENODEV; + } else { + if (tc->hpd_num < 0 || tc->hpd_num > 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); @@ -1365,6 +1479,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_num >= 0) { + u32 lcnt_reg = tc->hpd_num == 0 ? INT_GP0_LCNT : INT_GP1_LCNT; + u32 h_lc = INT_GPIO_H(tc->hpd_num) | INT_GPIO_LC(tc->hpd_num); + + /* 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_num)); + + 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; @@ -1377,12 +1507,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); @@ -1390,9 +1514,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) From patchwork Tue Mar 26 10:31: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: 161196 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5039289jan; Tue, 26 Mar 2019 03:33:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsNAXcU+UIeZxBOfk7zknOxHHPBJiix9h8jpH08fnWJ+1VuArP9YiZyIkxgbi37KeNG9+z X-Received: by 2002:a63:f310:: with SMTP id l16mr27709096pgh.72.1553596413006; Tue, 26 Mar 2019 03:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553596413; cv=none; d=google.com; s=arc-20160816; b=GK+ZAd/6JRRXzSr3kM1Q8u/+kqJ/89Q1s71RbMTMhEX7ly74bQNQTgODc5SdhjESxK K5O1+cwwx1VbKNWWWd5fnHaPVcwgp6eXYxki6aXBUuBqOUrrXRAxYbQRzOju7iXyhjwL /5E5AkH0te0/hRcoR3dWNj2GyTf+O89AIrk+q6ZYvZvm/ddtMFf07CmWmovHhpiu1Sfs Y94BbA1RV+09emdS6pS53UQKS9+r/Gf1Dgw80r8S5Yyhf6yby+fbgQnfwAeDz86nETQC w5VGOXvmGrFIbn17Boq5od1b5XV7h8t6eJDqczwzL5eKrVzPYinXZ2h6+eNw3+IQU3/z UbSA== 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=9qYJKquGFy3eZcn67Nm2sCk/f8kwMkodAwo3j0+PkUo=; b=lPx+Fv5ZRTmEi7YOcQxYDDHVtv2cat4jlB4ZDY4CF4ktpPL+nPHJfclSMKrGbKNUvK i0RhT6M/nheaLjNSPa1ZBKmRfswzLLRTDNx3hrvOFEL8d232Dpj8ctSpCw5A4l6fOOyQ YNH3gXRXQZrlG+7XgNqbRikObN8LrV4GOJMfPAk5ko/U/R0X0eKxescwdyt+mnrrN++k LNYyN7eAEDnHno1T+GZoVdFBmVh15z8eai5onvm3tiYZdFutVP7SjtsCxvsJxUQmG2qI saECmhAlAQuJn7W7658nqcEWecmBuO+37cMj23GAqeIh3DW7GUz94yQFT66PX9ct/lhx sRqA== 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 p10si15849823pgl.186.2019.03.26.03.33.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:33: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 491616E7F6; Tue, 26 Mar 2019 10:33:31 +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 99D6F6E7F5 for ; Tue, 26 Mar 2019 10:33:29 +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 x2QAXPwa044162; Tue, 26 Mar 2019 05:33:25 -0500 Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2QAXPZI095041 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Mar 2019 05:33:25 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 26 Mar 2019 05:33:24 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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, 26 Mar 2019 05:33:24 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2QAWN2O071249; Tue, 26 Mar 2019 05:33:21 -0500 From: Tomi Valkeinen To: Andrzej Hajda , Laurent Pinchart , , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [PATCHv2 22/22] dt-bindings: tc358767: add IRQ & HPD support Date: Tue, 26 Mar 2019 12:31:46 +0200 Message-ID: <20190326103146.24795-23-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326103146.24795-1-tomi.valkeinen@ti.com> References: <20190326103146.24795-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=1553596405; bh=iLe3JPfS3Zeo9ctSgTJhtSrMMjrmEk7FHDCecPKCHHI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=nR22lOUm7SwYiXF3wjd96VQkqhTWTO3+CaySXB/Sawq2NATVTZ/6a3WhNo6q7MJMZ 9b5oNba1bKJwnNucrGDoqL0ruQQ5EaqsgCrUmuUl89Kl5w2vy9KxBM7brywIyzC9eg OmH4uQ0EJwYCmSPY6L+pvR7zbnhrbSIWgkdRJTxo= 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: devicetree@vger.kernel.org, Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add DT properties needed for IRQ and HPD support. Signed-off-by: Tomi Valkeinen Cc: devicetree@vger.kernel.org Cc: Rob Herring --- A quick summary of tc358767's HPD/GPIO support: tc358767 has two pins that can be used as GPIOs. Those can be used for HPD by configuring the pin as input. tc358767 supports HW detection of a "short" HPD pulse (programmable length) which can be used to detect DisplayPort IRQ from the monitor. Afaik, this kind of short pulse detection is not possible with common GPIOs found in SoCs. While I think the HPD support works ok, I'm unsure about the DT binding. I first tried implementing the HPD as a gpiochip, but for interrupts I then needed irqchip, and the amount of code started to increase a lot. I decided that gpiochip + irqchip just isn't worth the effort and complexity here, as most likely the pins will ever be used for HPD. So, here I have a simple 'hpd-num' DT property to mark which (if any) of the two GPIO pins is used for HPD. Suggestions welcome. .../devicetree/bindings/display/bridge/toshiba,tc358767.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358767.txt b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358767.txt index e3f6aa6a214d..79c71e7eb71f 100644 --- a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358767.txt +++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358767.txt @@ -12,6 +12,9 @@ Optional properties: (active high shutdown input) - reset-gpios: OF device-tree gpio specification for RSTX pin (active low system reset) + - interrupt-parent: phandle of the parent interrupt controller + - interrupts: interrupt specifier for the bridge's interrupt + - hpd-num: TC358767 GPIO pin number to which HPD is connected to (0 or 1) - ports: the ports node can contain video interface port nodes to connect to a DPI/DSI source and to an eDP/DP sink according to [1][2]: - port@0: DSI input port