aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_simple_kms_helper.c15
-rw-r--r--include/drm/drm_simple_kms_helper.h14
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
index 9d3f6b70812c..6c327fdbaaee 100644
--- a/drivers/gpu/drm/drm_simple_kms_helper.c
+++ b/drivers/gpu/drm/drm_simple_kms_helper.c
@@ -34,6 +34,20 @@ static const struct drm_encoder_funcs drm_simple_kms_encoder_funcs = {
34 .destroy = drm_encoder_cleanup, 34 .destroy = drm_encoder_cleanup,
35}; 35};
36 36
37static enum drm_mode_status
38drm_simple_kms_crtc_mode_valid(struct drm_crtc *crtc,
39 const struct drm_display_mode *mode)
40{
41 struct drm_simple_display_pipe *pipe;
42
43 pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
44 if (!pipe->funcs || !pipe->funcs->mode_valid)
45 /* Anything goes */
46 return MODE_OK;
47
48 return pipe->funcs->mode_valid(crtc, mode);
49}
50
37static int drm_simple_kms_crtc_check(struct drm_crtc *crtc, 51static int drm_simple_kms_crtc_check(struct drm_crtc *crtc,
38 struct drm_crtc_state *state) 52 struct drm_crtc_state *state)
39{ 53{
@@ -72,6 +86,7 @@ static void drm_simple_kms_crtc_disable(struct drm_crtc *crtc,
72} 86}
73 87
74static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = { 88static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = {
89 .mode_valid = drm_simple_kms_crtc_mode_valid,
75 .atomic_check = drm_simple_kms_crtc_check, 90 .atomic_check = drm_simple_kms_crtc_check,
76 .atomic_enable = drm_simple_kms_crtc_enable, 91 .atomic_enable = drm_simple_kms_crtc_enable,
77 .atomic_disable = drm_simple_kms_crtc_disable, 92 .atomic_disable = drm_simple_kms_crtc_disable,
diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h
index 6d9adbb46293..d9e4c3c3f009 100644
--- a/include/drm/drm_simple_kms_helper.h
+++ b/include/drm/drm_simple_kms_helper.h
@@ -22,6 +22,20 @@ struct drm_simple_display_pipe;
22 */ 22 */
23struct drm_simple_display_pipe_funcs { 23struct drm_simple_display_pipe_funcs {
24 /** 24 /**
25 * @mode_valid:
26 *
27 * This function is called to filter out valid modes from the
28 * suggestions suggested by the bridge or display. This optional
29 * hook is passed in when initializing the pipeline.
30 *
31 * RETURNS:
32 *
33 * drm_mode_status Enum
34 */
35 enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc,
36 const struct drm_display_mode *mode);
37
38 /**
25 * @enable: 39 * @enable:
26 * 40 *
27 * This function should be used to enable the pipeline. 41 * This function should be used to enable the pipeline.