From patchwork Thu Sep 29 14:46:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zain Wang X-Patchwork-Id: 9356559 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 E1EFA600C8 for ; Thu, 29 Sep 2016 14:48:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3D0729AF6 for ; Thu, 29 Sep 2016 14:48:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C851C29AF9; Thu, 29 Sep 2016 14:48:58 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 293B229AF6 for ; Thu, 29 Sep 2016 14:48:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpcdt-0006ZL-Hm; Thu, 29 Sep 2016 14:48:57 +0000 Received: from regular1.263xmail.com ([211.150.99.136]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpcdm-0006NR-IX for linux-rockchip@lists.infradead.org; Thu, 29 Sep 2016 14:48:55 +0000 Received: from wzz?rock-chips.com (unknown [192.168.167.177]) by regular1.263xmail.com (Postfix) with ESMTP id 7E65735; Thu, 29 Sep 2016 22:48:26 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id C19A2364; Thu, 29 Sep 2016 22:48:24 +0800 (CST) X-RL-SENDER: wzz@rock-chips.com X-FST-TO: seanpaul@chromium.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: wzz@rock-chips.com X-UNIQUE-TAG: <092be36ba68609d2efffe301f174de04> X-ATTACHMENT-NUM: 0 X-SENDER: zain.wang@rock-chips.com X-DNS-TYPE: 0 Received: from localhost (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 28799Y3Q4TC; Thu, 29 Sep 2016 22:48:27 +0800 (CST) From: zain wang To: Sean Paul , Daniel Vetter , Inki Dae , David Airlie Subject: [PATCH v1 4/4] drm: bridge/analogix: switch Main-link and eDP PHY when enable/disable psr Date: Thu, 29 Sep 2016 22:46:40 +0800 Message-Id: <1475160400-30782-5-git-send-email-wzz@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1475160400-30782-1-git-send-email-wzz@rock-chips.com> References: <1475160400-30782-1-git-send-email-wzz@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160929_074851_211851_7AD56C6F X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, Heiko Stuebner , Tomeu Vizoso , linux-rockchip@lists.infradead.org, Jingoo Han , dianders@chromium.org, dri-devel@lists.freedesktop.org, Tomasz Figa , Javier Martinez Canillas , zain wang , Mika Kahola , Yakir Yang , =?UTF-8?q?St=C3=A9phane=20Marchesin?= , Thierry Reding , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP turn off Main-link and power down eDP PHY when enable psr, turn on Main-link and power up eDP PHY when disable psr. Signed-off-by: zain wang --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 105 ++++++++++----------- 1 file changed, 52 insertions(+), 53 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 7177f5f..1bc98ab 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -98,56 +98,6 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) return 0; } -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) - return -EINVAL; - - if (dp->dpms_mode != DRM_MODE_DPMS_ON) - return -EBUSY; - - /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */ - memset(&psr_vsc, 0, sizeof(psr_vsc)); - psr_vsc.sdp_header.HB0 = 0; - psr_vsc.sdp_header.HB1 = 0x7; - psr_vsc.sdp_header.HB2 = 0x2; - psr_vsc.sdp_header.HB3 = 0x8; - - psr_vsc.DB0 = 0; - psr_vsc.DB1 = EDP_VSC_PSR_STATE_ACTIVE | EDP_VSC_PSR_CRC_VALUES_VALID; - - return analogix_dp_send_psr_spd(dp, &psr_vsc); -} -EXPORT_SYMBOL_GPL(analogix_dp_enable_psr); - -int analogix_dp_disable_psr(struct device *dev) -{ - struct analogix_dp_device *dp = dev_get_drvdata(dev); - struct edp_vsc_psr psr_vsc; - - if (!dp->psr_support) - return -EINVAL; - - if (dp->dpms_mode != DRM_MODE_DPMS_ON) - return -EBUSY; - - /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */ - memset(&psr_vsc, 0, sizeof(psr_vsc)); - psr_vsc.sdp_header.HB0 = 0; - psr_vsc.sdp_header.HB1 = 0x7; - psr_vsc.sdp_header.HB2 = 0x2; - psr_vsc.sdp_header.HB3 = 0x8; - - psr_vsc.DB0 = 0; - psr_vsc.DB1 = 0; - - return analogix_dp_send_psr_spd(dp, &psr_vsc); -} -EXPORT_SYMBOL_GPL(analogix_dp_disable_psr); - static bool analogix_dp_detect_sink_psr(struct analogix_dp_device *dp) { unsigned char psr_version; @@ -168,12 +118,11 @@ static void analogix_dp_enable_sink_psr(struct analogix_dp_device *dp) drm_dp_dpcd_writeb(&dp->aux, DP_PSR_EN_CFG, psr_en); /* Main-Link transmitter remains active during PSR active states */ - psr_en = DP_PSR_MAIN_LINK_ACTIVE | DP_PSR_CRC_VERIFICATION; + psr_en = DP_PSR_CRC_VERIFICATION; drm_dp_dpcd_writeb(&dp->aux, DP_PSR_EN_CFG, psr_en); /* Enable psr function */ - psr_en = DP_PSR_ENABLE | DP_PSR_MAIN_LINK_ACTIVE | - DP_PSR_CRC_VERIFICATION; + psr_en = DP_PSR_ENABLE | DP_PSR_CRC_VERIFICATION; drm_dp_dpcd_writeb(&dp->aux, DP_PSR_EN_CFG, psr_en); analogix_dp_enable_psr_crc(dp); @@ -876,6 +825,56 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) analogix_dp_enable_sink_psr(dp); } +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) + return -EINVAL; + + if (dp->dpms_mode != DRM_MODE_DPMS_ON) + return -EBUSY; + + /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */ + memset(&psr_vsc, 0, sizeof(psr_vsc)); + psr_vsc.sdp_header.HB0 = 0; + psr_vsc.sdp_header.HB1 = 0x7; + psr_vsc.sdp_header.HB2 = 0x2; + psr_vsc.sdp_header.HB3 = 0x8; + + psr_vsc.DB0 = 0; + psr_vsc.DB1 = EDP_VSC_PSR_STATE_ACTIVE | EDP_VSC_PSR_CRC_VALUES_VALID; + + return analogix_dp_send_psr_spd(dp, &psr_vsc); +} +EXPORT_SYMBOL_GPL(analogix_dp_enable_psr); + +int analogix_dp_disable_psr(struct device *dev) +{ + struct analogix_dp_device *dp = dev_get_drvdata(dev); + struct edp_vsc_psr psr_vsc; + + if (!dp->psr_support) + return -EINVAL; + + if (dp->dpms_mode != DRM_MODE_DPMS_ON) + return -EBUSY; + + /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */ + memset(&psr_vsc, 0, sizeof(psr_vsc)); + psr_vsc.sdp_header.HB0 = 0; + psr_vsc.sdp_header.HB1 = 0x7; + psr_vsc.sdp_header.HB2 = 0x2; + psr_vsc.sdp_header.HB3 = 0x8; + + psr_vsc.DB0 = 0; + psr_vsc.DB1 = 0; + + return analogix_dp_send_psr_spd(dp, &psr_vsc); +} +EXPORT_SYMBOL_GPL(analogix_dp_disable_psr); + /* * This function is a bit of a catch-all for panel preparation, hopefully * simplifying the logic of functions that need to prepare/unprepare the panel