aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-10-31 10:42:13 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-11-18 07:32:28 -0500
commitfc1fe6e794cc85fcdb63daa9c7a977940ff49e4f (patch)
treedc061a3f7b568417296297e21f149ba1a00b8254
parent688af02d22c11a077532d6437e4afc7bdc972f82 (diff)
OMAPDSS: add dedicated fck PLL support
This patch adds support for SoCs that have a dedicated DSS PLL used for DSS function clock. If there is no dss parent clock defined, it is presumed that the functionl clock rate can be set (almost) freely. The code calculates the highest allowed fck rate, which when divided with some integer gives the required pck. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/omap2/dss/dss.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 08c58ebe219c..9a145da35ad3 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -446,12 +446,20 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min,
446 unsigned long prate; 446 unsigned long prate;
447 unsigned m; 447 unsigned m;
448 448
449 fck_hw_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
450
449 if (dss.parent_clk == NULL) { 451 if (dss.parent_clk == NULL) {
450 fck = clk_get_rate(dss.dss_clk); 452 unsigned pckd;
453
454 pckd = fck_hw_max / pck;
455
456 fck = pck * pckd;
457
458 fck = clk_round_rate(dss.dss_clk, fck);
459
451 return func(fck, data); 460 return func(fck, data);
452 } 461 }
453 462
454 fck_hw_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
455 fckd_hw_max = dss.feat->fck_div_max; 463 fckd_hw_max = dss.feat->fck_div_max;
456 464
457 m = dss.feat->dss_fck_multiplier; 465 m = dss.feat->dss_fck_multiplier;
@@ -503,16 +511,17 @@ static int dss_setup_default_clock(void)
503 unsigned fck_div; 511 unsigned fck_div;
504 int r; 512 int r;
505 513
506 if (dss.parent_clk == NULL)
507 return 0;
508
509 max_dss_fck = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK); 514 max_dss_fck = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
510 515
511 prate = clk_get_rate(dss.parent_clk); 516 if (dss.parent_clk == NULL) {
517 fck = clk_round_rate(dss.dss_clk, max_dss_fck);
518 } else {
519 prate = clk_get_rate(dss.parent_clk);
512 520
513 fck_div = DIV_ROUND_UP(prate * dss.feat->dss_fck_multiplier, 521 fck_div = DIV_ROUND_UP(prate * dss.feat->dss_fck_multiplier,
514 max_dss_fck); 522 max_dss_fck);
515 fck = prate / fck_div * dss.feat->dss_fck_multiplier; 523 fck = prate / fck_div * dss.feat->dss_fck_multiplier;
524 }
516 525
517 r = dss_set_fck_rate(fck); 526 r = dss_set_fck_rate(fck);
518 if (r) 527 if (r)