Received: by 10.192.165.148 with SMTP id m20csp3279871imm; Mon, 23 Apr 2018 04:00:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx495W5RlxO3tz0N/NmMLJWINIk7TZ5D4zzmvBLK09kaAJX9F8UfNq3FozbzRtH/ZZvHbVH0a X-Received: by 2002:a17:902:8692:: with SMTP id g18-v6mr9030399plo.152.1524481205291; Mon, 23 Apr 2018 04:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524481205; cv=none; d=google.com; s=arc-20160816; b=S8tMCmrOeRSvLy996SkK0tf6PSIUAoxYljdpeGgzR72iZ4NbGA36OAuuHo+e5gKrk+ uKAtffIXkTzj8KQ7QrolX3w9DatECvgQI4SrmJDeA9YF6QMUjlabu7oRPnuU0SBdI5HG /3mesMQnU2JSb0DL7nu/vUrR3QtXOPeqyaweT+773f8wVDK8/F8+zcWfCyycWdGKfHKt CKoBr44AqJ9AVMWaGyxDb1w5L32ww3DSPnfzFG+fp5DIvaBRIdjQi8dPhsvOLL41nX2o 8gJuz2/sIRvLehdwvaJ1JpWKwcVA8Z1ZKfuWYXIAXb5OqY7v9l31aS6xDjKQM9OqnwC8 75YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=SUAZOP2fKnNCrwKQMfhKCwwBYcaCELL1vP/k8KKJJ0w=; b=uppO0kSBhWvro8DfQTSnsdskTfJU30q3oJqBnSmXlWSFfdYYFjR9ZPf8npIg5Ja8hP 48xzuhdSLqG7qTuRm4N3/haxQiFW32PhwfJWvjCQ2dbOWXix//1Mz8g3+853/GOldRyE n57gbhPKPAtgw5psvQuiQWjH691mIctdfWD83WNPO+q1uFZqTRcvYLwS71rr8fCuCLKV /l7OGEi4UlEX0NoSSWC52P/qMAQ/96rK5ffOL/1bz+rzcqfIl0xkOAdLNmmjNNk34Ft3 1Vsux2uFVJzYYx9IAHFzfpzJHa7PuEU7ujEm4d2Kmsh/UAHDqk6xuVBBzlPHIbGN7Q6x uCgg== 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 x15-v6si11568289pln.479.2018.04.23.03.59.20; Mon, 23 Apr 2018 04:00:05 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755196AbeDWKzc (ORCPT + 99 others); Mon, 23 Apr 2018 06:55:32 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:38934 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755063AbeDWKuz (ORCPT ); Mon, 23 Apr 2018 06:50:55 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 4971F277B99 From: Enric Balletbo i Serra To: architt@codeaurora.org, inki.dae@samsung.com, thierry.reding@gmail.com, hjc@rock-chips.com, seanpaul@chromium.org, airlied@linux.ie, tfiga@chromium.org, heiko@sntech.de Cc: dri-devel@lists.freedesktop.org, dianders@chromium.org, a.hajda@samsung.com, kernel@collabora.com, m.szyprowski@samsung.com, linux-samsung-soc@vger.kernel.org, jy0922.shim@samsung.com, rydberg@bitmath.org, krzk@kernel.org, linux-rockchip@lists.infradead.org, kgene@kernel.org, orjan.eide@arm.com, wxt@rock-chips.com, jeffy.chen@rock-chips.com, linux-arm-kernel@lists.infradead.org, wzz@rock-chips.com, hl@rock-chips.com, jingoohan1@gmail.com, sw0312.kim@samsung.com, linux-kernel@vger.kernel.org, kyungmin.park@samsung.com, Laurent.pinchart@ideasonboard.com, kuankuan.y@gmail.com, hshi@chromium.org, "Kristian H . Kristensen" , Enric Balletbo i Serra Subject: [RESEND PATCH v6 18/27] drm/bridge: analogix_dp: Reorder plat_data->power_off to happen sooner Date: Mon, 23 Apr 2018 12:49:54 +0200 Message-Id: <20180423105003.9004-19-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180423105003.9004-1-enric.balletbo@collabora.com> References: <20180423105003.9004-1-enric.balletbo@collabora.com> 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 Signed-off-by: Enric Balletbo i Serra Tested-by: Marek Szyprowski Reviewed-by: Archit Taneja --- 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 69b2c16e5776..a260de4f0bd8 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1337,12 +1337,13 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) } disable_irq(dp->irq); - analogix_dp_set_analog_power_down(dp, POWER_ALL, 1); - phy_power_off(dp->phy); if (dp->plat_data->power_off) dp->plat_data->power_off(dp->plat_data); + analogix_dp_set_analog_power_down(dp, POWER_ALL, 1); + phy_power_off(dp->phy); + clk_disable_unprepare(dp->clock); pm_runtime_put_sync(dp->dev); -- 2.17.0