Linux-Renesas-SoC Archive on lore.kernel.org
 help / color / Atom feed
From: Nguyen An Hoan <na-hoan@jinso.co.jp>
To: linux-renesas-soc@vger.kernel.org, geert+renesas@glider.be,
	laurent.pinchart@ideasonboard.com,
	kieran.bingham+renesas@ideasonboard.com
Cc: kuninori.morimoto.gx@renesas.com,
	yoshihiro.shimoda.uh@renesas.com, h-inayoshi@jinso.co.jp,
	nv-dung@jinso.co.jp, na-hoan@jinso.co.jp, cv-dong@jinso.co.jp
Subject: [PATCH 1/2] drm: rcar-du: Add Standby Mode support
Date: Fri, 14 Dec 2018 16:25:17 +0900
Message-ID: <1544772318-17408-1-git-send-email-na-hoan@jinso.co.jp> (raw)

From: Hoan Nguyen An <na-hoan@jinso.co.jp>

Add function support for Module Standby Mode

Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 26 ++++++++++++++++++++++++++
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  1 +
 2 files changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 90dacab..935cdd1 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -651,6 +651,32 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
 	rcar_du_group_start_stop(rcrtc->group, false);
 }
 
+int rcar_du_crtc_standby(struct rcar_du_crtc *rcrtc)
+{
+	u32 val_reg;
+	unsigned int i = 0;
+
+	/* Enter Standby mode */
+	rcar_du_crtc_dsysr_clr_set(rcrtc, DSYSR_DRES | DSYSR_DEN, 0);
+
+	for(i = 100; i > 0; i--)
+	{
+		val_reg = rcar_du_crtc_read(rcrtc, DSSR);
+		if(!(val_reg & DSSR_VBK))
+			break;
+		udelay(10);
+	}
+
+	if(!(i > 0))
+		return -ETIMEDOUT;
+
+	/* Stop clock */
+	clk_set_rate(rcrtc->extclock, 0);
+	clk_set_rate(rcrtc->clock, 0);
+
+	return 0;
+}
+
 /* -----------------------------------------------------------------------------
  * CRTC Functions
  */
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
index 59ac6e7..6e0de42 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
@@ -99,6 +99,7 @@ enum rcar_du_output {
 
 int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex,
 			unsigned int hwindex);
+int rcar_du_crtc_standby(struct rcar_du_crtc *rcrtc);
 void rcar_du_crtc_suspend(struct rcar_du_crtc *rcrtc);
 void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc);
 
-- 
2.7.4


             reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14  7:25 Nguyen An Hoan [this message]
2018-12-14  7:25 ` [PATCH 2/2] drm: rcar-du: Add Standby Mode to suspend() Nguyen An Hoan
2018-12-14  8:15   ` Laurent Pinchart
2018-12-14  8:47 ` [PATCH 1/2] drm: rcar-du: Add Standby Mode support Sergei Shtylyov
2018-12-14 19:06 ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1544772318-17408-1-git-send-email-na-hoan@jinso.co.jp \
    --to=na-hoan@jinso.co.jp \
    --cc=cv-dong@jinso.co.jp \
    --cc=geert+renesas@glider.be \
    --cc=h-inayoshi@jinso.co.jp \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=nv-dung@jinso.co.jp \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Renesas-SoC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-renesas-soc/0 linux-renesas-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-renesas-soc linux-renesas-soc/ https://lore.kernel.org/linux-renesas-soc \
		linux-renesas-soc@vger.kernel.org
	public-inbox-index linux-renesas-soc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-renesas-soc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git