From patchwork Fri Mar 10 04:32:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 9614753 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 CC11E60415 for ; Fri, 10 Mar 2017 04:47:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEDE4286B9 for ; Fri, 10 Mar 2017 04:47:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3CC3286E3; Fri, 10 Mar 2017 04:47:32 +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 4CBF6286B9 for ; Fri, 10 Mar 2017 04:47:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0BBF06ED8F; Fri, 10 Mar 2017 04:47:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-x229.google.com (mail-qk0-x229.google.com [IPv6:2607:f8b0:400d:c09::229]) by gabe.freedesktop.org (Postfix) with ESMTPS id 60F086ED8A for ; Fri, 10 Mar 2017 04:46:26 +0000 (UTC) Received: by mail-qk0-x229.google.com with SMTP id 1so151722085qkl.3 for ; Thu, 09 Mar 2017 20:46:26 -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=EAW8a3WpnWN/eiiciTzoF7B5RqZoAKjgGAe+p4mJpL4=; b=ZqYWJgUQ1eAU0D79cGDMtEyki84WGxRCNhhqiCj9hWzjXUhniE42VpLBMaffZq2c88 ELni5+S7dCR9PlNUq+Qgx4oIp7V0k/9xItG+RtReB5ZI5Ioa7+lwbCnXzylezFyHS7ix 4XrKqrDpJl9YzXiXKgGRTjGgms/M9IcfOynBU= 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=EAW8a3WpnWN/eiiciTzoF7B5RqZoAKjgGAe+p4mJpL4=; b=NclChK7ZxOdTT0HtMZOhEoTvuQZD0NlTDrUtgnlqfcqDe1JkB6+jK4tQm0m5bHVQHU 23ToT5xgbKm3tLrhmT9c6vqylj0FTqgot1QuaWngwvNO4kbxmY/GCQT9GDidLULLQIpe Ln6OrAiXZxAxKSllMTuLdvLDGJJmN/F3R7CIKp1bNs+5IAG4kkellKzOEzSsyiRSkohC UQVlfT0cIdv815aoOP0uSFgUChzNrGX5ahOf9z7OCoJnKQRaherI1l9F5HcCgY8HMd4o QAdp2y4jD1WforrAb7gDglfXK+Emr8f0sV6s1IcvOuc7XFKmkG9Ns/Gx+OXmsShg7qSZ aGYg== X-Gm-Message-State: AMke39nXc1cZzdsjsOUtCob0lvVWwD4rPYO2OzxoH0dqW+0R2mmF1AfEp/6ivDgPtE77vhs9 X-Received: by 10.237.45.194 with SMTP id i60mr19848828qtd.135.1489120561624; Thu, 09 Mar 2017 20:36:01 -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.35.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 20:36:00 -0800 (PST) From: Sean Paul To: linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH 10/41] drm/bridge: analogix_dp: Don't change psr while bridge is disabled Date: Thu, 9 Mar 2017 23:32:25 -0500 Message-Id: <20170310043305.17216-11-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 , Tomeu Vizoso , Douglas Anderson , Krzysztof Kozlowski , Tomasz Figa , Lin Huang , Yakir Yang , linux-arm-kernel@lists.infradead.org, Caesar Wang 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: zain wang There is a race between AUX CH bring-up and enabling bridge which will cause link training to fail. To avoid hitting it, don't change psr state while enabling the bridge. Cc: Tomeu Vizoso Cc: Sean Paul Signed-off-by: zain wang Signed-off-by: Caesar Wang [seanpaul fixed up the commit message a bit and renamed *_supported to *_enabled] Signed-off-by: Sean Paul --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 15 ++++++++------- drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 2 +- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 2 +- include/drm/bridge/analogix_dp.h | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 8a8f05fe9da3..64d94a34874d 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -98,20 +98,20 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) return 0; } -int analogix_dp_psr_supported(struct device *dev) +int analogix_dp_psr_enabled(struct device *dev) { struct analogix_dp_device *dp = dev_get_drvdata(dev); - return dp->psr_support; + return dp->psr_enable; } -EXPORT_SYMBOL_GPL(analogix_dp_psr_supported); +EXPORT_SYMBOL_GPL(analogix_dp_psr_enabled); int analogix_dp_enable_psr(struct device *dev) { struct analogix_dp_device *dp = dev_get_drvdata(dev); struct edp_vsc_psr psr_vsc; - if (!dp->psr_support) + if (!dp->psr_enable) return 0; /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */ @@ -134,7 +134,7 @@ int analogix_dp_disable_psr(struct device *dev) struct edp_vsc_psr psr_vsc; int ret; - if (!dp->psr_support) + if (!dp->psr_enable) return 0; /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */ @@ -878,8 +878,8 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) /* Enable video */ analogix_dp_start_video(dp); - dp->psr_support = analogix_dp_detect_sink_psr(dp); - if (dp->psr_support) + dp->psr_enable = analogix_dp_detect_sink_psr(dp); + if (dp->psr_enable) analogix_dp_enable_sink_psr(dp); } @@ -1120,6 +1120,7 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) if (ret) DRM_ERROR("failed to setup the panel ret = %d\n", ret); + dp->psr_enable = false; dp->dpms_mode = DRM_MODE_DPMS_OFF; } diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h index b039b28d8fcc..e135a42cb19e 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h @@ -170,7 +170,7 @@ struct analogix_dp_device { int dpms_mode; int hpd_gpio; bool force_hpd; - bool psr_support; + bool psr_enable; struct mutex panel_lock; bool panel_is_modeset; diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 64e7e2c0bc58..f44756029478 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -83,7 +83,7 @@ static void analogix_dp_psr_set(struct drm_encoder *encoder, bool enabled) int vact_end; int ret; - if (!analogix_dp_psr_supported(dp->dev)) + if (!analogix_dp_psr_enabled(dp->dev)) return; dev_dbg(dp->dev, "%s PSR...\n", enabled ? "enable" : "disable"); diff --git a/include/drm/bridge/analogix_dp.h b/include/drm/bridge/analogix_dp.h index c99d6eaef1ac..4fc0165ed3f5 100644 --- a/include/drm/bridge/analogix_dp.h +++ b/include/drm/bridge/analogix_dp.h @@ -38,7 +38,7 @@ struct analogix_dp_plat_data { struct drm_connector *); }; -int analogix_dp_psr_supported(struct device *dev); +int analogix_dp_psr_enabled(struct device *dev); int analogix_dp_enable_psr(struct device *dev); int analogix_dp_disable_psr(struct device *dev);