aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-08-04 18:44:16 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-08-15 08:18:25 -0400
commitc4ff6ea60eb13953df58d786ffadce47e0c90ceb (patch)
treebbbf8f900b944b0c73bec04df9065ff1806c6b6f /drivers/gpu/drm
parentfe9964cb1ed04195cecf5c11fa44f484a7f00fc9 (diff)
drm: omapdrm: Move PCD, LINEWIDTH and DOWNSCALE features to dispc driver
The FEAT_PARAM_DSS_PCD, FEAT_PARAM_LINEWIDTH and FEAT_PARAM_DOWNSCALE features are specific to the DISPC, move them from the omap_dss_features structure to the dispc driver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dispc.c53
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dss_features.c19
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dss_features.h3
3 files changed, 39 insertions, 36 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 23f887ce4936..49c9c46428f9 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -105,6 +105,9 @@ struct dispc_features {
105 u16 mgr_height_max; 105 u16 mgr_height_max;
106 unsigned long max_lcd_pclk; 106 unsigned long max_lcd_pclk;
107 unsigned long max_tv_pclk; 107 unsigned long max_tv_pclk;
108 unsigned int max_downscale;
109 unsigned int max_line_width;
110 unsigned int min_pcd;
108 int (*calc_scaling) (unsigned long pclk, unsigned long lclk, 111 int (*calc_scaling) (unsigned long pclk, unsigned long lclk,
109 const struct videomode *vm, 112 const struct videomode *vm,
110 u16 width, u16 height, u16 out_width, u16 out_height, 113 u16 width, u16 height, u16 out_width, u16 out_height,
@@ -2207,8 +2210,7 @@ static int dispc_ovl_calc_scaling_24xx(unsigned long pclk, unsigned long lclk,
2207 int error; 2210 int error;
2208 u16 in_width, in_height; 2211 u16 in_width, in_height;
2209 int min_factor = min(*decim_x, *decim_y); 2212 int min_factor = min(*decim_x, *decim_y);
2210 const int maxsinglelinewidth = 2213 const int maxsinglelinewidth = dispc.feat->max_line_width;
2211 dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
2212 2214
2213 *five_taps = false; 2215 *five_taps = false;
2214 2216
@@ -2252,8 +2254,7 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,
2252{ 2254{
2253 int error; 2255 int error;
2254 u16 in_width, in_height; 2256 u16 in_width, in_height;
2255 const int maxsinglelinewidth = 2257 const int maxsinglelinewidth = dispc.feat->max_line_width;
2256 dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
2257 2258
2258 do { 2259 do {
2259 in_height = height / *decim_y; 2260 in_height = height / *decim_y;
@@ -2338,9 +2339,8 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk,
2338 u16 in_width, in_width_max; 2339 u16 in_width, in_width_max;
2339 int decim_x_min = *decim_x; 2340 int decim_x_min = *decim_x;
2340 u16 in_height = height / *decim_y; 2341 u16 in_height = height / *decim_y;
2341 const int maxsinglelinewidth = 2342 const int maxsinglelinewidth = dispc.feat->max_line_width;
2342 dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH); 2343 const int maxdownscale = dispc.feat->max_downscale;
2343 const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE);
2344 2344
2345 if (mem_to_mem) { 2345 if (mem_to_mem) {
2346 in_width_max = out_width * maxdownscale; 2346 in_width_max = out_width * maxdownscale;
@@ -2400,7 +2400,7 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk,
2400 int *x_predecim, int *y_predecim, u16 pos_x, 2400 int *x_predecim, int *y_predecim, u16 pos_x,
2401 enum omap_dss_rotation_type rotation_type, bool mem_to_mem) 2401 enum omap_dss_rotation_type rotation_type, bool mem_to_mem)
2402{ 2402{
2403 const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE); 2403 const int maxdownscale = dispc.feat->max_downscale;
2404 const int max_decim_limit = 16; 2404 const int max_decim_limit = 16;
2405 unsigned long core_clk = 0; 2405 unsigned long core_clk = 0;
2406 int decim_x, decim_y, ret; 2406 int decim_x, decim_y, ret;
@@ -3481,7 +3481,7 @@ int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,
3481 return 0; 3481 return 0;
3482} 3482}
3483 3483
3484bool dispc_div_calc(unsigned long dispc, 3484bool dispc_div_calc(unsigned long dispc_freq,
3485 unsigned long pck_min, unsigned long pck_max, 3485 unsigned long pck_min, unsigned long pck_max,
3486 dispc_div_calc_func func, void *data) 3486 dispc_div_calc_func func, void *data)
3487{ 3487{
@@ -3499,19 +3499,19 @@ bool dispc_div_calc(unsigned long dispc,
3499 min_fck_per_pck = 0; 3499 min_fck_per_pck = 0;
3500#endif 3500#endif
3501 3501
3502 pckd_hw_min = dss_feat_get_param_min(FEAT_PARAM_DSS_PCD); 3502 pckd_hw_min = dispc.feat->min_pcd;
3503 pckd_hw_max = dss_feat_get_param_max(FEAT_PARAM_DSS_PCD); 3503 pckd_hw_max = 255;
3504 3504
3505 lck_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK); 3505 lck_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
3506 3506
3507 pck_min = pck_min ? pck_min : 1; 3507 pck_min = pck_min ? pck_min : 1;
3508 pck_max = pck_max ? pck_max : ULONG_MAX; 3508 pck_max = pck_max ? pck_max : ULONG_MAX;
3509 3509
3510 lckd_start = max(DIV_ROUND_UP(dispc, lck_max), 1ul); 3510 lckd_start = max(DIV_ROUND_UP(dispc_freq, lck_max), 1ul);
3511 lckd_stop = min(dispc / pck_min, 255ul); 3511 lckd_stop = min(dispc_freq / pck_min, 255ul);
3512 3512
3513 for (lckd = lckd_start; lckd <= lckd_stop; ++lckd) { 3513 for (lckd = lckd_start; lckd <= lckd_stop; ++lckd) {
3514 lck = dispc / lckd; 3514 lck = dispc_freq / lckd;
3515 3515
3516 pckd_start = max(DIV_ROUND_UP(lck, pck_max), pckd_hw_min); 3516 pckd_start = max(DIV_ROUND_UP(lck, pck_max), pckd_hw_min);
3517 pckd_stop = min(lck / pck_min, pckd_hw_max); 3517 pckd_stop = min(lck / pck_min, pckd_hw_max);
@@ -4047,6 +4047,13 @@ static const struct dispc_features omap24xx_dispc_feats = {
4047 .mgr_width_max = 2048, 4047 .mgr_width_max = 2048,
4048 .mgr_height_max = 2048, 4048 .mgr_height_max = 2048,
4049 .max_lcd_pclk = 66500000, 4049 .max_lcd_pclk = 66500000,
4050 .max_downscale = 2,
4051 /*
4052 * Assume the line width buffer to be 768 pixels as OMAP2 DISPC scaler
4053 * cannot scale an image width larger than 768.
4054 */
4055 .max_line_width = 768,
4056 .min_pcd = 2,
4050 .calc_scaling = dispc_ovl_calc_scaling_24xx, 4057 .calc_scaling = dispc_ovl_calc_scaling_24xx,
4051 .calc_core_clk = calc_core_clk_24xx, 4058 .calc_core_clk = calc_core_clk_24xx,
4052 .num_fifos = 3, 4059 .num_fifos = 3,
@@ -4078,6 +4085,9 @@ static const struct dispc_features omap34xx_rev1_0_dispc_feats = {
4078 .mgr_height_max = 2048, 4085 .mgr_height_max = 2048,
4079 .max_lcd_pclk = 173000000, 4086 .max_lcd_pclk = 173000000,
4080 .max_tv_pclk = 59000000, 4087 .max_tv_pclk = 59000000,
4088 .max_downscale = 4,
4089 .max_line_width = 1024,
4090 .min_pcd = 1,
4081 .calc_scaling = dispc_ovl_calc_scaling_34xx, 4091 .calc_scaling = dispc_ovl_calc_scaling_34xx,
4082 .calc_core_clk = calc_core_clk_34xx, 4092 .calc_core_clk = calc_core_clk_34xx,
4083 .num_fifos = 3, 4093 .num_fifos = 3,
@@ -4109,6 +4119,9 @@ static const struct dispc_features omap34xx_rev3_0_dispc_feats = {
4109 .mgr_height_max = 2048, 4119 .mgr_height_max = 2048,
4110 .max_lcd_pclk = 173000000, 4120 .max_lcd_pclk = 173000000,
4111 .max_tv_pclk = 59000000, 4121 .max_tv_pclk = 59000000,
4122 .max_downscale = 4,
4123 .max_line_width = 1024,
4124 .min_pcd = 1,
4112 .calc_scaling = dispc_ovl_calc_scaling_34xx, 4125 .calc_scaling = dispc_ovl_calc_scaling_34xx,
4113 .calc_core_clk = calc_core_clk_34xx, 4126 .calc_core_clk = calc_core_clk_34xx,
4114 .num_fifos = 3, 4127 .num_fifos = 3,
@@ -4140,6 +4153,9 @@ static const struct dispc_features omap36xx_dispc_feats = {
4140 .mgr_height_max = 2048, 4153 .mgr_height_max = 2048,
4141 .max_lcd_pclk = 173000000, 4154 .max_lcd_pclk = 173000000,
4142 .max_tv_pclk = 59000000, 4155 .max_tv_pclk = 59000000,
4156 .max_downscale = 4,
4157 .max_line_width = 1024,
4158 .min_pcd = 1,
4143 .calc_scaling = dispc_ovl_calc_scaling_34xx, 4159 .calc_scaling = dispc_ovl_calc_scaling_34xx,
4144 .calc_core_clk = calc_core_clk_34xx, 4160 .calc_core_clk = calc_core_clk_34xx,
4145 .num_fifos = 3, 4161 .num_fifos = 3,
@@ -4171,6 +4187,9 @@ static const struct dispc_features am43xx_dispc_feats = {
4171 .mgr_height_max = 2048, 4187 .mgr_height_max = 2048,
4172 .max_lcd_pclk = 173000000, 4188 .max_lcd_pclk = 173000000,
4173 .max_tv_pclk = 59000000, 4189 .max_tv_pclk = 59000000,
4190 .max_downscale = 4,
4191 .max_line_width = 1024,
4192 .min_pcd = 1,
4174 .calc_scaling = dispc_ovl_calc_scaling_34xx, 4193 .calc_scaling = dispc_ovl_calc_scaling_34xx,
4175 .calc_core_clk = calc_core_clk_34xx, 4194 .calc_core_clk = calc_core_clk_34xx,
4176 .num_fifos = 3, 4195 .num_fifos = 3,
@@ -4202,6 +4221,9 @@ static const struct dispc_features omap44xx_dispc_feats = {
4202 .mgr_height_max = 2048, 4221 .mgr_height_max = 2048,
4203 .max_lcd_pclk = 170000000, 4222 .max_lcd_pclk = 170000000,
4204 .max_tv_pclk = 185625000, 4223 .max_tv_pclk = 185625000,
4224 .max_downscale = 4,
4225 .max_line_width = 2048,
4226 .min_pcd = 1,
4205 .calc_scaling = dispc_ovl_calc_scaling_44xx, 4227 .calc_scaling = dispc_ovl_calc_scaling_44xx,
4206 .calc_core_clk = calc_core_clk_44xx, 4228 .calc_core_clk = calc_core_clk_44xx,
4207 .num_fifos = 5, 4229 .num_fifos = 5,
@@ -4238,6 +4260,9 @@ static const struct dispc_features omap54xx_dispc_feats = {
4238 .mgr_height_max = 4096, 4260 .mgr_height_max = 4096,
4239 .max_lcd_pclk = 170000000, 4261 .max_lcd_pclk = 170000000,
4240 .max_tv_pclk = 186000000, 4262 .max_tv_pclk = 186000000,
4263 .max_downscale = 4,
4264 .max_line_width = 2048,
4265 .min_pcd = 1,
4241 .calc_scaling = dispc_ovl_calc_scaling_44xx, 4266 .calc_scaling = dispc_ovl_calc_scaling_44xx,
4242 .calc_core_clk = calc_core_clk_44xx, 4267 .calc_core_clk = calc_core_clk_44xx,
4243 .num_fifos = 5, 4268 .num_fifos = 5,
diff --git a/drivers/gpu/drm/omapdrm/dss/dss_features.c b/drivers/gpu/drm/omapdrm/dss/dss_features.c
index 1d35cc80b363..c904d80a5920 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss_features.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss_features.c
@@ -102,41 +102,22 @@ static const enum omap_dss_output_id omap5_dss_supported_outputs[] = {
102 102
103static const struct dss_param_range omap2_dss_param_range[] = { 103static const struct dss_param_range omap2_dss_param_range[] = {
104 [FEAT_PARAM_DSS_FCK] = { 0, 133000000 }, 104 [FEAT_PARAM_DSS_FCK] = { 0, 133000000 },
105 [FEAT_PARAM_DSS_PCD] = { 2, 255 },
106 [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
107 /*
108 * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
109 * scaler cannot scale a image with width more than 768.
110 */
111 [FEAT_PARAM_LINEWIDTH] = { 1, 768 },
112}; 105};
113 106
114static const struct dss_param_range omap3_dss_param_range[] = { 107static const struct dss_param_range omap3_dss_param_range[] = {
115 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 }, 108 [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
116 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
117 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
118 [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
119}; 109};
120 110
121static const struct dss_param_range am43xx_dss_param_range[] = { 111static const struct dss_param_range am43xx_dss_param_range[] = {
122 [FEAT_PARAM_DSS_FCK] = { 0, 200000000 }, 112 [FEAT_PARAM_DSS_FCK] = { 0, 200000000 },
123 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
124 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
125 [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
126}; 113};
127 114
128static const struct dss_param_range omap4_dss_param_range[] = { 115static const struct dss_param_range omap4_dss_param_range[] = {
129 [FEAT_PARAM_DSS_FCK] = { 0, 186000000 }, 116 [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
130 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
131 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
132 [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
133}; 117};
134 118
135static const struct dss_param_range omap5_dss_param_range[] = { 119static const struct dss_param_range omap5_dss_param_range[] = {
136 [FEAT_PARAM_DSS_FCK] = { 0, 209250000 }, 120 [FEAT_PARAM_DSS_FCK] = { 0, 209250000 },
137 [FEAT_PARAM_DSS_PCD] = { 1, 255 },
138 [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
139 [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
140}; 121};
141 122
142/* OMAP2 DSS Features */ 123/* OMAP2 DSS Features */
diff --git a/drivers/gpu/drm/omapdrm/dss/dss_features.h b/drivers/gpu/drm/omapdrm/dss/dss_features.h
index 289c5dc1ef09..b1179fb25866 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss_features.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss_features.h
@@ -27,9 +27,6 @@
27 27
28enum dss_range_param { 28enum dss_range_param {
29 FEAT_PARAM_DSS_FCK, 29 FEAT_PARAM_DSS_FCK,
30 FEAT_PARAM_DSS_PCD,
31 FEAT_PARAM_DOWNSCALE,
32 FEAT_PARAM_LINEWIDTH,
33}; 30};
34 31
35/* DSS Feature Functions */ 32/* DSS Feature Functions */