aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-10-19 08:36:11 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-11-27 05:27:02 -0500
commit8702ee50645ea2046bf91838bc615dffc8644fba (patch)
tree893e91b4d4d3adac4f167ba7ee132ac42f200cf1 /drivers/video
parent251886d8bc6f565c14acb34b12c007b994c2e56d (diff)
OMAPDSS: DISPC: pass pclk to calc_core_clk()
In order to make the scaling calculations independent of the current hardware configuration (e.g. which manager is connected to this output), we need to change the calc funcs to get all the variables needed for the calculations via parameters. This patch changes calc_core_clk() function to get pclk as a parameter. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/dss/dispc.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index fff26fd5d17f..1704077b1f06 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -97,7 +97,7 @@ struct dispc_features {
97 enum omap_color_mode color_mode, bool *five_taps, 97 enum omap_color_mode color_mode, bool *five_taps,
98 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y, 98 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
99 u16 pos_x, unsigned long *core_clk, bool mem_to_mem); 99 u16 pos_x, unsigned long *core_clk, bool mem_to_mem);
100 unsigned long (*calc_core_clk) (enum omap_plane plane, 100 unsigned long (*calc_core_clk) (unsigned long pclk,
101 u16 width, u16 height, u16 out_width, u16 out_height, 101 u16 width, u16 height, u16 out_width, u16 out_height,
102 bool mem_to_mem); 102 bool mem_to_mem);
103 u8 num_fifos; 103 u8 num_fifos;
@@ -2044,14 +2044,13 @@ static int check_horiz_timing_omap3(enum omap_plane plane,
2044 return 0; 2044 return 0;
2045} 2045}
2046 2046
2047static unsigned long calc_core_clk_five_taps(enum omap_plane plane, 2047static unsigned long calc_core_clk_five_taps(unsigned long pclk,
2048 const struct omap_video_timings *mgr_timings, u16 width, 2048 const struct omap_video_timings *mgr_timings, u16 width,
2049 u16 height, u16 out_width, u16 out_height, 2049 u16 height, u16 out_width, u16 out_height,
2050 enum omap_color_mode color_mode) 2050 enum omap_color_mode color_mode)
2051{ 2051{
2052 u32 core_clk = 0; 2052 u32 core_clk = 0;
2053 u64 tmp; 2053 u64 tmp;
2054 unsigned long pclk = dispc_plane_pclk_rate(plane);
2055 2054
2056 if (height <= out_height && width <= out_width) 2055 if (height <= out_height && width <= out_width)
2057 return (unsigned long) pclk; 2056 return (unsigned long) pclk;
@@ -2085,22 +2084,19 @@ static unsigned long calc_core_clk_five_taps(enum omap_plane plane,
2085 return core_clk; 2084 return core_clk;
2086} 2085}
2087 2086
2088static unsigned long calc_core_clk_24xx(enum omap_plane plane, u16 width, 2087static unsigned long calc_core_clk_24xx(unsigned long pclk, u16 width,
2089 u16 height, u16 out_width, u16 out_height, bool mem_to_mem) 2088 u16 height, u16 out_width, u16 out_height, bool mem_to_mem)
2090{ 2089{
2091 unsigned long pclk = dispc_plane_pclk_rate(plane);
2092
2093 if (height > out_height && width > out_width) 2090 if (height > out_height && width > out_width)
2094 return pclk * 4; 2091 return pclk * 4;
2095 else 2092 else
2096 return pclk * 2; 2093 return pclk * 2;
2097} 2094}
2098 2095
2099static unsigned long calc_core_clk_34xx(enum omap_plane plane, u16 width, 2096static unsigned long calc_core_clk_34xx(unsigned long pclk, u16 width,
2100 u16 height, u16 out_width, u16 out_height, bool mem_to_mem) 2097 u16 height, u16 out_width, u16 out_height, bool mem_to_mem)
2101{ 2098{
2102 unsigned int hf, vf; 2099 unsigned int hf, vf;
2103 unsigned long pclk = dispc_plane_pclk_rate(plane);
2104 2100
2105 /* 2101 /*
2106 * FIXME how to determine the 'A' factor 2102 * FIXME how to determine the 'A' factor
@@ -2123,11 +2119,9 @@ static unsigned long calc_core_clk_34xx(enum omap_plane plane, u16 width,
2123 return pclk * vf * hf; 2119 return pclk * vf * hf;
2124} 2120}
2125 2121
2126static unsigned long calc_core_clk_44xx(enum omap_plane plane, u16 width, 2122static unsigned long calc_core_clk_44xx(unsigned long pclk, u16 width,
2127 u16 height, u16 out_width, u16 out_height, bool mem_to_mem) 2123 u16 height, u16 out_width, u16 out_height, bool mem_to_mem)
2128{ 2124{
2129 unsigned long pclk;
2130
2131 /* 2125 /*
2132 * If the overlay/writeback is in mem to mem mode, there are no 2126 * If the overlay/writeback is in mem to mem mode, there are no
2133 * downscaling limitations with respect to pixel clock, return 1 as 2127 * downscaling limitations with respect to pixel clock, return 1 as
@@ -2137,8 +2131,6 @@ static unsigned long calc_core_clk_44xx(enum omap_plane plane, u16 width,
2137 if (mem_to_mem) 2131 if (mem_to_mem)
2138 return 1; 2132 return 1;
2139 2133
2140 pclk = dispc_plane_pclk_rate(plane);
2141
2142 if (width > out_width) 2134 if (width > out_width)
2143 return DIV_ROUND_UP(pclk, out_width) * width; 2135 return DIV_ROUND_UP(pclk, out_width) * width;
2144 else 2136 else
@@ -2157,13 +2149,14 @@ static int dispc_ovl_calc_scaling_24xx(enum omap_plane plane,
2157 int min_factor = min(*decim_x, *decim_y); 2149 int min_factor = min(*decim_x, *decim_y);
2158 const int maxsinglelinewidth = 2150 const int maxsinglelinewidth =
2159 dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH); 2151 dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
2152 unsigned long pclk = dispc_plane_pclk_rate(plane);
2160 2153
2161 *five_taps = false; 2154 *five_taps = false;
2162 2155
2163 do { 2156 do {
2164 in_height = DIV_ROUND_UP(height, *decim_y); 2157 in_height = DIV_ROUND_UP(height, *decim_y);
2165 in_width = DIV_ROUND_UP(width, *decim_x); 2158 in_width = DIV_ROUND_UP(width, *decim_x);
2166 *core_clk = dispc.feat->calc_core_clk(plane, in_width, 2159 *core_clk = dispc.feat->calc_core_clk(pclk, in_width,
2167 in_height, out_width, out_height, mem_to_mem); 2160 in_height, out_width, out_height, mem_to_mem);
2168 error = (in_width > maxsinglelinewidth || !*core_clk || 2161 error = (in_width > maxsinglelinewidth || !*core_clk ||
2169 *core_clk > dispc_core_clk_rate()); 2162 *core_clk > dispc_core_clk_rate());
@@ -2198,11 +2191,12 @@ static int dispc_ovl_calc_scaling_34xx(enum omap_plane plane,
2198 int min_factor = min(*decim_x, *decim_y); 2191 int min_factor = min(*decim_x, *decim_y);
2199 const int maxsinglelinewidth = 2192 const int maxsinglelinewidth =
2200 dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH); 2193 dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
2194 unsigned long pclk = dispc_plane_pclk_rate(plane);
2201 2195
2202 do { 2196 do {
2203 in_height = DIV_ROUND_UP(height, *decim_y); 2197 in_height = DIV_ROUND_UP(height, *decim_y);
2204 in_width = DIV_ROUND_UP(width, *decim_x); 2198 in_width = DIV_ROUND_UP(width, *decim_x);
2205 *core_clk = calc_core_clk_five_taps(plane, mgr_timings, 2199 *core_clk = calc_core_clk_five_taps(pclk, mgr_timings,
2206 in_width, in_height, out_width, out_height, color_mode); 2200 in_width, in_height, out_width, out_height, color_mode);
2207 2201
2208 error = check_horiz_timing_omap3(plane, mgr_timings, 2202 error = check_horiz_timing_omap3(plane, mgr_timings,
@@ -2214,7 +2208,7 @@ static int dispc_ovl_calc_scaling_34xx(enum omap_plane plane,
2214 in_height < out_height * 2) 2208 in_height < out_height * 2)
2215 *five_taps = false; 2209 *five_taps = false;
2216 if (!*five_taps) 2210 if (!*five_taps)
2217 *core_clk = dispc.feat->calc_core_clk(plane, in_width, 2211 *core_clk = dispc.feat->calc_core_clk(pclk, in_width,
2218 in_height, out_width, out_height, 2212 in_height, out_width, out_height,
2219 mem_to_mem); 2213 mem_to_mem);
2220 2214
@@ -2265,12 +2259,11 @@ static int dispc_ovl_calc_scaling_44xx(enum omap_plane plane,
2265 const int maxsinglelinewidth = 2259 const int maxsinglelinewidth =
2266 dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH); 2260 dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
2267 const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE); 2261 const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE);
2262 unsigned long pclk = dispc_plane_pclk_rate(plane);
2268 2263
2269 if (mem_to_mem) { 2264 if (mem_to_mem) {
2270 in_width_max = out_width * maxdownscale; 2265 in_width_max = out_width * maxdownscale;
2271 } else { 2266 } else {
2272 unsigned long pclk = dispc_plane_pclk_rate(plane);
2273
2274 in_width_max = dispc_core_clk_rate() / 2267 in_width_max = dispc_core_clk_rate() /
2275 DIV_ROUND_UP(pclk, out_width); 2268 DIV_ROUND_UP(pclk, out_width);
2276 } 2269 }
@@ -2291,7 +2284,7 @@ static int dispc_ovl_calc_scaling_44xx(enum omap_plane plane,
2291 return -EINVAL; 2284 return -EINVAL;
2292 } 2285 }
2293 2286
2294 *core_clk = dispc.feat->calc_core_clk(plane, in_width, in_height, 2287 *core_clk = dispc.feat->calc_core_clk(pclk, in_width, in_height,
2295 out_width, out_height, mem_to_mem); 2288 out_width, out_height, mem_to_mem);
2296 return 0; 2289 return 0;
2297} 2290}