From patchwork Fri Mar 10 04:32:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 9614775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AD92F60415 for ; Fri, 10 Mar 2017 04:50:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0CEA286E3 for ; Fri, 10 Mar 2017 04:50:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95E96286F3; Fri, 10 Mar 2017 04:50:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 55BD1286E3 for ; Fri, 10 Mar 2017 04:50:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 537E26ED95; Fri, 10 Mar 2017 04:50:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-x230.google.com (mail-qk0-x230.google.com [IPv6:2607:f8b0:400d:c09::230]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7AF0C6ED99 for ; Fri, 10 Mar 2017 04:49:13 +0000 (UTC) Received: by mail-qk0-x230.google.com with SMTP id v125so149138266qkh.2 for ; Thu, 09 Mar 2017 20:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZDtty1BNJTG/qxnSbp47a5gWM4xrFLAbnaq515thnWE=; b=U/cEqUnhZp+v0GfOWPPm4pe5KvxDnL8JPmhY9KhC4hMhCh6tOJRcskBLEbmzoztGVO hIcairTByLmwyT2mR0occWbKMDamdATxSyR/7z+r5gBrbAM7sFtwnP40zeuMi+SDm4em mu+2PENydy3TiHeYp/51vCrbDpgaVVSMGC3mE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZDtty1BNJTG/qxnSbp47a5gWM4xrFLAbnaq515thnWE=; b=MJ0YUK3xxAbcSoDXU+0Bd+OsJkGHj498Yqv2asO6ff5EkQ4QaVB+rH7KqSH8VAhjxp 27dkgQzM9jwKbdTq8RMg16fMpp28e0Yo+bdVWhpzu0wBPJmtaldO37xTI99rcFrWAgZs e12Puw0YjKpeu+oRKzzuIMAD5te3k4hPfnr3RuGPjWqA9K5m0cSwCCblVwZoSytTUFoe 83/417KYYwGdarPGJ+BAIk0HwLrOeoBn2QJA4QMXcgTa1PdDKqEdI0p0bh9C6q7MtRoW 3QC9+uYiCKtUVcU9mu+w0OmGVUjfkYoQFzAvVNoeP5O4GZ1Hpp/SBU03aG6yGSAOM1zW Rx1A== X-Gm-Message-State: AMke39k4KPdmawJQlXyWmDICIJ6R4FqzVy7rhvGkMf7eqnHFWwR2gYkx2e1iDix1Sul3FVex X-Received: by 10.55.210.70 with SMTP id f67mr16921949qkj.304.1489120948710; Thu, 09 Mar 2017 20:42:28 -0800 (PST) Received: from boxwood.roam.corp.google.com (cpe-75-189-128-87.nc.res.rr.com. [75.189.128.87]) by smtp.gmail.com with ESMTPSA id n19sm5697731qtn.35.2017.03.09.20.42.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 20:42:27 -0800 (PST) From: Sean Paul To: linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH 38/41] drm/bridge: analogix_dp: Reorder plat_data->power_off to happen sooner Date: Thu, 9 Mar 2017 23:32:53 -0500 Message-Id: <20170310043305.17216-39-seanpaul@chromium.org> X-Mailer: git-send-email 2.12.0.246.ga2ecc84866-goog In-Reply-To: <20170310043305.17216-1-seanpaul@chromium.org> References: <20170310043305.17216-1-seanpaul@chromium.org> Cc: zain wang , Lin Huang , Tomeu Vizoso , Douglas Anderson , Yakir Yang , "Kristian H . Kristensen" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 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 1454075bce9a..a05bc0271188 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1329,12 +1329,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);