aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-05-18 05:06:49 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-05-19 13:19:09 -0400
commit683cd8669797000ca5b3730b8773013e13eb89e0 (patch)
tree6c4daa2196d9485dd7d84d1a3937aeedf2dfcc94
parentf44b717c3d6908ac6590a1193a07c920d05e5a1d (diff)
drm/omap: support type B PLL for DPI
Type A and B PLLs require a bit different calculations for the clock rates. DPI driver supports only type A PLLs. This patch adds support for the type B PLL. Type B PLLs are simpler than type A, as type B can produce a good clock for almost any rate. Thus we can just ask it to produce the pixel clock and use one as LCK and PCK dividers. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dpi.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 7d70bfcf89c9..050ec4cd4d59 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -217,22 +217,35 @@ static bool dpi_dsi_clk_calc(struct dpi_data *dpi, unsigned long pck,
217 struct dpi_clk_calc_ctx *ctx) 217 struct dpi_clk_calc_ctx *ctx)
218{ 218{
219 unsigned long clkin; 219 unsigned long clkin;
220 unsigned long pll_min, pll_max;
221 220
222 memset(ctx, 0, sizeof(*ctx)); 221 memset(ctx, 0, sizeof(*ctx));
223 ctx->pll = dpi->pll; 222 ctx->pll = dpi->pll;
224 ctx->clkout_idx = dss_pll_get_clkout_idx_for_src(dpi->clk_src); 223 ctx->clkout_idx = dss_pll_get_clkout_idx_for_src(dpi->clk_src);
225 ctx->pck_min = pck - 1000;
226 ctx->pck_max = pck + 1000;
227 224
228 pll_min = 0; 225 clkin = clk_get_rate(dpi->pll->clkin);
229 pll_max = 0;
230 226
231 clkin = clk_get_rate(ctx->pll->clkin); 227 if (dpi->pll->hw->type == DSS_PLL_TYPE_A) {
228 unsigned long pll_min, pll_max;
232 229
233 return dss_pll_calc_a(ctx->pll, clkin, 230 ctx->pck_min = pck - 1000;
234 pll_min, pll_max, 231 ctx->pck_max = pck + 1000;
235 dpi_calc_pll_cb, ctx); 232
233 pll_min = 0;
234 pll_max = 0;
235
236 return dss_pll_calc_a(ctx->pll, clkin,
237 pll_min, pll_max,
238 dpi_calc_pll_cb, ctx);
239 } else { /* DSS_PLL_TYPE_B */
240 dss_pll_calc_b(dpi->pll, clkin, pck, &ctx->dsi_cinfo);
241
242 ctx->dispc_cinfo.lck_div = 1;
243 ctx->dispc_cinfo.pck_div = 1;
244 ctx->dispc_cinfo.lck = ctx->dsi_cinfo.clkout[0];
245 ctx->dispc_cinfo.pck = ctx->dispc_cinfo.lck;
246
247 return true;
248 }
236} 249}
237 250
238static bool dpi_dss_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx) 251static bool dpi_dss_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx)