diff options
author | Patrik Jakobsson <patrik.r.jakobsson@gmail.com> | 2013-07-10 12:12:11 -0400 |
---|---|---|
committer | Patrik Jakobsson <patrik.r.jakobsson@gmail.com> | 2013-07-23 19:47:22 -0400 |
commit | 7ea03f069572fef5701b8be90aed1cfd0b64d76e (patch) | |
tree | fffb4675b8f2a85d5511208485972889efd7bb38 /drivers/gpu/drm/gma500 | |
parent | b8e5ec9f306744e19357580a3cf47452fe64b27a (diff) |
drm/gma500/cdv: Convert to gma_crtc_dpms()
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/gma500')
-rw-r--r-- | drivers/gpu/drm/gma500/cdv_intel_display.c | 137 | ||||
-rw-r--r-- | drivers/gpu/drm/gma500/gma_display.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/gma500/gma_display.h | 5 |
3 files changed, 8 insertions, 138 deletions
diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c index 9eee57b3cc59..1160175f16f9 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_display.c +++ b/drivers/gpu/drm/gma500/cdv_intel_display.c | |||
@@ -512,7 +512,7 @@ static bool is_pipeb_lvds(struct drm_device *dev, struct drm_crtc *crtc) | |||
512 | return false; | 512 | return false; |
513 | } | 513 | } |
514 | 514 | ||
515 | static void cdv_intel_disable_self_refresh (struct drm_device *dev) | 515 | void cdv_intel_disable_self_refresh(struct drm_device *dev) |
516 | { | 516 | { |
517 | if (REG_READ(FW_BLC_SELF) & FW_BLC_SELF_EN) { | 517 | if (REG_READ(FW_BLC_SELF) & FW_BLC_SELF_EN) { |
518 | 518 | ||
@@ -533,7 +533,7 @@ static void cdv_intel_disable_self_refresh (struct drm_device *dev) | |||
533 | 533 | ||
534 | } | 534 | } |
535 | 535 | ||
536 | static void cdv_intel_update_watermark (struct drm_device *dev, struct drm_crtc *crtc) | 536 | void cdv_intel_update_watermark(struct drm_device *dev, struct drm_crtc *crtc) |
537 | { | 537 | { |
538 | 538 | ||
539 | if (cdv_intel_single_pipe_active(dev)) { | 539 | if (cdv_intel_single_pipe_active(dev)) { |
@@ -646,137 +646,6 @@ static void cdv_intel_crtc_load_lut(struct drm_crtc *crtc) | |||
646 | } | 646 | } |
647 | 647 | ||
648 | /** | 648 | /** |
649 | * Sets the power management mode of the pipe and plane. | ||
650 | * | ||
651 | * This code should probably grow support for turning the cursor off and back | ||
652 | * on appropriately at the same time as we're turning the pipe off/on. | ||
653 | */ | ||
654 | static void cdv_intel_crtc_dpms(struct drm_crtc *crtc, int mode) | ||
655 | { | ||
656 | struct drm_device *dev = crtc->dev; | ||
657 | struct drm_psb_private *dev_priv = dev->dev_private; | ||
658 | struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); | ||
659 | int pipe = psb_intel_crtc->pipe; | ||
660 | const struct psb_offset *map = &dev_priv->regmap[pipe]; | ||
661 | u32 temp; | ||
662 | |||
663 | /* XXX: When our outputs are all unaware of DPMS modes other than off | ||
664 | * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC. | ||
665 | */ | ||
666 | cdv_intel_disable_self_refresh(dev); | ||
667 | |||
668 | switch (mode) { | ||
669 | case DRM_MODE_DPMS_ON: | ||
670 | case DRM_MODE_DPMS_STANDBY: | ||
671 | case DRM_MODE_DPMS_SUSPEND: | ||
672 | if (psb_intel_crtc->active) | ||
673 | break; | ||
674 | |||
675 | psb_intel_crtc->active = true; | ||
676 | |||
677 | /* Enable the DPLL */ | ||
678 | temp = REG_READ(map->dpll); | ||
679 | if ((temp & DPLL_VCO_ENABLE) == 0) { | ||
680 | REG_WRITE(map->dpll, temp); | ||
681 | REG_READ(map->dpll); | ||
682 | /* Wait for the clocks to stabilize. */ | ||
683 | udelay(150); | ||
684 | REG_WRITE(map->dpll, temp | DPLL_VCO_ENABLE); | ||
685 | REG_READ(map->dpll); | ||
686 | /* Wait for the clocks to stabilize. */ | ||
687 | udelay(150); | ||
688 | REG_WRITE(map->dpll, temp | DPLL_VCO_ENABLE); | ||
689 | REG_READ(map->dpll); | ||
690 | /* Wait for the clocks to stabilize. */ | ||
691 | udelay(150); | ||
692 | } | ||
693 | |||
694 | /* Jim Bish - switch plan and pipe per scott */ | ||
695 | /* Enable the plane */ | ||
696 | temp = REG_READ(map->cntr); | ||
697 | if ((temp & DISPLAY_PLANE_ENABLE) == 0) { | ||
698 | REG_WRITE(map->cntr, | ||
699 | temp | DISPLAY_PLANE_ENABLE); | ||
700 | /* Flush the plane changes */ | ||
701 | REG_WRITE(map->base, REG_READ(map->base)); | ||
702 | } | ||
703 | |||
704 | udelay(150); | ||
705 | |||
706 | /* Enable the pipe */ | ||
707 | temp = REG_READ(map->conf); | ||
708 | if ((temp & PIPEACONF_ENABLE) == 0) | ||
709 | REG_WRITE(map->conf, temp | PIPEACONF_ENABLE); | ||
710 | |||
711 | temp = REG_READ(map->status); | ||
712 | temp &= ~(0xFFFF); | ||
713 | temp |= PIPE_FIFO_UNDERRUN; | ||
714 | REG_WRITE(map->status, temp); | ||
715 | REG_READ(map->status); | ||
716 | |||
717 | cdv_intel_crtc_load_lut(crtc); | ||
718 | |||
719 | /* Give the overlay scaler a chance to enable | ||
720 | * if it's on this pipe */ | ||
721 | /* psb_intel_crtc_dpms_video(crtc, true); TODO */ | ||
722 | break; | ||
723 | case DRM_MODE_DPMS_OFF: | ||
724 | if (!psb_intel_crtc->active) | ||
725 | break; | ||
726 | |||
727 | psb_intel_crtc->active = false; | ||
728 | |||
729 | /* Give the overlay scaler a chance to disable | ||
730 | * if it's on this pipe */ | ||
731 | /* psb_intel_crtc_dpms_video(crtc, FALSE); TODO */ | ||
732 | |||
733 | /* Disable the VGA plane that we never use */ | ||
734 | REG_WRITE(VGACNTRL, VGA_DISP_DISABLE); | ||
735 | |||
736 | /* Jim Bish - changed pipe/plane here as well. */ | ||
737 | |||
738 | drm_vblank_off(dev, pipe); | ||
739 | /* Wait for vblank for the disable to take effect */ | ||
740 | gma_wait_for_vblank(dev); | ||
741 | |||
742 | /* Next, disable display pipes */ | ||
743 | temp = REG_READ(map->conf); | ||
744 | if ((temp & PIPEACONF_ENABLE) != 0) { | ||
745 | REG_WRITE(map->conf, temp & ~PIPEACONF_ENABLE); | ||
746 | REG_READ(map->conf); | ||
747 | } | ||
748 | |||
749 | /* Wait for vblank for the disable to take effect. */ | ||
750 | gma_wait_for_vblank(dev); | ||
751 | |||
752 | udelay(150); | ||
753 | |||
754 | /* Disable display plane */ | ||
755 | temp = REG_READ(map->cntr); | ||
756 | if ((temp & DISPLAY_PLANE_ENABLE) != 0) { | ||
757 | REG_WRITE(map->cntr, | ||
758 | temp & ~DISPLAY_PLANE_ENABLE); | ||
759 | /* Flush the plane changes */ | ||
760 | REG_WRITE(map->base, REG_READ(map->base)); | ||
761 | REG_READ(map->base); | ||
762 | } | ||
763 | |||
764 | temp = REG_READ(map->dpll); | ||
765 | if ((temp & DPLL_VCO_ENABLE) != 0) { | ||
766 | REG_WRITE(map->dpll, temp & ~DPLL_VCO_ENABLE); | ||
767 | REG_READ(map->dpll); | ||
768 | } | ||
769 | |||
770 | /* Wait for the clocks to turn off. */ | ||
771 | udelay(150); | ||
772 | break; | ||
773 | } | ||
774 | cdv_intel_update_watermark(dev, crtc); | ||
775 | /*Set FIFO Watermarks*/ | ||
776 | REG_WRITE(DSPARB, 0x3F3E); | ||
777 | } | ||
778 | |||
779 | /** | ||
780 | * Return the pipe currently connected to the panel fitter, | 649 | * Return the pipe currently connected to the panel fitter, |
781 | * or -1 if the panel fitter is not present or not in use | 650 | * or -1 if the panel fitter is not present or not in use |
782 | */ | 651 | */ |
@@ -1518,7 +1387,7 @@ struct drm_display_mode *cdv_intel_crtc_mode_get(struct drm_device *dev, | |||
1518 | } | 1387 | } |
1519 | 1388 | ||
1520 | const struct drm_crtc_helper_funcs cdv_intel_helper_funcs = { | 1389 | const struct drm_crtc_helper_funcs cdv_intel_helper_funcs = { |
1521 | .dpms = cdv_intel_crtc_dpms, | 1390 | .dpms = gma_crtc_dpms, |
1522 | .mode_fixup = gma_crtc_mode_fixup, | 1391 | .mode_fixup = gma_crtc_mode_fixup, |
1523 | .mode_set = cdv_intel_crtc_mode_set, | 1392 | .mode_set = cdv_intel_crtc_mode_set, |
1524 | .mode_set_base = gma_pipe_set_base, | 1393 | .mode_set_base = gma_pipe_set_base, |
diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c index 297937d12fb9..7a0888a64a33 100644 --- a/drivers/gpu/drm/gma500/gma_display.c +++ b/drivers/gpu/drm/gma500/gma_display.c | |||
@@ -210,10 +210,8 @@ void gma_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
210 | * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC. | 210 | * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC. |
211 | */ | 211 | */ |
212 | 212 | ||
213 | /* FIXME: Uncomment this when we move cdv to generic dpms | ||
214 | if (IS_CDV(dev)) | 213 | if (IS_CDV(dev)) |
215 | cdv_intel_disable_self_refresh(dev); | 214 | cdv_intel_disable_self_refresh(dev); |
216 | */ | ||
217 | 215 | ||
218 | switch (mode) { | 216 | switch (mode) { |
219 | case DRM_MODE_DPMS_ON: | 217 | case DRM_MODE_DPMS_ON: |
@@ -322,10 +320,8 @@ void gma_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
322 | break; | 320 | break; |
323 | } | 321 | } |
324 | 322 | ||
325 | /* FIXME: Uncomment this when we move cdv to generic dpms | ||
326 | if (IS_CDV(dev)) | 323 | if (IS_CDV(dev)) |
327 | cdv_intel_update_watermark(dev, crtc); | 324 | cdv_intel_update_watermark(dev, crtc); |
328 | */ | ||
329 | 325 | ||
330 | /* Set FIFO watermarks */ | 326 | /* Set FIFO watermarks */ |
331 | REG_WRITE(DSPARB, 0x3F3E); | 327 | REG_WRITE(DSPARB, 0x3F3E); |
diff --git a/drivers/gpu/drm/gma500/gma_display.h b/drivers/gpu/drm/gma500/gma_display.h index 24a582e009e6..665164d41224 100644 --- a/drivers/gpu/drm/gma500/gma_display.h +++ b/drivers/gpu/drm/gma500/gma_display.h | |||
@@ -85,4 +85,9 @@ extern bool gma_pll_is_valid(struct drm_crtc *crtc, | |||
85 | extern bool gma_find_best_pll(const struct gma_limit_t *limit, | 85 | extern bool gma_find_best_pll(const struct gma_limit_t *limit, |
86 | struct drm_crtc *crtc, int target, int refclk, | 86 | struct drm_crtc *crtc, int target, int refclk, |
87 | struct gma_clock_t *best_clock); | 87 | struct gma_clock_t *best_clock); |
88 | |||
89 | /* Cedarview specific functions */ | ||
90 | extern void cdv_intel_disable_self_refresh(struct drm_device *dev); | ||
91 | extern void cdv_intel_update_watermark(struct drm_device *dev, | ||
92 | struct drm_crtc *crtc); | ||
88 | #endif | 93 | #endif |