aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2014-08-07 07:29:24 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-11-12 06:40:23 -0500
commitdbb26e53e5a6eda5ee53fb36cdf3ca2517cfb135 (patch)
tree0215be4607f4d85776cc9adc469a382f74ea37bb /drivers/video
parentacf604b709e6b933638bd72d52c5b2e0ff37ff16 (diff)
OMAPDSS: DSI: features: combine dsi & dispc hsdivs
The HSDIV outputs of DSI PLL (and also other PLLs) all have the same bit width for the divider value. Simplify the code by merging HSDIV divider widths into one width. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/omap2/dss/dsi.c13
-rw-r--r--drivers/video/fbdev/omap2/dss/dss_features.c12
-rw-r--r--drivers/video/fbdev/omap2/dss/dss_features.h3
3 files changed, 11 insertions, 17 deletions
diff --git a/drivers/video/fbdev/omap2/dss/dsi.c b/drivers/video/fbdev/omap2/dss/dsi.c
index 406af309f8ff..22cc91851e94 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -374,7 +374,7 @@ struct dsi_data {
374#endif 374#endif
375 /* DSI PLL Parameter Ranges */ 375 /* DSI PLL Parameter Ranges */
376 unsigned long regm_max, regn_max; 376 unsigned long regm_max, regn_max;
377 unsigned long regm_dispc_max, regm_dsi_max; 377 unsigned long regm_hsdiv_max;
378 unsigned long fint_min, fint_max; 378 unsigned long fint_min, fint_max;
379 unsigned long lpdiv_max; 379 unsigned long lpdiv_max;
380 380
@@ -1414,7 +1414,7 @@ bool dsi_hsdiv_calc(struct platform_device *dsidev, unsigned long pll,
1414 out_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK); 1414 out_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
1415 1415
1416 regm_start = max(DIV_ROUND_UP(pll, out_max), 1ul); 1416 regm_start = max(DIV_ROUND_UP(pll, out_max), 1ul);
1417 regm_stop = min(pll / out_min, dsi->regm_dispc_max); 1417 regm_stop = min(pll / out_min, dsi->regm_hsdiv_max);
1418 1418
1419 for (regm = regm_start; regm <= regm_stop; ++regm) { 1419 for (regm = regm_start; regm <= regm_stop; ++regm) {
1420 out = pll / regm; 1420 out = pll / regm;
@@ -1477,10 +1477,10 @@ static int dsi_calc_clock_rates(struct platform_device *dsidev,
1477 if (cinfo->regm == 0 || cinfo->regm > dsi->regm_max) 1477 if (cinfo->regm == 0 || cinfo->regm > dsi->regm_max)
1478 return -EINVAL; 1478 return -EINVAL;
1479 1479
1480 if (cinfo->regm_hsdiv[HSDIV_DISPC] > dsi->regm_dispc_max) 1480 if (cinfo->regm_hsdiv[HSDIV_DISPC] > dsi->regm_hsdiv_max)
1481 return -EINVAL; 1481 return -EINVAL;
1482 1482
1483 if (cinfo->regm_hsdiv[HSDIV_DSI] > dsi->regm_dsi_max) 1483 if (cinfo->regm_hsdiv[HSDIV_DSI] > dsi->regm_hsdiv_max)
1484 return -EINVAL; 1484 return -EINVAL;
1485 1485
1486 cinfo->fint = clk_get_rate(dsi->sys_clk) / cinfo->regn; 1486 cinfo->fint = clk_get_rate(dsi->sys_clk) / cinfo->regn;
@@ -5232,9 +5232,8 @@ static void dsi_calc_clock_param_ranges(struct platform_device *dsidev)
5232 5232
5233 dsi->regn_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGN); 5233 dsi->regn_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGN);
5234 dsi->regm_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGM); 5234 dsi->regm_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGM);
5235 dsi->regm_dispc_max = 5235 dsi->regm_hsdiv_max =
5236 dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGM_DISPC); 5236 dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGM_HSDIV);
5237 dsi->regm_dsi_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGM_DSI);
5238 dsi->fint_min = dss_feat_get_param_min(FEAT_PARAM_DSIPLL_FINT); 5237 dsi->fint_min = dss_feat_get_param_min(FEAT_PARAM_DSIPLL_FINT);
5239 dsi->fint_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_FINT); 5238 dsi->fint_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_FINT);
5240 dsi->lpdiv_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_LPDIV); 5239 dsi->lpdiv_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_LPDIV);
diff --git a/drivers/video/fbdev/omap2/dss/dss_features.c b/drivers/video/fbdev/omap2/dss/dss_features.c
index 15088df7bd16..7e7fcf450342 100644
--- a/drivers/video/fbdev/omap2/dss/dss_features.c
+++ b/drivers/video/fbdev/omap2/dss/dss_features.c
@@ -439,8 +439,7 @@ static const struct dss_param_range omap2_dss_param_range[] = {
439 [FEAT_PARAM_DSS_PCD] = { 2, 255 }, 439 [FEAT_PARAM_DSS_PCD] = { 2, 255 },
440 [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 }, 440 [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
441 [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 }, 441 [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
442 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 }, 442 [FEAT_PARAM_DSIPLL_REGM_HSDIV] = { 0, 0 },
443 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 },
444 [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 }, 443 [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
445 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 }, 444 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
446 [FEAT_PARAM_DOWNSCALE] = { 1, 2 }, 445 [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
@@ -456,8 +455,7 @@ static const struct dss_param_range omap3_dss_param_range[] = {
456 [FEAT_PARAM_DSS_PCD] = { 1, 255 }, 455 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
457 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 }, 456 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
458 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 }, 457 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
459 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 }, 458 [FEAT_PARAM_DSIPLL_REGM_HSDIV] = { 0, (1 << 4) - 1 },
460 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 },
461 [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 }, 459 [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
462 [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1}, 460 [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
463 [FEAT_PARAM_DSI_FCK] = { 0, 173000000 }, 461 [FEAT_PARAM_DSI_FCK] = { 0, 173000000 },
@@ -477,8 +475,7 @@ static const struct dss_param_range omap4_dss_param_range[] = {
477 [FEAT_PARAM_DSS_PCD] = { 1, 255 }, 475 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
478 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 }, 476 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
479 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 }, 477 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
480 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 }, 478 [FEAT_PARAM_DSIPLL_REGM_HSDIV] = { 0, (1 << 5) - 1 },
481 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
482 [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 }, 479 [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
483 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 }, 480 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
484 [FEAT_PARAM_DSI_FCK] = { 0, 170000000 }, 481 [FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
@@ -491,8 +488,7 @@ static const struct dss_param_range omap5_dss_param_range[] = {
491 [FEAT_PARAM_DSS_PCD] = { 1, 255 }, 488 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
492 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 }, 489 [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
493 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 }, 490 [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
494 [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 }, 491 [FEAT_PARAM_DSIPLL_REGM_HSDIV] = { 0, (1 << 5) - 1 },
495 [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
496 [FEAT_PARAM_DSIPLL_FINT] = { 150000, 52000000 }, 492 [FEAT_PARAM_DSIPLL_FINT] = { 150000, 52000000 },
497 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 }, 493 [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
498 [FEAT_PARAM_DSI_FCK] = { 0, 209250000 }, 494 [FEAT_PARAM_DSI_FCK] = { 0, 209250000 },
diff --git a/drivers/video/fbdev/omap2/dss/dss_features.h b/drivers/video/fbdev/omap2/dss/dss_features.h
index e3ef3b714896..05e8127d36b0 100644
--- a/drivers/video/fbdev/omap2/dss/dss_features.h
+++ b/drivers/video/fbdev/omap2/dss/dss_features.h
@@ -88,8 +88,7 @@ enum dss_range_param {
88 FEAT_PARAM_DSS_PCD, 88 FEAT_PARAM_DSS_PCD,
89 FEAT_PARAM_DSIPLL_REGN, 89 FEAT_PARAM_DSIPLL_REGN,
90 FEAT_PARAM_DSIPLL_REGM, 90 FEAT_PARAM_DSIPLL_REGM,
91 FEAT_PARAM_DSIPLL_REGM_DISPC, 91 FEAT_PARAM_DSIPLL_REGM_HSDIV,
92 FEAT_PARAM_DSIPLL_REGM_DSI,
93 FEAT_PARAM_DSIPLL_FINT, 92 FEAT_PARAM_DSIPLL_FINT,
94 FEAT_PARAM_DSIPLL_LPDIV, 93 FEAT_PARAM_DSIPLL_LPDIV,
95 FEAT_PARAM_DSI_FCK, 94 FEAT_PARAM_DSI_FCK,