blob: ec627fa2f5d53abd61e2ac4df9df716db2845a53 [file] [log] [blame]
Inki Dae1c248b72011-10-04 19:19:01 +09001/* exynos_drm_encoder.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * Authors:
5 * Inki Dae <inki.dae@samsung.com>
6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 *
Inki Daed81aecb2012-12-18 02:30:17 +09009 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
Inki Dae1c248b72011-10-04 19:19:01 +090013 */
14
David Howells760285e2012-10-02 18:01:07 +010015#include <drm/drmP.h>
16#include <drm/drm_crtc_helper.h>
Inki Dae1c248b72011-10-04 19:19:01 +090017
18#include "exynos_drm_drv.h"
Inki Dae1c248b72011-10-04 19:19:01 +090019#include "exynos_drm_encoder.h"
Inki Dae50caf252012-08-20 21:29:25 +090020#include "exynos_drm_connector.h"
Inki Dae1c248b72011-10-04 19:19:01 +090021
22#define to_exynos_encoder(x) container_of(x, struct exynos_drm_encoder,\
23 drm_encoder)
24
25/*
26 * exynos specific encoder structure.
27 *
28 * @drm_encoder: encoder object.
29 * @manager: specific encoder has its own manager to control a hardware
30 * appropriately and we can access a hardware drawing on this manager.
Inki Daeec05da92011-12-06 11:06:54 +090031 * @dpms: store the encoder dpms value.
Inki Dae44c91692012-10-18 18:59:55 +090032 * @updated: indicate whether overlay data updating is needed or not.
Inki Dae1c248b72011-10-04 19:19:01 +090033 */
34struct exynos_drm_encoder {
Inki Dae1b85a072012-08-17 17:58:38 +090035 struct drm_crtc *old_crtc;
Inki Dae1c248b72011-10-04 19:19:01 +090036 struct drm_encoder drm_encoder;
37 struct exynos_drm_manager *manager;
Inki Dae44c91692012-10-18 18:59:55 +090038 int dpms;
39 bool updated;
Inki Dae1c248b72011-10-04 19:19:01 +090040};
41
Inki Dae50caf252012-08-20 21:29:25 +090042static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode)
Inki Dae1c248b72011-10-04 19:19:01 +090043{
44 struct drm_device *dev = encoder->dev;
45 struct drm_connector *connector;
Joonyoung Shim396464d2011-11-14 15:20:49 +090046
Inki Dae1c248b72011-10-04 19:19:01 +090047 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
Inki Dae58f6aad2012-09-24 20:04:24 +090048 if (exynos_drm_best_encoder(connector) == encoder) {
Joonyoung Shimd2716c82011-11-04 17:04:45 +090049 DRM_DEBUG_KMS("connector[%d] dpms[%d]\n",
50 connector->base.id, mode);
Inki Dae50caf252012-08-20 21:29:25 +090051
52 exynos_drm_display_power(connector, mode);
Inki Dae1c248b72011-10-04 19:19:01 +090053 }
54 }
55}
56
Inki Daeec05da92011-12-06 11:06:54 +090057static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
58{
59 struct drm_device *dev = encoder->dev;
60 struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
61 struct exynos_drm_manager_ops *manager_ops = manager->ops;
62 struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
63
YoungJun Chobca34c92013-06-12 10:40:52 +090064 DRM_DEBUG_KMS("encoder dpms: %d\n", mode);
Inki Daeec05da92011-12-06 11:06:54 +090065
66 if (exynos_encoder->dpms == mode) {
67 DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
68 return;
69 }
70
71 mutex_lock(&dev->struct_mutex);
72
73 switch (mode) {
74 case DRM_MODE_DPMS_ON:
75 if (manager_ops && manager_ops->apply)
Inki Dae44c91692012-10-18 18:59:55 +090076 if (!exynos_encoder->updated)
Sean Paulbb7704d2014-01-30 16:19:06 -050077 manager_ops->apply(manager);
Inki Dae44c91692012-10-18 18:59:55 +090078
Inki Dae50caf252012-08-20 21:29:25 +090079 exynos_drm_connector_power(encoder, mode);
Inki Daeec05da92011-12-06 11:06:54 +090080 exynos_encoder->dpms = mode;
81 break;
82 case DRM_MODE_DPMS_STANDBY:
83 case DRM_MODE_DPMS_SUSPEND:
84 case DRM_MODE_DPMS_OFF:
Inki Dae50caf252012-08-20 21:29:25 +090085 exynos_drm_connector_power(encoder, mode);
Inki Daeec05da92011-12-06 11:06:54 +090086 exynos_encoder->dpms = mode;
Inki Dae44c91692012-10-18 18:59:55 +090087 exynos_encoder->updated = false;
Inki Daeec05da92011-12-06 11:06:54 +090088 break;
89 default:
90 DRM_ERROR("unspecified mode %d\n", mode);
91 break;
92 }
93
94 mutex_unlock(&dev->struct_mutex);
95}
96
Inki Dae1c248b72011-10-04 19:19:01 +090097static bool
98exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder,
Laurent Pincharte811f5a2012-07-17 17:56:50 +020099 const struct drm_display_mode *mode,
Inki Dae1c248b72011-10-04 19:19:01 +0900100 struct drm_display_mode *adjusted_mode)
101{
Inki Dae1de425b2012-03-16 18:47:04 +0900102 struct drm_device *dev = encoder->dev;
103 struct drm_connector *connector;
104 struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
105 struct exynos_drm_manager_ops *manager_ops = manager->ops;
106
Inki Dae1de425b2012-03-16 18:47:04 +0900107 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
108 if (connector->encoder == encoder)
109 if (manager_ops && manager_ops->mode_fixup)
Sean Paulbb7704d2014-01-30 16:19:06 -0500110 manager_ops->mode_fixup(manager, connector,
Inki Dae1de425b2012-03-16 18:47:04 +0900111 mode, adjusted_mode);
112 }
Inki Dae1c248b72011-10-04 19:19:01 +0900113
114 return true;
115}
116
Inki Dae1b85a072012-08-17 17:58:38 +0900117static void disable_plane_to_crtc(struct drm_device *dev,
118 struct drm_crtc *old_crtc,
119 struct drm_crtc *new_crtc)
120{
121 struct drm_plane *plane;
122
123 /*
124 * if old_crtc isn't same as encoder->crtc then it means that
125 * user changed crtc id to another one so the plane to old_crtc
126 * should be disabled and plane->crtc should be set to new_crtc
127 * (encoder->crtc)
128 */
129 list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
130 if (plane->crtc == old_crtc) {
131 /*
132 * do not change below call order.
133 *
134 * plane->funcs->disable_plane call checks
135 * if encoder->crtc is same as plane->crtc and if same
Sean Paul1c6244c2014-01-30 16:19:02 -0500136 * then manager_ops->win_disable callback will be called
Inki Dae1b85a072012-08-17 17:58:38 +0900137 * to diasble current hw overlay so plane->crtc should
138 * have new_crtc because new_crtc was set to
139 * encoder->crtc in advance.
140 */
141 plane->crtc = new_crtc;
142 plane->funcs->disable_plane(plane);
143 }
144 }
145}
146
Inki Dae1c248b72011-10-04 19:19:01 +0900147static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder,
148 struct drm_display_mode *mode,
149 struct drm_display_mode *adjusted_mode)
150{
151 struct drm_device *dev = encoder->dev;
152 struct drm_connector *connector;
Inki Dae1b85a072012-08-17 17:58:38 +0900153 struct exynos_drm_manager *manager;
154 struct exynos_drm_manager_ops *manager_ops;
Inki Dae1c248b72011-10-04 19:19:01 +0900155
Inki Dae1c248b72011-10-04 19:19:01 +0900156 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
Inki Dae1b85a072012-08-17 17:58:38 +0900157 if (connector->encoder == encoder) {
158 struct exynos_drm_encoder *exynos_encoder;
159
160 exynos_encoder = to_exynos_encoder(encoder);
161
162 if (exynos_encoder->old_crtc != encoder->crtc &&
163 exynos_encoder->old_crtc) {
164
165 /*
166 * disable a plane to old crtc and change
167 * crtc of the plane to new one.
168 */
169 disable_plane_to_crtc(dev,
170 exynos_encoder->old_crtc,
171 encoder->crtc);
172 }
173
174 manager = exynos_drm_get_manager(encoder);
175 manager_ops = manager->ops;
176
Inki Dae1c248b72011-10-04 19:19:01 +0900177 if (manager_ops && manager_ops->mode_set)
Sean Paulbb7704d2014-01-30 16:19:06 -0500178 manager_ops->mode_set(manager, adjusted_mode);
Inki Dae1b85a072012-08-17 17:58:38 +0900179
180 exynos_encoder->old_crtc = encoder->crtc;
181 }
Inki Dae1c248b72011-10-04 19:19:01 +0900182 }
183}
184
185static void exynos_drm_encoder_prepare(struct drm_encoder *encoder)
186{
Inki Dae1c248b72011-10-04 19:19:01 +0900187 /* drm framework doesn't check NULL. */
188}
189
190static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
191{
Inki Dae44c91692012-10-18 18:59:55 +0900192 struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
193 struct exynos_drm_manager *manager = exynos_encoder->manager;
Inki Dae1c248b72011-10-04 19:19:01 +0900194 struct exynos_drm_manager_ops *manager_ops = manager->ops;
Inki Dae1c248b72011-10-04 19:19:01 +0900195
Inki Dae1c248b72011-10-04 19:19:01 +0900196 if (manager_ops && manager_ops->commit)
Sean Paulbb7704d2014-01-30 16:19:06 -0500197 manager_ops->commit(manager);
Inki Dae44c91692012-10-18 18:59:55 +0900198
199 /*
200 * this will avoid one issue that overlay data is updated to
201 * real hardware two times.
202 * And this variable will be used to check if the data was
203 * already updated or not by exynos_drm_encoder_dpms function.
204 */
205 exynos_encoder->updated = true;
Inki Dae8e8755d2012-11-14 20:41:35 +0900206
207 /*
208 * In case of setcrtc, there is no way to update encoder's dpms
209 * so update it here.
210 */
211 exynos_encoder->dpms = DRM_MODE_DPMS_ON;
Inki Dae1c248b72011-10-04 19:19:01 +0900212}
213
Inki Dae1daa8922012-11-22 17:41:23 +0900214void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb)
215{
216 struct exynos_drm_encoder *exynos_encoder;
Prathyush Kf74085a2012-12-06 20:16:00 +0530217 struct exynos_drm_manager_ops *ops;
Inki Dae1daa8922012-11-22 17:41:23 +0900218 struct drm_device *dev = fb->dev;
219 struct drm_encoder *encoder;
220
221 /*
222 * make sure that overlay data are updated to real hardware
223 * for all encoders.
224 */
225 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
226 exynos_encoder = to_exynos_encoder(encoder);
Prathyush Kf74085a2012-12-06 20:16:00 +0530227 ops = exynos_encoder->manager->ops;
Inki Dae1daa8922012-11-22 17:41:23 +0900228
229 /*
230 * wait for vblank interrupt
231 * - this makes sure that overlay data are updated to
232 * real hardware.
233 */
Prathyush Kf74085a2012-12-06 20:16:00 +0530234 if (ops->wait_for_vblank)
Sean Paulbb7704d2014-01-30 16:19:06 -0500235 ops->wait_for_vblank(exynos_encoder->manager);
Inki Dae1daa8922012-11-22 17:41:23 +0900236 }
237}
238
239
Inki Daebcf4cef2012-08-24 10:54:12 -0700240static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
241{
242 struct drm_plane *plane;
243 struct drm_device *dev = encoder->dev;
244
245 exynos_drm_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
246
247 /* all planes connected to this encoder should be also disabled. */
248 list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
249 if (plane->crtc == encoder->crtc)
250 plane->funcs->disable_plane(plane);
251 }
252}
253
Inki Dae1c248b72011-10-04 19:19:01 +0900254static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = {
255 .dpms = exynos_drm_encoder_dpms,
256 .mode_fixup = exynos_drm_encoder_mode_fixup,
257 .mode_set = exynos_drm_encoder_mode_set,
258 .prepare = exynos_drm_encoder_prepare,
259 .commit = exynos_drm_encoder_commit,
Inki Daebcf4cef2012-08-24 10:54:12 -0700260 .disable = exynos_drm_encoder_disable,
Inki Dae1c248b72011-10-04 19:19:01 +0900261};
262
263static void exynos_drm_encoder_destroy(struct drm_encoder *encoder)
264{
265 struct exynos_drm_encoder *exynos_encoder =
266 to_exynos_encoder(encoder);
267
Inki Dae1c248b72011-10-04 19:19:01 +0900268 exynos_encoder->manager->pipe = -1;
269
270 drm_encoder_cleanup(encoder);
Inki Dae1c248b72011-10-04 19:19:01 +0900271 kfree(exynos_encoder);
272}
273
274static struct drm_encoder_funcs exynos_encoder_funcs = {
275 .destroy = exynos_drm_encoder_destroy,
276};
277
Inki Daed081f562012-02-15 11:25:19 +0900278static unsigned int exynos_drm_encoder_clones(struct drm_encoder *encoder)
279{
280 struct drm_encoder *clone;
281 struct drm_device *dev = encoder->dev;
282 struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
283 struct exynos_drm_display_ops *display_ops =
284 exynos_encoder->manager->display_ops;
285 unsigned int clone_mask = 0;
286 int cnt = 0;
287
288 list_for_each_entry(clone, &dev->mode_config.encoder_list, head) {
289 switch (display_ops->type) {
290 case EXYNOS_DISPLAY_TYPE_LCD:
291 case EXYNOS_DISPLAY_TYPE_HDMI:
Inki Daeb73d1232012-03-21 10:55:26 +0900292 case EXYNOS_DISPLAY_TYPE_VIDI:
Inki Daed081f562012-02-15 11:25:19 +0900293 clone_mask |= (1 << (cnt++));
294 break;
295 default:
296 continue;
297 }
298 }
299
300 return clone_mask;
301}
302
303void exynos_drm_encoder_setup(struct drm_device *dev)
304{
305 struct drm_encoder *encoder;
306
Inki Daed081f562012-02-15 11:25:19 +0900307 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
308 encoder->possible_clones = exynos_drm_encoder_clones(encoder);
309}
310
Inki Dae1c248b72011-10-04 19:19:01 +0900311struct drm_encoder *
312exynos_drm_encoder_create(struct drm_device *dev,
313 struct exynos_drm_manager *manager,
314 unsigned int possible_crtcs)
315{
316 struct drm_encoder *encoder;
317 struct exynos_drm_encoder *exynos_encoder;
Sean Paul1f9cafc32014-01-30 16:19:03 -0500318 int ret;
Inki Dae1c248b72011-10-04 19:19:01 +0900319
Inki Dae1c248b72011-10-04 19:19:01 +0900320 if (!manager || !possible_crtcs)
321 return NULL;
322
323 if (!manager->dev)
324 return NULL;
325
326 exynos_encoder = kzalloc(sizeof(*exynos_encoder), GFP_KERNEL);
Sachin Kamat38bb5252013-08-19 19:04:55 +0900327 if (!exynos_encoder)
Inki Dae1c248b72011-10-04 19:19:01 +0900328 return NULL;
Inki Dae1c248b72011-10-04 19:19:01 +0900329
Inki Daeec05da92011-12-06 11:06:54 +0900330 exynos_encoder->dpms = DRM_MODE_DPMS_OFF;
Inki Dae1c248b72011-10-04 19:19:01 +0900331 exynos_encoder->manager = manager;
332 encoder = &exynos_encoder->drm_encoder;
333 encoder->possible_crtcs = possible_crtcs;
334
335 DRM_DEBUG_KMS("possible_crtcs = 0x%x\n", encoder->possible_crtcs);
336
337 drm_encoder_init(dev, encoder, &exynos_encoder_funcs,
338 DRM_MODE_ENCODER_TMDS);
339
340 drm_encoder_helper_add(encoder, &exynos_encoder_helper_funcs);
341
Sean Paul1f9cafc32014-01-30 16:19:03 -0500342 if (manager->ops && manager->ops->initialize) {
Sean Paulbb7704d2014-01-30 16:19:06 -0500343 ret = manager->ops->initialize(manager, dev);
Sean Paul1f9cafc32014-01-30 16:19:03 -0500344 if (ret) {
345 DRM_ERROR("Manager initialize failed %d\n", ret);
346 goto error;
347 }
348 }
349
350 if (manager->display_ops && manager->display_ops->initialize) {
351 ret = manager->display_ops->initialize(manager->dev, dev);
352 if (ret) {
353 DRM_ERROR("Display initialize failed %d\n", ret);
354 goto error;
355 }
356 }
357
Inki Dae1c248b72011-10-04 19:19:01 +0900358 DRM_DEBUG_KMS("encoder has been created\n");
359
360 return encoder;
Sean Paul1f9cafc32014-01-30 16:19:03 -0500361
362error:
363 exynos_drm_encoder_destroy(&exynos_encoder->drm_encoder);
364 return NULL;
Inki Dae1c248b72011-10-04 19:19:01 +0900365}
366
367struct exynos_drm_manager *exynos_drm_get_manager(struct drm_encoder *encoder)
368{
369 return to_exynos_encoder(encoder)->manager;
370}
371
372void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data,
373 void (*fn)(struct drm_encoder *, void *))
374{
375 struct drm_device *dev = crtc->dev;
376 struct drm_encoder *encoder;
Joonyoung Shimd2716c82011-11-04 17:04:45 +0900377 struct exynos_drm_private *private = dev->dev_private;
378 struct exynos_drm_manager *manager;
Inki Dae1c248b72011-10-04 19:19:01 +0900379
380 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
Joonyoung Shimd2716c82011-11-04 17:04:45 +0900381 /*
382 * if crtc is detached from encoder, check pipe,
383 * otherwise check crtc attached to encoder
384 */
385 if (!encoder->crtc) {
386 manager = to_exynos_encoder(encoder)->manager;
387 if (manager->pipe < 0 ||
388 private->crtc[manager->pipe] != crtc)
389 continue;
390 } else {
391 if (encoder->crtc != crtc)
392 continue;
393 }
Inki Dae1c248b72011-10-04 19:19:01 +0900394
395 fn(encoder, data);
396 }
397}
398
399void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data)
400{
401 struct exynos_drm_manager *manager =
402 to_exynos_encoder(encoder)->manager;
403 struct exynos_drm_manager_ops *manager_ops = manager->ops;
404 int crtc = *(int *)data;
405
Joonyoung Shimd249ce02012-06-27 14:27:02 +0900406 if (manager->pipe != crtc)
407 return;
Inki Dae1c248b72011-10-04 19:19:01 +0900408
409 if (manager_ops->enable_vblank)
Sean Paulbb7704d2014-01-30 16:19:06 -0500410 manager_ops->enable_vblank(manager);
Inki Dae1c248b72011-10-04 19:19:01 +0900411}
412
413void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)
414{
415 struct exynos_drm_manager *manager =
416 to_exynos_encoder(encoder)->manager;
417 struct exynos_drm_manager_ops *manager_ops = manager->ops;
418 int crtc = *(int *)data;
419
Joonyoung Shimd249ce02012-06-27 14:27:02 +0900420 if (manager->pipe != crtc)
421 return;
Inki Dae1c248b72011-10-04 19:19:01 +0900422
423 if (manager_ops->disable_vblank)
Sean Paulbb7704d2014-01-30 16:19:06 -0500424 manager_ops->disable_vblank(manager);
Inki Dae1c248b72011-10-04 19:19:01 +0900425}
426
Inki Daeec05da92011-12-06 11:06:54 +0900427void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)
428{
Inki Daeec05da92011-12-06 11:06:54 +0900429 struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
430 struct exynos_drm_manager *manager = exynos_encoder->manager;
431 struct exynos_drm_manager_ops *manager_ops = manager->ops;
Inki Daeec05da92011-12-06 11:06:54 +0900432 int mode = *(int *)data;
433
Inki Daeec05da92011-12-06 11:06:54 +0900434 if (manager_ops && manager_ops->dpms)
Sean Paulbb7704d2014-01-30 16:19:06 -0500435 manager_ops->dpms(manager, mode);
Inki Daeec05da92011-12-06 11:06:54 +0900436
437 /*
Inki Daeec05da92011-12-06 11:06:54 +0900438 * if this condition is ok then it means that the crtc is already
439 * detached from encoder and last function for detaching is properly
440 * done, so clear pipe from manager to prevent repeated call.
441 */
442 if (mode > DRM_MODE_DPMS_ON) {
443 if (!encoder->crtc)
444 manager->pipe = -1;
445 }
446}
447
Joonyoung Shimd249ce02012-06-27 14:27:02 +0900448void exynos_drm_encoder_crtc_pipe(struct drm_encoder *encoder, void *data)
449{
450 struct exynos_drm_manager *manager =
451 to_exynos_encoder(encoder)->manager;
452 int pipe = *(int *)data;
453
Joonyoung Shimd249ce02012-06-27 14:27:02 +0900454 /*
455 * when crtc is detached from encoder, this pipe is used
456 * to select manager operation
457 */
458 manager->pipe = pipe;
459}
Joonyoung Shim4070d212012-06-27 14:27:05 +0900460
461void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data)
462{
463 struct exynos_drm_manager *manager =
464 to_exynos_encoder(encoder)->manager;
Sean Paul1c6244c2014-01-30 16:19:02 -0500465 struct exynos_drm_manager_ops *manager_ops = manager->ops;
Joonyoung Shim4070d212012-06-27 14:27:05 +0900466 struct exynos_drm_overlay *overlay = data;
467
Sean Paul1c6244c2014-01-30 16:19:02 -0500468 if (manager_ops && manager_ops->win_mode_set)
Sean Paulbb7704d2014-01-30 16:19:06 -0500469 manager_ops->win_mode_set(manager, overlay);
Joonyoung Shim4070d212012-06-27 14:27:05 +0900470}
471
472void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data)
473{
474 struct exynos_drm_manager *manager =
475 to_exynos_encoder(encoder)->manager;
Sean Paul1c6244c2014-01-30 16:19:02 -0500476 struct exynos_drm_manager_ops *manager_ops = manager->ops;
Joonyoung Shim4070d212012-06-27 14:27:05 +0900477 int zpos = DEFAULT_ZPOS;
478
Joonyoung Shim4070d212012-06-27 14:27:05 +0900479 if (data)
480 zpos = *(int *)data;
481
Sean Paul1c6244c2014-01-30 16:19:02 -0500482 if (manager_ops && manager_ops->win_commit)
Sean Paulbb7704d2014-01-30 16:19:06 -0500483 manager_ops->win_commit(manager, zpos);
Joonyoung Shim4070d212012-06-27 14:27:05 +0900484}
485
Joonyoung Shimcf5188a2012-06-27 14:27:09 +0900486void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data)
487{
488 struct exynos_drm_manager *manager =
489 to_exynos_encoder(encoder)->manager;
Sean Paul1c6244c2014-01-30 16:19:02 -0500490 struct exynos_drm_manager_ops *manager_ops = manager->ops;
Joonyoung Shimcf5188a2012-06-27 14:27:09 +0900491 int zpos = DEFAULT_ZPOS;
492
Joonyoung Shimcf5188a2012-06-27 14:27:09 +0900493 if (data)
494 zpos = *(int *)data;
495
Sean Paul1c6244c2014-01-30 16:19:02 -0500496 if (manager_ops && manager_ops->win_enable)
Sean Paulbb7704d2014-01-30 16:19:06 -0500497 manager_ops->win_enable(manager, zpos);
Joonyoung Shimcf5188a2012-06-27 14:27:09 +0900498}
499
Joonyoung Shim4070d212012-06-27 14:27:05 +0900500void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data)
501{
502 struct exynos_drm_manager *manager =
503 to_exynos_encoder(encoder)->manager;
Sean Paul1c6244c2014-01-30 16:19:02 -0500504 struct exynos_drm_manager_ops *manager_ops = manager->ops;
Joonyoung Shim4070d212012-06-27 14:27:05 +0900505 int zpos = DEFAULT_ZPOS;
506
Joonyoung Shim4070d212012-06-27 14:27:05 +0900507 if (data)
508 zpos = *(int *)data;
509
Sean Paul1c6244c2014-01-30 16:19:02 -0500510 if (manager_ops && manager_ops->win_disable)
Sean Paulbb7704d2014-01-30 16:19:06 -0500511 manager_ops->win_disable(manager, zpos);
Joonyoung Shim4070d212012-06-27 14:27:05 +0900512}