diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2016-01-05 20:27:49 +0300 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@free-electrons.com> | 2016-04-14 10:17:28 +0300 |
commit | 5ac44c8b061653119456921e2e4aa78668b9f3d9 (patch) | |
tree | 686495b1844dbf9efd5f5fd4396aed6ed7972011 /drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | |
parent | 17a8e03e7e97d3445ec60a16a234149ca51e96fb (diff) | |
download | linux-5ac44c8b061653119456921e2e4aa78668b9f3d9.tar.xz |
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>
Diffstat (limited to 'drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c')
-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) cfg); } +static bool atmel_hlcdc_crtc_mode_fixup(struct drm_crtc *c, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); + + return atmel_hlcdc_dc_mode_valid(crtc->dc, adjusted_mode) == MODE_OK; +} + static void atmel_hlcdc_crtc_disable(struct drm_crtc *c) { struct drm_device *dev = c->dev; @@ -304,12 +313,8 @@ static int atmel_hlcdc_crtc_select_output_mode(struct drm_crtc_state *state) static int atmel_hlcdc_crtc_atomic_check(struct drm_crtc *c, struct drm_crtc_state *s) { - struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); int ret; - if (atmel_hlcdc_dc_mode_valid(crtc->dc, &s->adjusted_mode) != MODE_OK) - return -EINVAL; - ret = atmel_hlcdc_crtc_select_output_mode(s); if (ret) return ret; @@ -339,6 +344,7 @@ static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc, } static const struct drm_crtc_helper_funcs lcdc_crtc_helper_funcs = { + .mode_fixup = atmel_hlcdc_crtc_mode_fixup, .mode_set = drm_helper_crtc_mode_set, .mode_set_nofb = atmel_hlcdc_crtc_mode_set_nofb, .mode_set_base = drm_helper_crtc_mode_set_base, |