aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/atmel-hlcdc
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-01-05 12:11:39 -0500
committerBoris Brezillon <boris.brezillon@free-electrons.com>2016-04-14 03:17:26 -0400
commit79a3fc2d98111e371bd4c49e6f2de26ef8deb03f (patch)
tree136c83b824e6d36262dba062278b40bc5a01b52f /drivers/gpu/drm/atmel-hlcdc
parentaab6d08c700ca4c9377e44c66debe89dc690a690 (diff)
drm: atmel-hlcdc: support extended timing ranges on sama5d4 and sama5d2
The display timings on old SoCs older than the sama5d4 are quite limited and prevent the use of many displays. Add support for extended timing ranges on sama5d2 and sama5d4. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'drivers/gpu/drm/atmel-hlcdc')
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c24
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h6
2 files changed, 24 insertions, 6 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 67b139174e7b..eb6195c108f3 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -50,6 +50,9 @@ static const struct atmel_hlcdc_dc_desc atmel_hlcdc_dc_at91sam9n12 = {
50 .min_height = 0, 50 .min_height = 0,
51 .max_width = 1280, 51 .max_width = 1280,
52 .max_height = 860, 52 .max_height = 860,
53 .max_spw = 0x3f,
54 .max_vpw = 0x3f,
55 .max_hpw = 0xff,
53 .nlayers = ARRAY_SIZE(atmel_hlcdc_at91sam9n12_layers), 56 .nlayers = ARRAY_SIZE(atmel_hlcdc_at91sam9n12_layers),
54 .layers = atmel_hlcdc_at91sam9n12_layers, 57 .layers = atmel_hlcdc_at91sam9n12_layers,
55}; 58};
@@ -134,6 +137,9 @@ static const struct atmel_hlcdc_dc_desc atmel_hlcdc_dc_at91sam9x5 = {
134 .min_height = 0, 137 .min_height = 0,
135 .max_width = 800, 138 .max_width = 800,
136 .max_height = 600, 139 .max_height = 600,
140 .max_spw = 0x3f,
141 .max_vpw = 0x3f,
142 .max_hpw = 0xff,
137 .nlayers = ARRAY_SIZE(atmel_hlcdc_at91sam9x5_layers), 143 .nlayers = ARRAY_SIZE(atmel_hlcdc_at91sam9x5_layers),
138 .layers = atmel_hlcdc_at91sam9x5_layers, 144 .layers = atmel_hlcdc_at91sam9x5_layers,
139}; 145};
@@ -237,6 +243,9 @@ static const struct atmel_hlcdc_dc_desc atmel_hlcdc_dc_sama5d3 = {
237 .min_height = 0, 243 .min_height = 0,
238 .max_width = 2048, 244 .max_width = 2048,
239 .max_height = 2048, 245 .max_height = 2048,
246 .max_spw = 0x3f,
247 .max_vpw = 0x3f,
248 .max_hpw = 0x1ff,
240 .nlayers = ARRAY_SIZE(atmel_hlcdc_sama5d3_layers), 249 .nlayers = ARRAY_SIZE(atmel_hlcdc_sama5d3_layers),
241 .layers = atmel_hlcdc_sama5d3_layers, 250 .layers = atmel_hlcdc_sama5d3_layers,
242}; 251};
@@ -320,6 +329,9 @@ static const struct atmel_hlcdc_dc_desc atmel_hlcdc_dc_sama5d4 = {
320 .min_height = 0, 329 .min_height = 0,
321 .max_width = 2048, 330 .max_width = 2048,
322 .max_height = 2048, 331 .max_height = 2048,
332 .max_spw = 0xff,
333 .max_vpw = 0xff,
334 .max_hpw = 0x3ff,
323 .nlayers = ARRAY_SIZE(atmel_hlcdc_sama5d4_layers), 335 .nlayers = ARRAY_SIZE(atmel_hlcdc_sama5d4_layers),
324 .layers = atmel_hlcdc_sama5d4_layers, 336 .layers = atmel_hlcdc_sama5d4_layers,
325}; 337};
@@ -358,19 +370,19 @@ int atmel_hlcdc_dc_mode_valid(struct atmel_hlcdc_dc *dc,
358 int hback_porch = mode->htotal - mode->hsync_end; 370 int hback_porch = mode->htotal - mode->hsync_end;
359 int hsync_len = mode->hsync_end - mode->hsync_start; 371 int hsync_len = mode->hsync_end - mode->hsync_start;
360 372
361 if (hsync_len > 0x40 || hsync_len < 1) 373 if (hsync_len > dc->desc->max_spw + 1 || hsync_len < 1)
362 return MODE_HSYNC; 374 return MODE_HSYNC;
363 375
364 if (vsync_len > 0x40 || vsync_len < 1) 376 if (vsync_len > dc->desc->max_spw + 1 || vsync_len < 1)
365 return MODE_VSYNC; 377 return MODE_VSYNC;
366 378
367 if (hfront_porch > 0x200 || hfront_porch < 1 || 379 if (hfront_porch > dc->desc->max_hpw + 1 || hfront_porch < 1 ||
368 hback_porch > 0x200 || hback_porch < 1 || 380 hback_porch > dc->desc->max_hpw + 1 || hback_porch < 1 ||
369 mode->hdisplay < 1) 381 mode->hdisplay < 1)
370 return MODE_H_ILLEGAL; 382 return MODE_H_ILLEGAL;
371 383
372 if (vfront_porch > 0x40 || vfront_porch < 1 || 384 if (vfront_porch > dc->desc->max_vpw + 1 || vfront_porch < 1 ||
373 vback_porch > 0x40 || vback_porch < 0 || 385 vback_porch > dc->desc->max_vpw || vback_porch < 0 ||
374 mode->vdisplay < 1) 386 mode->vdisplay < 1)
375 return MODE_V_ILLEGAL; 387 return MODE_V_ILLEGAL;
376 388
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
index 733dd1d01b1e..638e3c7293b0 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
@@ -50,6 +50,9 @@
50 * @min_height: minimum height supported by the Display Controller 50 * @min_height: minimum height supported by the Display Controller
51 * @max_width: maximum width supported by the Display Controller 51 * @max_width: maximum width supported by the Display Controller
52 * @max_height: maximum height supported by the Display Controller 52 * @max_height: maximum height supported by the Display Controller
53 * @max_spw: maximum vertical/horizontal pulse width
54 * @max_vpw: maximum vertical back/front porch width
55 * @max_hpw: maximum horizontal back/front porch width
53 * @layers: a layer description table describing available layers 56 * @layers: a layer description table describing available layers
54 * @nlayers: layer description table size 57 * @nlayers: layer description table size
55 */ 58 */
@@ -58,6 +61,9 @@ struct atmel_hlcdc_dc_desc {
58 int min_height; 61 int min_height;
59 int max_width; 62 int max_width;
60 int max_height; 63 int max_height;
64 int max_spw;
65 int max_vpw;
66 int max_hpw;
61 const struct atmel_hlcdc_layer_desc *layers; 67 const struct atmel_hlcdc_layer_desc *layers;
62 int nlayers; 68 int nlayers;
63}; 69};