Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: zte: use vblank hooks in struct drm_crtc_funcs

The vblank hooks in struct drm_driver are deprecated and only meant for
legacy drivers. For modern drivers with DRIVER_MODESET flag, the hooks
in struct drm_crtc_funcs should be used instead.

The functions are moved around to save forward declaration.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1486458995-31018-24-git-send-email-shawnguo@kernel.org

+23 -43
-2
drivers/gpu/drm/zte/zx_drm_drv.c
··· 71 71 .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | 72 72 DRIVER_ATOMIC, 73 73 .lastclose = zx_drm_lastclose, 74 - .enable_vblank = zx_vou_enable_vblank, 75 - .disable_vblank = zx_vou_disable_vblank, 76 74 .gem_free_object = drm_gem_cma_free_object, 77 75 .gem_vm_ops = &drm_gem_cma_vm_ops, 78 76 .dumb_create = drm_gem_cma_dumb_create,
+23 -38
drivers/gpu/drm/zte/zx_vou.c
··· 470 470 .atomic_flush = zx_crtc_atomic_flush, 471 471 }; 472 472 473 + static int zx_vou_enable_vblank(struct drm_crtc *crtc) 474 + { 475 + struct zx_crtc *zcrtc = to_zx_crtc(crtc); 476 + struct zx_vou_hw *vou = crtc_to_vou(crtc); 477 + u32 int_frame_mask = zcrtc->bits->int_frame_mask; 478 + 479 + zx_writel_mask(vou->timing + TIMING_INT_CTRL, int_frame_mask, 480 + int_frame_mask); 481 + 482 + return 0; 483 + } 484 + 485 + static void zx_vou_disable_vblank(struct drm_crtc *crtc) 486 + { 487 + struct zx_crtc *zcrtc = to_zx_crtc(crtc); 488 + struct zx_vou_hw *vou = crtc_to_vou(crtc); 489 + 490 + zx_writel_mask(vou->timing + TIMING_INT_CTRL, 491 + zcrtc->bits->int_frame_mask, 0); 492 + } 493 + 473 494 static const struct drm_crtc_funcs zx_crtc_funcs = { 474 495 .destroy = drm_crtc_cleanup, 475 496 .set_config = drm_atomic_helper_set_config, ··· 498 477 .reset = drm_atomic_helper_crtc_reset, 499 478 .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, 500 479 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, 480 + .enable_vblank = zx_vou_enable_vblank, 481 + .disable_vblank = zx_vou_disable_vblank, 501 482 }; 502 483 503 484 static int zx_crtc_init(struct drm_device *drm, struct zx_vou_hw *vou, ··· 574 551 vou->aux_crtc = zcrtc; 575 552 576 553 return 0; 577 - } 578 - 579 - int zx_vou_enable_vblank(struct drm_device *drm, unsigned int pipe) 580 - { 581 - struct drm_crtc *crtc; 582 - struct zx_crtc *zcrtc; 583 - struct zx_vou_hw *vou; 584 - u32 int_frame_mask; 585 - 586 - crtc = drm_crtc_from_index(drm, pipe); 587 - if (!crtc) 588 - return 0; 589 - 590 - vou = crtc_to_vou(crtc); 591 - zcrtc = to_zx_crtc(crtc); 592 - int_frame_mask = zcrtc->bits->int_frame_mask; 593 - 594 - zx_writel_mask(vou->timing + TIMING_INT_CTRL, int_frame_mask, 595 - int_frame_mask); 596 - 597 - return 0; 598 - } 599 - 600 - void zx_vou_disable_vblank(struct drm_device *drm, unsigned int pipe) 601 - { 602 - struct drm_crtc *crtc; 603 - struct zx_crtc *zcrtc; 604 - struct zx_vou_hw *vou; 605 - 606 - crtc = drm_crtc_from_index(drm, pipe); 607 - if (!crtc) 608 - return; 609 - 610 - vou = crtc_to_vou(crtc); 611 - zcrtc = to_zx_crtc(crtc); 612 - 613 - zx_writel_mask(vou->timing + TIMING_INT_CTRL, 614 - zcrtc->bits->int_frame_mask, 0); 615 554 } 616 555 617 556 void zx_vou_layer_enable(struct drm_plane *plane)
-3
drivers/gpu/drm/zte/zx_vou.h
··· 61 61 void zx_vou_config_dividers(struct drm_crtc *crtc, 62 62 struct vou_div_config *configs, int num); 63 63 64 - int zx_vou_enable_vblank(struct drm_device *drm, unsigned int pipe); 65 - void zx_vou_disable_vblank(struct drm_device *drm, unsigned int pipe); 66 - 67 64 void zx_vou_layer_enable(struct drm_plane *plane); 68 65 void zx_vou_layer_disable(struct drm_plane *plane); 69 66