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_edid.h>
8 #include <drm/drm_probe_helper.h>
9
10 #include "aspeed_gfx.h"
11
aspeed_gfx_get_modes(struct drm_connector * connector)12 static int aspeed_gfx_get_modes(struct drm_connector *connector)
13 {
14 return drm_add_modes_noedid(connector, 800, 600);
15 }
16
17 static const struct
18 drm_connector_helper_funcs aspeed_gfx_connector_helper_funcs = {
19 .get_modes = aspeed_gfx_get_modes,
20 };
21
22 static const struct drm_connector_funcs aspeed_gfx_connector_funcs = {
23 .fill_modes = drm_helper_probe_single_connector_modes,
24 .destroy = drm_connector_cleanup,
25 .reset = drm_atomic_helper_connector_reset,
26 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
27 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
28 };
29
aspeed_gfx_create_output(struct drm_device * drm)30 int aspeed_gfx_create_output(struct drm_device *drm)
31 {
32 struct aspeed_gfx *priv = to_aspeed_gfx(drm);
33 int ret;
34
35 priv->connector.dpms = DRM_MODE_DPMS_OFF;
36 priv->connector.polled = 0;
37 drm_connector_helper_add(&priv->connector,
38 &aspeed_gfx_connector_helper_funcs);
39 ret = drm_connector_init(drm, &priv->connector,
40 &aspeed_gfx_connector_funcs,
41 DRM_MODE_CONNECTOR_Unknown);
42 return ret;
43 }
44