linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Archit Taneja <archit@ti.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>,
	linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org
Cc: Nishanth Menon <nm@ti.com>
Subject: Re: [PATCH 1/2] OMAPDSS: use DISPC register to detect context loss
Date: Tue, 18 Feb 2014 17:09:19 +0530	[thread overview]
Message-ID: <53034667.80603@ti.com> (raw)
In-Reply-To: <1392366572-31729-1-git-send-email-tomi.valkeinen@ti.com>

On Friday 14 February 2014 01:59 PM, Tomi Valkeinen wrote:
> Instead of relying on the OMAP specific
> omap_pm_get_dev_context_loss_count() to detect register context loss, we
> can achieve the same in a much simpler way by just observing the DISPC
> registers.
>
> We always set DISPC's load mode to LOAD_FRAME_ONLY, which is not the
> reset value. Thus we can just observe the load mode to see if we have
> lost register context.

Nice trick :p

Reviewed-by: Archit Taneja <archit@ti.com>

Archit

>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>   drivers/video/omap2/dss/dispc.c | 24 +++++++++++-------------
>   1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
> index bbeb8dd7f108..1659aa912d2b 100644
> --- a/drivers/video/omap2/dss/dispc.c
> +++ b/drivers/video/omap2/dss/dispc.c
> @@ -100,8 +100,6 @@ static struct {
>   	struct platform_device *pdev;
>   	void __iomem    *base;
>
> -	int		ctx_loss_cnt;
> -
>   	int irq;
>
>   	unsigned long core_clk_rate;
> @@ -357,29 +355,20 @@ static void dispc_save_context(void)
>   	if (dss_has_feature(FEAT_CORE_CLK_DIV))
>   		SR(DIVISOR);
>
> -	dispc.ctx_loss_cnt = dss_get_ctx_loss_count();
>   	dispc.ctx_valid = true;
>
> -	DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt);
> +	DSSDBG("context saved\n");
>   }
>
>   static void dispc_restore_context(void)
>   {
> -	int i, j, ctx;
> +	int i, j;
>
>   	DSSDBG("dispc_restore_context\n");
>
>   	if (!dispc.ctx_valid)
>   		return;
>
> -	ctx = dss_get_ctx_loss_count();
> -
> -	if (ctx >= 0 && ctx == dispc.ctx_loss_cnt)
> -		return;
> -
> -	DSSDBG("ctx_loss_count: saved %d, current %d\n",
> -			dispc.ctx_loss_cnt, ctx);
> -
>   	/*RR(IRQENABLE);*/
>   	/*RR(CONTROL);*/
>   	RR(CONFIG);
> @@ -3768,6 +3757,15 @@ static int dispc_runtime_suspend(struct device *dev)
>
>   static int dispc_runtime_resume(struct device *dev)
>   {
> +	/*
> +	 * The reset value for load mode is 0 (OMAP_DSS_LOAD_CLUT_AND_FRAME)
> +	 * but we always initialize it to 2 (OMAP_DSS_LOAD_FRAME_ONLY) in
> +	 * _omap_dispc_initial_config(). We can thus use it to detect if
> +	 * we have lost register context.
> +	 */
> +	if (REG_GET(DISPC_CONFIG, 2, 1) == OMAP_DSS_LOAD_FRAME_ONLY)
> +		return 0;
> +
>   	_omap_dispc_initial_config();
>
>   	dispc_restore_context();
>


      parent reply	other threads:[~2014-02-18 11:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14  8:29 [PATCH 1/2] OMAPDSS: use DISPC register to detect context loss Tomi Valkeinen
2014-02-14  8:29 ` [PATCH 2/2] OMAPDSS: Remove unused get_context_loss_count support Tomi Valkeinen
2014-02-18 11:39 ` Archit Taneja [this message]

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=53034667.80603@ti.com \
    --to=archit@ti.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=tomi.valkeinen@ti.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).