aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/exynos
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2014-01-30 16:19:08 -0500
committerInki Dae <daeinki@gmail.com>2014-03-23 11:36:30 -0400
commite5b89916bc24f8b290d69229b6cbbdf35add1904 (patch)
tree9e34f9639f8dd956a3fdce6c8c2f18d0e4f51005 /drivers/gpu/drm/exynos
parent87244fa604201c7eee643e5e5e1a19e1f7fc5e3a (diff)
drm/exynos: Remove dpms link between encoder/connector
This patch removes the call from encoder dpms into connector dpms (which will then call back into encoder dpms through the helper function). The callback is likely to keep connector->dpms in the right state when initiating dpms from crtc or encoder, but this isn't the right way to do it. This patch is the first step towards rationalizing power management in the exynos drm driver. Signed-off-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu/drm/exynos')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_connector.c42
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_connector.h4
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_encoder.c50
3 files changed, 8 insertions, 88 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index 23b69d836512..ca270e25f0cd 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -26,7 +26,6 @@ struct exynos_drm_connector {
26 struct drm_connector drm_connector; 26 struct drm_connector drm_connector;
27 uint32_t encoder_id; 27 uint32_t encoder_id;
28 struct exynos_drm_manager *manager; 28 struct exynos_drm_manager *manager;
29 uint32_t dpms;
30}; 29};
31 30
32static int exynos_drm_connector_get_modes(struct drm_connector *connector) 31static int exynos_drm_connector_get_modes(struct drm_connector *connector)
@@ -119,7 +118,8 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector,
119 return ret; 118 return ret;
120} 119}
121 120
122struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector) 121static struct drm_encoder *exynos_drm_best_encoder(
122 struct drm_connector *connector)
123{ 123{
124 struct drm_device *dev = connector->dev; 124 struct drm_device *dev = connector->dev;
125 struct exynos_drm_connector *exynos_connector = 125 struct exynos_drm_connector *exynos_connector =
@@ -146,41 +146,6 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = {
146 .best_encoder = exynos_drm_best_encoder, 146 .best_encoder = exynos_drm_best_encoder,
147}; 147};
148 148
149void exynos_drm_display_power(struct drm_connector *connector, int mode)
150{
151 struct drm_encoder *encoder = exynos_drm_best_encoder(connector);
152 struct exynos_drm_connector *exynos_connector;
153 struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
154 struct exynos_drm_display_ops *display_ops = manager->display_ops;
155
156 exynos_connector = to_exynos_connector(connector);
157
158 if (exynos_connector->dpms == mode) {
159 DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
160 return;
161 }
162
163 if (display_ops && display_ops->power_on)
164 display_ops->power_on(manager->dev, mode);
165
166 exynos_connector->dpms = mode;
167}
168
169static void exynos_drm_connector_dpms(struct drm_connector *connector,
170 int mode)
171{
172 /*
173 * in case that drm_crtc_helper_set_mode() is called,
174 * encoder/crtc->funcs->dpms() will be just returned
175 * because they already were DRM_MODE_DPMS_ON so only
176 * exynos_drm_display_power() will be called.
177 */
178 drm_helper_connector_dpms(connector, mode);
179
180 exynos_drm_display_power(connector, mode);
181
182}
183
184static int exynos_drm_connector_fill_modes(struct drm_connector *connector, 149static int exynos_drm_connector_fill_modes(struct drm_connector *connector,
185 unsigned int max_width, unsigned int max_height) 150 unsigned int max_width, unsigned int max_height)
186{ 151{
@@ -236,7 +201,7 @@ static void exynos_drm_connector_destroy(struct drm_connector *connector)
236} 201}
237 202
238static struct drm_connector_funcs exynos_connector_funcs = { 203static struct drm_connector_funcs exynos_connector_funcs = {
239 .dpms = exynos_drm_connector_dpms, 204 .dpms = drm_helper_connector_dpms,
240 .fill_modes = exynos_drm_connector_fill_modes, 205 .fill_modes = exynos_drm_connector_fill_modes,
241 .detect = exynos_drm_connector_detect, 206 .detect = exynos_drm_connector_detect,
242 .destroy = exynos_drm_connector_destroy, 207 .destroy = exynos_drm_connector_destroy,
@@ -281,7 +246,6 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
281 246
282 exynos_connector->encoder_id = encoder->base.id; 247 exynos_connector->encoder_id = encoder->base.id;
283 exynos_connector->manager = manager; 248 exynos_connector->manager = manager;
284 exynos_connector->dpms = DRM_MODE_DPMS_OFF;
285 connector->dpms = DRM_MODE_DPMS_OFF; 249 connector->dpms = DRM_MODE_DPMS_OFF;
286 connector->encoder = encoder; 250 connector->encoder = encoder;
287 251
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.h b/drivers/gpu/drm/exynos/exynos_drm_connector.h
index 547c6b590357..4eb20d78379a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.h
@@ -17,8 +17,4 @@
17struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, 17struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
18 struct drm_encoder *encoder); 18 struct drm_encoder *encoder);
19 19
20struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector);
21
22void exynos_drm_display_power(struct drm_connector *connector, int mode);
23
24#endif 20#endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 19ee84da5e08..df4b2852b2d1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -29,35 +29,19 @@
29 * @manager: specific encoder has its own manager to control a hardware 29 * @manager: specific encoder has its own manager to control a hardware
30 * appropriately and we can access a hardware drawing on this manager. 30 * appropriately and we can access a hardware drawing on this manager.
31 * @dpms: store the encoder dpms value. 31 * @dpms: store the encoder dpms value.
32 * @updated: indicate whether overlay data updating is needed or not.
33 */ 32 */
34struct exynos_drm_encoder { 33struct exynos_drm_encoder {
35 struct drm_crtc *old_crtc; 34 struct drm_crtc *old_crtc;
36 struct drm_encoder drm_encoder; 35 struct drm_encoder drm_encoder;
37 struct exynos_drm_manager *manager; 36 struct exynos_drm_manager *manager;
38 int dpms; 37 int dpms;
39 bool updated;
40}; 38};
41 39
42static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode)
43{
44 struct drm_device *dev = encoder->dev;
45 struct drm_connector *connector;
46
47 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
48 if (exynos_drm_best_encoder(connector) == encoder) {
49 DRM_DEBUG_KMS("connector[%d] dpms[%d]\n",
50 connector->base.id, mode);
51
52 exynos_drm_display_power(connector, mode);
53 }
54 }
55}
56
57static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) 40static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
58{ 41{
59 struct drm_device *dev = encoder->dev; 42 struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
60 struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); 43 struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
44 struct exynos_drm_display_ops *display_ops = manager->display_ops;
61 45
62 DRM_DEBUG_KMS("encoder dpms: %d\n", mode); 46 DRM_DEBUG_KMS("encoder dpms: %d\n", mode);
63 47
@@ -66,26 +50,10 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
66 return; 50 return;
67 } 51 }
68 52
69 mutex_lock(&dev->struct_mutex); 53 if (display_ops && display_ops->power_on)
70 54 display_ops->power_on(manager->ctx, mode);
71 switch (mode) {
72 case DRM_MODE_DPMS_ON:
73 exynos_drm_connector_power(encoder, mode);
74 exynos_encoder->dpms = mode;
75 break;
76 case DRM_MODE_DPMS_STANDBY:
77 case DRM_MODE_DPMS_SUSPEND:
78 case DRM_MODE_DPMS_OFF:
79 exynos_drm_connector_power(encoder, mode);
80 exynos_encoder->dpms = mode;
81 exynos_encoder->updated = false;
82 break;
83 default:
84 DRM_ERROR("unspecified mode %d\n", mode);
85 break;
86 }
87 55
88 mutex_unlock(&dev->struct_mutex); 56 exynos_encoder->dpms = mode;
89} 57}
90 58
91static bool 59static bool
@@ -191,14 +159,6 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
191 manager_ops->commit(manager); 159 manager_ops->commit(manager);
192 160
193 /* 161 /*
194 * this will avoid one issue that overlay data is updated to
195 * real hardware two times.
196 * And this variable will be used to check if the data was
197 * already updated or not by exynos_drm_encoder_dpms function.
198 */
199 exynos_encoder->updated = true;
200
201 /*
202 * In case of setcrtc, there is no way to update encoder's dpms 162 * In case of setcrtc, there is no way to update encoder's dpms
203 * so update it here. 163 * so update it here.
204 */ 164 */