Received: by 10.213.65.68 with SMTP id h4csp1737553imn; Thu, 5 Apr 2018 02:58:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+7/hcj1Yy8I4R9ftbE1BrmXq9pH63yuDqQoZh5jIYr3M0u6XOUFQFv4Y2RaeTuv1mrberl X-Received: by 2002:a17:902:69ce:: with SMTP id m14-v6mr22606756pln.358.1522922336763; Thu, 05 Apr 2018 02:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522922336; cv=none; d=google.com; s=arc-20160816; b=z9QWw+RWN7/mddMSLy2y9Rxo/3JxiF2x7bEkcv3RhzsbBIcLWNmuovrXQ2BO+Qfe3r 69HDEIBofDggOx8Y6QzQ2P4bYBAr2XhIoLAFj7EW3FfV1iW8tapyOz5kzGhLPO6OurL0 SpY3LZRnAyKr6OQgDvJiY6j2gttMHOA8l0nCpAK1ZT0a1EdqbJRml8MaJcGsHNlKVPvV 2hxvixfCR81L15hwWdvrFnr1hEsR7HdtISz5rBgeTZi/j3nSAwl1p2I7KekQ5iGE7Ikn hhypCsv4q3BNdvthQKk5Msu5JF4gzLoVUfh5kTqL4K1auCEAISG5OzIXRjsxQieSxZUB ofvA== 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=l9enl41ZFwuWTdnBol0nit2EyfExp79SoskUIZFN0J0=; b=DnE2680COJDMUQbctCv3l7rG96QL09P1Z00qoEjuK3g4kXF8F+JgTbEYFNxzcBkb+L b67VI7WpndoIIzb47kyKgIrk9uMXjsAlLs4RDW5pxd84ecLhoMTx9M7dmDPff8XLm6ek kwu4lBY+bIS7M0oOMWD3MXwYw41IgVam7E4VlFTVtN/X+PcW9qYvTM/E79ko/aXw5wWq XPAJlJl/2RLAYQOYql8dMOc21duEa9Q3CdXipe0wmk8jIPZbDzAHUfStcf5yJsp9/OC8 a9htZoWZHi3RyAkCE8MRhiIHTc5iGEm9Ej7U/Y0YJ1S3yHIVHLbONDU0JuZJd4I9rqt8 Vk1w== 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 y10-v6si5457359plt.533.2018.04.05.02.58.43; Thu, 05 Apr 2018 02:58:56 -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 S1752090AbeDEJu6 (ORCPT + 99 others); Thu, 5 Apr 2018 05:50:58 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60938 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751906AbeDEJux (ORCPT ); Thu, 5 Apr 2018 05:50:53 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 09D23277A2F 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, ykk@rock-chips.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, linux-input@vger.kernel.org, orjan.eide@arm.com, wxt@rock-chips.com, jeffy.chen@rock-chips.com, linux-arm-kernel@lists.infradead.org, mark.yao@rock-chips.com, 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: [PATCH v6 18/30] drm/bridge: analogix_dp: Reorder plat_data->power_off to happen sooner Date: Thu, 5 Apr 2018 11:49:48 +0200 Message-Id: <20180405095000.9756-19-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180405095000.9756-1-enric.balletbo@collabora.com> References: <20180405095000.9756-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.16.3