Skip to content

Commit e72bbab

Browse files
author
Thomas Zimmermann
committed
drm/ast: astdp: Validate display modes
Validate each display mode against the astdp transmitter chips. Filters out modes that the chip does not support. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250204133209.403327-5-tzimmermann@suse.de
1 parent 9aed3a4 commit e72bbab

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/gpu/drm/ast/ast_dp.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,19 @@ static const struct drm_encoder_funcs ast_astdp_encoder_funcs = {
300300
.destroy = drm_encoder_cleanup,
301301
};
302302

303+
static enum drm_mode_status
304+
ast_astdp_encoder_helper_mode_valid(struct drm_encoder *encoder,
305+
const struct drm_display_mode *mode)
306+
{
307+
int res;
308+
309+
res = ast_astdp_get_mode_index(mode->hdisplay, mode->vdisplay);
310+
if (res < 0)
311+
return MODE_NOMODE;
312+
313+
return MODE_OK;
314+
}
315+
303316
static void ast_astdp_encoder_helper_atomic_mode_set(struct drm_encoder *encoder,
304317
struct drm_crtc_state *crtc_state,
305318
struct drm_connector_state *conn_state)
@@ -389,6 +402,7 @@ static int ast_astdp_encoder_helper_atomic_check(struct drm_encoder *encoder,
389402
}
390403

391404
static const struct drm_encoder_helper_funcs ast_astdp_encoder_helper_funcs = {
405+
.mode_valid = ast_astdp_encoder_helper_mode_valid,
392406
.atomic_mode_set = ast_astdp_encoder_helper_atomic_mode_set,
393407
.atomic_enable = ast_astdp_encoder_helper_atomic_enable,
394408
.atomic_disable = ast_astdp_encoder_helper_atomic_disable,

0 commit comments

Comments
 (0)