diff options
author | Inki Dae <inki.dae@samsung.com> | 2011-10-19 04:16:55 -0400 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2011-11-15 00:58:45 -0500 |
commit | adb6b1596743e93e50fad2ff26d9604cda4361ab (patch) | |
tree | 8ab6f7703e11bc655f2a16692a56bc64e365acd3 /drivers | |
parent | 8b58dfe0290cb57e3f8601b197f00c23fa39a60d (diff) |
drm/exynos: added manager object to connector
connector contains some contents for display controller so the connector also
should be able to access controller through manager.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_connector.c | 38 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_encoder.c | 3 |
2 files changed, 33 insertions, 8 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 7ca1274775b7..d33f8039a882 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c | |||
@@ -37,6 +37,8 @@ | |||
37 | 37 | ||
38 | struct exynos_drm_connector { | 38 | struct exynos_drm_connector { |
39 | struct drm_connector drm_connector; | 39 | struct drm_connector drm_connector; |
40 | uint32_t encoder_id; | ||
41 | struct exynos_drm_manager *manager; | ||
40 | }; | 42 | }; |
41 | 43 | ||
42 | /* convert exynos_video_timings to drm_display_mode */ | 44 | /* convert exynos_video_timings to drm_display_mode */ |
@@ -99,8 +101,9 @@ convert_to_video_timing(struct fb_videomode *timing, | |||
99 | 101 | ||
100 | static int exynos_drm_connector_get_modes(struct drm_connector *connector) | 102 | static int exynos_drm_connector_get_modes(struct drm_connector *connector) |
101 | { | 103 | { |
102 | struct exynos_drm_manager *manager = | 104 | struct exynos_drm_connector *exynos_connector = |
103 | exynos_drm_get_manager(connector->encoder); | 105 | to_exynos_connector(connector); |
106 | struct exynos_drm_manager *manager = exynos_connector->manager; | ||
104 | struct exynos_drm_display *display = manager->display; | 107 | struct exynos_drm_display *display = manager->display; |
105 | unsigned int count; | 108 | unsigned int count; |
106 | 109 | ||
@@ -169,8 +172,9 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
169 | static int exynos_drm_connector_mode_valid(struct drm_connector *connector, | 172 | static int exynos_drm_connector_mode_valid(struct drm_connector *connector, |
170 | struct drm_display_mode *mode) | 173 | struct drm_display_mode *mode) |
171 | { | 174 | { |
172 | struct exynos_drm_manager *manager = | 175 | struct exynos_drm_connector *exynos_connector = |
173 | exynos_drm_get_manager(connector->encoder); | 176 | to_exynos_connector(connector); |
177 | struct exynos_drm_manager *manager = exynos_connector->manager; | ||
174 | struct exynos_drm_display *display = manager->display; | 178 | struct exynos_drm_display *display = manager->display; |
175 | struct fb_videomode timing; | 179 | struct fb_videomode timing; |
176 | int ret = MODE_BAD; | 180 | int ret = MODE_BAD; |
@@ -188,9 +192,25 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector, | |||
188 | 192 | ||
189 | struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector) | 193 | struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector) |
190 | { | 194 | { |
195 | struct drm_device *dev = connector->dev; | ||
196 | struct exynos_drm_connector *exynos_connector = | ||
197 | to_exynos_connector(connector); | ||
198 | struct drm_mode_object *obj; | ||
199 | struct drm_encoder *encoder; | ||
200 | |||
191 | DRM_DEBUG_KMS("%s\n", __FILE__); | 201 | DRM_DEBUG_KMS("%s\n", __FILE__); |
192 | 202 | ||
193 | return connector->encoder; | 203 | obj = drm_mode_object_find(dev, exynos_connector->encoder_id, |
204 | DRM_MODE_OBJECT_ENCODER); | ||
205 | if (!obj) { | ||
206 | DRM_DEBUG_KMS("Unknown ENCODER ID %d\n", | ||
207 | exynos_connector->encoder_id); | ||
208 | return NULL; | ||
209 | } | ||
210 | |||
211 | encoder = obj_to_encoder(obj); | ||
212 | |||
213 | return encoder; | ||
194 | } | 214 | } |
195 | 215 | ||
196 | static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { | 216 | static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { |
@@ -203,8 +223,9 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { | |||
203 | static enum drm_connector_status | 223 | static enum drm_connector_status |
204 | exynos_drm_connector_detect(struct drm_connector *connector, bool force) | 224 | exynos_drm_connector_detect(struct drm_connector *connector, bool force) |
205 | { | 225 | { |
206 | struct exynos_drm_manager *manager = | 226 | struct exynos_drm_connector *exynos_connector = |
207 | exynos_drm_get_manager(connector->encoder); | 227 | to_exynos_connector(connector); |
228 | struct exynos_drm_manager *manager = exynos_connector->manager; | ||
208 | struct exynos_drm_display *display = manager->display; | 229 | struct exynos_drm_display *display = manager->display; |
209 | enum drm_connector_status status = connector_status_disconnected; | 230 | enum drm_connector_status status = connector_status_disconnected; |
210 | 231 | ||
@@ -276,7 +297,10 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, | |||
276 | if (err) | 297 | if (err) |
277 | goto err_connector; | 298 | goto err_connector; |
278 | 299 | ||
300 | exynos_connector->encoder_id = encoder->base.id; | ||
301 | exynos_connector->manager = manager; | ||
279 | connector->encoder = encoder; | 302 | connector->encoder = encoder; |
303 | |||
280 | err = drm_mode_connector_attach_encoder(connector, encoder); | 304 | err = drm_mode_connector_attach_encoder(connector, encoder); |
281 | if (err) { | 305 | if (err) { |
282 | DRM_ERROR("failed to attach a connector to a encoder\n"); | 306 | DRM_ERROR("failed to attach a connector to a encoder\n"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 7cf6fa86a67e..4e5535b2b8e3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c | |||
@@ -58,7 +58,8 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
58 | 58 | ||
59 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 59 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
60 | if (connector->encoder == encoder) { | 60 | if (connector->encoder == encoder) { |
61 | struct exynos_drm_display *display = manager->display; | 61 | struct exynos_drm_display *display = |
62 | manager->display; | ||
62 | 63 | ||
63 | if (display && display->power_on) | 64 | if (display && display->power_on) |
64 | display->power_on(manager->dev, mode); | 65 | display->power_on(manager->dev, mode); |