diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2018-04-05 02:55:37 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2018-04-05 05:47:35 -0400 |
commit | 41613a1a7df27a0aa34bf77d51278bbe8e108a8f (patch) | |
tree | 532472a1a7af03c588dcfe38e7ba15b0955a227f | |
parent | 8cd1b5bd70cccda6854088825e725a513ec919c6 (diff) |
drm/omap: fix crash if there's no video PLL
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.
Fixes: 8a7eda768667 ("drm: omapdrm: dispc: Pass DISPC pointer to remaining dispc API functions")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reported-by: Keerthy <j-keerthy@ti.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180405065537.29818-1-tomi.valkeinen@ti.com
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/dpi.c | 15 |
1 files 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) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | struct dpi_clk_calc_ctx { | 144 | struct dpi_clk_calc_ctx { |
145 | struct dss_pll *pll; | 145 | struct dpi_data *dpi; |
146 | unsigned int clkout_idx; | 146 | unsigned int clkout_idx; |
147 | 147 | ||
148 | /* inputs */ | 148 | /* inputs */ |
@@ -191,7 +191,7 @@ static bool dpi_calc_hsdiv_cb(int m_dispc, unsigned long dispc, | |||
191 | ctx->pll_cinfo.mX[ctx->clkout_idx] = m_dispc; | 191 | ctx->pll_cinfo.mX[ctx->clkout_idx] = m_dispc; |
192 | ctx->pll_cinfo.clkout[ctx->clkout_idx] = dispc; | 192 | ctx->pll_cinfo.clkout[ctx->clkout_idx] = dispc; |
193 | 193 | ||
194 | return dispc_div_calc(ctx->pll->dss->dispc, dispc, | 194 | return dispc_div_calc(ctx->dpi->dss->dispc, dispc, |
195 | ctx->pck_min, ctx->pck_max, | 195 | ctx->pck_min, ctx->pck_max, |
196 | dpi_calc_dispc_cb, ctx); | 196 | dpi_calc_dispc_cb, ctx); |
197 | } | 197 | } |
@@ -208,8 +208,8 @@ static bool dpi_calc_pll_cb(int n, int m, unsigned long fint, | |||
208 | ctx->pll_cinfo.fint = fint; | 208 | ctx->pll_cinfo.fint = fint; |
209 | ctx->pll_cinfo.clkdco = clkdco; | 209 | ctx->pll_cinfo.clkdco = clkdco; |
210 | 210 | ||
211 | return dss_pll_hsdiv_calc_a(ctx->pll, clkdco, | 211 | return dss_pll_hsdiv_calc_a(ctx->dpi->pll, clkdco, |
212 | ctx->pck_min, dss_get_max_fck_rate(ctx->pll->dss), | 212 | ctx->pck_min, dss_get_max_fck_rate(ctx->dpi->dss), |
213 | dpi_calc_hsdiv_cb, ctx); | 213 | dpi_calc_hsdiv_cb, ctx); |
214 | } | 214 | } |
215 | 215 | ||
@@ -219,7 +219,7 @@ static bool dpi_calc_dss_cb(unsigned long fck, void *data) | |||
219 | 219 | ||
220 | ctx->fck = fck; | 220 | ctx->fck = fck; |
221 | 221 | ||
222 | return dispc_div_calc(ctx->pll->dss->dispc, fck, | 222 | return dispc_div_calc(ctx->dpi->dss->dispc, fck, |
223 | ctx->pck_min, ctx->pck_max, | 223 | ctx->pck_min, ctx->pck_max, |
224 | dpi_calc_dispc_cb, ctx); | 224 | dpi_calc_dispc_cb, ctx); |
225 | } | 225 | } |
@@ -230,7 +230,7 @@ static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck, | |||
230 | unsigned long clkin; | 230 | unsigned long clkin; |
231 | 231 | ||
232 | memset(ctx, 0, sizeof(*ctx)); | 232 | memset(ctx, 0, sizeof(*ctx)); |
233 | ctx->pll = dpi->pll; | 233 | ctx->dpi = dpi; |
234 | ctx->clkout_idx = dss_pll_get_clkout_idx_for_src(dpi->clk_src); | 234 | ctx->clkout_idx = dss_pll_get_clkout_idx_for_src(dpi->clk_src); |
235 | 235 | ||
236 | clkin = clk_get_rate(dpi->pll->clkin); | 236 | clkin = clk_get_rate(dpi->pll->clkin); |
@@ -244,7 +244,7 @@ static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck, | |||
244 | pll_min = 0; | 244 | pll_min = 0; |
245 | pll_max = 0; | 245 | pll_max = 0; |
246 | 246 | ||
247 | return dss_pll_calc_a(ctx->pll, clkin, | 247 | return dss_pll_calc_a(ctx->dpi->pll, clkin, |
248 | pll_min, pll_max, | 248 | pll_min, pll_max, |
249 | dpi_calc_pll_cb, ctx); | 249 | dpi_calc_pll_cb, ctx); |
250 | } else { /* DSS_PLL_TYPE_B */ | 250 | } else { /* DSS_PLL_TYPE_B */ |
@@ -275,6 +275,7 @@ static bool dpi_dss_clk_calc(struct dpi_data *dpi, unsigned long pck, | |||
275 | bool ok; | 275 | bool ok; |
276 | 276 | ||
277 | memset(ctx, 0, sizeof(*ctx)); | 277 | memset(ctx, 0, sizeof(*ctx)); |
278 | ctx->dpi = dpi; | ||
278 | if (pck > 1000 * i * i * i) | 279 | if (pck > 1000 * i * i * i) |
279 | ctx->pck_min = max(pck - 1000 * i * i * i, 0lu); | 280 | ctx->pck_min = max(pck - 1000 * i * i * i, 0lu); |
280 | else | 281 | else |