Lines Matching refs:ctx
89 struct vidi_context *ctx = crtc->ctx; in vidi_enable_vblank() local
91 if (ctx->suspended) in vidi_enable_vblank()
94 if (!test_and_set_bit(0, &ctx->irq_flags)) in vidi_enable_vblank()
95 ctx->vblank_on = true; in vidi_enable_vblank()
97 ctx->direct_vblank = true; in vidi_enable_vblank()
104 schedule_work(&ctx->work); in vidi_enable_vblank()
111 struct vidi_context *ctx = crtc->ctx; in vidi_disable_vblank() local
113 if (ctx->suspended) in vidi_disable_vblank()
116 if (test_and_clear_bit(0, &ctx->irq_flags)) in vidi_disable_vblank()
117 ctx->vblank_on = false; in vidi_disable_vblank()
122 struct vidi_context *ctx = crtc->ctx; in vidi_win_commit() local
125 if (ctx->suspended) in vidi_win_commit()
131 plane = &ctx->planes[win]; in vidi_win_commit()
137 if (ctx->vblank_on) in vidi_win_commit()
138 schedule_work(&ctx->work); in vidi_win_commit()
143 struct vidi_context *ctx = crtc->ctx; in vidi_win_disable() local
149 plane = &ctx->planes[win]; in vidi_win_disable()
155 static int vidi_power_on(struct vidi_context *ctx, bool enable) in vidi_power_on() argument
166 ctx->suspended = false; in vidi_power_on()
169 if (test_and_clear_bit(0, &ctx->irq_flags)) in vidi_power_on()
170 vidi_enable_vblank(ctx->crtc); in vidi_power_on()
173 plane = &ctx->planes[i]; in vidi_power_on()
175 vidi_win_commit(ctx->crtc, i); in vidi_power_on()
178 ctx->suspended = true; in vidi_power_on()
186 struct vidi_context *ctx = crtc->ctx; in vidi_dpms() local
190 mutex_lock(&ctx->lock); in vidi_dpms()
194 vidi_power_on(ctx, true); in vidi_dpms()
199 vidi_power_on(ctx, false); in vidi_dpms()
206 mutex_unlock(&ctx->lock); in vidi_dpms()
209 static int vidi_ctx_initialize(struct vidi_context *ctx, in vidi_ctx_initialize() argument
214 ctx->drm_dev = drm_dev; in vidi_ctx_initialize()
215 ctx->pipe = priv->pipe++; in vidi_ctx_initialize()
230 struct vidi_context *ctx = container_of(work, struct vidi_context, in vidi_fake_vblank_handler() local
233 if (ctx->pipe < 0) in vidi_fake_vblank_handler()
239 mutex_lock(&ctx->lock); in vidi_fake_vblank_handler()
241 if (ctx->direct_vblank) { in vidi_fake_vblank_handler()
242 drm_handle_vblank(ctx->drm_dev, ctx->pipe); in vidi_fake_vblank_handler()
243 ctx->direct_vblank = false; in vidi_fake_vblank_handler()
244 mutex_unlock(&ctx->lock); in vidi_fake_vblank_handler()
248 mutex_unlock(&ctx->lock); in vidi_fake_vblank_handler()
250 exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe); in vidi_fake_vblank_handler()
256 struct vidi_context *ctx = dev_get_drvdata(dev); in vidi_show_connection() local
259 mutex_lock(&ctx->lock); in vidi_show_connection()
261 rc = sprintf(buf, "%d\n", ctx->connected); in vidi_show_connection()
263 mutex_unlock(&ctx->lock); in vidi_show_connection()
272 struct vidi_context *ctx = dev_get_drvdata(dev); in vidi_store_connection() local
275 ret = kstrtoint(buf, 0, &ctx->connected); in vidi_store_connection()
279 if (ctx->connected > 1) in vidi_store_connection()
283 if (!ctx->raw_edid) in vidi_store_connection()
284 ctx->raw_edid = (struct edid *)fake_edid_info; in vidi_store_connection()
287 if (ctx->raw_edid != (struct edid *)fake_edid_info) { in vidi_store_connection()
294 drm_helper_hpd_irq_event(ctx->drm_dev); in vidi_store_connection()
305 struct vidi_context *ctx = NULL; in vidi_connection_ioctl() local
325 ctx = display_to_vidi(display); in vidi_connection_ioctl()
330 if (!ctx) { in vidi_connection_ioctl()
335 if (ctx->connected == vidi->connection) { in vidi_connection_ioctl()
346 ctx->raw_edid = drm_edid_duplicate(raw_edid); in vidi_connection_ioctl()
347 if (!ctx->raw_edid) { in vidi_connection_ioctl()
356 if (ctx->raw_edid && ctx->raw_edid != in vidi_connection_ioctl()
358 kfree(ctx->raw_edid); in vidi_connection_ioctl()
359 ctx->raw_edid = NULL; in vidi_connection_ioctl()
363 ctx->connected = vidi->connection; in vidi_connection_ioctl()
364 drm_helper_hpd_irq_event(ctx->drm_dev); in vidi_connection_ioctl()
372 struct vidi_context *ctx = ctx_from_connector(connector); in vidi_detect() local
378 return ctx->connected ? connector_status_connected : in vidi_detect()
395 struct vidi_context *ctx = ctx_from_connector(connector); in vidi_get_modes() local
403 if (!ctx->raw_edid) { in vidi_get_modes()
408 edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH; in vidi_get_modes()
409 edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL); in vidi_get_modes()
422 struct vidi_context *ctx = ctx_from_connector(connector); in vidi_best_encoder() local
424 return ctx->encoder; in vidi_best_encoder()
435 struct vidi_context *ctx = display_to_vidi(display); in vidi_create_connector() local
436 struct drm_connector *connector = &ctx->connector; in vidi_create_connector()
439 ctx->encoder = encoder; in vidi_create_connector()
442 ret = drm_connector_init(ctx->drm_dev, connector, in vidi_create_connector()
463 struct vidi_context *ctx = dev_get_drvdata(dev); in vidi_bind() local
470 vidi_ctx_initialize(ctx, drm_dev); in vidi_bind()
473 type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY : in vidi_bind()
475 ret = exynos_plane_init(drm_dev, &ctx->planes[zpos], in vidi_bind()
476 1 << ctx->pipe, type, zpos); in vidi_bind()
481 exynos_plane = &ctx->planes[ctx->default_win]; in vidi_bind()
482 ctx->crtc = exynos_drm_crtc_create(drm_dev, &exynos_plane->base, in vidi_bind()
483 ctx->pipe, EXYNOS_DISPLAY_TYPE_VIDI, in vidi_bind()
484 &vidi_crtc_ops, ctx); in vidi_bind()
485 if (IS_ERR(ctx->crtc)) { in vidi_bind()
487 return PTR_ERR(ctx->crtc); in vidi_bind()
490 ret = exynos_drm_create_enc_conn(drm_dev, &ctx->display); in vidi_bind()
492 ctx->crtc->base.funcs->destroy(&ctx->crtc->base); in vidi_bind()
511 struct vidi_context *ctx; in vidi_probe() local
514 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); in vidi_probe()
515 if (!ctx) in vidi_probe()
518 ctx->display.type = EXYNOS_DISPLAY_TYPE_VIDI; in vidi_probe()
519 ctx->display.ops = &vidi_display_ops; in vidi_probe()
520 ctx->default_win = 0; in vidi_probe()
521 ctx->pdev = pdev; in vidi_probe()
529 ctx->display.type); in vidi_probe()
533 INIT_WORK(&ctx->work, vidi_fake_vblank_handler); in vidi_probe()
535 mutex_init(&ctx->lock); in vidi_probe()
537 platform_set_drvdata(pdev, ctx); in vidi_probe()
563 struct vidi_context *ctx = platform_get_drvdata(pdev); in vidi_remove() local
565 if (ctx->raw_edid != (struct edid *)fake_edid_info) { in vidi_remove()
566 kfree(ctx->raw_edid); in vidi_remove()
567 ctx->raw_edid = NULL; in vidi_remove()