Received: by 10.223.176.46 with SMTP id f43csp685562wra; Fri, 26 Jan 2018 05:22:33 -0800 (PST) X-Google-Smtp-Source: AH8x227VPiGhEdEw6Ezm3rUr/CFp90F2xfCqHxwqZbi0zI3jTmQ9PDTA+WJt+q+voZTBhOSlLSpr X-Received: by 10.98.31.72 with SMTP id f69mr19172403pff.196.1516972953096; Fri, 26 Jan 2018 05:22:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516972953; cv=none; d=google.com; s=arc-20160816; b=zw6np0nQrabhSBdNdb7TED9bw9l+VCvHAggTZswE6R6GMwFAa7O5FnuqSGZLJzCTUE jp1HWTePI1LIHP8lSYgAV3BM8MvaeVA2vnWpN/ai2hbe3jxNvYNMuzyfOR9kGEr/jxgH hX/MIaUysrD2wGcO3uQtx5ax7U9/997DawoxYpgRs1ujuHQxoT7A8gExBtuLXwA8L57W z5akf2D35EBGzvOc0KigmKXosU+135ssgXrj4vnoVvpQdBJdmsvlh64fXvSAQkey9ZxO /KecynSCxLA0/Ju9V781zJixMSEF8jj+BWB5CJbcIVUlt9Tr8WQXUh1Gt7iU2iOt0o6r 3aog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfert-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=sC/bVru7Gy2fl6SaGs3qle79uynL0TlxsFoQivBauN8=; b=GW31kakKVzJimJ9sFHXcD/6O7Z7zw0/KmlmOt7ZfLijcyVANuu2XXaRKIjB5Gl2T/f 6xj4a0/3jk0UjMB980uAViipBkS7kA+KQxtoNmq9Is6Zrz/oufmXEJ2+9sIhp0kQuOEh UGvs3qJWPAzQD9ULRYGq+m2zd/HBrZM9c6qbzueuR8fVtT3wjdHrlQTAyU+t/VsSjH3b Hd07R3OvQe4M+sZGSEKCk9+NjCXRPH2fcg7i0K0GyhHyXAItwrbiWapbqOwnW3QHzmjf eaoSBr+2VB22sgLVjvPu33BZvJh2yxKvkir1gBU0sOd6t5tnzhNbGKO/f59PWulPNMUW O0dQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b25si6351166pfc.241.2018.01.26.05.22.18; Fri, 26 Jan 2018 05:22:33 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752772AbeAZNVL (ORCPT + 99 others); Fri, 26 Jan 2018 08:21:11 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:34374 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752374AbeAZNR7 (ORCPT ); Fri, 26 Jan 2018 08:17:59 -0500 Received: from localhost.localdomain (unknown [IPv6:2a01:e35:8a7e:4790:a8d7:ca4:7b4f:7f87]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tescande) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 74ABF274DDB; Fri, 26 Jan 2018 13:17:58 +0000 (GMT) From: Thierry Escande To: Archit Taneja , Inki Dae , Thierry Reding , Sandy Huang , Sean Paul , David Airlie , Tomasz Figa Cc: Haixia Shi , =?UTF-8?q?=C3=98rjan=20Eide?= , Zain Wang , Yakir Yang , Lin Huang , Douglas Anderson , Mark Yao , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 30/43] drm/bridge: analogix_dp: Reorder plat_data->power_off to happen sooner Date: Fri, 26 Jan 2018 14:16:57 +0100 Message-Id: <20180126131710.7622-31-thierry.escande@collabora.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180126131710.7622-1-thierry.escande@collabora.com> References: <20180126131710.7622-1-thierry.escande@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset = "utf-8" Content-Transfert-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas Anderson The current user of the analogix power_off is "analogix_dp-rockchip". That driver does this: - deactivate PSR - turn off a clock Both of these things (especially deactive PSR) should be done before we turn the PHY power off and turn off analog power. Let's move the callback up. Note that without this patch (and with https://patchwork.kernel.org/patch/9553349/ [seanpaul: this patch was not applied, but it seems like the race can still occur]), I experienced an error in reboot testing where one thread was at: rockchip_drm_psr_deactivate rockchip_dp_powerdown analogix_dp_bridge_disable drm_bridge_disable ...and the other thread was at: analogix_dp_send_psr_spd analogix_dp_enable_psr analogix_dp_psr_set psr_flush_handler The flush handler thread was finding AUX channel errors and eventually reported "Failed to apply PSR", where I had a kgdb breakpoint. Presumably the device would have eventually given up and shut down anyway, but it seems better to fix the order to be more correct. Cc: Kristian H. Kristensen Signed-off-by: Douglas Anderson Signed-off-by: Sean Paul Signed-off-by: Thierry Escande Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index bee0f7aa5c23..3ee1f533a6ad 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1335,12 +1335,13 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) } disable_irq(dp->irq); - phy_power_off(dp->phy); - analogix_dp_set_analog_power_down(dp, POWER_ALL, 1); if (dp->plat_data->power_off) dp->plat_data->power_off(dp->plat_data); + phy_power_off(dp->phy); + analogix_dp_set_analog_power_down(dp, POWER_ALL, 1); + clk_disable_unprepare(dp->clock); pm_runtime_put_sync(dp->dev); -- 2.14.1