[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1476771756-12045-1-git-send-email-wzz@rock-chips.com>
Date: Tue, 18 Oct 2016 14:22:36 +0800
From: Zain Wang <wzz@...k-chips.com>
To: Sean Paul <seanpaul@...omium.org>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Inki Dae <inki.dae@...sung.com>,
David Airlie <airlied@...ux.ie>
Cc: Tomeu Vizoso <tomeu.vizoso@...labora.com>,
Mika Kahola <mika.kahola@...el.com>,
Stéphane Marchesin <marcheu@...omium.org>,
Tomasz Figa <tfiga@...omium.org>, dianders@...omium.org,
Thierry Reding <treding@...dia.com>,
Krzysztof Kozlowski <k.kozlowski@...sung.com>,
Heiko Stuebner <heiko@...ech.de>,
Jingoo Han <jingoohan1@...il.com>,
Javier Martinez Canillas <javier@....samsung.com>,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-samsung-soc@...r.kernel.org,
linux-rockchip@...ts.infradead.org, zain wang <wzz@...k-chips.com>
Subject: [PATCH 6/6] drm: bridge/analogix: enable vop standby when entry PSR
From: zain wang <wzz@...k-chips.com>
make VOP standby when entry PSR to save some power.
Signed-off-by: zain wang <wzz@...k-chips.com>
---
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 29 ++++++++++++++++++-------
drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 1 +
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 19 ++++++++++++++++
3 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 1c2d756..e0f3ed3 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -113,6 +113,13 @@ static void analogix_dp_psr_work(struct work_struct *work)
if (!crtc)
return;
+ spin_lock_irqsave(&dp->psr_lock, flags);
+ psr_state = dp->psr_state;
+ spin_unlock_irqrestore(&dp->psr_lock, flags);
+
+ if (psr_state != EDP_VSC_PSR_STATE_ACTIVE)
+ rockchip_drm_vop_set_standby(crtc, false);
+
vact_end = crtc->mode.vtotal - crtc->mode.vsync_start + crtc->mode.vdisplay;
ret = rockchip_drm_wait_line_flag(dp->encoder.crtc, vact_end,
@@ -122,14 +129,20 @@ static void analogix_dp_psr_work(struct work_struct *work)
return;
}
- spin_lock_irqsave(&dp->psr_lock, flags);
- psr_state = dp->psr_state;
- spin_unlock_irqrestore(&dp->psr_lock, flags);
-
- if (psr_state == EDP_VSC_PSR_STATE_ACTIVE)
- analogix_dp_enable_psr(dp->dev);
- else
- analogix_dp_disable_psr(dp->dev);
+ if (psr_state == EDP_VSC_PSR_STATE_ACTIVE) {
+ ret = analogix_dp_enable_psr(dp->dev);
+ if (ret) {
+ dev_err(dp->dev, "failed to enable psr\n");
+ return;
+ }
+ rockchip_drm_vop_set_standby(crtc, true);
+ } else {
+ ret = analogix_dp_disable_psr(dp->dev);
+ if (ret) {
+ dev_err(dp->dev, "failed to disable psr\n");
+ return;
+ }
+ }
}
static int rockchip_dp_pre_init(struct rockchip_dp_device *dp)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
index fb6226c..7149c69 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
@@ -74,5 +74,6 @@ void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
struct device *dev);
int rockchip_drm_wait_line_flag(struct drm_crtc *crtc, unsigned int line_num,
unsigned int mstimeout);
+void rockchip_drm_vop_set_standby(struct drm_crtc *crtc, bool enabled);
#endif /* _ROCKCHIP_DRM_DRV_H_ */
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 1740a0b..13eabda 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1478,6 +1478,25 @@ int rockchip_drm_wait_line_flag(struct drm_crtc *crtc, unsigned int line_num,
}
EXPORT_SYMBOL(rockchip_drm_wait_line_flag);
+void rockchip_drm_vop_set_standby(struct drm_crtc *crtc, bool enabled)
+{
+ struct vop *vop = to_vop(crtc);
+
+ if (!crtc || !vop->is_enabled)
+ return;
+
+ spin_lock(&vop->reg_lock);
+
+ if (enabled)
+ VOP_CTRL_SET(vop, standby, 1);
+ else
+ VOP_CTRL_SET(vop, standby, 0);
+
+ spin_unlock(&vop->reg_lock);
+
+}
+EXPORT_SYMBOL(rockchip_drm_vop_set_standby);
+
static int vop_bind(struct device *dev, struct device *master, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
--
1.9.1
Powered by blists - more mailing lists