Skip to content

Commit

Permalink
drm/panel: simple: Set appropriate mode type
Browse files Browse the repository at this point in the history
All modes exposed by simple panels should be tagged as driver defined
modes. Moreover, if a panel supports only one mode, this mode is
obviously the preferred one.

Doing this also fix a problem occurring when a 'video=' parameter is
passed on the kernel command line. In some cases the user provided mode
will be preferred over the simple panel ones, which might result in
unpredictable behavior.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com>
[treding@nvidia.com: reshuffle some code for consistency]
Signed-off-by: Thierry Reding <treding@nvidia.com>
  • Loading branch information
Boris Brezillon authored and Thierry Reding committed May 12, 2016
1 parent cf5c9e6 commit cda5537
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/gpu/drm/panel/panel-simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
}

drm_display_mode_from_videomode(&vm, mode);

mode->type |= DRM_MODE_TYPE_DRIVER;

if (panel->desc->num_modes == 1)
mode->type |= DRM_MODE_TYPE_PREFERRED;

drm_mode_set_name(mode);

drm_mode_probed_add(connector, mode);
Expand All @@ -133,6 +139,11 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
continue;
}

mode->type |= DRM_MODE_TYPE_DRIVER;

if (panel->desc->num_modes == 1)
mode->type |= DRM_MODE_TYPE_PREFERRED;

drm_mode_set_name(mode);

drm_mode_probed_add(connector, mode);
Expand Down

0 comments on commit cda5537

Please sign in to comment.