Received: by 10.192.165.148 with SMTP id m20csp4738883imm; Tue, 24 Apr 2018 07:40:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+WaTrSj5BZPqSTu8f2LHqTdN1RKlfGh66uxH+GYugC2utwk0zo/4HOuig8J7iAbLGFlcVA X-Received: by 10.99.0.4 with SMTP id 4mr20255737pga.107.1524580833981; Tue, 24 Apr 2018 07:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524580833; cv=none; d=google.com; s=arc-20160816; b=b3CpZQX4wziylaiI060YwOZrV6oleUPCvmgKf323g0YzeESGrAi3JhBSXP07iHG03O PwFCIGFBXsf/WEXCo8i3dgMUlqqFHRc1tXSlgvp5G/s/SyPyc1gImomAH6vtzNQgdlnp DkoH+rISqCIey8LOB7/nN0PgI9vox3uX/xaeZWziYXwJH9vJqBMJySdYha4YMUHYqNzm K6fi8AKXeR7KkY2Lwc5jLNf0RedRNmRuJmmfkIa4HH6xR6AL64Nfuj4myDXZMTlYi83d oMPvOBSAW+AKQ9+PJ9R0kt06IpEaszWiOcGpnrZmaurCU7g09o0SXsP2aYDxUgnQxd8s y+fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:content-language :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:dkim-signature :arc-authentication-results; bh=zj0NyDP8Sa9SUF1Z26fHE/Hggan/XJ/A42mWja2LSjI=; b=FRAYilG7V2BiOlyBiSmCcJwdDQzNKxZpJNqcRYByn9lK+WOW4FT9D2mdqA/zZYz6H0 /v6r0JuWhY5aCcraRkz+DderUfHw0ser+eNn9B9b9RuhU374tOfHhwWZWSolgk4H0xEs rVN9Y44v1IqYwAhhva1smR36uU7xrbsgbkanhbHBy+aLrRvk/+/SBEzpvU45lVY+3+d4 U+8CuOoX56EaJkhimU4HO00KhbE6oeP/mJggt0rDxLjpdR191SjU9C05p3h9Lw+WpPP/ aO+A/Xxvw7y1DpWOL2bXIKE07RK2VNyeJvP0JbVwteCFAO/elomxoWWCZj/gd4U3sltT fkQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tFQsjICy; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v41-v6si11872817plg.451.2018.04.24.07.40.19; Tue, 24 Apr 2018 07:40:33 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tFQsjICy; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933489AbeDXN7H (ORCPT + 99 others); Tue, 24 Apr 2018 09:59:07 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:39808 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933467AbeDXN64 (ORCPT ); Tue, 24 Apr 2018 09:58:56 -0400 Received: by mail-qk0-f194.google.com with SMTP id z75so8605900qkb.6; Tue, 24 Apr 2018 06:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:content-language :thread-index; bh=zj0NyDP8Sa9SUF1Z26fHE/Hggan/XJ/A42mWja2LSjI=; b=tFQsjICygMgaj/A8fooviqOlbuYUkxFvxRLz7P8ybNh+TF3BKUZFzBSJfzcrWEAHKz w/4l7HbaXeOrTbBLLiu2tXi8/1E/YabwMpUwN2jn591/Gw1fD3R4a9mEdSunkmxS4jrR E+XykS5Q9iVR1IR+ptEgsDAXW3UfMM7lgGjeysxvTzP/pLYsgeGSNXjs1igcgu0JV/8p I6GcSSKIm42oVcfbMeTdF8cutPgHH2xhdrqc4r/T6VkV88EUVEf0feiXmRsQJqDWRzXF tEIbz+v9UVYcMKIEAkN3AQb9rhQYyd4kEm7Yz5qfZalfPm530GuYenmNeqYhup4EEyiX EULw== 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:references:in-reply-to:subject:date :message-id:mime-version:content-transfer-encoding:content-language :thread-index; bh=zj0NyDP8Sa9SUF1Z26fHE/Hggan/XJ/A42mWja2LSjI=; b=ErXFccjEM0ITueRnPY8+ehomcBRasrxhBSzuktt/akM8dusshOUAWISH+gWiMhP6ED FwHTd+vr45PQDc730uRhlWYvciyN673LzSChkUGlmgLQ1Zi5ya6eLZMgZHzg/47eLHSc SxI3OcJ7q+SRnmWt0/qsa0yJzYfDqJc6JXgoEI8pXXPFfpUXoryoAHHMixzgdaeRkTiJ baJshBXTLSNGKJbQUhM5OMuCBE5G870sITomtANMkjPLiHjNstXuFOx+cGtpw290E2eY OMQDGENrUOwt4Sx1WeJWQR+HPB362aqoXna2/TAVm1LSHDLELeYfGinvEkXdUneLrdoQ a/oQ== X-Gm-Message-State: ALQs6tA23E1QhkQGZJZP6ZVrp6pVz3oVSZVAuDh3QteNHfb4V7j/djX4 YKe3oCVYTTTBtTOQG7ulvgg= X-Received: by 10.55.141.70 with SMTP id p67mr26641204qkd.227.1524578335158; Tue, 24 Apr 2018 06:58:55 -0700 (PDT) Received: from DESKTOP3JAHB13 ([2607:b400:26:0:d591:2454:e7bc:aa63]) by smtp.gmail.com with ESMTPSA id a20sm11713217qkb.17.2018.04.24.06.58.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 06:58:54 -0700 (PDT) From: "Jingoo Han" To: "'Enric Balletbo i Serra'" , , , , , , , , Cc: , , , , , , , , , , , , , , , , , , , , , , References: <20180423105003.9004-1-enric.balletbo@collabora.com> <20180423105003.9004-14-enric.balletbo@collabora.com> In-Reply-To: <20180423105003.9004-14-enric.balletbo@collabora.com> Subject: Re: [RESEND PATCH v6 13/27] drm/rockchip: Restore psr->state when enable/disable psr failed Date: Tue, 24 Apr 2018 09:58:50 -0400 Message-ID: <000401d3dbd4$61b507c0$251f1740$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Content-Language: en-us Thread-Index: AQJsKqzGdLQ3B8H319FIYPcigFOt/AGVO47IotKpTfA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday, April 23, 2018 6:50 AM, Enric Balletbo i Serra wrote: > > From: zain wang > > If we failed disable psr, it would hang the display until next psr > cycle coming. So we should restore psr->state when it failed. > > Cc: Tomasz Figa > Signed-off-by: zain wang > Signed-off-by: Douglas Anderson > Signed-off-by: Sean Paul > Signed-off-by: Thierry Escande > Signed-off-by: Enric Balletbo i Serra > Tested-by: Marek Szyprowski > Reviewed-by: Heiko Stuebner > Reviewed-by: Archit Taneja Acked-by: Jingoo Han Best regards, Jingoo Han > --- > > .../drm/bridge/analogix/analogix_dp_core.c | 4 +++- > .../gpu/drm/rockchip/analogix_dp-rockchip.c | 10 +++++----- > drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 20 ++++++++++++------- > drivers/gpu/drm/rockchip/rockchip_drm_psr.h | 2 +- > 4 files changed, 22 insertions(+), 14 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > index 75e61ebf6722..5540e2dfc2ec 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > @@ -153,8 +153,10 @@ int analogix_dp_disable_psr(struct analogix_dp_device > *dp) > psr_vsc.DB1 = 0; > > ret = drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, DP_SET_POWER_D0); > - if (ret != 1) > + if (ret != 1) { > dev_err(dp->dev, "Failed to set DP Power0 %d\n", ret); > + return ret; > + } > > return analogix_dp_send_psr_spd(dp, &psr_vsc, false); > } > diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c > b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c > index 3e8bf79bea58..8c884f9ce713 100644 > --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c > +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c > @@ -77,13 +77,13 @@ struct rockchip_dp_device { > struct analogix_dp_plat_data plat_data; > }; > > -static void analogix_dp_psr_set(struct drm_encoder *encoder, bool enabled) > +static int analogix_dp_psr_set(struct drm_encoder *encoder, bool enabled) > { > struct rockchip_dp_device *dp = to_dp(encoder); > int ret; > > if (!analogix_dp_psr_enabled(dp->adp)) > - return; > + return 0; > > DRM_DEV_DEBUG(dp->dev, "%s PSR...\n", enabled ? "Entry" : "Exit"); > > @@ -91,13 +91,13 @@ static void analogix_dp_psr_set(struct drm_encoder > *encoder, bool enabled) > PSR_WAIT_LINE_FLAG_TIMEOUT_MS); > if (ret) { > DRM_DEV_ERROR(dp->dev, "line flag interrupt did not > arrive\n"); > - return; > + return -ETIMEDOUT; > } > > if (enabled) > - analogix_dp_enable_psr(dp->adp); > + return analogix_dp_enable_psr(dp->adp); > else > - analogix_dp_disable_psr(dp->adp); > + return analogix_dp_disable_psr(dp->adp); > } > > static int rockchip_dp_pre_init(struct rockchip_dp_device *dp) > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c > b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c > index b339ca943139..9376f4396b6b 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c > @@ -36,7 +36,7 @@ struct psr_drv { > > struct delayed_work flush_work; > > - void (*set)(struct drm_encoder *encoder, bool enable); > + int (*set)(struct drm_encoder *encoder, bool enable); > }; > > static struct psr_drv *find_psr_by_crtc(struct drm_crtc *crtc) > @@ -93,19 +93,25 @@ static void psr_set_state_locked(struct psr_drv *psr, > enum psr_state state) > return; > } > > - psr->state = state; > - > /* Actually commit the state change to hardware */ > - switch (psr->state) { > + switch (state) { > case PSR_ENABLE: > - psr->set(psr->encoder, true); > + if (psr->set(psr->encoder, true)) > + return; > break; > > case PSR_DISABLE: > case PSR_FLUSH: > - psr->set(psr->encoder, false); > + if (psr->set(psr->encoder, false)) > + return; > break; > + > + default: > + pr_err("%s: Unknown state %d\n", __func__, state); > + return; > } > + > + psr->state = state; > } > > static void psr_set_state(struct psr_drv *psr, enum psr_state state) > @@ -229,7 +235,7 @@ EXPORT_SYMBOL(rockchip_drm_psr_flush_all); > * Zero on success, negative errno on failure. > */ > int rockchip_drm_psr_register(struct drm_encoder *encoder, > - void (*psr_set)(struct drm_encoder *, bool enable)) > + int (*psr_set)(struct drm_encoder *, bool enable)) > { > struct rockchip_drm_private *drm_drv = encoder->dev->dev_private; > struct psr_drv *psr; > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.h > b/drivers/gpu/drm/rockchip/rockchip_drm_psr.h > index b1ea0155e57c..06537ee27565 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.h > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.h > @@ -22,7 +22,7 @@ int rockchip_drm_psr_activate(struct drm_encoder > *encoder); > int rockchip_drm_psr_deactivate(struct drm_encoder *encoder); > > int rockchip_drm_psr_register(struct drm_encoder *encoder, > - void (*psr_set)(struct drm_encoder *, bool enable)); > + int (*psr_set)(struct drm_encoder *, bool enable)); > void rockchip_drm_psr_unregister(struct drm_encoder *encoder); > > #endif /* __ROCKCHIP_DRM_PSR__ */ > -- > 2.17.0