dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Keerthy <j-keerthy@ti.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/omap: fix crash if there's no video PLL
Date: Thu, 05 Apr 2018 11:05:42 +0300	[thread overview]
Message-ID: <1753911.LsArlMeJuA@avalon> (raw)
In-Reply-To: <20180405065537.29818-1-tomi.valkeinen@ti.com>

Hi Tomi,

On Thursday, 5 April 2018 09:55:37 EEST Tomi Valkeinen wrote:
> Commit 8a7eda7686675b73d74c22c0d5b83059f9d783f6 ("drm: omapdrm: dispc:
> Pass DISPC pointer to remaining dispc API functions") made dpi.c use
> ctx->pll even when there's no PLL, causing a crash at modeset on AM4
> EVM, and presumably all OMAP2/3 boards.
> 
> Fix this by having struct dpi_data pointer in the ctx instead, giving
> access to dispc without going through the pll.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Reported-by: Keerthy <j-keerthy@ti.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Oops, sorry about this :-/

You should add a

Fixes: 8a7eda768667 ("drm: omapdrm: dispc: Pass DISPC pointer to remaining 
dispc API functions")

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/omapdrm/dss/dpi.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c
> b/drivers/gpu/drm/omapdrm/dss/dpi.c index fb1c27f69e3a..3d662e6805eb 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dpi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
> @@ -142,7 +142,7 @@ static enum dss_clk_source dpi_get_clk_src(struct
> dpi_data *dpi) }
> 
>  struct dpi_clk_calc_ctx {
> -	struct dss_pll *pll;
> +	struct dpi_data *dpi;
>  	unsigned int clkout_idx;
> 
>  	/* inputs */
> @@ -191,7 +191,7 @@ static bool dpi_calc_hsdiv_cb(int m_dispc, unsigned long
> dispc, ctx->pll_cinfo.mX[ctx->clkout_idx] = m_dispc;
>  	ctx->pll_cinfo.clkout[ctx->clkout_idx] = dispc;
> 
> -	return dispc_div_calc(ctx->pll->dss->dispc, dispc,
> +	return dispc_div_calc(ctx->dpi->dss->dispc, dispc,
>  			      ctx->pck_min, ctx->pck_max,
>  			      dpi_calc_dispc_cb, ctx);
>  }
> @@ -208,8 +208,8 @@ static bool dpi_calc_pll_cb(int n, int m, unsigned long
> fint, ctx->pll_cinfo.fint = fint;
>  	ctx->pll_cinfo.clkdco = clkdco;
> 
> -	return dss_pll_hsdiv_calc_a(ctx->pll, clkdco,
> -		ctx->pck_min, dss_get_max_fck_rate(ctx->pll->dss),
> +	return dss_pll_hsdiv_calc_a(ctx->dpi->pll, clkdco,
> +		ctx->pck_min, dss_get_max_fck_rate(ctx->dpi->dss),
>  		dpi_calc_hsdiv_cb, ctx);
>  }
> 
> @@ -219,7 +219,7 @@ static bool dpi_calc_dss_cb(unsigned long fck, void
> *data)
> 
>  	ctx->fck = fck;
> 
> -	return dispc_div_calc(ctx->pll->dss->dispc, fck,
> +	return dispc_div_calc(ctx->dpi->dss->dispc, fck,
>  			      ctx->pck_min, ctx->pck_max,
>  			      dpi_calc_dispc_cb, ctx);
>  }
> @@ -230,7 +230,7 @@ static bool dpi_pll_clk_calc(struct dpi_data *dpi,
> unsigned long pck, unsigned long clkin;
> 
>  	memset(ctx, 0, sizeof(*ctx));
> -	ctx->pll = dpi->pll;
> +	ctx->dpi = dpi;
>  	ctx->clkout_idx = dss_pll_get_clkout_idx_for_src(dpi->clk_src);
> 
>  	clkin = clk_get_rate(dpi->pll->clkin);
> @@ -244,7 +244,7 @@ static bool dpi_pll_clk_calc(struct dpi_data *dpi,
> unsigned long pck, pll_min = 0;
>  		pll_max = 0;
> 
> -		return dss_pll_calc_a(ctx->pll, clkin,
> +		return dss_pll_calc_a(ctx->dpi->pll, clkin,
>  				pll_min, pll_max,
>  				dpi_calc_pll_cb, ctx);
>  	} else { /* DSS_PLL_TYPE_B */
> @@ -275,6 +275,7 @@ static bool dpi_dss_clk_calc(struct dpi_data *dpi,
> unsigned long pck, bool ok;
> 
>  		memset(ctx, 0, sizeof(*ctx));
> +		ctx->dpi = dpi;
>  		if (pck > 1000 * i * i * i)
>  			ctx->pck_min = max(pck - 1000 * i * i * i, 0lu);
>  		else

-- 
Regards,

Laurent Pinchart



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2018-04-05  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05  6:55 [PATCH] drm/omap: fix crash if there's no video PLL Tomi Valkeinen
2018-04-05  7:35 ` Keerthy
2018-04-05  8:05 ` Laurent Pinchart [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=1753911.LsArlMeJuA@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=j-keerthy@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