From patchwork Tue May 28 08:27:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 165251 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8169001ili; Tue, 28 May 2019 01:28:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxeaNXSZzLSuIk5E+BiFG/Pkh5EEePmfD/NZC06KlN8Ewv9CnrZ4/hidrc4v3h0y34LDL/z X-Received: by 2002:a17:902:6bc8:: with SMTP id m8mr130682720plt.227.1559032122478; Tue, 28 May 2019 01:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559032122; cv=none; d=google.com; s=arc-20160816; b=qdgv9wdlNyMrhTtr0kPcCaU+Wq9J4XCFR7Z6+88UGnb8LL6zQgBhrVaJDLDOxmw70R dpaTd/1EAQxzmbea8dsvmqJkUqOMchj/uIpB3BP5TkveolJfl7SMl2v7GrBTVy9VfO0m H7YjG2/1KgjzWM0tCj9liCK9lw8YKcFKp1YWKSctg/YA7OnIZ678k9W4U68HyJo+jiKZ sVAbvbQGi4rk5VKaPBLuSrXTgjUqTFp6RF8VvrQsjwVGAYsjC6/R5zmxAOhGYxPOMXE+ JCDSjAbpjSIRjvaqQgEA7o1TkKItfGGuAu01XiQxRK8lyebYe5SFXjJgWptKOR0yI5c+ DyNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=NE7bkQRPXGKJpSBzjqqbFAdmBc7OWkaP7sjo1JWrMeU=; b=vb605NQvqViNgjWd/t6r0I3OqSKrQfbxQ2U7N1mhQdhpZ03rN9xhOIZEo9PJlAeX3y YFejWOW6J/4fEFqUk+H8ycRiePp8kk2kMGuAOdqrh2SVh/JsdYQsq+Yagz/tlZV6u4AI +Me5Vk7vPlQ9aASaroIbYSSTEgLDC43dUM0FdQ9doa7qfMfo0AD3gNlzYnPAds268vfl mrF0x+DfQsVLna1USdZ9126DWM2lRVV1wKB6TUzqcJxyFXBaV6MrwVkK0P05QTL7Jvc2 WPnTEKdI3IE93XBQ2BWkH8fKPRrTGMJwNwavI6QRJoYPTGMmA+KkhfF4BUUZu/To/m/T fpNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id g3si20865599pgc.156.2019.05.28.01.28.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 01:28:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A69B389CB8; Tue, 28 May 2019 08:28:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2907589CAF for ; Tue, 28 May 2019 08:28:33 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4S8SR8K031905; Tue, 28 May 2019 03:28:27 -0500 Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4S8SR7Y082845 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 May 2019 03:28:27 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 28 May 2019 03:28:27 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 28 May 2019 03:28:27 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x4S8Rxue125039; Tue, 28 May 2019 03:28:25 -0500 From: Tomi Valkeinen To: , Andrzej Hajda , Laurent Pinchart , Lucas Stach , Andrey Gusakov , Philipp Zabel , Andrey Smirnov , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCHv4 10/24] drm/bridge: tc358767: add link disable function Date: Tue, 28 May 2019 11:27:33 +0300 Message-ID: <20190528082747.3631-11-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190528082747.3631-1-tomi.valkeinen@ti.com> References: <20190528082747.3631-1-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1559032107; bh=E9OK9geYrWh2r44XMJ6sVAh6zf+T0He0OZJ9NtE9SI0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tVmBqlHQLwnO5fnXpKKqZfrn7lKOatqGD8L755TtzmRLTdpm0MJFkWKfYM4orVkKN vmJ32mm3u+PHQR3rn06y0hyBDuaMn2kXhVRPWywbhfv/pvbt//9HgPKTpcKXDcQL39 XecYxGsU+MH2jjbBPzEM7hZ2+HW5lLh/K6MIq7hk= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currently we have tc_main_link_setup(), which configures and enabled the link, but we have no counter-part for disabling the link. Add tc_main_link_disable, and rename tc_main_link_setup to tc_main_link_enable. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 46975676c88c..2323a22656e8 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -822,7 +822,7 @@ static int tc_link_training(struct tc_data *tc, int pattern) return ret; } -static int tc_main_link_setup(struct tc_data *tc) +static int tc_main_link_enable(struct tc_data *tc) { struct drm_dp_aux *aux = &tc->aux; struct device *dev = tc->dev; @@ -837,6 +837,8 @@ static int tc_main_link_setup(struct tc_data *tc) if (!tc->mode) return -EINVAL; + dev_dbg(tc->dev, "link enable\n"); + tc_write(DP0_SRCCTRL, tc_srcctrl(tc)); /* SSCG and BW27 on DP1 must be set to the same as on DP0 */ tc_write(DP1_SRCCTRL, @@ -1006,6 +1008,20 @@ static int tc_main_link_setup(struct tc_data *tc) return ret; } +static int tc_main_link_disable(struct tc_data *tc) +{ + int ret; + + dev_dbg(tc->dev, "link disable\n"); + + tc_write(DP0_SRCCTRL, 0); + tc_write(DP0CTL, 0); + + return 0; +err: + return ret; +} + static int tc_stream_enable(struct tc_data *tc) { int ret; @@ -1084,15 +1100,16 @@ static void tc_bridge_enable(struct drm_bridge *bridge) struct tc_data *tc = bridge_to_tc(bridge); int ret; - ret = tc_main_link_setup(tc); + ret = tc_main_link_enable(tc); if (ret < 0) { - dev_err(tc->dev, "main link setup error: %d\n", ret); + dev_err(tc->dev, "main link enable error: %d\n", ret); return; } ret = tc_stream_enable(tc); if (ret < 0) { dev_err(tc->dev, "main link stream start error: %d\n", ret); + tc_main_link_disable(tc); return; } @@ -1109,6 +1126,10 @@ static void tc_bridge_disable(struct drm_bridge *bridge) ret = tc_stream_disable(tc); if (ret < 0) dev_err(tc->dev, "main link stream stop error: %d\n", ret); + + ret = tc_main_link_disable(tc); + if (ret < 0) + dev_err(tc->dev, "main link disable error: %d\n", ret); } static void tc_bridge_post_disable(struct drm_bridge *bridge)