Received: by 10.223.185.111 with SMTP id b44csp820111wrg; Fri, 9 Mar 2018 14:29:58 -0800 (PST) X-Google-Smtp-Source: AG47ELv8lgbmgR3xB20XAXPfxoHv9yhY6giFPxe4DVyw+AAqiVH+M2w5IlqR6KUhfnsssMbrO5IO X-Received: by 2002:a17:902:8f95:: with SMTP id z21-v6mr78587plo.132.1520634598191; Fri, 09 Mar 2018 14:29:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520634598; cv=none; d=google.com; s=arc-20160816; b=oC5KQaR04uy0rvQK46Enw2Fkhj0ed7afm+mt9U3GeJHsI5FcLZWMEywSdFfaqKJTvA 3D9QVDp47nJ59ogY5wK/TKKvBGrMzTE/Fut6Lbyj3V+LKr8eUIGtmyiUz7/97tbBDKiz 182vVHm3i3HBZSyPwwqUBImFvCbX+JU3MsfxMqf3pnn7xMwPI2M5TYTpKPjpvEtHrY5J HjDXM4WMTNn2YIWbENTw6grZkxWE0KawI1KgfBYxWn6uF8jCb6zHWZEEVYPbXqgO5jt4 0dYo4Isgta4xbFC6ZYQuyNpq7W3uV73/vtC7PQ7s2mIED7gHcvi6wfrbagxAflTaqfk0 qTTw== 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=tr1FKgzCWOb3BLVp4oL1BwM6hqUtge8disTuT6lehXA=; b=pIVYoP1nqPw7tOkPNcmSsRclojkQ9kdEcqTP6sRD49KVqjPKMHu5vD8wdwFnblQrjy OGUdpVOTpjNtZMe2dTER5mXjhP/vNCQy94Swk8/DyBe347okSAyBsoFvmI7nRgCIyiP2 UsXEiKkvgjlzSz2n/4XTl+6b+ECH1fN9WcokbxvJ4/8ETcoLkkfMNgE0CaT+ctff8b1Q 9mnfyYrtPPpJn1XJuQ5qUgWf3eIVqN01H9xIOFDSRZ3BUZDCBbiHh4YEYsc4UZvM+MRk BcbsUBRA9vUo+dk8IfN2rHA+sCn3L6W/rLcw3gQ0Qbna7YZV0hYuJWuJ77zgOPsCYZ9n BIyw== 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 j9si1554520pfh.200.2018.03.09.14.29.43; Fri, 09 Mar 2018 14:29:58 -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 S933130AbeCIWYr (ORCPT + 99 others); Fri, 9 Mar 2018 17:24:47 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:42844 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933014AbeCIWYn (ORCPT ); Fri, 9 Mar 2018 17:24:43 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 711EF2792CE 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 v5 24/36] drm/bridge: analogix_dp: Reorder plat_data->power_off to happen sooner Date: Fri, 9 Mar 2018 23:23:15 +0100 Message-Id: <20180309222327.18689-25-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180309222327.18689-1-enric.balletbo@collabora.com> References: <20180309222327.18689-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 --- 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 37b16643f14c..eaf93cbd47a8 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.1