36 #define to_exynos_encoder(x) container_of(x, struct exynos_drm_encoder,\
56 static void exynos_drm_connector_power(
struct drm_encoder *encoder,
int mode)
63 DRM_DEBUG_KMS(
"connector[%d] dpms[%d]\n",
64 connector->
base.id, mode);
78 DRM_DEBUG_KMS(
"%s, encoder dpms: %d\n", __FILE__, mode);
80 if (exynos_encoder->
dpms == mode) {
81 DRM_DEBUG_KMS(
"desired dpms mode is same as previous one.\n");
89 if (manager_ops && manager_ops->
apply)
93 exynos_drm_connector_power(encoder, mode);
99 exynos_drm_connector_power(encoder, mode);
101 exynos_encoder->
updated =
false;
104 DRM_ERROR(
"unspecified mode %d\n", mode);
112 exynos_drm_encoder_mode_fixup(
struct drm_encoder *encoder,
121 DRM_DEBUG_KMS(
"%s\n", __FILE__);
124 if (connector->
encoder == encoder)
127 mode, adjusted_mode);
133 static void disable_plane_to_crtc(
struct drm_device *dev,
146 if (plane->
crtc == old_crtc) {
157 plane->
crtc = new_crtc;
158 plane->
funcs->disable_plane(plane);
163 static void exynos_drm_encoder_mode_set(
struct drm_encoder *encoder,
172 DRM_DEBUG_KMS(
"%s\n", __FILE__);
175 if (connector->
encoder == encoder) {
187 disable_plane_to_crtc(dev,
193 manager_ops = manager->
ops;
195 if (manager_ops && manager_ops->
mode_set)
204 static void exynos_drm_encoder_prepare(
struct drm_encoder *encoder)
206 DRM_DEBUG_KMS(
"%s\n", __FILE__);
211 static void exynos_drm_encoder_commit(
struct drm_encoder *encoder)
217 DRM_DEBUG_KMS(
"%s\n", __FILE__);
219 if (manager_ops && manager_ops->
commit)
228 exynos_encoder->
updated =
true;
237 static void exynos_drm_encoder_disable(
struct drm_encoder *encoder)
247 plane->
funcs->disable_plane(plane);
252 .dpms = exynos_drm_encoder_dpms,
253 .mode_fixup = exynos_drm_encoder_mode_fixup,
254 .mode_set = exynos_drm_encoder_mode_set,
255 .prepare = exynos_drm_encoder_prepare,
256 .commit = exynos_drm_encoder_commit,
257 .disable = exynos_drm_encoder_disable,
260 static void exynos_drm_encoder_destroy(
struct drm_encoder *encoder)
265 DRM_DEBUG_KMS(
"%s\n", __FILE__);
267 exynos_encoder->
manager->pipe = -1;
270 kfree(exynos_encoder);
274 .destroy = exynos_drm_encoder_destroy,
277 static unsigned int exynos_drm_encoder_clones(
struct drm_encoder *encoder)
283 exynos_encoder->
manager->display_ops;
284 unsigned int clone_mask = 0;
288 switch (display_ops->
type) {
292 clone_mask |= (1 << (cnt++));
306 DRM_DEBUG_KMS(
"%s\n", __FILE__);
320 DRM_DEBUG_KMS(
"%s\n", __FILE__);
322 if (!manager || !possible_crtcs)
328 exynos_encoder = kzalloc(
sizeof(*exynos_encoder),
GFP_KERNEL);
329 if (!exynos_encoder) {
330 DRM_ERROR(
"failed to allocate encoder\n");
339 DRM_DEBUG_KMS(
"possible_crtcs = 0x%x\n", encoder->
possible_crtcs);
344 drm_encoder_helper_add(encoder, &exynos_encoder_helper_funcs);
346 DRM_DEBUG_KMS(
"encoder has been created\n");
369 if (!encoder->
crtc) {
371 if (manager->
pipe < 0 ||
372 private->crtc[manager->
pipe] != crtc)
375 if (encoder->
crtc != crtc)
388 int crtc = *(
int *)data;
390 if (manager->
pipe != crtc)
402 int crtc = *(
int *)data;
404 if (manager->
pipe != crtc)
416 int mode = *(
int *)data;
418 DRM_DEBUG_KMS(
"%s\n", __FILE__);
420 if (manager_ops && manager_ops->
dpms)
421 manager_ops->
dpms(manager->
dev, mode);
438 int pipe = *(
int *)data;
440 DRM_DEBUG_KMS(
"%s\n", __FILE__);
456 DRM_DEBUG_KMS(
"%s\n", __FILE__);
458 if (overlay_ops && overlay_ops->
mode_set)
469 DRM_DEBUG_KMS(
"%s\n", __FILE__);
474 if (overlay_ops && overlay_ops->
commit)
485 DRM_DEBUG_KMS(
"%s\n", __FILE__);
490 if (overlay_ops && overlay_ops->
enable)
501 DRM_DEBUG_KMS(
"%s\n", __FILE__);
506 if (overlay_ops && overlay_ops->
disable)