| .. | .. |
|---|
| 8 | 8 | |
|---|
| 9 | 9 | #include <linux/clk.h> |
|---|
| 10 | 10 | |
|---|
| 11 | | -#include <drm/drmP.h> |
|---|
| 12 | 11 | #include <drm/drm_atomic.h> |
|---|
| 13 | 12 | #include <drm/drm_atomic_helper.h> |
|---|
| 14 | | -#include <drm/drm_crtc_helper.h> |
|---|
| 13 | +#include <drm/drm_device.h> |
|---|
| 15 | 14 | #include <drm/drm_plane_helper.h> |
|---|
| 15 | +#include <drm/drm_print.h> |
|---|
| 16 | +#include <drm/drm_probe_helper.h> |
|---|
| 17 | +#include <drm/drm_vblank.h> |
|---|
| 16 | 18 | |
|---|
| 17 | 19 | #include "sti_compositor.h" |
|---|
| 18 | 20 | #include "sti_crtc.h" |
|---|
| .. | .. |
|---|
| 40 | 42 | DRM_DEBUG_DRIVER("\n"); |
|---|
| 41 | 43 | |
|---|
| 42 | 44 | mixer->status = STI_MIXER_DISABLING; |
|---|
| 45 | + |
|---|
| 46 | + drm_crtc_wait_one_vblank(crtc); |
|---|
| 43 | 47 | } |
|---|
| 44 | 48 | |
|---|
| 45 | 49 | static int |
|---|
| .. | .. |
|---|
| 51 | 55 | struct clk *compo_clk, *pix_clk; |
|---|
| 52 | 56 | int rate = mode->clock * 1000; |
|---|
| 53 | 57 | |
|---|
| 54 | | - DRM_DEBUG_KMS("CRTC:%d (%s) mode:%d (%s)\n", |
|---|
| 55 | | - crtc->base.id, sti_mixer_to_str(mixer), |
|---|
| 56 | | - mode->base.id, mode->name); |
|---|
| 58 | + DRM_DEBUG_KMS("CRTC:%d (%s) mode: (%s)\n", |
|---|
| 59 | + crtc->base.id, sti_mixer_to_str(mixer), mode->name); |
|---|
| 57 | 60 | |
|---|
| 58 | | - DRM_DEBUG_KMS("%d %d %d %d %d %d %d %d %d %d 0x%x 0x%x\n", |
|---|
| 59 | | - mode->vrefresh, mode->clock, |
|---|
| 60 | | - mode->hdisplay, |
|---|
| 61 | | - mode->hsync_start, mode->hsync_end, |
|---|
| 62 | | - mode->htotal, |
|---|
| 63 | | - mode->vdisplay, |
|---|
| 64 | | - mode->vsync_start, mode->vsync_end, |
|---|
| 65 | | - mode->vtotal, mode->type, mode->flags); |
|---|
| 61 | + DRM_DEBUG_KMS(DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); |
|---|
| 66 | 62 | |
|---|
| 67 | 63 | if (mixer->id == STI_MIXER_MAIN) { |
|---|
| 68 | 64 | compo_clk = compo->clk_compo_main; |
|---|
| .. | .. |
|---|
| 250 | 246 | struct sti_compositor *compo; |
|---|
| 251 | 247 | struct drm_crtc *crtc = data; |
|---|
| 252 | 248 | struct sti_mixer *mixer; |
|---|
| 253 | | - struct sti_private *priv; |
|---|
| 254 | 249 | unsigned int pipe; |
|---|
| 255 | 250 | |
|---|
| 256 | | - priv = crtc->dev->dev_private; |
|---|
| 257 | 251 | pipe = drm_crtc_index(crtc); |
|---|
| 258 | 252 | compo = container_of(nb, struct sti_compositor, vtg_vblank_nb[pipe]); |
|---|
| 259 | 253 | mixer = compo->mixer[pipe]; |
|---|
| .. | .. |
|---|
| 285 | 279 | return 0; |
|---|
| 286 | 280 | } |
|---|
| 287 | 281 | |
|---|
| 288 | | -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe) |
|---|
| 282 | +static int sti_crtc_enable_vblank(struct drm_crtc *crtc) |
|---|
| 289 | 283 | { |
|---|
| 284 | + struct drm_device *dev = crtc->dev; |
|---|
| 285 | + unsigned int pipe = crtc->index; |
|---|
| 290 | 286 | struct sti_private *dev_priv = dev->dev_private; |
|---|
| 291 | 287 | struct sti_compositor *compo = dev_priv->compo; |
|---|
| 292 | 288 | struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe]; |
|---|
| 293 | | - struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc; |
|---|
| 294 | 289 | struct sti_vtg *vtg = compo->vtg[pipe]; |
|---|
| 295 | 290 | |
|---|
| 296 | 291 | DRM_DEBUG_DRIVER("\n"); |
|---|
| .. | .. |
|---|
| 303 | 298 | return 0; |
|---|
| 304 | 299 | } |
|---|
| 305 | 300 | |
|---|
| 306 | | -void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe) |
|---|
| 301 | +static void sti_crtc_disable_vblank(struct drm_crtc *crtc) |
|---|
| 307 | 302 | { |
|---|
| 303 | + struct drm_device *drm_dev = crtc->dev; |
|---|
| 304 | + unsigned int pipe = crtc->index; |
|---|
| 308 | 305 | struct sti_private *priv = drm_dev->dev_private; |
|---|
| 309 | 306 | struct sti_compositor *compo = priv->compo; |
|---|
| 310 | 307 | struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe]; |
|---|
| .. | .. |
|---|
| 322 | 319 | struct sti_compositor *compo = dev_get_drvdata(mixer->dev); |
|---|
| 323 | 320 | |
|---|
| 324 | 321 | if (drm_crtc_index(crtc) == 0) |
|---|
| 325 | | - return sti_compositor_debugfs_init(compo, crtc->dev->primary); |
|---|
| 322 | + sti_compositor_debugfs_init(compo, crtc->dev->primary); |
|---|
| 326 | 323 | |
|---|
| 327 | 324 | return 0; |
|---|
| 328 | 325 | } |
|---|
| .. | .. |
|---|
| 336 | 333 | .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, |
|---|
| 337 | 334 | .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, |
|---|
| 338 | 335 | .late_register = sti_crtc_late_register, |
|---|
| 336 | + .enable_vblank = sti_crtc_enable_vblank, |
|---|
| 337 | + .disable_vblank = sti_crtc_disable_vblank, |
|---|
| 339 | 338 | }; |
|---|
| 340 | 339 | |
|---|
| 341 | 340 | bool sti_crtc_is_main(struct drm_crtc *crtc) |
|---|