Lines Matching full:crtc
36 static struct drm_encoder *sun4i_crtc_get_encoder(struct drm_crtc *crtc) in sun4i_crtc_get_encoder() argument
40 drm_for_each_encoder(encoder, crtc->dev) in sun4i_crtc_get_encoder()
41 if (encoder->crtc == crtc) in sun4i_crtc_get_encoder()
47 static int sun4i_crtc_atomic_check(struct drm_crtc *crtc, in sun4i_crtc_atomic_check() argument
50 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); in sun4i_crtc_atomic_check()
60 static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc, in sun4i_crtc_atomic_begin() argument
63 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); in sun4i_crtc_atomic_begin()
64 struct drm_device *dev = crtc->dev; in sun4i_crtc_atomic_begin()
68 if (crtc->state->event) { in sun4i_crtc_atomic_begin()
69 WARN_ON(drm_crtc_vblank_get(crtc) != 0); in sun4i_crtc_atomic_begin()
72 scrtc->event = crtc->state->event; in sun4i_crtc_atomic_begin()
74 crtc->state->event = NULL; in sun4i_crtc_atomic_begin()
81 static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc, in sun4i_crtc_atomic_flush() argument
84 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); in sun4i_crtc_atomic_flush()
85 struct drm_pending_vblank_event *event = crtc->state->event; in sun4i_crtc_atomic_flush()
92 crtc->state->event = NULL; in sun4i_crtc_atomic_flush()
94 spin_lock_irq(&crtc->dev->event_lock); in sun4i_crtc_atomic_flush()
95 if (drm_crtc_vblank_get(crtc) == 0) in sun4i_crtc_atomic_flush()
96 drm_crtc_arm_vblank_event(crtc, event); in sun4i_crtc_atomic_flush()
98 drm_crtc_send_vblank_event(crtc, event); in sun4i_crtc_atomic_flush()
99 spin_unlock_irq(&crtc->dev->event_lock); in sun4i_crtc_atomic_flush()
103 static void sun4i_crtc_atomic_disable(struct drm_crtc *crtc, in sun4i_crtc_atomic_disable() argument
106 struct drm_encoder *encoder = sun4i_crtc_get_encoder(crtc); in sun4i_crtc_atomic_disable()
107 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); in sun4i_crtc_atomic_disable()
109 DRM_DEBUG_DRIVER("Disabling the CRTC\n"); in sun4i_crtc_atomic_disable()
111 drm_crtc_vblank_off(crtc); in sun4i_crtc_atomic_disable()
115 if (crtc->state->event && !crtc->state->active) { in sun4i_crtc_atomic_disable()
116 spin_lock_irq(&crtc->dev->event_lock); in sun4i_crtc_atomic_disable()
117 drm_crtc_send_vblank_event(crtc, crtc->state->event); in sun4i_crtc_atomic_disable()
118 spin_unlock_irq(&crtc->dev->event_lock); in sun4i_crtc_atomic_disable()
120 crtc->state->event = NULL; in sun4i_crtc_atomic_disable()
124 static void sun4i_crtc_atomic_enable(struct drm_crtc *crtc, in sun4i_crtc_atomic_enable() argument
127 struct drm_encoder *encoder = sun4i_crtc_get_encoder(crtc); in sun4i_crtc_atomic_enable()
128 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); in sun4i_crtc_atomic_enable()
130 DRM_DEBUG_DRIVER("Enabling the CRTC\n"); in sun4i_crtc_atomic_enable()
134 drm_crtc_vblank_on(crtc); in sun4i_crtc_atomic_enable()
137 static void sun4i_crtc_mode_set_nofb(struct drm_crtc *crtc) in sun4i_crtc_mode_set_nofb() argument
139 struct drm_display_mode *mode = &crtc->state->adjusted_mode; in sun4i_crtc_mode_set_nofb()
140 struct drm_encoder *encoder = sun4i_crtc_get_encoder(crtc); in sun4i_crtc_mode_set_nofb()
141 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); in sun4i_crtc_mode_set_nofb()
155 static int sun4i_crtc_enable_vblank(struct drm_crtc *crtc) in sun4i_crtc_enable_vblank() argument
157 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); in sun4i_crtc_enable_vblank()
159 DRM_DEBUG_DRIVER("Enabling VBLANK on crtc %p\n", crtc); in sun4i_crtc_enable_vblank()
166 static void sun4i_crtc_disable_vblank(struct drm_crtc *crtc) in sun4i_crtc_disable_vblank() argument
168 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); in sun4i_crtc_disable_vblank()
170 DRM_DEBUG_DRIVER("Disabling VBLANK on crtc %p\n", crtc); in sun4i_crtc_disable_vblank()
224 ret = drm_crtc_init_with_planes(drm, &scrtc->crtc, in sun4i_crtc_init()
230 dev_err(drm->dev, "Couldn't init DRM CRTC\n"); in sun4i_crtc_init()
234 drm_crtc_helper_add(&scrtc->crtc, &sun4i_crtc_helper_funcs); in sun4i_crtc_init()
236 /* Set crtc.port to output port node of the tcon */ in sun4i_crtc_init()
237 scrtc->crtc.port = of_graph_get_port_by_id(scrtc->tcon->dev->of_node, in sun4i_crtc_init()
240 /* Set possible_crtcs to this crtc for overlay planes */ in sun4i_crtc_init()
242 uint32_t possible_crtcs = drm_crtc_mask(&scrtc->crtc); in sun4i_crtc_init()