diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2016-01-05 12:27:49 -0500 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@free-electrons.com> | 2016-04-14 03:17:28 -0400 |
commit | 5ac44c8b061653119456921e2e4aa78668b9f3d9 (patch) | |
tree | 686495b1844dbf9efd5f5fd4396aed6ed7972011 | |
parent | 17a8e03e7e97d3445ec60a16a234149ca51e96fb (diff) |
drm: atmel-hlcdc: check display mode validity in crtc->mode_fixup()
Move the adjusted display mode check into ->mode_fixup().
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>
-rw-r--r-- | drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index 021bd218655f..bd35a8ac1a49 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | |||
@@ -142,6 +142,15 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) | |||
142 | cfg); | 142 | cfg); |
143 | } | 143 | } |
144 | 144 | ||
145 | static bool atmel_hlcdc_crtc_mode_fixup(struct drm_crtc *c, | ||
146 | const struct drm_display_mode *mode, | ||
147 | struct drm_display_mode *adjusted_mode) | ||
148 | { | ||
149 | struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); | ||
150 | |||
151 | return atmel_hlcdc_dc_mode_valid(crtc->dc, adjusted_mode) == MODE_OK; | ||
152 | } | ||
153 | |||
145 | static void atmel_hlcdc_crtc_disable(struct drm_crtc *c) | 154 | static void atmel_hlcdc_crtc_disable(struct drm_crtc *c) |
146 | { | 155 | { |
147 | struct drm_device *dev = c->dev; | 156 | struct drm_device *dev = c->dev; |
@@ -304,12 +313,8 @@ static int atmel_hlcdc_crtc_select_output_mode(struct drm_crtc_state *state) | |||
304 | static int atmel_hlcdc_crtc_atomic_check(struct drm_crtc *c, | 313 | static int atmel_hlcdc_crtc_atomic_check(struct drm_crtc *c, |
305 | struct drm_crtc_state *s) | 314 | struct drm_crtc_state *s) |
306 | { | 315 | { |
307 | struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); | ||
308 | int ret; | 316 | int ret; |
309 | 317 | ||
310 | if (atmel_hlcdc_dc_mode_valid(crtc->dc, &s->adjusted_mode) != MODE_OK) | ||
311 | return -EINVAL; | ||
312 | |||
313 | ret = atmel_hlcdc_crtc_select_output_mode(s); | 318 | ret = atmel_hlcdc_crtc_select_output_mode(s); |
314 | if (ret) | 319 | if (ret) |
315 | return ret; | 320 | return ret; |
@@ -339,6 +344,7 @@ static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc, | |||
339 | } | 344 | } |
340 | 345 | ||
341 | static const struct drm_crtc_helper_funcs lcdc_crtc_helper_funcs = { | 346 | static const struct drm_crtc_helper_funcs lcdc_crtc_helper_funcs = { |
347 | .mode_fixup = atmel_hlcdc_crtc_mode_fixup, | ||
342 | .mode_set = drm_helper_crtc_mode_set, | 348 | .mode_set = drm_helper_crtc_mode_set, |
343 | .mode_set_nofb = atmel_hlcdc_crtc_mode_set_nofb, | 349 | .mode_set_nofb = atmel_hlcdc_crtc_mode_set_nofb, |
344 | .mode_set_base = drm_helper_crtc_mode_set_base, | 350 | .mode_set_base = drm_helper_crtc_mode_set_base, |