aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/omap2/dss/dispc.c5
-rw-r--r--drivers/video/omap2/dss/dpi.c28
-rw-r--r--drivers/video/omap2/dss/dsi.c8
-rw-r--r--drivers/video/omap2/dss/dss.c7
-rw-r--r--drivers/video/omap2/dss/dss.h9
-rw-r--r--drivers/video/omap2/dss/sdi.c3
6 files changed, 24 insertions, 36 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index e48d1c10a3c..6e25624b3fa 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3167,7 +3167,7 @@ void dispc_mgr_set_pol_freq(enum omap_channel channel,
3167} 3167}
3168 3168
3169/* with fck as input clock rate, find dispc dividers that produce req_pck */ 3169/* with fck as input clock rate, find dispc dividers that produce req_pck */
3170void dispc_find_clk_divs(bool is_tft, unsigned long req_pck, unsigned long fck, 3170void dispc_find_clk_divs(unsigned long req_pck, unsigned long fck,
3171 struct dispc_clock_info *cinfo) 3171 struct dispc_clock_info *cinfo)
3172{ 3172{
3173 u16 pcd_min, pcd_max; 3173 u16 pcd_min, pcd_max;
@@ -3178,9 +3178,6 @@ void dispc_find_clk_divs(bool is_tft, unsigned long req_pck, unsigned long fck,
3178 pcd_min = dss_feat_get_param_min(FEAT_PARAM_DSS_PCD); 3178 pcd_min = dss_feat_get_param_min(FEAT_PARAM_DSS_PCD);
3179 pcd_max = dss_feat_get_param_max(FEAT_PARAM_DSS_PCD); 3179 pcd_max = dss_feat_get_param_max(FEAT_PARAM_DSS_PCD);
3180 3180
3181 if (!is_tft)
3182 pcd_min = 3;
3183
3184 best_pck = 0; 3181 best_pck = 0;
3185 best_ld = 0; 3182 best_ld = 0;
3186 best_pd = 0; 3183 best_pd = 0;
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 8c2056c9537..09dd2435df1 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -64,7 +64,7 @@ static bool dpi_use_dsi_pll(struct omap_dss_device *dssdev)
64 return false; 64 return false;
65} 65}
66 66
67static int dpi_set_dsi_clk(struct omap_dss_device *dssdev, bool is_tft, 67static int dpi_set_dsi_clk(struct omap_dss_device *dssdev,
68 unsigned long pck_req, unsigned long *fck, int *lck_div, 68 unsigned long pck_req, unsigned long *fck, int *lck_div,
69 int *pck_div) 69 int *pck_div)
70{ 70{
@@ -72,8 +72,8 @@ static int dpi_set_dsi_clk(struct omap_dss_device *dssdev, bool is_tft,
72 struct dispc_clock_info dispc_cinfo; 72 struct dispc_clock_info dispc_cinfo;
73 int r; 73 int r;
74 74
75 r = dsi_pll_calc_clock_div_pck(dpi.dsidev, is_tft, pck_req, 75 r = dsi_pll_calc_clock_div_pck(dpi.dsidev, pck_req, &dsi_cinfo,
76 &dsi_cinfo, &dispc_cinfo); 76 &dispc_cinfo);
77 if (r) 77 if (r)
78 return r; 78 return r;
79 79
@@ -96,7 +96,7 @@ static int dpi_set_dsi_clk(struct omap_dss_device *dssdev, bool is_tft,
96 return 0; 96 return 0;
97} 97}
98 98
99static int dpi_set_dispc_clk(struct omap_dss_device *dssdev, bool is_tft, 99static int dpi_set_dispc_clk(struct omap_dss_device *dssdev,
100 unsigned long pck_req, unsigned long *fck, int *lck_div, 100 unsigned long pck_req, unsigned long *fck, int *lck_div,
101 int *pck_div) 101 int *pck_div)
102{ 102{
@@ -104,7 +104,7 @@ static int dpi_set_dispc_clk(struct omap_dss_device *dssdev, bool is_tft,
104 struct dispc_clock_info dispc_cinfo; 104 struct dispc_clock_info dispc_cinfo;
105 int r; 105 int r;
106 106
107 r = dss_calc_clock_div(is_tft, pck_req, &dss_cinfo, &dispc_cinfo); 107 r = dss_calc_clock_div(pck_req, &dss_cinfo, &dispc_cinfo);
108 if (r) 108 if (r)
109 return r; 109 return r;
110 110
@@ -129,20 +129,17 @@ static int dpi_set_mode(struct omap_dss_device *dssdev)
129 int lck_div = 0, pck_div = 0; 129 int lck_div = 0, pck_div = 0;
130 unsigned long fck = 0; 130 unsigned long fck = 0;
131 unsigned long pck; 131 unsigned long pck;
132 bool is_tft;
133 int r = 0; 132 int r = 0;
134 133
135 dispc_mgr_set_pol_freq(dssdev->manager->id, dssdev->panel.config, 134 dispc_mgr_set_pol_freq(dssdev->manager->id, dssdev->panel.config,
136 dssdev->panel.acbi, dssdev->panel.acb); 135 dssdev->panel.acbi, dssdev->panel.acb);
137 136
138 is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0;
139
140 if (dpi_use_dsi_pll(dssdev)) 137 if (dpi_use_dsi_pll(dssdev))
141 r = dpi_set_dsi_clk(dssdev, is_tft, t->pixel_clock * 1000, 138 r = dpi_set_dsi_clk(dssdev, t->pixel_clock * 1000, &fck,
142 &fck, &lck_div, &pck_div); 139 &lck_div, &pck_div);
143 else 140 else
144 r = dpi_set_dispc_clk(dssdev, is_tft, t->pixel_clock * 1000, 141 r = dpi_set_dispc_clk(dssdev, t->pixel_clock * 1000, &fck,
145 &fck, &lck_div, &pck_div); 142 &lck_div, &pck_div);
146 if (r) 143 if (r)
147 return r; 144 return r;
148 145
@@ -292,7 +289,6 @@ EXPORT_SYMBOL(dpi_set_timings);
292int dpi_check_timings(struct omap_dss_device *dssdev, 289int dpi_check_timings(struct omap_dss_device *dssdev,
293 struct omap_video_timings *timings) 290 struct omap_video_timings *timings)
294{ 291{
295 bool is_tft;
296 int r; 292 int r;
297 int lck_div, pck_div; 293 int lck_div, pck_div;
298 unsigned long fck; 294 unsigned long fck;
@@ -305,11 +301,9 @@ int dpi_check_timings(struct omap_dss_device *dssdev,
305 if (timings->pixel_clock == 0) 301 if (timings->pixel_clock == 0)
306 return -EINVAL; 302 return -EINVAL;
307 303
308 is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0;
309
310 if (dpi_use_dsi_pll(dssdev)) { 304 if (dpi_use_dsi_pll(dssdev)) {
311 struct dsi_clock_info dsi_cinfo; 305 struct dsi_clock_info dsi_cinfo;
312 r = dsi_pll_calc_clock_div_pck(dpi.dsidev, is_tft, 306 r = dsi_pll_calc_clock_div_pck(dpi.dsidev,
313 timings->pixel_clock * 1000, 307 timings->pixel_clock * 1000,
314 &dsi_cinfo, &dispc_cinfo); 308 &dsi_cinfo, &dispc_cinfo);
315 309
@@ -319,7 +313,7 @@ int dpi_check_timings(struct omap_dss_device *dssdev,
319 fck = dsi_cinfo.dsi_pll_hsdiv_dispc_clk; 313 fck = dsi_cinfo.dsi_pll_hsdiv_dispc_clk;
320 } else { 314 } else {
321 struct dss_clock_info dss_cinfo; 315 struct dss_clock_info dss_cinfo;
322 r = dss_calc_clock_div(is_tft, timings->pixel_clock * 1000, 316 r = dss_calc_clock_div(timings->pixel_clock * 1000,
323 &dss_cinfo, &dispc_cinfo); 317 &dss_cinfo, &dispc_cinfo);
324 318
325 if (r) 319 if (r)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index df65b93c065..aa3b81088a2 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -1316,7 +1316,7 @@ static int dsi_calc_clock_rates(struct platform_device *dsidev,
1316 return 0; 1316 return 0;
1317} 1317}
1318 1318
1319int dsi_pll_calc_clock_div_pck(struct platform_device *dsidev, bool is_tft, 1319int dsi_pll_calc_clock_div_pck(struct platform_device *dsidev,
1320 unsigned long req_pck, struct dsi_clock_info *dsi_cinfo, 1320 unsigned long req_pck, struct dsi_clock_info *dsi_cinfo,
1321 struct dispc_clock_info *dispc_cinfo) 1321 struct dispc_clock_info *dispc_cinfo)
1322{ 1322{
@@ -1335,8 +1335,8 @@ int dsi_pll_calc_clock_div_pck(struct platform_device *dsidev, bool is_tft,
1335 dsi->cache_cinfo.clkin == dss_sys_clk) { 1335 dsi->cache_cinfo.clkin == dss_sys_clk) {
1336 DSSDBG("DSI clock info found from cache\n"); 1336 DSSDBG("DSI clock info found from cache\n");
1337 *dsi_cinfo = dsi->cache_cinfo; 1337 *dsi_cinfo = dsi->cache_cinfo;
1338 dispc_find_clk_divs(is_tft, req_pck, 1338 dispc_find_clk_divs(req_pck, dsi_cinfo->dsi_pll_hsdiv_dispc_clk,
1339 dsi_cinfo->dsi_pll_hsdiv_dispc_clk, dispc_cinfo); 1339 dispc_cinfo);
1340 return 0; 1340 return 0;
1341 } 1341 }
1342 1342
@@ -1402,7 +1402,7 @@ retry:
1402 1402
1403 match = 1; 1403 match = 1;
1404 1404
1405 dispc_find_clk_divs(is_tft, req_pck, 1405 dispc_find_clk_divs(req_pck,
1406 cur.dsi_pll_hsdiv_dispc_clk, 1406 cur.dsi_pll_hsdiv_dispc_clk,
1407 &cur_dispc); 1407 &cur_dispc);
1408 1408
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index fc0c3ce802e..04b4586113e 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -506,8 +506,7 @@ unsigned long dss_get_dpll4_rate(void)
506 return 0; 506 return 0;
507} 507}
508 508
509int dss_calc_clock_div(bool is_tft, unsigned long req_pck, 509int dss_calc_clock_div(unsigned long req_pck, struct dss_clock_info *dss_cinfo,
510 struct dss_clock_info *dss_cinfo,
511 struct dispc_clock_info *dispc_cinfo) 510 struct dispc_clock_info *dispc_cinfo)
512{ 511{
513 unsigned long prate; 512 unsigned long prate;
@@ -555,7 +554,7 @@ retry:
555 fck = clk_get_rate(dss.dss_clk); 554 fck = clk_get_rate(dss.dss_clk);
556 fck_div = 1; 555 fck_div = 1;
557 556
558 dispc_find_clk_divs(is_tft, req_pck, fck, &cur_dispc); 557 dispc_find_clk_divs(req_pck, fck, &cur_dispc);
559 match = 1; 558 match = 1;
560 559
561 best_dss.fck = fck; 560 best_dss.fck = fck;
@@ -585,7 +584,7 @@ retry:
585 584
586 match = 1; 585 match = 1;
587 586
588 dispc_find_clk_divs(is_tft, req_pck, fck, &cur_dispc); 587 dispc_find_clk_divs(req_pck, fck, &cur_dispc);
589 588
590 if (abs(cur_dispc.pck - req_pck) < 589 if (abs(cur_dispc.pck - req_pck) <
591 abs(best_dispc.pck - req_pck)) { 590 abs(best_dispc.pck - req_pck)) {
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index df131fc6895..88e1c12195e 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -274,8 +274,7 @@ unsigned long dss_get_dpll4_rate(void);
274int dss_calc_clock_rates(struct dss_clock_info *cinfo); 274int dss_calc_clock_rates(struct dss_clock_info *cinfo);
275int dss_set_clock_div(struct dss_clock_info *cinfo); 275int dss_set_clock_div(struct dss_clock_info *cinfo);
276int dss_get_clock_div(struct dss_clock_info *cinfo); 276int dss_get_clock_div(struct dss_clock_info *cinfo);
277int dss_calc_clock_div(bool is_tft, unsigned long req_pck, 277int dss_calc_clock_div(unsigned long req_pck, struct dss_clock_info *dss_cinfo,
278 struct dss_clock_info *dss_cinfo,
279 struct dispc_clock_info *dispc_cinfo); 278 struct dispc_clock_info *dispc_cinfo);
280 279
281/* SDI */ 280/* SDI */
@@ -302,7 +301,7 @@ u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt);
302unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev); 301unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev);
303int dsi_pll_set_clock_div(struct platform_device *dsidev, 302int dsi_pll_set_clock_div(struct platform_device *dsidev,
304 struct dsi_clock_info *cinfo); 303 struct dsi_clock_info *cinfo);
305int dsi_pll_calc_clock_div_pck(struct platform_device *dsidev, bool is_tft, 304int dsi_pll_calc_clock_div_pck(struct platform_device *dsidev,
306 unsigned long req_pck, struct dsi_clock_info *cinfo, 305 unsigned long req_pck, struct dsi_clock_info *cinfo,
307 struct dispc_clock_info *dispc_cinfo); 306 struct dispc_clock_info *dispc_cinfo);
308int dsi_pll_init(struct platform_device *dsidev, bool enable_hsclk, 307int dsi_pll_init(struct platform_device *dsidev, bool enable_hsclk,
@@ -336,7 +335,7 @@ static inline int dsi_pll_set_clock_div(struct platform_device *dsidev,
336 return -ENODEV; 335 return -ENODEV;
337} 336}
338static inline int dsi_pll_calc_clock_div_pck(struct platform_device *dsidev, 337static inline int dsi_pll_calc_clock_div_pck(struct platform_device *dsidev,
339 bool is_tft, unsigned long req_pck, 338 unsigned long req_pck,
340 struct dsi_clock_info *dsi_cinfo, 339 struct dsi_clock_info *dsi_cinfo,
341 struct dispc_clock_info *dispc_cinfo) 340 struct dispc_clock_info *dispc_cinfo)
342{ 341{
@@ -393,7 +392,7 @@ void dispc_set_loadmode(enum omap_dss_load_mode mode);
393bool dispc_mgr_timings_ok(enum omap_channel channel, 392bool dispc_mgr_timings_ok(enum omap_channel channel,
394 const struct omap_video_timings *timings); 393 const struct omap_video_timings *timings);
395unsigned long dispc_fclk_rate(void); 394unsigned long dispc_fclk_rate(void);
396void dispc_find_clk_divs(bool is_tft, unsigned long req_pck, unsigned long fck, 395void dispc_find_clk_divs(unsigned long req_pck, unsigned long fck,
397 struct dispc_clock_info *cinfo); 396 struct dispc_clock_info *cinfo);
398int dispc_calc_clock_rates(unsigned long dispc_fclk_rate, 397int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,
399 struct dispc_clock_info *cinfo); 398 struct dispc_clock_info *cinfo);
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 3a43dc2a9b4..d07ecc44603 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -84,8 +84,7 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev)
84 dispc_mgr_set_pol_freq(dssdev->manager->id, dssdev->panel.config, 84 dispc_mgr_set_pol_freq(dssdev->manager->id, dssdev->panel.config,
85 dssdev->panel.acbi, dssdev->panel.acb); 85 dssdev->panel.acbi, dssdev->panel.acb);
86 86
87 r = dss_calc_clock_div(1, t->pixel_clock * 1000, 87 r = dss_calc_clock_div(t->pixel_clock * 1000, &dss_cinfo, &dispc_cinfo);
88 &dss_cinfo, &dispc_cinfo);
89 if (r) 88 if (r)
90 goto err_calc_clock_div; 89 goto err_calc_clock_div;
91 90