Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2460654imm; Thu, 7 Jun 2018 10:58:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJNj+WW1bqt5Isg+/s0nXliochWTJPeYZKOdSN/rcurZ1NBxQ2G6y0ed4++lQYKKtRdD/Qg X-Received: by 2002:a17:902:7883:: with SMTP id q3-v6mr3069701pll.71.1528394339329; Thu, 07 Jun 2018 10:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528394339; cv=none; d=google.com; s=arc-20160816; b=OInMHYdAHPRuPqRY9z/+dGRsHIgvToFy4nmr6HSPiah6d7W3Wp1KqAARfgsiDU/+sj +dCJDJFywbmfccE86/0i9SYHy88qzey3PtpfMoFC+9Pu0oI/IQwMa0gobNQrY70AhODP FFCyWi7z0sTD+0fb4S2jeULyM2sBpu7MVDAtNfxmXEqSlIqA0O42MHed12qO6FnXOPP6 iP7jbf+CNwS5B85LkSHGSXxI2eGR/nE8AaAX2q/ACvKxixzjzxZCJVIKhaZOwIvqWwKm YWihCXoBcQwwJEpUS7808FXVU9o0XMybQQdA+08iX3yqVFVF+g3KAPIEgg/rH5e9g1Aq JHzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=v8IcsAxsc67NQMXyuq9Rvqo95Vtx8Rg/3ZsiVtmvVpg=; b=ZhR5YPWq3ZG4DN3hgli7ZlLYz+eyBTE1liMlqfMEG4NiBozCLNyXcbJ0qt7zEENIAV qGA0ir9CZB3RIYSciYOEXhfYqQQ4x9n86i4aXeLxKKTdtqSXMkZZ3ZVmUunxcwzIgKCg pppLf4xRrcbnpKCT0CcwNCixvKf9h/N7RzSn9iAIjEjfvx/Qv/HMOT3qnMG7Qkpx74X4 gYo+6vyTeXdjTwdu5IHT0Xm814JJq9o7rtnuo1hAiCSMpzTN0OU0HD4SD6PoSl0Lo4/W SfGSQXxztdxMbRdBJSwbsbYIv+KgTWVVjDOUDhQT8YkQERxkgsDGmEuvLRfGHGiVZEso hgQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a21-v6si30433332pls.237.2018.06.07.10.58.45; Thu, 07 Jun 2018 10:58:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934864AbeFGOvL (ORCPT + 99 others); Thu, 7 Jun 2018 10:51:11 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40813 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933084AbeFGOrl (ORCPT ); Thu, 7 Jun 2018 10:47:41 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbG-0005Zo-7X; Thu, 07 Jun 2018 15:09:14 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbD-0003Fy-2S; Thu, 07 Jun 2018 15:09:11 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "=?UTF-8?q?Michel=20D=C3=A4nzer?=" , "Alex Deucher" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 363/410] drm/radeon: Don't turn off DP sink when disconnected In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Michel Dänzer commit 2681bc79eeb640562c932007bfebbbdc55bf6a7d upstream. Turning off the sink in this case causes various issues, because userspace expects it to stay on until it turns it off explicitly. Instead, turn the sink off and back on when a display is connected again. This dance seems necessary for link training to work correctly. Bugzilla: https://bugs.freedesktop.org/105308 Reviewed-by: Alex Deucher Signed-off-by: Michel Dänzer Signed-off-by: Alex Deucher Signed-off-by: Ben Hutchings --- drivers/gpu/drm/radeon/radeon_connectors.c | 31 +++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-) --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c @@ -66,25 +66,18 @@ void radeon_connector_hotplug(struct drm /* don't do anything if sink is not display port, i.e., * passive dp->(dvi|hdmi) adaptor */ - if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { - int saved_dpms = connector->dpms; - /* Only turn off the display if it's physically disconnected */ - if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) { - drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); - } else if (radeon_dp_needs_link_train(radeon_connector)) { - /* Don't try to start link training before we - * have the dpcd */ - if (!radeon_dp_getdpcd(radeon_connector)) - return; + if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT && + radeon_hpd_sense(rdev, radeon_connector->hpd.hpd) && + radeon_dp_needs_link_train(radeon_connector)) { + /* Don't start link training before we have the DPCD */ + if (!radeon_dp_getdpcd(radeon_connector)) + return; - /* set it to OFF so that drm_helper_connector_dpms() - * won't return immediately since the current state - * is ON at this point. - */ - connector->dpms = DRM_MODE_DPMS_OFF; - drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); - } - connector->dpms = saved_dpms; + /* Turn the connector off and back on immediately, which + * will trigger link training + */ + drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); + drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); } } }