aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2015-09-24 12:35:31 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-10-06 06:57:47 -0400
commit88e72717c2de4181d8a6de1b04315953ad2bebdf (patch)
tree3390bb603c0bb14ed0233362dba616af2fb60c96
parent14152c8d30bbe5155d0438feb0a1931aee0e5bce (diff)
drm/irq: Use unsigned int pipe in public API
This continues the pattern started in commit cc1ef118fc09 ("drm/irq: Make pipe unsigned and name consistent"). This is applied to the public APIs and driver callbacks, so pretty much all drivers need to be updated to match the new prototypes. Cc: Christian König <christian.koenig@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Inki Dae <inki.dae@samsung.com> Cc: Jianwei Wang <jianwei.wang.chn@gmail.com> Cc: Alison Wang <alison.wang@freescale.com> Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: David Airlie <airlied@linux.ie> Cc: Rob Clark <robdclark@gmail.com> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Mark Yao <mark.yao@rock-chips.com> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org> Cc: Vincent Abriou <vincent.abriou@st.com> Cc: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_display.c9
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c36
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h9
-rw-r--r--drivers/gpu/drm/armada/armada_drv.c8
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c6
-rw-r--r--drivers/gpu/drm/drm_irq.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.c4
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.h4
-rw-r--r--drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c5
-rw-r--r--drivers/gpu/drm/gma500/psb_drv.h6
-rw-r--r--drivers/gpu/drm/gma500/psb_irq.c8
-rw-r--r--drivers/gpu/drm/gma500/psb_irq.h6
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c34
-rw-r--r--drivers/gpu/drm/imx/imx-drm-core.c8
-rw-r--r--drivers/gpu/drm/mga/mga_drv.h6
-rw-r--r--drivers/gpu/drm/mga/mga_irq.c20
-rw-r--r--drivers/gpu/drm/msm/msm_drv.c12
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c23
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.h12
-rw-r--r--drivers/gpu/drm/omapdrm/omap_drv.h4
-rw-r--r--drivers/gpu/drm/omapdrm/omap_irq.c16
-rw-r--r--drivers/gpu/drm/qxl/qxl_drv.c7
-rw-r--r--drivers/gpu/drm/r128/r128_drv.h6
-rw-r--r--drivers/gpu/drm/r128/r128_irq.c16
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c25
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.h6
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq.c38
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h5
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_drv.c8
-rw-r--r--drivers/gpu/drm/rockchip/rockchip_drm_drv.c6
-rw-r--r--drivers/gpu/drm/shmobile/shmob_drm_drv.c4
-rw-r--r--drivers/gpu/drm/sti/sti_crtc.c16
-rw-r--r--drivers/gpu/drm/sti/sti_crtc.h4
-rw-r--r--drivers/gpu/drm/tegra/drm.c7
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_drv.c4
-rw-r--r--drivers/gpu/drm/via/via_drv.h6
-rw-r--r--drivers/gpu/drm/via/via_irq.c17
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.h6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c6
-rw-r--r--include/drm/drmP.h25
42 files changed, 239 insertions, 232 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 6647fb26ef25..5e43178d07d5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -2349,10 +2349,10 @@ void amdgpu_driver_preclose_kms(struct drm_device *dev,
2349 struct drm_file *file_priv); 2349 struct drm_file *file_priv);
2350int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon); 2350int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon);
2351int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon); 2351int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
2352u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, int crtc); 2352u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
2353int amdgpu_enable_vblank_kms(struct drm_device *dev, int crtc); 2353int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
2354void amdgpu_disable_vblank_kms(struct drm_device *dev, int crtc); 2354void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
2355int amdgpu_get_vblank_timestamp_kms(struct drm_device *dev, int crtc, 2355int amdgpu_get_vblank_timestamp_kms(struct drm_device *dev, unsigned int pipe,
2356 int *max_error, 2356 int *max_error,
2357 struct timeval *vblank_time, 2357 struct timeval *vblank_time,
2358 unsigned flags); 2358 unsigned flags);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 9b34a3410c32..de116398fa49 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -721,7 +721,7 @@ bool amdgpu_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
721 * an optional accurate timestamp of when query happened. 721 * an optional accurate timestamp of when query happened.
722 * 722 *
723 * \param dev Device to query. 723 * \param dev Device to query.
724 * \param crtc Crtc to query. 724 * \param pipe Crtc to query.
725 * \param flags Flags from caller (DRM_CALLED_FROM_VBLIRQ or 0). 725 * \param flags Flags from caller (DRM_CALLED_FROM_VBLIRQ or 0).
726 * \param *vpos Location where vertical scanout position should be stored. 726 * \param *vpos Location where vertical scanout position should be stored.
727 * \param *hpos Location where horizontal scanout position should go. 727 * \param *hpos Location where horizontal scanout position should go.
@@ -744,8 +744,9 @@ bool amdgpu_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
744 * unknown small number of scanlines wrt. real scanout position. 744 * unknown small number of scanlines wrt. real scanout position.
745 * 745 *
746 */ 746 */
747int amdgpu_get_crtc_scanoutpos(struct drm_device *dev, int crtc, unsigned int flags, 747int amdgpu_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
748 int *vpos, int *hpos, ktime_t *stime, ktime_t *etime, 748 unsigned int flags, int *vpos, int *hpos,
749 ktime_t *stime, ktime_t *etime,
749 const struct drm_display_mode *mode) 750 const struct drm_display_mode *mode)
750{ 751{
751 u32 vbl = 0, position = 0; 752 u32 vbl = 0, position = 0;
@@ -760,7 +761,7 @@ int amdgpu_get_crtc_scanoutpos(struct drm_device *dev, int crtc, unsigned int fl
760 if (stime) 761 if (stime)
761 *stime = ktime_get(); 762 *stime = ktime_get();
762 763
763 if (amdgpu_display_page_flip_get_scanoutpos(adev, crtc, &vbl, &position) == 0) 764 if (amdgpu_display_page_flip_get_scanoutpos(adev, pipe, &vbl, &position) == 0)
764 ret |= DRM_SCANOUTPOS_VALID; 765 ret |= DRM_SCANOUTPOS_VALID;
765 766
766 /* Get optional system timestamp after query. */ 767 /* Get optional system timestamp after query. */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 275f1c3dbba0..b9faaf800ae1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -600,36 +600,36 @@ void amdgpu_driver_preclose_kms(struct drm_device *dev,
600 * amdgpu_get_vblank_counter_kms - get frame count 600 * amdgpu_get_vblank_counter_kms - get frame count
601 * 601 *
602 * @dev: drm dev pointer 602 * @dev: drm dev pointer
603 * @crtc: crtc to get the frame count from 603 * @pipe: crtc to get the frame count from
604 * 604 *
605 * Gets the frame count on the requested crtc (all asics). 605 * Gets the frame count on the requested crtc (all asics).
606 * Returns frame count on success, -EINVAL on failure. 606 * Returns frame count on success, -EINVAL on failure.
607 */ 607 */
608u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, int crtc) 608u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
609{ 609{
610 struct amdgpu_device *adev = dev->dev_private; 610 struct amdgpu_device *adev = dev->dev_private;
611 611
612 if (crtc < 0 || crtc >= adev->mode_info.num_crtc) { 612 if (pipe >= adev->mode_info.num_crtc) {
613 DRM_ERROR("Invalid crtc %d\n", crtc); 613 DRM_ERROR("Invalid crtc %u\n", pipe);
614 return -EINVAL; 614 return -EINVAL;
615 } 615 }
616 616
617 return amdgpu_display_vblank_get_counter(adev, crtc); 617 return amdgpu_display_vblank_get_counter(adev, pipe);
618} 618}
619 619
620/** 620/**
621 * amdgpu_enable_vblank_kms - enable vblank interrupt 621 * amdgpu_enable_vblank_kms - enable vblank interrupt
622 * 622 *
623 * @dev: drm dev pointer 623 * @dev: drm dev pointer
624 * @crtc: crtc to enable vblank interrupt for 624 * @pipe: crtc to enable vblank interrupt for
625 * 625 *
626 * Enable the interrupt on the requested crtc (all asics). 626 * Enable the interrupt on the requested crtc (all asics).
627 * Returns 0 on success, -EINVAL on failure. 627 * Returns 0 on success, -EINVAL on failure.
628 */ 628 */
629int amdgpu_enable_vblank_kms(struct drm_device *dev, int crtc) 629int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
630{ 630{
631 struct amdgpu_device *adev = dev->dev_private; 631 struct amdgpu_device *adev = dev->dev_private;
632 int idx = amdgpu_crtc_idx_to_irq_type(adev, crtc); 632 int idx = amdgpu_crtc_idx_to_irq_type(adev, pipe);
633 633
634 return amdgpu_irq_get(adev, &adev->crtc_irq, idx); 634 return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
635} 635}
@@ -638,14 +638,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, int crtc)
638 * amdgpu_disable_vblank_kms - disable vblank interrupt 638 * amdgpu_disable_vblank_kms - disable vblank interrupt
639 * 639 *
640 * @dev: drm dev pointer 640 * @dev: drm dev pointer
641 * @crtc: crtc to disable vblank interrupt for 641 * @pipe: crtc to disable vblank interrupt for
642 * 642 *
643 * Disable the interrupt on the requested crtc (all asics). 643 * Disable the interrupt on the requested crtc (all asics).
644 */ 644 */
645void amdgpu_disable_vblank_kms(struct drm_device *dev, int crtc) 645void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
646{ 646{
647 struct amdgpu_device *adev = dev->dev_private; 647 struct amdgpu_device *adev = dev->dev_private;
648 int idx = amdgpu_crtc_idx_to_irq_type(adev, crtc); 648 int idx = amdgpu_crtc_idx_to_irq_type(adev, pipe);
649 649
650 amdgpu_irq_put(adev, &adev->crtc_irq, idx); 650 amdgpu_irq_put(adev, &adev->crtc_irq, idx);
651} 651}
@@ -663,26 +663,26 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, int crtc)
663 * scanout position. (all asics). 663 * scanout position. (all asics).
664 * Returns postive status flags on success, negative error on failure. 664 * Returns postive status flags on success, negative error on failure.
665 */ 665 */
666int amdgpu_get_vblank_timestamp_kms(struct drm_device *dev, int crtc, 666int amdgpu_get_vblank_timestamp_kms(struct drm_device *dev, unsigned int pipe,
667 int *max_error, 667 int *max_error,
668 struct timeval *vblank_time, 668 struct timeval *vblank_time,
669 unsigned flags) 669 unsigned flags)
670{ 670{
671 struct drm_crtc *drmcrtc; 671 struct drm_crtc *crtc;
672 struct amdgpu_device *adev = dev->dev_private; 672 struct amdgpu_device *adev = dev->dev_private;
673 673
674 if (crtc < 0 || crtc >= dev->num_crtcs) { 674 if (pipe >= dev->num_crtcs) {
675 DRM_ERROR("Invalid crtc %d\n", crtc); 675 DRM_ERROR("Invalid crtc %u\n", pipe);
676 return -EINVAL; 676 return -EINVAL;
677 } 677 }
678 678
679 /* Get associated drm_crtc: */ 679 /* Get associated drm_crtc: */
680 drmcrtc = &adev->mode_info.crtcs[crtc]->base; 680 crtc = &adev->mode_info.crtcs[pipe]->base;
681 681
682 /* Helper routine in DRM core does all the work: */ 682 /* Helper routine in DRM core does all the work: */
683 return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error, 683 return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error,
684 vblank_time, flags, 684 vblank_time, flags,
685 &drmcrtc->hwmode); 685 &crtc->hwmode);
686} 686}
687 687
688const struct drm_ioctl_desc amdgpu_ioctls_kms[] = { 688const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index 2b03425f9740..f6b02994442b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -540,11 +540,10 @@ bool amdgpu_ddc_probe(struct amdgpu_connector *amdgpu_connector, bool use_aux);
540 540
541void amdgpu_encoder_set_active_device(struct drm_encoder *encoder); 541void amdgpu_encoder_set_active_device(struct drm_encoder *encoder);
542 542
543int amdgpu_get_crtc_scanoutpos(struct drm_device *dev, int crtc, 543int amdgpu_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
544 unsigned int flags, 544 unsigned int flags, int *vpos, int *hpos,
545 int *vpos, int *hpos, ktime_t *stime, 545 ktime_t *stime, ktime_t *etime,
546 ktime_t *etime, 546 const struct drm_display_mode *mode);
547 const struct drm_display_mode *mode);
548 547
549int amdgpu_framebuffer_init(struct drm_device *dev, 548int amdgpu_framebuffer_init(struct drm_device *dev,
550 struct amdgpu_framebuffer *rfb, 549 struct amdgpu_framebuffer *rfb,
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index 225034b74cda..a438886fcdb6 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -254,17 +254,17 @@ void armada_drm_vbl_event_remove(struct armada_crtc *dcrtc,
254} 254}
255 255
256/* These are called under the vbl_lock. */ 256/* These are called under the vbl_lock. */
257static int armada_drm_enable_vblank(struct drm_device *dev, int crtc) 257static int armada_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
258{ 258{
259 struct armada_private *priv = dev->dev_private; 259 struct armada_private *priv = dev->dev_private;
260 armada_drm_crtc_enable_irq(priv->dcrtc[crtc], VSYNC_IRQ_ENA); 260 armada_drm_crtc_enable_irq(priv->dcrtc[pipe], VSYNC_IRQ_ENA);
261 return 0; 261 return 0;
262} 262}
263 263
264static void armada_drm_disable_vblank(struct drm_device *dev, int crtc) 264static void armada_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
265{ 265{
266 struct armada_private *priv = dev->dev_private; 266 struct armada_private *priv = dev->dev_private;
267 armada_drm_crtc_disable_irq(priv->dcrtc[crtc], VSYNC_IRQ_ENA); 267 armada_drm_crtc_disable_irq(priv->dcrtc[pipe], VSYNC_IRQ_ENA);
268} 268}
269 269
270static struct drm_ioctl_desc armada_ioctls[] = { 270static struct drm_ioctl_desc armada_ioctls[] = {
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 8bc62ec407f9..6dfb63ab54d2 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -656,7 +656,8 @@ static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
656 regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr); 656 regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
657} 657}
658 658
659static int atmel_hlcdc_dc_enable_vblank(struct drm_device *dev, int crtc) 659static int atmel_hlcdc_dc_enable_vblank(struct drm_device *dev,
660 unsigned int pipe)
660{ 661{
661 struct atmel_hlcdc_dc *dc = dev->dev_private; 662 struct atmel_hlcdc_dc *dc = dev->dev_private;
662 663
@@ -666,7 +667,8 @@ static int atmel_hlcdc_dc_enable_vblank(struct drm_device *dev, int crtc)
666 return 0; 667 return 0;
667} 668}
668 669
669static void atmel_hlcdc_dc_disable_vblank(struct drm_device *dev, int crtc) 670static void atmel_hlcdc_dc_disable_vblank(struct drm_device *dev,
671 unsigned int pipe)
670{ 672{
671 struct atmel_hlcdc_dc *dc = dev->dev_private; 673 struct atmel_hlcdc_dc *dc = dev->dev_private;
672 674
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 6bff6d3e570e..0659d9956b7c 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -877,7 +877,7 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
877 * Returns: 877 * Returns:
878 * The software vblank counter. 878 * The software vblank counter.
879 */ 879 */
880u32 drm_vblank_count(struct drm_device *dev, int pipe) 880u32 drm_vblank_count(struct drm_device *dev, unsigned int pipe)
881{ 881{
882 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; 882 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
883 883
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 0872aa2f450f..f364d694a780 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -167,7 +167,7 @@ err_crtc:
167 return ERR_PTR(ret); 167 return ERR_PTR(ret);
168} 168}
169 169
170int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe) 170int exynos_drm_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
171{ 171{
172 struct exynos_drm_private *private = dev->dev_private; 172 struct exynos_drm_private *private = dev->dev_private;
173 struct exynos_drm_crtc *exynos_crtc = 173 struct exynos_drm_crtc *exynos_crtc =
@@ -179,7 +179,7 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe)
179 return 0; 179 return 0;
180} 180}
181 181
182void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe) 182void exynos_drm_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe)
183{ 183{
184 struct exynos_drm_private *private = dev->dev_private; 184 struct exynos_drm_private *private = dev->dev_private;
185 struct exynos_drm_crtc *exynos_crtc = 185 struct exynos_drm_crtc *exynos_crtc =
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index f87d4abda6f7..f9f365bd0257 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -23,8 +23,8 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
23 enum exynos_drm_output_type type, 23 enum exynos_drm_output_type type,
24 const struct exynos_drm_crtc_ops *ops, 24 const struct exynos_drm_crtc_ops *ops,
25 void *context); 25 void *context);
26int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe); 26int exynos_drm_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
27void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe); 27void exynos_drm_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
28void exynos_drm_crtc_wait_pending_update(struct exynos_drm_crtc *exynos_crtc); 28void exynos_drm_crtc_wait_pending_update(struct exynos_drm_crtc *exynos_crtc);
29void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc, 29void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc,
30 struct exynos_drm_plane *exynos_plane); 30 struct exynos_drm_plane *exynos_plane);
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 9a8e2da47158..f1fd986ca332 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -140,7 +140,7 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
140 return IRQ_HANDLED; 140 return IRQ_HANDLED;
141} 141}
142 142
143static int fsl_dcu_drm_enable_vblank(struct drm_device *dev, int crtc) 143static int fsl_dcu_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
144{ 144{
145 struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; 145 struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
146 unsigned int value; 146 unsigned int value;
@@ -156,7 +156,8 @@ static int fsl_dcu_drm_enable_vblank(struct drm_device *dev, int crtc)
156 return 0; 156 return 0;
157} 157}
158 158
159static void fsl_dcu_drm_disable_vblank(struct drm_device *dev, int crtc) 159static void fsl_dcu_drm_disable_vblank(struct drm_device *dev,
160 unsigned int pipe)
160{ 161{
161 struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; 162 struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
162 unsigned int value; 163 unsigned int value;
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index e38057b91865..e21726ecac32 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -687,15 +687,15 @@ extern void psb_irq_turn_off_dpst(struct drm_device *dev);
687extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands); 687extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
688extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence); 688extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
689extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence); 689extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence);
690extern int psb_enable_vblank(struct drm_device *dev, int crtc); 690extern int psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
691extern void psb_disable_vblank(struct drm_device *dev, int crtc); 691extern void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
692void 692void
693psb_enable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask); 693psb_enable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
694 694
695void 695void
696psb_disable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask); 696psb_disable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
697 697
698extern u32 psb_get_vblank_counter(struct drm_device *dev, int crtc); 698extern u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
699 699
700/* framebuffer.c */ 700/* framebuffer.c */
701extern int psbfb_probed(struct drm_device *dev); 701extern int psbfb_probed(struct drm_device *dev);
diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 624eb36511c5..78eb10902809 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -510,7 +510,7 @@ int psb_irq_disable_dpst(struct drm_device *dev)
510/* 510/*
511 * It is used to enable VBLANK interrupt 511 * It is used to enable VBLANK interrupt
512 */ 512 */
513int psb_enable_vblank(struct drm_device *dev, int pipe) 513int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
514{ 514{
515 struct drm_psb_private *dev_priv = dev->dev_private; 515 struct drm_psb_private *dev_priv = dev->dev_private;
516 unsigned long irqflags; 516 unsigned long irqflags;
@@ -549,7 +549,7 @@ int psb_enable_vblank(struct drm_device *dev, int pipe)
549/* 549/*
550 * It is used to disable VBLANK interrupt 550 * It is used to disable VBLANK interrupt
551 */ 551 */
552void psb_disable_vblank(struct drm_device *dev, int pipe) 552void psb_disable_vblank(struct drm_device *dev, unsigned int pipe)
553{ 553{
554 struct drm_psb_private *dev_priv = dev->dev_private; 554 struct drm_psb_private *dev_priv = dev->dev_private;
555 unsigned long irqflags; 555 unsigned long irqflags;
@@ -622,7 +622,7 @@ void mdfld_disable_te(struct drm_device *dev, int pipe)
622/* Called from drm generic code, passed a 'crtc', which 622/* Called from drm generic code, passed a 'crtc', which
623 * we use as a pipe index 623 * we use as a pipe index
624 */ 624 */
625u32 psb_get_vblank_counter(struct drm_device *dev, int pipe) 625u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
626{ 626{
627 uint32_t high_frame = PIPEAFRAMEHIGH; 627 uint32_t high_frame = PIPEAFRAMEHIGH;
628 uint32_t low_frame = PIPEAFRAMEPIXEL; 628 uint32_t low_frame = PIPEAFRAMEPIXEL;
@@ -654,7 +654,7 @@ u32 psb_get_vblank_counter(struct drm_device *dev, int pipe)
654 reg_val = REG_READ(pipeconf_reg); 654 reg_val = REG_READ(pipeconf_reg);
655 655
656 if (!(reg_val & PIPEACONF_ENABLE)) { 656 if (!(reg_val & PIPEACONF_ENABLE)) {
657 dev_err(dev->dev, "trying to get vblank count for disabled pipe %d\n", 657 dev_err(dev->dev, "trying to get vblank count for disabled pipe %u\n",
658 pipe); 658 pipe);
659 goto psb_get_vblank_counter_exit; 659 goto psb_get_vblank_counter_exit;
660 } 660 }
diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_irq.h
index d0b45ffa1126..e6a81a8c9f35 100644
--- a/drivers/gpu/drm/gma500/psb_irq.h
+++ b/drivers/gpu/drm/gma500/psb_irq.h
@@ -38,9 +38,9 @@ int psb_irq_enable_dpst(struct drm_device *dev);
38int psb_irq_disable_dpst(struct drm_device *dev); 38int psb_irq_disable_dpst(struct drm_device *dev);
39void psb_irq_turn_on_dpst(struct drm_device *dev); 39void psb_irq_turn_on_dpst(struct drm_device *dev);
40void psb_irq_turn_off_dpst(struct drm_device *dev); 40void psb_irq_turn_off_dpst(struct drm_device *dev);
41int psb_enable_vblank(struct drm_device *dev, int pipe); 41int psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
42void psb_disable_vblank(struct drm_device *dev, int pipe); 42void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
43u32 psb_get_vblank_counter(struct drm_device *dev, int pipe); 43u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
44 44
45int mdfld_enable_te(struct drm_device *dev, int pipe); 45int mdfld_enable_te(struct drm_device *dev, int pipe);
46void mdfld_disable_te(struct drm_device *dev, int pipe); 46void mdfld_disable_te(struct drm_device *dev, int pipe);
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 88d064e80783..bc732eb52b50 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -554,7 +554,7 @@ static void i915_enable_asle_pipestat(struct drm_device *dev)
554 * of horizontal active on the first line of vertical active 554 * of horizontal active on the first line of vertical active
555 */ 555 */
556 556
557static u32 i8xx_get_vblank_counter(struct drm_device *dev, int pipe) 557static u32 i8xx_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
558{ 558{
559 /* Gen2 doesn't have a hardware frame counter */ 559 /* Gen2 doesn't have a hardware frame counter */
560 return 0; 560 return 0;
@@ -563,7 +563,7 @@ static u32 i8xx_get_vblank_counter(struct drm_device *dev, int pipe)
563/* Called from drm generic code, passed a 'crtc', which 563/* Called from drm generic code, passed a 'crtc', which
564 * we use as a pipe index 564 * we use as a pipe index
565 */ 565 */
566static u32 i915_get_vblank_counter(struct drm_device *dev, int pipe) 566static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
567{ 567{
568 struct drm_i915_private *dev_priv = dev->dev_private; 568 struct drm_i915_private *dev_priv = dev->dev_private;
569 unsigned long high_frame; 569 unsigned long high_frame;
@@ -611,7 +611,7 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
611 return (((high1 << 8) | low) + (pixel >= vbl_start)) & 0xffffff; 611 return (((high1 << 8) | low) + (pixel >= vbl_start)) & 0xffffff;
612} 612}
613 613
614static u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe) 614static u32 gm45_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
615{ 615{
616 struct drm_i915_private *dev_priv = dev->dev_private; 616 struct drm_i915_private *dev_priv = dev->dev_private;
617 int reg = PIPE_FRMCOUNT_GM45(pipe); 617 int reg = PIPE_FRMCOUNT_GM45(pipe);
@@ -672,7 +672,7 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
672 return (position + crtc->scanline_offset) % vtotal; 672 return (position + crtc->scanline_offset) % vtotal;
673} 673}
674 674
675static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe, 675static int i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
676 unsigned int flags, int *vpos, int *hpos, 676 unsigned int flags, int *vpos, int *hpos,
677 ktime_t *stime, ktime_t *etime, 677 ktime_t *stime, ktime_t *etime,
678 const struct drm_display_mode *mode) 678 const struct drm_display_mode *mode)
@@ -809,27 +809,27 @@ int intel_get_crtc_scanline(struct intel_crtc *crtc)
809 return position; 809 return position;
810} 810}
811 811
812static int i915_get_vblank_timestamp(struct drm_device *dev, int pipe, 812static int i915_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
813 int *max_error, 813 int *max_error,
814 struct timeval *vblank_time, 814 struct timeval *vblank_time,
815 unsigned flags) 815 unsigned flags)
816{ 816{
817 struct drm_crtc *crtc; 817 struct drm_crtc *crtc;
818 818
819 if (pipe < 0 || pipe >= INTEL_INFO(dev)->num_pipes) { 819 if (pipe >= INTEL_INFO(dev)->num_pipes) {
820 DRM_ERROR("Invalid crtc %d\n", pipe); 820 DRM_ERROR("Invalid crtc %u\n", pipe);
821 return -EINVAL; 821 return -EINVAL;
822 } 822 }
823 823
824 /* Get drm_crtc to timestamp: */ 824 /* Get drm_crtc to timestamp: */
825 crtc = intel_get_crtc_for_pipe(dev, pipe); 825 crtc = intel_get_crtc_for_pipe(dev, pipe);
826 if (crtc == NULL) { 826 if (crtc == NULL) {
827 DRM_ERROR("Invalid crtc %d\n", pipe); 827 DRM_ERROR("Invalid crtc %u\n", pipe);
828 return -EINVAL; 828 return -EINVAL;
829 } 829 }
830 830
831 if (!crtc->hwmode.crtc_clock) { 831 if (!crtc->hwmode.crtc_clock) {
832 DRM_DEBUG_KMS("crtc %d is disabled\n", pipe); 832 DRM_DEBUG_KMS("crtc %u is disabled\n", pipe);
833 return -EBUSY; 833 return -EBUSY;
834 } 834 }
835 835
@@ -2431,7 +2431,7 @@ void i915_handle_error(struct drm_device *dev, bool wedged,
2431/* Called from drm generic code, passed 'crtc' which 2431/* Called from drm generic code, passed 'crtc' which
2432 * we use as a pipe index 2432 * we use as a pipe index
2433 */ 2433 */
2434static int i915_enable_vblank(struct drm_device *dev, int pipe) 2434static int i915_enable_vblank(struct drm_device *dev, unsigned int pipe)
2435{ 2435{
2436 struct drm_i915_private *dev_priv = dev->dev_private; 2436 struct drm_i915_private *dev_priv = dev->dev_private;
2437 unsigned long irqflags; 2437 unsigned long irqflags;
@@ -2448,7 +2448,7 @@ static int i915_enable_vblank(struct drm_device *dev, int pipe)
2448 return 0; 2448 return 0;
2449} 2449}
2450 2450
2451static int ironlake_enable_vblank(struct drm_device *dev, int pipe) 2451static int ironlake_enable_vblank(struct drm_device *dev, unsigned int pipe)
2452{ 2452{
2453 struct drm_i915_private *dev_priv = dev->dev_private; 2453 struct drm_i915_private *dev_priv = dev->dev_private;
2454 unsigned long irqflags; 2454 unsigned long irqflags;
@@ -2462,7 +2462,7 @@ static int ironlake_enable_vblank(struct drm_device *dev, int pipe)
2462 return 0; 2462 return 0;
2463} 2463}
2464 2464
2465static int valleyview_enable_vblank(struct drm_device *dev, int pipe) 2465static int valleyview_enable_vblank(struct drm_device *dev, unsigned int pipe)
2466{ 2466{
2467 struct drm_i915_private *dev_priv = dev->dev_private; 2467 struct drm_i915_private *dev_priv = dev->dev_private;
2468 unsigned long irqflags; 2468 unsigned long irqflags;
@@ -2475,7 +2475,7 @@ static int valleyview_enable_vblank(struct drm_device *dev, int pipe)
2475 return 0; 2475 return 0;
2476} 2476}
2477 2477
2478static int gen8_enable_vblank(struct drm_device *dev, int pipe) 2478static int gen8_enable_vblank(struct drm_device *dev, unsigned int pipe)
2479{ 2479{
2480 struct drm_i915_private *dev_priv = dev->dev_private; 2480 struct drm_i915_private *dev_priv = dev->dev_private;
2481 unsigned long irqflags; 2481 unsigned long irqflags;
@@ -2491,7 +2491,7 @@ static int gen8_enable_vblank(struct drm_device *dev, int pipe)
2491/* Called from drm generic code, passed 'crtc' which 2491/* Called from drm generic code, passed 'crtc' which
2492 * we use as a pipe index 2492 * we use as a pipe index
2493 */ 2493 */
2494static void i915_disable_vblank(struct drm_device *dev, int pipe) 2494static void i915_disable_vblank(struct drm_device *dev, unsigned int pipe)
2495{ 2495{
2496 struct drm_i915_private *dev_priv = dev->dev_private; 2496 struct drm_i915_private *dev_priv = dev->dev_private;
2497 unsigned long irqflags; 2497 unsigned long irqflags;
@@ -2503,7 +2503,7 @@ static void i915_disable_vblank(struct drm_device *dev, int pipe)
2503 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); 2503 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
2504} 2504}
2505 2505
2506static void ironlake_disable_vblank(struct drm_device *dev, int pipe) 2506static void ironlake_disable_vblank(struct drm_device *dev, unsigned int pipe)
2507{ 2507{
2508 struct drm_i915_private *dev_priv = dev->dev_private; 2508 struct drm_i915_private *dev_priv = dev->dev_private;
2509 unsigned long irqflags; 2509 unsigned long irqflags;
@@ -2515,7 +2515,7 @@ static void ironlake_disable_vblank(struct drm_device *dev, int pipe)
2515 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); 2515 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
2516} 2516}
2517 2517
2518static void valleyview_disable_vblank(struct drm_device *dev, int pipe) 2518static void valleyview_disable_vblank(struct drm_device *dev, unsigned int pipe)
2519{ 2519{
2520 struct drm_i915_private *dev_priv = dev->dev_private; 2520 struct drm_i915_private *dev_priv = dev->dev_private;
2521 unsigned long irqflags; 2521 unsigned long irqflags;
@@ -2526,7 +2526,7 @@ static void valleyview_disable_vblank(struct drm_device *dev, int pipe)
2526 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); 2526 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
2527} 2527}
2528 2528
2529static void gen8_disable_vblank(struct drm_device *dev, int pipe) 2529static void gen8_disable_vblank(struct drm_device *dev, unsigned int pipe)
2530{ 2530{
2531 struct drm_i915_private *dev_priv = dev->dev_private; 2531 struct drm_i915_private *dev_priv = dev->dev_private;
2532 unsigned long irqflags; 2532 unsigned long irqflags;
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 74f505b0dd02..b880c12c6521 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -145,10 +145,10 @@ void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc)
145} 145}
146EXPORT_SYMBOL_GPL(imx_drm_handle_vblank); 146EXPORT_SYMBOL_GPL(imx_drm_handle_vblank);
147 147
148static int imx_drm_enable_vblank(struct drm_device *drm, int crtc) 148static int imx_drm_enable_vblank(struct drm_device *drm, unsigned int pipe)
149{ 149{
150 struct imx_drm_device *imxdrm = drm->dev_private; 150 struct imx_drm_device *imxdrm = drm->dev_private;
151 struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[crtc]; 151 struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[pipe];
152 int ret; 152 int ret;
153 153
154 if (!imx_drm_crtc) 154 if (!imx_drm_crtc)
@@ -163,10 +163,10 @@ static int imx_drm_enable_vblank(struct drm_device *drm, int crtc)
163 return ret; 163 return ret;
164} 164}
165 165
166static void imx_drm_disable_vblank(struct drm_device *drm, int crtc) 166static void imx_drm_disable_vblank(struct drm_device *drm, unsigned int pipe)
167{ 167{
168 struct imx_drm_device *imxdrm = drm->dev_private; 168 struct imx_drm_device *imxdrm = drm->dev_private;
169 struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[crtc]; 169 struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[pipe];
170 170
171 if (!imx_drm_crtc) 171 if (!imx_drm_crtc)
172 return; 172 return;
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
index b4a2014917e5..bb312339e0b0 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
+++ b/drivers/gpu/drm/mga/mga_drv.h
@@ -183,9 +183,9 @@ extern int mga_warp_install_microcode(drm_mga_private_t *dev_priv);
183extern int mga_warp_init(drm_mga_private_t *dev_priv); 183extern int mga_warp_init(drm_mga_private_t *dev_priv);
184 184
185 /* mga_irq.c */ 185 /* mga_irq.c */
186extern int mga_enable_vblank(struct drm_device *dev, int crtc); 186extern int mga_enable_vblank(struct drm_device *dev, unsigned int pipe);
187extern void mga_disable_vblank(struct drm_device *dev, int crtc); 187extern void mga_disable_vblank(struct drm_device *dev, unsigned int pipe);
188extern u32 mga_get_vblank_counter(struct drm_device *dev, int crtc); 188extern u32 mga_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
189extern int mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence); 189extern int mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence);
190extern int mga_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence); 190extern int mga_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence);
191extern irqreturn_t mga_driver_irq_handler(int irq, void *arg); 191extern irqreturn_t mga_driver_irq_handler(int irq, void *arg);
diff --git a/drivers/gpu/drm/mga/mga_irq.c b/drivers/gpu/drm/mga/mga_irq.c
index 1b071b8ff9dc..693ba708cfed 100644
--- a/drivers/gpu/drm/mga/mga_irq.c
+++ b/drivers/gpu/drm/mga/mga_irq.c
@@ -35,12 +35,12 @@
35#include <drm/mga_drm.h> 35#include <drm/mga_drm.h>
36#include "mga_drv.h" 36#include "mga_drv.h"
37 37
38u32 mga_get_vblank_counter(struct drm_device *dev, int crtc) 38u32 mga_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
39{ 39{
40 const drm_mga_private_t *const dev_priv = 40 const drm_mga_private_t *const dev_priv =
41 (drm_mga_private_t *) dev->dev_private; 41 (drm_mga_private_t *) dev->dev_private;
42 42
43 if (crtc != 0) 43 if (pipe != 0)
44 return 0; 44 return 0;
45 45
46 return atomic_read(&dev_priv->vbl_received); 46 return atomic_read(&dev_priv->vbl_received);
@@ -88,13 +88,13 @@ irqreturn_t mga_driver_irq_handler(int irq, void *arg)
88 return IRQ_NONE; 88 return IRQ_NONE;
89} 89}
90 90
91int mga_enable_vblank(struct drm_device *dev, int crtc) 91int mga_enable_vblank(struct drm_device *dev, unsigned int pipe)
92{ 92{
93 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; 93 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
94 94
95 if (crtc != 0) { 95 if (pipe != 0) {
96 DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", 96 DRM_ERROR("tried to enable vblank on non-existent crtc %u\n",
97 crtc); 97 pipe);
98 return 0; 98 return 0;
99 } 99 }
100 100
@@ -103,11 +103,11 @@ int mga_enable_vblank(struct drm_device *dev, int crtc)
103} 103}
104 104
105 105
106void mga_disable_vblank(struct drm_device *dev, int crtc) 106void mga_disable_vblank(struct drm_device *dev, unsigned int pipe)
107{ 107{
108 if (crtc != 0) { 108 if (pipe != 0) {
109 DRM_ERROR("tried to disable vblank on non-existent crtc %d\n", 109 DRM_ERROR("tried to disable vblank on non-existent crtc %u\n",
110 crtc); 110 pipe);
111 } 111 }
112 112
113 /* Do *NOT* disable the vertical refresh interrupt. MGA doesn't have 113 /* Do *NOT* disable the vertical refresh interrupt. MGA doesn't have
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 0339c5d82d37..7e44511d0951 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -531,24 +531,24 @@ static void msm_irq_uninstall(struct drm_device *dev)
531 kms->funcs->irq_uninstall(kms); 531 kms->funcs->irq_uninstall(kms);
532} 532}
533 533
534static int msm_enable_vblank(struct drm_device *dev, int crtc_id) 534static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
535{ 535{
536 struct msm_drm_private *priv = dev->dev_private; 536 struct msm_drm_private *priv = dev->dev_private;
537 struct msm_kms *kms = priv->kms; 537 struct msm_kms *kms = priv->kms;
538 if (!kms) 538 if (!kms)
539 return -ENXIO; 539 return -ENXIO;
540 DBG("dev=%p, crtc=%d", dev, crtc_id); 540 DBG("dev=%p, crtc=%u", dev, pipe);
541 return vblank_ctrl_queue_work(priv, crtc_id, true); 541 return vblank_ctrl_queue_work(priv, pipe, true);
542} 542}
543 543
544static void msm_disable_vblank(struct drm_device *dev, int crtc_id) 544static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe)
545{ 545{
546 struct msm_drm_private *priv = dev->dev_private; 546 struct msm_drm_private *priv = dev->dev_private;
547 struct msm_kms *kms = priv->kms; 547 struct msm_kms *kms = priv->kms;
548 if (!kms) 548 if (!kms)
549 return; 549 return;
550 DBG("dev=%p, crtc=%d", dev, crtc_id); 550 DBG("dev=%p, crtc=%u", dev, pipe);
551 vblank_ctrl_queue_work(priv, crtc_id, false); 551 vblank_ctrl_queue_work(priv, pipe, false);
552} 552}
553 553
554/* 554/*
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index a82c3cbe3127..886079dd9baa 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -51,12 +51,12 @@ nouveau_display_vblank_handler(struct nvif_notify *notify)
51} 51}
52 52
53int 53int
54nouveau_display_vblank_enable(struct drm_device *dev, int head) 54nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe)
55{ 55{
56 struct drm_crtc *crtc; 56 struct drm_crtc *crtc;
57 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 57 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
58 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 58 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
59 if (nv_crtc->index == head) { 59 if (nv_crtc->index == pipe) {
60 nvif_notify_get(&nv_crtc->vblank); 60 nvif_notify_get(&nv_crtc->vblank);
61 return 0; 61 return 0;
62 } 62 }
@@ -65,12 +65,12 @@ nouveau_display_vblank_enable(struct drm_device *dev, int head)
65} 65}
66 66
67void 67void
68nouveau_display_vblank_disable(struct drm_device *dev, int head) 68nouveau_display_vblank_disable(struct drm_device *dev, unsigned int pipe)
69{ 69{
70 struct drm_crtc *crtc; 70 struct drm_crtc *crtc;
71 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 71 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
72 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 72 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
73 if (nv_crtc->index == head) { 73 if (nv_crtc->index == pipe) {
74 nvif_notify_put(&nv_crtc->vblank); 74 nvif_notify_put(&nv_crtc->vblank);
75 return; 75 return;
76 } 76 }
@@ -132,14 +132,15 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
132} 132}
133 133
134int 134int
135nouveau_display_scanoutpos(struct drm_device *dev, int head, unsigned int flags, 135nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe,
136 int *vpos, int *hpos, ktime_t *stime, ktime_t *etime, 136 unsigned int flags, int *vpos, int *hpos,
137 ktime_t *stime, ktime_t *etime,
137 const struct drm_display_mode *mode) 138 const struct drm_display_mode *mode)
138{ 139{
139 struct drm_crtc *crtc; 140 struct drm_crtc *crtc;
140 141
141 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 142 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
142 if (nouveau_crtc(crtc)->index == head) { 143 if (nouveau_crtc(crtc)->index == pipe) {
143 return nouveau_display_scanoutpos_head(crtc, vpos, hpos, 144 return nouveau_display_scanoutpos_head(crtc, vpos, hpos,
144 stime, etime); 145 stime, etime);
145 } 146 }
@@ -149,15 +150,15 @@ nouveau_display_scanoutpos(struct drm_device *dev, int head, unsigned int flags,
149} 150}
150 151
151int 152int
152nouveau_display_vblstamp(struct drm_device *dev, int head, int *max_error, 153nouveau_display_vblstamp(struct drm_device *dev, unsigned int pipe,
153 struct timeval *time, unsigned flags) 154 int *max_error, struct timeval *time, unsigned flags)
154{ 155{
155 struct drm_crtc *crtc; 156 struct drm_crtc *crtc;
156 157
157 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 158 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
158 if (nouveau_crtc(crtc)->index == head) { 159 if (nouveau_crtc(crtc)->index == pipe) {
159 return drm_calc_vbltimestamp_from_scanoutpos(dev, 160 return drm_calc_vbltimestamp_from_scanoutpos(dev,
160 head, max_error, time, flags, 161 pipe, max_error, time, flags,
161 &crtc->hwmode); 162 &crtc->hwmode);
162 } 163 }
163 } 164 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 4182d21538c5..856abe0f070d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -65,12 +65,12 @@ int nouveau_display_init(struct drm_device *dev);
65void nouveau_display_fini(struct drm_device *dev); 65void nouveau_display_fini(struct drm_device *dev);
66int nouveau_display_suspend(struct drm_device *dev, bool runtime); 66int nouveau_display_suspend(struct drm_device *dev, bool runtime);
67void nouveau_display_resume(struct drm_device *dev, bool runtime); 67void nouveau_display_resume(struct drm_device *dev, bool runtime);
68int nouveau_display_vblank_enable(struct drm_device *, int); 68int nouveau_display_vblank_enable(struct drm_device *, unsigned int);
69void nouveau_display_vblank_disable(struct drm_device *, int); 69void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
70int nouveau_display_scanoutpos(struct drm_device *, int, unsigned int, 70int nouveau_display_scanoutpos(struct drm_device *, unsigned int,
71 int *, int *, ktime_t *, ktime_t *, 71 unsigned int, int *, int *, ktime_t *,
72 const struct drm_display_mode *); 72 ktime_t *, const struct drm_display_mode *);
73int nouveau_display_vblstamp(struct drm_device *, int, int *, 73int nouveau_display_vblstamp(struct drm_device *, unsigned int, int *,
74 struct timeval *, unsigned); 74 struct timeval *, unsigned);
75 75
76int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, 76int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 12081e61d45a..5c367aad8a6e 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -129,8 +129,8 @@ void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
129int omap_gem_resume(struct device *dev); 129int omap_gem_resume(struct device *dev);
130#endif 130#endif
131 131
132int omap_irq_enable_vblank(struct drm_device *dev, int crtc_id); 132int omap_irq_enable_vblank(struct drm_device *dev, unsigned int pipe);
133void omap_irq_disable_vblank(struct drm_device *dev, int crtc_id); 133void omap_irq_disable_vblank(struct drm_device *dev, unsigned int pipe);
134void __omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq); 134void __omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq);
135void __omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq); 135void __omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq);
136void omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq); 136void omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq);
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
index 249c0330d6ce..60e1e8016708 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -134,7 +134,7 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
134/** 134/**
135 * enable_vblank - enable vblank interrupt events 135 * enable_vblank - enable vblank interrupt events
136 * @dev: DRM device 136 * @dev: DRM device
137 * @crtc: which irq to enable 137 * @pipe: which irq to enable
138 * 138 *
139 * Enable vblank interrupts for @crtc. If the device doesn't have 139 * Enable vblank interrupts for @crtc. If the device doesn't have
140 * a hardware vblank counter, this routine should be a no-op, since 140 * a hardware vblank counter, this routine should be a no-op, since
@@ -144,13 +144,13 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
144 * Zero on success, appropriate errno if the given @crtc's vblank 144 * Zero on success, appropriate errno if the given @crtc's vblank
145 * interrupt cannot be enabled. 145 * interrupt cannot be enabled.
146 */ 146 */
147int omap_irq_enable_vblank(struct drm_device *dev, int crtc_id) 147int omap_irq_enable_vblank(struct drm_device *dev, unsigned int pipe)
148{ 148{
149 struct omap_drm_private *priv = dev->dev_private; 149 struct omap_drm_private *priv = dev->dev_private;
150 struct drm_crtc *crtc = priv->crtcs[crtc_id]; 150 struct drm_crtc *crtc = priv->crtcs[pipe];
151 unsigned long flags; 151 unsigned long flags;
152 152
153 DBG("dev=%p, crtc=%d", dev, crtc_id); 153 DBG("dev=%p, crtc=%u", dev, pipe);
154 154
155 spin_lock_irqsave(&list_lock, flags); 155 spin_lock_irqsave(&list_lock, flags);
156 priv->vblank_mask |= pipe2vbl(crtc); 156 priv->vblank_mask |= pipe2vbl(crtc);
@@ -163,19 +163,19 @@ int omap_irq_enable_vblank(struct drm_device *dev, int crtc_id)
163/** 163/**
164 * disable_vblank - disable vblank interrupt events 164 * disable_vblank - disable vblank interrupt events
165 * @dev: DRM device 165 * @dev: DRM device
166 * @crtc: which irq to enable 166 * @pipe: which irq to enable
167 * 167 *
168 * Disable vblank interrupts for @crtc. If the device doesn't have 168 * Disable vblank interrupts for @crtc. If the device doesn't have
169 * a hardware vblank counter, this routine should be a no-op, since 169 * a hardware vblank counter, this routine should be a no-op, since
170 * interrupts will have to stay on to keep the count accurate. 170 * interrupts will have to stay on to keep the count accurate.
171 */ 171 */
172void omap_irq_disable_vblank(struct drm_device *dev, int crtc_id) 172void omap_irq_disable_vblank(struct drm_device *dev, unsigned int pipe)
173{ 173{
174 struct omap_drm_private *priv = dev->dev_private; 174 struct omap_drm_private *priv = dev->dev_private;
175 struct drm_crtc *crtc = priv->crtcs[crtc_id]; 175 struct drm_crtc *crtc = priv->crtcs[pipe];
176 unsigned long flags; 176 unsigned long flags;
177 177
178 DBG("dev=%p, crtc=%d", dev, crtc_id); 178 DBG("dev=%p, crtc=%u", dev, pipe);
179 179
180 spin_lock_irqsave(&list_lock, flags); 180 spin_lock_irqsave(&list_lock, flags);
181 priv->vblank_mask &= ~pipe2vbl(crtc); 181 priv->vblank_mask &= ~pipe2vbl(crtc);
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index 83f6f0b5e9ef..7307b07fe06b 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -196,17 +196,18 @@ static int qxl_pm_restore(struct device *dev)
196 return qxl_drm_resume(drm_dev, false); 196 return qxl_drm_resume(drm_dev, false);
197} 197}
198 198
199static u32 qxl_noop_get_vblank_counter(struct drm_device *dev, int crtc) 199static u32 qxl_noop_get_vblank_counter(struct drm_device *dev,
200 unsigned int pipe)
200{ 201{
201 return 0; 202 return 0;
202} 203}
203 204
204static int qxl_noop_enable_vblank(struct drm_device *dev, int crtc) 205static int qxl_noop_enable_vblank(struct drm_device *dev, unsigned int pipe)
205{ 206{
206 return 0; 207 return 0;
207} 208}
208 209
209static void qxl_noop_disable_vblank(struct drm_device *dev, int crtc) 210static void qxl_noop_disable_vblank(struct drm_device *dev, unsigned int pipe)
210{ 211{
211} 212}
212 213
diff --git a/drivers/gpu/drm/r128/r128_drv.h b/drivers/gpu/drm/r128/r128_drv.h
index 723e5d6f10a4..09143b840482 100644
--- a/drivers/gpu/drm/r128/r128_drv.h
+++ b/drivers/gpu/drm/r128/r128_drv.h
@@ -154,9 +154,9 @@ extern int r128_wait_ring(drm_r128_private_t *dev_priv, int n);
154extern int r128_do_cce_idle(drm_r128_private_t *dev_priv); 154extern int r128_do_cce_idle(drm_r128_private_t *dev_priv);
155extern int r128_do_cleanup_cce(struct drm_device *dev); 155extern int r128_do_cleanup_cce(struct drm_device *dev);
156 156
157extern int r128_enable_vblank(struct drm_device *dev, int crtc); 157extern int r128_enable_vblank(struct drm_device *dev, unsigned int pipe);
158extern void r128_disable_vblank(struct drm_device *dev, int crtc); 158extern void r128_disable_vblank(struct drm_device *dev, unsigned int pipe);
159extern u32 r128_get_vblank_counter(struct drm_device *dev, int crtc); 159extern u32 r128_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
160extern irqreturn_t r128_driver_irq_handler(int irq, void *arg); 160extern irqreturn_t r128_driver_irq_handler(int irq, void *arg);
161extern void r128_driver_irq_preinstall(struct drm_device *dev); 161extern void r128_driver_irq_preinstall(struct drm_device *dev);
162extern int r128_driver_irq_postinstall(struct drm_device *dev); 162extern int r128_driver_irq_postinstall(struct drm_device *dev);
diff --git a/drivers/gpu/drm/r128/r128_irq.c b/drivers/gpu/drm/r128/r128_irq.c
index c2ae496babb7..9730f4918944 100644
--- a/drivers/gpu/drm/r128/r128_irq.c
+++ b/drivers/gpu/drm/r128/r128_irq.c
@@ -34,11 +34,11 @@
34#include <drm/r128_drm.h> 34#include <drm/r128_drm.h>
35#include "r128_drv.h" 35#include "r128_drv.h"
36 36
37u32 r128_get_vblank_counter(struct drm_device *dev, int crtc) 37u32 r128_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
38{ 38{
39 const drm_r128_private_t *dev_priv = dev->dev_private; 39 const drm_r128_private_t *dev_priv = dev->dev_private;
40 40
41 if (crtc != 0) 41 if (pipe != 0)
42 return 0; 42 return 0;
43 43
44 return atomic_read(&dev_priv->vbl_received); 44 return atomic_read(&dev_priv->vbl_received);
@@ -62,12 +62,12 @@ irqreturn_t r128_driver_irq_handler(int irq, void *arg)
62 return IRQ_NONE; 62 return IRQ_NONE;
63} 63}
64 64
65int r128_enable_vblank(struct drm_device *dev, int crtc) 65int r128_enable_vblank(struct drm_device *dev, unsigned int pipe)
66{ 66{
67 drm_r128_private_t *dev_priv = dev->dev_private; 67 drm_r128_private_t *dev_priv = dev->dev_private;
68 68
69 if (crtc != 0) { 69 if (pipe != 0) {
70 DRM_ERROR("%s: bad crtc %d\n", __func__, crtc); 70 DRM_ERROR("%s: bad crtc %u\n", __func__, pipe);
71 return -EINVAL; 71 return -EINVAL;
72 } 72 }
73 73
@@ -75,10 +75,10 @@ int r128_enable_vblank(struct drm_device *dev, int crtc)
75 return 0; 75 return 0;
76} 76}
77 77
78void r128_disable_vblank(struct drm_device *dev, int crtc) 78void r128_disable_vblank(struct drm_device *dev, unsigned int pipe)
79{ 79{
80 if (crtc != 0) 80 if (pipe != 0)
81 DRM_ERROR("%s: bad crtc %d\n", __func__, crtc); 81 DRM_ERROR("%s: bad crtc %u\n", __func__, pipe);
82 82
83 /* 83 /*
84 * FIXME: implement proper interrupt disable by using the vblank 84 * FIXME: implement proper interrupt disable by using the vblank
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 0503af748d99..a58635c5db3d 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1799,8 +1799,9 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
1799 * unknown small number of scanlines wrt. real scanout position. 1799 * unknown small number of scanlines wrt. real scanout position.
1800 * 1800 *
1801 */ 1801 */
1802int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, unsigned int flags, 1802int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
1803 int *vpos, int *hpos, ktime_t *stime, ktime_t *etime, 1803 unsigned int flags, int *vpos, int *hpos,
1804 ktime_t *stime, ktime_t *etime,
1804 const struct drm_display_mode *mode) 1805 const struct drm_display_mode *mode)
1805{ 1806{
1806 u32 stat_crtc = 0, vbl = 0, position = 0; 1807 u32 stat_crtc = 0, vbl = 0, position = 0;
@@ -1816,42 +1817,42 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, unsigned int fl
1816 *stime = ktime_get(); 1817 *stime = ktime_get();
1817 1818
1818 if (ASIC_IS_DCE4(rdev)) { 1819 if (ASIC_IS_DCE4(rdev)) {
1819 if (crtc == 0) { 1820 if (pipe == 0) {
1820 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END + 1821 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END +
1821 EVERGREEN_CRTC0_REGISTER_OFFSET); 1822 EVERGREEN_CRTC0_REGISTER_OFFSET);
1822 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION + 1823 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION +
1823 EVERGREEN_CRTC0_REGISTER_OFFSET); 1824 EVERGREEN_CRTC0_REGISTER_OFFSET);
1824 ret |= DRM_SCANOUTPOS_VALID; 1825 ret |= DRM_SCANOUTPOS_VALID;
1825 } 1826 }
1826 if (crtc == 1) { 1827 if (pipe == 1) {
1827 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END + 1828 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END +
1828 EVERGREEN_CRTC1_REGISTER_OFFSET); 1829 EVERGREEN_CRTC1_REGISTER_OFFSET);
1829 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION + 1830 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION +
1830 EVERGREEN_CRTC1_REGISTER_OFFSET); 1831 EVERGREEN_CRTC1_REGISTER_OFFSET);
1831 ret |= DRM_SCANOUTPOS_VALID; 1832 ret |= DRM_SCANOUTPOS_VALID;
1832 } 1833 }
1833 if (crtc == 2) { 1834 if (pipe == 2) {
1834 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END + 1835 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END +
1835 EVERGREEN_CRTC2_REGISTER_OFFSET); 1836 EVERGREEN_CRTC2_REGISTER_OFFSET);
1836 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION + 1837 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION +
1837 EVERGREEN_CRTC2_REGISTER_OFFSET); 1838 EVERGREEN_CRTC2_REGISTER_OFFSET);
1838 ret |= DRM_SCANOUTPOS_VALID; 1839 ret |= DRM_SCANOUTPOS_VALID;
1839 } 1840 }
1840 if (crtc == 3) { 1841 if (pipe == 3) {
1841 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END + 1842 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END +
1842 EVERGREEN_CRTC3_REGISTER_OFFSET); 1843 EVERGREEN_CRTC3_REGISTER_OFFSET);
1843 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION + 1844 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION +
1844 EVERGREEN_CRTC3_REGISTER_OFFSET); 1845 EVERGREEN_CRTC3_REGISTER_OFFSET);
1845 ret |= DRM_SCANOUTPOS_VALID; 1846 ret |= DRM_SCANOUTPOS_VALID;
1846 } 1847 }
1847 if (crtc == 4) { 1848 if (pipe == 4) {
1848 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END + 1849 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END +
1849 EVERGREEN_CRTC4_REGISTER_OFFSET); 1850 EVERGREEN_CRTC4_REGISTER_OFFSET);
1850 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION + 1851 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION +
1851 EVERGREEN_CRTC4_REGISTER_OFFSET); 1852 EVERGREEN_CRTC4_REGISTER_OFFSET);
1852 ret |= DRM_SCANOUTPOS_VALID; 1853 ret |= DRM_SCANOUTPOS_VALID;
1853 } 1854 }
1854 if (crtc == 5) { 1855 if (pipe == 5) {
1855 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END + 1856 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END +
1856 EVERGREEN_CRTC5_REGISTER_OFFSET); 1857 EVERGREEN_CRTC5_REGISTER_OFFSET);
1857 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION + 1858 position = RREG32(EVERGREEN_CRTC_STATUS_POSITION +
@@ -1859,19 +1860,19 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, unsigned int fl
1859 ret |= DRM_SCANOUTPOS_VALID; 1860 ret |= DRM_SCANOUTPOS_VALID;
1860 } 1861 }
1861 } else if (ASIC_IS_AVIVO(rdev)) { 1862 } else if (ASIC_IS_AVIVO(rdev)) {
1862 if (crtc == 0) { 1863 if (pipe == 0) {
1863 vbl = RREG32(AVIVO_D1CRTC_V_BLANK_START_END); 1864 vbl = RREG32(AVIVO_D1CRTC_V_BLANK_START_END);
1864 position = RREG32(AVIVO_D1CRTC_STATUS_POSITION); 1865 position = RREG32(AVIVO_D1CRTC_STATUS_POSITION);
1865 ret |= DRM_SCANOUTPOS_VALID; 1866 ret |= DRM_SCANOUTPOS_VALID;
1866 } 1867 }
1867 if (crtc == 1) { 1868 if (pipe == 1) {
1868 vbl = RREG32(AVIVO_D2CRTC_V_BLANK_START_END); 1869 vbl = RREG32(AVIVO_D2CRTC_V_BLANK_START_END);
1869 position = RREG32(AVIVO_D2CRTC_STATUS_POSITION); 1870 position = RREG32(AVIVO_D2CRTC_STATUS_POSITION);
1870 ret |= DRM_SCANOUTPOS_VALID; 1871 ret |= DRM_SCANOUTPOS_VALID;
1871 } 1872 }
1872 } else { 1873 } else {
1873 /* Pre-AVIVO: Different encoding of scanout pos and vblank interval. */ 1874 /* Pre-AVIVO: Different encoding of scanout pos and vblank interval. */
1874 if (crtc == 0) { 1875 if (pipe == 0) {
1875 /* Assume vbl_end == 0, get vbl_start from 1876 /* Assume vbl_end == 0, get vbl_start from
1876 * upper 16 bits. 1877 * upper 16 bits.
1877 */ 1878 */
@@ -1885,7 +1886,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, unsigned int fl
1885 1886
1886 ret |= DRM_SCANOUTPOS_VALID; 1887 ret |= DRM_SCANOUTPOS_VALID;
1887 } 1888 }
1888 if (crtc == 1) { 1889 if (pipe == 1) {
1889 vbl = (RREG32(RADEON_CRTC2_V_TOTAL_DISP) & 1890 vbl = (RREG32(RADEON_CRTC2_V_TOTAL_DISP) &
1890 RADEON_CRTC_V_DISP) >> RADEON_CRTC_V_DISP_SHIFT; 1891 RADEON_CRTC_V_DISP) >> RADEON_CRTC_V_DISP_SHIFT;
1891 position = (RREG32(RADEON_CRTC2_VLINE_CRNT_VLINE) >> 16) & RADEON_CRTC_V_TOTAL; 1892 position = (RREG32(RADEON_CRTC2_VLINE_CRNT_VLINE) >> 16) & RADEON_CRTC_V_TOTAL;
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index e30c1d73b4ca..5b6a6f5b3619 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -105,10 +105,10 @@ void radeon_driver_preclose_kms(struct drm_device *dev,
105 struct drm_file *file_priv); 105 struct drm_file *file_priv);
106int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon); 106int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon);
107int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon); 107int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
108u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc); 108u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
109int radeon_enable_vblank_kms(struct drm_device *dev, int crtc); 109int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
110void radeon_disable_vblank_kms(struct drm_device *dev, int crtc); 110void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
111int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc, 111int radeon_get_vblank_timestamp_kms(struct drm_device *dev, unsigned int pipe,
112 int *max_error, 112 int *max_error,
113 struct timeval *vblank_time, 113 struct timeval *vblank_time,
114 unsigned flags); 114 unsigned flags);
@@ -124,9 +124,8 @@ void radeon_gem_object_close(struct drm_gem_object *obj,
124struct dma_buf *radeon_gem_prime_export(struct drm_device *dev, 124struct dma_buf *radeon_gem_prime_export(struct drm_device *dev,
125 struct drm_gem_object *gobj, 125 struct drm_gem_object *gobj,
126 int flags); 126 int flags);
127extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, 127extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int crtc,
128 unsigned int flags, 128 unsigned int flags, int *vpos, int *hpos,
129 int *vpos, int *hpos,
130 ktime_t *stime, ktime_t *etime, 129 ktime_t *stime, ktime_t *etime,
131 const struct drm_display_mode *mode); 130 const struct drm_display_mode *mode);
132extern bool radeon_is_px(struct drm_device *dev); 131extern bool radeon_is_px(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h
index 46bd3938282c..0caafc7a6e17 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.h
+++ b/drivers/gpu/drm/radeon/radeon_drv.h
@@ -404,9 +404,9 @@ extern int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *
404extern int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv); 404extern int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv);
405 405
406extern void radeon_do_release(struct drm_device * dev); 406extern void radeon_do_release(struct drm_device * dev);
407extern u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc); 407extern u32 radeon_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
408extern int radeon_enable_vblank(struct drm_device *dev, int crtc); 408extern int radeon_enable_vblank(struct drm_device *dev, unsigned int pipe);
409extern void radeon_disable_vblank(struct drm_device *dev, int crtc); 409extern void radeon_disable_vblank(struct drm_device *dev, unsigned int pipe);
410extern irqreturn_t radeon_driver_irq_handler(int irq, void *arg); 410extern irqreturn_t radeon_driver_irq_handler(int irq, void *arg);
411extern void radeon_driver_irq_preinstall(struct drm_device * dev); 411extern void radeon_driver_irq_preinstall(struct drm_device * dev);
412extern int radeon_driver_irq_postinstall(struct drm_device *dev); 412extern int radeon_driver_irq_postinstall(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_irq.c b/drivers/gpu/drm/radeon/radeon_irq.c
index 244b19bab2e7..688afb62f7c4 100644
--- a/drivers/gpu/drm/radeon/radeon_irq.c
+++ b/drivers/gpu/drm/radeon/radeon_irq.c
@@ -62,12 +62,12 @@ static void r500_vbl_irq_set_state(struct drm_device *dev, u32 mask, int state)
62 RADEON_WRITE(R500_DxMODE_INT_MASK, dev_priv->r500_disp_irq_reg); 62 RADEON_WRITE(R500_DxMODE_INT_MASK, dev_priv->r500_disp_irq_reg);
63} 63}
64 64
65int radeon_enable_vblank(struct drm_device *dev, int crtc) 65int radeon_enable_vblank(struct drm_device *dev, unsigned int pipe)
66{ 66{
67 drm_radeon_private_t *dev_priv = dev->dev_private; 67 drm_radeon_private_t *dev_priv = dev->dev_private;
68 68
69 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600) { 69 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600) {
70 switch (crtc) { 70 switch (pipe) {
71 case 0: 71 case 0:
72 r500_vbl_irq_set_state(dev, R500_D1MODE_INT_MASK, 1); 72 r500_vbl_irq_set_state(dev, R500_D1MODE_INT_MASK, 1);
73 break; 73 break;
@@ -75,12 +75,12 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc)
75 r500_vbl_irq_set_state(dev, R500_D2MODE_INT_MASK, 1); 75 r500_vbl_irq_set_state(dev, R500_D2MODE_INT_MASK, 1);
76 break; 76 break;
77 default: 77 default:
78 DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", 78 DRM_ERROR("tried to enable vblank on non-existent crtc %u\n",
79 crtc); 79 pipe);
80 return -EINVAL; 80 return -EINVAL;
81 } 81 }
82 } else { 82 } else {
83 switch (crtc) { 83 switch (pipe) {
84 case 0: 84 case 0:
85 radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 1); 85 radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 1);
86 break; 86 break;
@@ -88,8 +88,8 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc)
88 radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 1); 88 radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 1);
89 break; 89 break;
90 default: 90 default:
91 DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", 91 DRM_ERROR("tried to enable vblank on non-existent crtc %u\n",
92 crtc); 92 pipe);
93 return -EINVAL; 93 return -EINVAL;
94 } 94 }
95 } 95 }
@@ -97,12 +97,12 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc)
97 return 0; 97 return 0;
98} 98}
99 99
100void radeon_disable_vblank(struct drm_device *dev, int crtc) 100void radeon_disable_vblank(struct drm_device *dev, unsigned int pipe)
101{ 101{
102 drm_radeon_private_t *dev_priv = dev->dev_private; 102 drm_radeon_private_t *dev_priv = dev->dev_private;
103 103
104 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600) { 104 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600) {
105 switch (crtc) { 105 switch (pipe) {
106 case 0: 106 case 0:
107 r500_vbl_irq_set_state(dev, R500_D1MODE_INT_MASK, 0); 107 r500_vbl_irq_set_state(dev, R500_D1MODE_INT_MASK, 0);
108 break; 108 break;
@@ -110,12 +110,12 @@ void radeon_disable_vblank(struct drm_device *dev, int crtc)
110 r500_vbl_irq_set_state(dev, R500_D2MODE_INT_MASK, 0); 110 r500_vbl_irq_set_state(dev, R500_D2MODE_INT_MASK, 0);
111 break; 111 break;
112 default: 112 default:
113 DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", 113 DRM_ERROR("tried to enable vblank on non-existent crtc %u\n",
114 crtc); 114 pipe);
115 break; 115 break;
116 } 116 }
117 } else { 117 } else {
118 switch (crtc) { 118 switch (pipe) {
119 case 0: 119 case 0:
120 radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 0); 120 radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 0);
121 break; 121 break;
@@ -123,8 +123,8 @@ void radeon_disable_vblank(struct drm_device *dev, int crtc)
123 radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 0); 123 radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 0);
124 break; 124 break;
125 default: 125 default:
126 DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", 126 DRM_ERROR("tried to enable vblank on non-existent crtc %u\n",
127 crtc); 127 pipe);
128 break; 128 break;
129 } 129 }
130 } 130 }
@@ -255,7 +255,7 @@ static int radeon_wait_irq(struct drm_device * dev, int swi_nr)
255 return ret; 255 return ret;
256} 256}
257 257
258u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc) 258u32 radeon_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
259{ 259{
260 drm_radeon_private_t *dev_priv = dev->dev_private; 260 drm_radeon_private_t *dev_priv = dev->dev_private;
261 261
@@ -264,18 +264,18 @@ u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc)
264 return -EINVAL; 264 return -EINVAL;
265 } 265 }
266 266
267 if (crtc < 0 || crtc > 1) { 267 if (pipe > 1) {
268 DRM_ERROR("Invalid crtc %d\n", crtc); 268 DRM_ERROR("Invalid crtc %u\n", pipe);
269 return -EINVAL; 269 return -EINVAL;
270 } 270 }
271 271
272 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600) { 272 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600) {
273 if (crtc == 0) 273 if (pipe == 0)
274 return RADEON_READ(R500_D1CRTC_FRAME_COUNT); 274 return RADEON_READ(R500_D1CRTC_FRAME_COUNT);
275 else 275 else
276 return RADEON_READ(R500_D2CRTC_FRAME_COUNT); 276 return RADEON_READ(R500_D2CRTC_FRAME_COUNT);
277 } else { 277 } else {
278 if (crtc == 0) 278 if (pipe == 0)
279 return RADEON_READ(RADEON_CRTC_CRNT_FRAME); 279 return RADEON_READ(RADEON_CRTC_CRNT_FRAME);
280 else 280 else
281 return RADEON_READ(RADEON_CRTC2_CRNT_FRAME); 281 return RADEON_READ(RADEON_CRTC2_CRNT_FRAME);
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 2317d04f8a09..de18f0668bea 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -874,9 +874,8 @@ extern int radeon_crtc_cursor_move(struct drm_crtc *crtc,
874 int x, int y); 874 int x, int y);
875extern void radeon_cursor_reset(struct drm_crtc *crtc); 875extern void radeon_cursor_reset(struct drm_crtc *crtc);
876 876
877extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, 877extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
878 unsigned int flags, 878 unsigned int flags, int *vpos, int *hpos,
879 int *vpos, int *hpos,
880 ktime_t *stime, ktime_t *etime, 879 ktime_t *stime, ktime_t *etime,
881 const struct drm_display_mode *mode); 880 const struct drm_display_mode *mode);
882 881
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 780ca11512ba..bb806c4c2e65 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -221,20 +221,20 @@ static void rcar_du_lastclose(struct drm_device *dev)
221 drm_fbdev_cma_restore_mode(rcdu->fbdev); 221 drm_fbdev_cma_restore_mode(rcdu->fbdev);
222} 222}
223 223
224static int rcar_du_enable_vblank(struct drm_device *dev, int crtc) 224static int rcar_du_enable_vblank(struct drm_device *dev, unsigned int pipe)
225{ 225{
226 struct rcar_du_device *rcdu = dev->dev_private; 226 struct rcar_du_device *rcdu = dev->dev_private;
227 227
228 rcar_du_crtc_enable_vblank(&rcdu->crtcs[crtc], true); 228 rcar_du_crtc_enable_vblank(&rcdu->crtcs[pipe], true);
229 229
230 return 0; 230 return 0;
231} 231}
232 232
233static void rcar_du_disable_vblank(struct drm_device *dev, int crtc) 233static void rcar_du_disable_vblank(struct drm_device *dev, unsigned int pipe)
234{ 234{
235 struct rcar_du_device *rcdu = dev->dev_private; 235 struct rcar_du_device *rcdu = dev->dev_private;
236 236
237 rcar_du_crtc_enable_vblank(&rcdu->crtcs[crtc], false); 237 rcar_du_crtc_enable_vblank(&rcdu->crtcs[pipe], false);
238} 238}
239 239
240static const struct file_operations rcar_du_fops = { 240static const struct file_operations rcar_du_fops = {
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 9a0c2911272a..32c6098a99d1 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -103,7 +103,8 @@ static struct drm_crtc *rockchip_crtc_from_pipe(struct drm_device *drm,
103 return NULL; 103 return NULL;
104} 104}
105 105
106static int rockchip_drm_crtc_enable_vblank(struct drm_device *dev, int pipe) 106static int rockchip_drm_crtc_enable_vblank(struct drm_device *dev,
107 unsigned int pipe)
107{ 108{
108 struct rockchip_drm_private *priv = dev->dev_private; 109 struct rockchip_drm_private *priv = dev->dev_private;
109 struct drm_crtc *crtc = rockchip_crtc_from_pipe(dev, pipe); 110 struct drm_crtc *crtc = rockchip_crtc_from_pipe(dev, pipe);
@@ -115,7 +116,8 @@ static int rockchip_drm_crtc_enable_vblank(struct drm_device *dev, int pipe)
115 return 0; 116 return 0;
116} 117}
117 118
118static void rockchip_drm_crtc_disable_vblank(struct drm_device *dev, int pipe) 119static void rockchip_drm_crtc_disable_vblank(struct drm_device *dev,
120 unsigned int pipe)
119{ 121{
120 struct rockchip_drm_private *priv = dev->dev_private; 122 struct rockchip_drm_private *priv = dev->dev_private;
121 struct drm_crtc *crtc = rockchip_crtc_from_pipe(dev, pipe); 123 struct drm_crtc *crtc = rockchip_crtc_from_pipe(dev, pipe);
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index 666321de7b99..ca2f918a6587 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -231,7 +231,7 @@ static irqreturn_t shmob_drm_irq(int irq, void *arg)
231 return IRQ_HANDLED; 231 return IRQ_HANDLED;
232} 232}
233 233
234static int shmob_drm_enable_vblank(struct drm_device *dev, int crtc) 234static int shmob_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
235{ 235{
236 struct shmob_drm_device *sdev = dev->dev_private; 236 struct shmob_drm_device *sdev = dev->dev_private;
237 237
@@ -240,7 +240,7 @@ static int shmob_drm_enable_vblank(struct drm_device *dev, int crtc)
240 return 0; 240 return 0;
241} 241}
242 242
243static void shmob_drm_disable_vblank(struct drm_device *dev, int crtc) 243static void shmob_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
244{ 244{
245 struct shmob_drm_device *sdev = dev->dev_private; 245 struct shmob_drm_device *sdev = dev->dev_private;
246 246
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index 018ffc970e96..493c4a3006ad 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -299,7 +299,7 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
299 return 0; 299 return 0;
300} 300}
301 301
302int sti_crtc_enable_vblank(struct drm_device *dev, int crtc) 302int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
303{ 303{
304 struct sti_private *dev_priv = dev->dev_private; 304 struct sti_private *dev_priv = dev->dev_private;
305 struct sti_compositor *compo = dev_priv->compo; 305 struct sti_compositor *compo = dev_priv->compo;
@@ -307,9 +307,9 @@ int sti_crtc_enable_vblank(struct drm_device *dev, int crtc)
307 307
308 DRM_DEBUG_DRIVER("\n"); 308 DRM_DEBUG_DRIVER("\n");
309 309
310 if (sti_vtg_register_client(crtc == STI_MIXER_MAIN ? 310 if (sti_vtg_register_client(pipe == STI_MIXER_MAIN ?
311 compo->vtg_main : compo->vtg_aux, 311 compo->vtg_main : compo->vtg_aux,
312 vtg_vblank_nb, crtc)) { 312 vtg_vblank_nb, pipe)) {
313 DRM_ERROR("Cannot register VTG notifier\n"); 313 DRM_ERROR("Cannot register VTG notifier\n");
314 return -EINVAL; 314 return -EINVAL;
315 } 315 }
@@ -318,7 +318,7 @@ int sti_crtc_enable_vblank(struct drm_device *dev, int crtc)
318} 318}
319EXPORT_SYMBOL(sti_crtc_enable_vblank); 319EXPORT_SYMBOL(sti_crtc_enable_vblank);
320 320
321void sti_crtc_disable_vblank(struct drm_device *drm_dev, int crtc) 321void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
322{ 322{
323 struct sti_private *priv = drm_dev->dev_private; 323 struct sti_private *priv = drm_dev->dev_private;
324 struct sti_compositor *compo = priv->compo; 324 struct sti_compositor *compo = priv->compo;
@@ -326,14 +326,14 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, int crtc)
326 326
327 DRM_DEBUG_DRIVER("\n"); 327 DRM_DEBUG_DRIVER("\n");
328 328
329 if (sti_vtg_unregister_client(crtc == STI_MIXER_MAIN ? 329 if (sti_vtg_unregister_client(pipe == STI_MIXER_MAIN ?
330 compo->vtg_main : compo->vtg_aux, vtg_vblank_nb)) 330 compo->vtg_main : compo->vtg_aux, vtg_vblank_nb))
331 DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n"); 331 DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n");
332 332
333 /* free the resources of the pending requests */ 333 /* free the resources of the pending requests */
334 if (compo->mixer[crtc]->pending_event) { 334 if (compo->mixer[pipe]->pending_event) {
335 drm_vblank_put(drm_dev, crtc); 335 drm_vblank_put(drm_dev, pipe);
336 compo->mixer[crtc]->pending_event = NULL; 336 compo->mixer[pipe]->pending_event = NULL;
337 } 337 }
338} 338}
339EXPORT_SYMBOL(sti_crtc_disable_vblank); 339EXPORT_SYMBOL(sti_crtc_disable_vblank);
diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
index 51963e6ddbe7..3f2d89a3634d 100644
--- a/drivers/gpu/drm/sti/sti_crtc.h
+++ b/drivers/gpu/drm/sti/sti_crtc.h
@@ -13,8 +13,8 @@ struct sti_mixer;
13 13
14int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer, 14int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
15 struct drm_plane *primary, struct drm_plane *cursor); 15 struct drm_plane *primary, struct drm_plane *cursor);
16int sti_crtc_enable_vblank(struct drm_device *dev, int crtc); 16int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
17void sti_crtc_disable_vblank(struct drm_device *dev, int crtc); 17void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
18int sti_crtc_vblank_cb(struct notifier_block *nb, 18int sti_crtc_vblank_cb(struct notifier_block *nb,
19 unsigned long event, void *data); 19 unsigned long event, void *data);
20bool sti_crtc_is_main(struct drm_crtc *drm_crtc); 20bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 2486bc24bff6..759e6af91e59 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -822,7 +822,8 @@ static struct drm_crtc *tegra_crtc_from_pipe(struct drm_device *drm,
822 return NULL; 822 return NULL;
823} 823}
824 824
825static u32 tegra_drm_get_vblank_counter(struct drm_device *drm, int pipe) 825static u32 tegra_drm_get_vblank_counter(struct drm_device *drm,
826 unsigned int pipe)
826{ 827{
827 struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe); 828 struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe);
828 struct tegra_dc *dc = to_tegra_dc(crtc); 829 struct tegra_dc *dc = to_tegra_dc(crtc);
@@ -833,7 +834,7 @@ static u32 tegra_drm_get_vblank_counter(struct drm_device *drm, int pipe)
833 return tegra_dc_get_vblank_counter(dc); 834 return tegra_dc_get_vblank_counter(dc);
834} 835}
835 836
836static int tegra_drm_enable_vblank(struct drm_device *drm, int pipe) 837static int tegra_drm_enable_vblank(struct drm_device *drm, unsigned int pipe)
837{ 838{
838 struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe); 839 struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe);
839 struct tegra_dc *dc = to_tegra_dc(crtc); 840 struct tegra_dc *dc = to_tegra_dc(crtc);
@@ -846,7 +847,7 @@ static int tegra_drm_enable_vblank(struct drm_device *drm, int pipe)
846 return 0; 847 return 0;
847} 848}
848 849
849static void tegra_drm_disable_vblank(struct drm_device *drm, int pipe) 850static void tegra_drm_disable_vblank(struct drm_device *drm, unsigned int pipe)
850{ 851{
851 struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe); 852 struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe);
852 struct tegra_dc *dc = to_tegra_dc(crtc); 853 struct tegra_dc *dc = to_tegra_dc(crtc);
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 0f283a3b932c..a5b8f5d39311 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -425,13 +425,13 @@ static void enable_vblank(struct drm_device *dev, bool enable)
425 tilcdc_clear(dev, reg, mask); 425 tilcdc_clear(dev, reg, mask);
426} 426}
427 427
428static int tilcdc_enable_vblank(struct drm_device *dev, int crtc) 428static int tilcdc_enable_vblank(struct drm_device *dev, unsigned int pipe)
429{ 429{
430 enable_vblank(dev, true); 430 enable_vblank(dev, true);
431 return 0; 431 return 0;
432} 432}
433 433
434static void tilcdc_disable_vblank(struct drm_device *dev, int crtc) 434static void tilcdc_disable_vblank(struct drm_device *dev, unsigned int pipe)
435{ 435{
436 enable_vblank(dev, false); 436 enable_vblank(dev, false);
437} 437}
diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h
index ef8c500b4a00..644093f5046c 100644
--- a/drivers/gpu/drm/via/via_drv.h
+++ b/drivers/gpu/drm/via/via_drv.h
@@ -136,9 +136,9 @@ extern int via_init_context(struct drm_device *dev, int context);
136extern int via_final_context(struct drm_device *dev, int context); 136extern int via_final_context(struct drm_device *dev, int context);
137 137
138extern int via_do_cleanup_map(struct drm_device *dev); 138extern int via_do_cleanup_map(struct drm_device *dev);
139extern u32 via_get_vblank_counter(struct drm_device *dev, int crtc); 139extern u32 via_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
140extern int via_enable_vblank(struct drm_device *dev, int crtc); 140extern int via_enable_vblank(struct drm_device *dev, unsigned int pipe);
141extern void via_disable_vblank(struct drm_device *dev, int crtc); 141extern void via_disable_vblank(struct drm_device *dev, unsigned int pipe);
142 142
143extern irqreturn_t via_driver_irq_handler(int irq, void *arg); 143extern irqreturn_t via_driver_irq_handler(int irq, void *arg);
144extern void via_driver_irq_preinstall(struct drm_device *dev); 144extern void via_driver_irq_preinstall(struct drm_device *dev);
diff --git a/drivers/gpu/drm/via/via_irq.c b/drivers/gpu/drm/via/via_irq.c
index 1319433816d3..ea8172c747a2 100644
--- a/drivers/gpu/drm/via/via_irq.c
+++ b/drivers/gpu/drm/via/via_irq.c
@@ -95,10 +95,11 @@ static unsigned time_diff(struct timeval *now, struct timeval *then)
95 1000000 - (then->tv_usec - now->tv_usec); 95 1000000 - (then->tv_usec - now->tv_usec);
96} 96}
97 97
98u32 via_get_vblank_counter(struct drm_device *dev, int crtc) 98u32 via_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
99{ 99{
100 drm_via_private_t *dev_priv = dev->dev_private; 100 drm_via_private_t *dev_priv = dev->dev_private;
101 if (crtc != 0) 101
102 if (pipe != 0)
102 return 0; 103 return 0;
103 104
104 return atomic_read(&dev_priv->vbl_received); 105 return atomic_read(&dev_priv->vbl_received);
@@ -170,13 +171,13 @@ static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t *dev_priv)
170 } 171 }
171} 172}
172 173
173int via_enable_vblank(struct drm_device *dev, int crtc) 174int via_enable_vblank(struct drm_device *dev, unsigned int pipe)
174{ 175{
175 drm_via_private_t *dev_priv = dev->dev_private; 176 drm_via_private_t *dev_priv = dev->dev_private;
176 u32 status; 177 u32 status;
177 178
178 if (crtc != 0) { 179 if (pipe != 0) {
179 DRM_ERROR("%s: bad crtc %d\n", __func__, crtc); 180 DRM_ERROR("%s: bad crtc %u\n", __func__, pipe);
180 return -EINVAL; 181 return -EINVAL;
181 } 182 }
182 183
@@ -189,7 +190,7 @@ int via_enable_vblank(struct drm_device *dev, int crtc)
189 return 0; 190 return 0;
190} 191}
191 192
192void via_disable_vblank(struct drm_device *dev, int crtc) 193void via_disable_vblank(struct drm_device *dev, unsigned int pipe)
193{ 194{
194 drm_via_private_t *dev_priv = dev->dev_private; 195 drm_via_private_t *dev_priv = dev->dev_private;
195 u32 status; 196 u32 status;
@@ -200,8 +201,8 @@ void via_disable_vblank(struct drm_device *dev, int crtc)
200 VIA_WRITE8(0x83d4, 0x11); 201 VIA_WRITE8(0x83d4, 0x11);
201 VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30); 202 VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30);
202 203
203 if (crtc != 0) 204 if (pipe != 0)
204 DRM_ERROR("%s: bad crtc %d\n", __func__, crtc); 205 DRM_ERROR("%s: bad crtc %u\n", __func__, pipe);
205} 206}
206 207
207static int 208static int
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index f19fd39b43e1..a613bd4851ba 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -914,9 +914,9 @@ void vmw_kms_idle_workqueues(struct vmw_master *vmaster);
914bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv, 914bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv,
915 uint32_t pitch, 915 uint32_t pitch,
916 uint32_t height); 916 uint32_t height);
917u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc); 917u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
918int vmw_enable_vblank(struct drm_device *dev, int crtc); 918int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe);
919void vmw_disable_vblank(struct drm_device *dev, int crtc); 919void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe);
920int vmw_kms_present(struct vmw_private *dev_priv, 920int vmw_kms_present(struct vmw_private *dev_priv,
921 struct drm_file *file_priv, 921 struct drm_file *file_priv,
922 struct vmw_framebuffer *vfb, 922 struct vmw_framebuffer *vfb,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 15a6c01cd016..03ffab2a6a9c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1263,7 +1263,7 @@ bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv,
1263/** 1263/**
1264 * Function called by DRM code called with vbl_lock held. 1264 * Function called by DRM code called with vbl_lock held.
1265 */ 1265 */
1266u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc) 1266u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
1267{ 1267{
1268 return 0; 1268 return 0;
1269} 1269}
@@ -1271,7 +1271,7 @@ u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc)
1271/** 1271/**
1272 * Function called by DRM code called with vbl_lock held. 1272 * Function called by DRM code called with vbl_lock held.
1273 */ 1273 */
1274int vmw_enable_vblank(struct drm_device *dev, int crtc) 1274int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe)
1275{ 1275{
1276 return -ENOSYS; 1276 return -ENOSYS;
1277} 1277}
@@ -1279,7 +1279,7 @@ int vmw_enable_vblank(struct drm_device *dev, int crtc)
1279/** 1279/**
1280 * Function called by DRM code called with vbl_lock held. 1280 * Function called by DRM code called with vbl_lock held.
1281 */ 1281 */
1282void vmw_disable_vblank(struct drm_device *dev, int crtc) 1282void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe)
1283{ 1283{
1284} 1284}
1285 1285
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 967d8a03c0e1..1cb1e842e64d 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -412,7 +412,7 @@ struct drm_driver {
412 /** 412 /**
413 * get_vblank_counter - get raw hardware vblank counter 413 * get_vblank_counter - get raw hardware vblank counter
414 * @dev: DRM device 414 * @dev: DRM device
415 * @crtc: counter to fetch 415 * @pipe: counter to fetch
416 * 416 *
417 * Driver callback for fetching a raw hardware vblank counter for @crtc. 417 * Driver callback for fetching a raw hardware vblank counter for @crtc.
418 * If a device doesn't have a hardware counter, the driver can simply 418 * If a device doesn't have a hardware counter, the driver can simply
@@ -426,12 +426,12 @@ struct drm_driver {
426 * RETURNS 426 * RETURNS
427 * Raw vblank counter value. 427 * Raw vblank counter value.
428 */ 428 */
429 u32 (*get_vblank_counter) (struct drm_device *dev, int crtc); 429 u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
430 430
431 /** 431 /**
432 * enable_vblank - enable vblank interrupt events 432 * enable_vblank - enable vblank interrupt events
433 * @dev: DRM device 433 * @dev: DRM device
434 * @crtc: which irq to enable 434 * @pipe: which irq to enable
435 * 435 *
436 * Enable vblank interrupts for @crtc. If the device doesn't have 436 * Enable vblank interrupts for @crtc. If the device doesn't have
437 * a hardware vblank counter, this routine should be a no-op, since 437 * a hardware vblank counter, this routine should be a no-op, since
@@ -441,18 +441,18 @@ struct drm_driver {
441 * Zero on success, appropriate errno if the given @crtc's vblank 441 * Zero on success, appropriate errno if the given @crtc's vblank
442 * interrupt cannot be enabled. 442 * interrupt cannot be enabled.
443 */ 443 */
444 int (*enable_vblank) (struct drm_device *dev, int crtc); 444 int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
445 445
446 /** 446 /**
447 * disable_vblank - disable vblank interrupt events 447 * disable_vblank - disable vblank interrupt events
448 * @dev: DRM device 448 * @dev: DRM device
449 * @crtc: which irq to enable 449 * @pipe: which irq to enable
450 * 450 *
451 * Disable vblank interrupts for @crtc. If the device doesn't have 451 * Disable vblank interrupts for @crtc. If the device doesn't have
452 * a hardware vblank counter, this routine should be a no-op, since 452 * a hardware vblank counter, this routine should be a no-op, since
453 * interrupts will have to stay on to keep the count accurate. 453 * interrupts will have to stay on to keep the count accurate.
454 */ 454 */
455 void (*disable_vblank) (struct drm_device *dev, int crtc); 455 void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
456 456
457 /** 457 /**
458 * Called by \c drm_device_is_agp. Typically used to determine if a 458 * Called by \c drm_device_is_agp. Typically used to determine if a
@@ -474,7 +474,7 @@ struct drm_driver {
474 * optional accurate ktime_get timestamp of when position was measured. 474 * optional accurate ktime_get timestamp of when position was measured.
475 * 475 *
476 * \param dev DRM device. 476 * \param dev DRM device.
477 * \param crtc Id of the crtc to query. 477 * \param pipe Id of the crtc to query.
478 * \param flags Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0). 478 * \param flags Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0).
479 * \param *vpos Target location for current vertical scanout position. 479 * \param *vpos Target location for current vertical scanout position.
480 * \param *hpos Target location for current horizontal scanout position. 480 * \param *hpos Target location for current horizontal scanout position.
@@ -498,9 +498,8 @@ struct drm_driver {
498 * but unknown small number of scanlines wrt. real scanout position. 498 * but unknown small number of scanlines wrt. real scanout position.
499 * 499 *
500 */ 500 */
501 int (*get_scanout_position) (struct drm_device *dev, int crtc, 501 int (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
502 unsigned int flags, 502 unsigned int flags, int *vpos, int *hpos,
503 int *vpos, int *hpos,
504 ktime_t *stime, ktime_t *etime, 503 ktime_t *stime, ktime_t *etime,
505 const struct drm_display_mode *mode); 504 const struct drm_display_mode *mode);
506 505
@@ -518,7 +517,7 @@ struct drm_driver {
518 * to the OpenML OML_sync_control extension specification. 517 * to the OpenML OML_sync_control extension specification.
519 * 518 *
520 * \param dev dev DRM device handle. 519 * \param dev dev DRM device handle.
521 * \param crtc crtc for which timestamp should be returned. 520 * \param pipe crtc for which timestamp should be returned.
522 * \param *max_error Maximum allowable timestamp error in nanoseconds. 521 * \param *max_error Maximum allowable timestamp error in nanoseconds.
523 * Implementation should strive to provide timestamp 522 * Implementation should strive to provide timestamp
524 * with an error of at most *max_error nanoseconds. 523 * with an error of at most *max_error nanoseconds.
@@ -534,7 +533,7 @@ struct drm_driver {
534 * negative number on failure. A positive status code on success, 533 * negative number on failure. A positive status code on success,
535 * which describes how the vblank_time timestamp was computed. 534 * which describes how the vblank_time timestamp was computed.
536 */ 535 */
537 int (*get_vblank_timestamp) (struct drm_device *dev, int crtc, 536 int (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
538 int *max_error, 537 int *max_error,
539 struct timeval *vblank_time, 538 struct timeval *vblank_time,
540 unsigned flags); 539 unsigned flags);
@@ -930,7 +929,7 @@ extern int drm_irq_uninstall(struct drm_device *dev);
930extern int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs); 929extern int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs);
931extern int drm_wait_vblank(struct drm_device *dev, void *data, 930extern int drm_wait_vblank(struct drm_device *dev, void *data,
932 struct drm_file *filp); 931 struct drm_file *filp);
933extern u32 drm_vblank_count(struct drm_device *dev, int pipe); 932extern u32 drm_vblank_count(struct drm_device *dev, unsigned int pipe);
934extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc); 933extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc);
935extern u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, 934extern u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
936 struct timeval *vblanktime); 935 struct timeval *vblanktime);