Commit 5ac44c8b authored by Boris Brezillon's avatar Boris Brezillon

drm: atmel-hlcdc: check display mode validity in crtc->mode_fixup()

Move the adjusted display mode check into ->mode_fixup().
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Tested-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
parent 17a8e03e
...@@ -142,6 +142,15 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) ...@@ -142,6 +142,15 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
cfg); 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) static void atmel_hlcdc_crtc_disable(struct drm_crtc *c)
{ {
struct drm_device *dev = c->dev; struct drm_device *dev = c->dev;
...@@ -304,12 +313,8 @@ static int atmel_hlcdc_crtc_select_output_mode(struct drm_crtc_state *state) ...@@ -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, static int atmel_hlcdc_crtc_atomic_check(struct drm_crtc *c,
struct drm_crtc_state *s) struct drm_crtc_state *s)
{ {
struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
int ret; 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); ret = atmel_hlcdc_crtc_select_output_mode(s);
if (ret) if (ret)
return ret; return ret;
...@@ -339,6 +344,7 @@ static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc, ...@@ -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 = { 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 = drm_helper_crtc_mode_set,
.mode_set_nofb = atmel_hlcdc_crtc_mode_set_nofb, .mode_set_nofb = atmel_hlcdc_crtc_mode_set_nofb,
.mode_set_base = drm_helper_crtc_mode_set_base, .mode_set_base = drm_helper_crtc_mode_set_base,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment