static int dpi_check_timings(struct omap_dss_device *dssdev, struct omap_video_timings *timings) { bool is_tft; int r; int lck_div, pck_div; unsigned long fck; unsigned long pck; if (!dispc_lcd_timings_ok(timings)) return -EINVAL; if (timings->pixel_clock == 0) return -EINVAL; is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0; #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL { struct dsi_clock_info cinfo; r = dsi_pll_calc_pck(is_tft, timings->pixel_clock * 1000, &cinfo); if (r) return r; fck = cinfo.dsi1_pll_fclk; lck_div = cinfo.lck_div; pck_div = cinfo.pck_div; } #else { struct dispc_clock_info cinfo; r = dispc_calc_clock_div(is_tft, timings->pixel_clock * 1000, &cinfo); if (r) return r; fck = cinfo.fck; lck_div = cinfo.lck_div; pck_div = cinfo.pck_div; } #endif pck = fck / lck_div / pck_div / 1000; timings->pixel_clock = pck; return 0; }
static int dpi_set_dsi_clk(bool is_tft, unsigned long pck_req, unsigned long *fck, int *lck_div, int *pck_div) { struct dsi_clock_info cinfo; int r; r = dsi_pll_calc_pck(is_tft, pck_req, &cinfo); if (r) return r; r = dsi_pll_program(&cinfo); if (r) return r; dss_select_clk_source(0, 1); dispc_set_lcd_divisor(cinfo.lck_div, cinfo.pck_div); *fck = cinfo.dsi1_pll_fclk; *lck_div = cinfo.lck_div; *pck_div = cinfo.pck_div; return 0; }
static int dpi_check_timings(struct omap_display *display, struct omap_video_timings *timings) { bool is_tft; int r; int lck_div, pck_div; unsigned long fck; unsigned long pck; if (cpu_is_omap24xx() || omap_rev() < OMAP3430_REV_ES3_0) { if (timings->hsw < 1 || timings->hsw > 64 || timings->hfp < 1 || timings->hfp > 256 || timings->hbp < 1 || timings->hbp > 256) { return -EINVAL; } if (timings->vsw < 1 || timings->vsw > 64 || timings->vfp > 255 || timings->vbp > 255) { return -EINVAL; } } else { if (timings->hsw < 1 || timings->hsw > 256 || timings->hfp < 1 || timings->hfp > 4096 || timings->hbp < 1 || timings->hbp > 4096) { return -EINVAL; } if (timings->vsw < 1 || timings->vsw > 64 || timings->vfp > 4095 || timings->vbp > 4095) { return -EINVAL; } } if (timings->pixel_clock == 0) return -EINVAL; is_tft = (display->panel->config & OMAP_DSS_LCD_TFT) != 0; #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL { struct dsi_clock_info cinfo; r = dsi_pll_calc_pck(is_tft, timings->pixel_clock * 1000, &cinfo); if (r) return r; fck = cinfo.dsi1_pll_fclk; lck_div = cinfo.lck_div; pck_div = cinfo.pck_div; } #else { struct dispc_clock_info cinfo; r = dispc_calc_clock_div(is_tft, timings->pixel_clock * 1000, &cinfo); if (r) return r; fck = cinfo.fck; lck_div = cinfo.lck_div; pck_div = cinfo.pck_div; } #endif pck = fck / lck_div / pck_div / 1000; timings->pixel_clock = pck; return 0; }