1 // SPDX-License-Identifier: GPL-2.0+ 2 // Copyright 2018 IBM Corporation 3 4 #include <drm/drm_atomic_helper.h> 5 #include <drm/drm_connector.h> 6 #include <drm/drm_crtc_helper.h> 7 #include <drm/drm_probe_helper.h> 8 9 #include "aspeed_gfx.h" 10 11 static int aspeed_gfx_get_modes(struct drm_connector *connector) 12 { 13 return drm_add_modes_noedid(connector, 800, 600); 14 } 15 16 static const struct 17 drm_connector_helper_funcs aspeed_gfx_connector_helper_funcs = { 18 .get_modes = aspeed_gfx_get_modes, 19 }; 20 21 static const struct drm_connector_funcs aspeed_gfx_connector_funcs = { 22 .fill_modes = drm_helper_probe_single_connector_modes, 23 .destroy = drm_connector_cleanup, 24 .reset = drm_atomic_helper_connector_reset, 25 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, 26 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 27 }; 28 29 int aspeed_gfx_create_output(struct drm_device *drm) 30 { 31 struct aspeed_gfx *priv = to_aspeed_gfx(drm); 32 int ret; 33 34 priv->connector.dpms = DRM_MODE_DPMS_OFF; 35 priv->connector.polled = 0; 36 drm_connector_helper_add(&priv->connector, 37 &aspeed_gfx_connector_helper_funcs); 38 ret = drm_connector_init(drm, &priv->connector, 39 &aspeed_gfx_connector_funcs, 40 DRM_MODE_CONNECTOR_Unknown); 41 return ret; 42 } 43