diff options
-rw-r--r-- | drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/aspeed/aspeed_gfx_out.c | 38 |
2 files changed, 47 insertions, 3 deletions
diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c index 17a22dd0922a..595530614c8d 100644 --- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c +++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c @@ -66,12 +66,20 @@ static const struct drm_mode_config_funcs aspeed_gfx_mode_config_funcs = { static void aspeed_gfx_setup_mode_config(struct drm_device *drm) { + struct aspeed_gfx *priv = drm->dev_private; + drm_mode_config_init(drm); drm->mode_config.min_width = 0; drm->mode_config.min_height = 0; - drm->mode_config.max_width = 800; - drm->mode_config.max_height = 600; + if (priv->output_mode & OUTPUT_DVO) { + drm->mode_config.max_width = 1280; + drm->mode_config.max_height = 720; + } + else { + drm->mode_config.max_width = 800; + drm->mode_config.max_height = 600; + } drm->mode_config.funcs = &aspeed_gfx_mode_config_funcs; } diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_out.c b/drivers/gpu/drm/aspeed/aspeed_gfx_out.c index 2f3115106baa..7ffb4303289e 100644 --- a/drivers/gpu/drm/aspeed/aspeed_gfx_out.c +++ b/drivers/gpu/drm/aspeed/aspeed_gfx_out.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ // Copyright 2018 IBM Corporation +// Copyright 2019 Raptor Engineering, LLC #include <drm/drm_atomic_helper.h> #include <drm/drm_connector.h> @@ -7,9 +8,44 @@ #include "aspeed_gfx.h" +/* + * Set of extra DVO modes. + */ +static const struct drm_display_mode dvo_extra_modes[] = { + /* 1280x720@30Hz */ + { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 29606, 1280, 1288, + 1408, 1536, 0, 720, 721, 724, 733, 0, + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, +}; + static int aspeed_gfx_get_modes(struct drm_connector *connector) { - return drm_add_modes_noedid(connector, 800, 600); + int i, count; + + struct aspeed_gfx *priv = connector->dev->dev_private; + + /* Add basic VGA mode */ + count = drm_add_modes_noedid(connector, 800, 600); + + /* Add extra DVO modes */ + for (i = 0; i < ARRAY_SIZE(dvo_extra_modes); i++) { + struct drm_display_mode *nmode; + nmode = drm_mode_duplicate(connector->dev, + &dvo_extra_modes[i]); + if (nmode) + drm_mode_probed_add(connector, nmode); + } + + if (priv->output_mode & OUTPUT_DVO) { + /* Use 1280x720@30Hz unless otherwise configured */ + drm_set_preferred_mode(connector, 1280, 720); + } + else { + /* Use 800x600@60Hz unless otherwise configured */ + drm_set_preferred_mode(connector, 800, 600); + } + + return count; } static const struct |