<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 20 Dec 2019 at 10:31, Zhihui Chen <<a href="mailto:chenzhihui4@huawei.com">chenzhihui4@huawei.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">add DPMS function to turn on/off signal of monitor<br>
<br>
Signed-off-by: Zhihui Chen <<a href="mailto:chenzhihui4@huawei.com" target="_blank">chenzhihui4@huawei.com</a>><br></blockquote><div> </div><div>Thanks for the patch.<br>Acked-by: Xinliang Liu <<a href="mailto:xinliang.liu@linaro.org">xinliang.liu@linaro.org</a>><br>Applied to drm-misc-next.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 16 ++++++++++++++++<br>
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h | 6 ++++++<br>
2 files changed, 22 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c<br>
index 722e369f30d4..24de937c1cb1 100644<br>
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c<br>
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c<br>
@@ -189,6 +189,20 @@ static struct drm_plane *hibmc_plane_init(struct hibmc_drm_private *priv)<br>
return plane;<br>
}<br>
<br>
+static void hibmc_crtc_dpms(struct drm_crtc *crtc, int dpms)<br>
+{<br>
+ struct hibmc_drm_private *priv = crtc->dev->dev_private;<br>
+ unsigned int reg;<br>
+<br>
+ reg = readl(priv->mmio + HIBMC_CRT_DISP_CTL);<br>
+ reg &= ~HIBMC_CRT_DISP_CTL_DPMS_MASK;<br>
+ reg |= HIBMC_FIELD(HIBMC_CRT_DISP_CTL_DPMS, dpms);<br>
+ reg &= ~HIBMC_CRT_DISP_CTL_TIMING_MASK;<br>
+ if (dpms == HIBMC_CRT_DPMS_ON)<br>
+ reg |= HIBMC_CRT_DISP_CTL_TIMING(1);<br>
+ writel(reg, priv->mmio + HIBMC_CRT_DISP_CTL);<br>
+}<br>
+<br>
static void hibmc_crtc_atomic_enable(struct drm_crtc *crtc,<br>
struct drm_crtc_state *old_state)<br>
{<br>
@@ -205,6 +219,7 @@ static void hibmc_crtc_atomic_enable(struct drm_crtc *crtc,<br>
reg |= HIBMC_CURR_GATE_DISPLAY(1);<br>
hibmc_set_current_gate(priv, reg);<br>
drm_crtc_vblank_on(crtc);<br>
+ hibmc_crtc_dpms(crtc, HIBMC_CRT_DPMS_ON);<br>
}<br>
<br>
static void hibmc_crtc_atomic_disable(struct drm_crtc *crtc,<br>
@@ -213,6 +228,7 @@ static void hibmc_crtc_atomic_disable(struct drm_crtc *crtc,<br>
unsigned int reg;<br>
struct hibmc_drm_private *priv = crtc->dev->dev_private;<br>
<br>
+ hibmc_crtc_dpms(crtc, HIBMC_CRT_DPMS_OFF);<br>
drm_crtc_vblank_off(crtc);<br>
<br>
hibmc_set_power_mode(priv, HIBMC_PW_MODE_CTL_MODE_SLEEP);<br>
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h<br>
index b63a1ee15ceb..b9e20cfcfb5a 100644<br>
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h<br>
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h<br>
@@ -68,6 +68,12 @@<br>
<br>
#define HIBMC_CRT_DISP_CTL 0x80200<br>
<br>
+#define HIBMC_CRT_DISP_CTL_DPMS(x) ((x) << 30)<br>
+#define HIBMC_CRT_DISP_CTL_DPMS_MASK 0xc0000000<br>
+<br>
+#define HIBMC_CRT_DPMS_ON 0<br>
+#define HIBMC_CRT_DPMS_OFF 3<br>
+<br>
#define HIBMC_CRT_DISP_CTL_CRTSELECT(x) ((x) << 25)<br>
#define HIBMC_CRT_DISP_CTL_CRTSELECT_MASK 0x2000000<br>
<br>
-- <br>
2.20.1<br>
<br>
<br>
</blockquote></div></div>