Lines Matching +full:ssc +full:- +full:range

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright © 2006-2011 Intel Corporation
56 /* The single-channel range is 25-112Mhz, and dual-channel
57 * is 80-224Mhz. Prefer single channel as much as possible.
117 ret__ = -ETIMEDOUT; \
216 int pipe = gma_crtc->pipe; in cdv_dpll_set_clock_cdv()
271 m |= ((clock->m2) << SB_M_DIVIDER_SHIFT); in cdv_dpll_set_clock_cdv()
287 n_vco |= ((clock->n) << SB_N_DIVIDER_SHIFT); in cdv_dpll_set_clock_cdv()
289 if (clock->vco < 2250000) { in cdv_dpll_set_clock_cdv()
292 } else if (clock->vco < 2750000) { in cdv_dpll_set_clock_cdv()
295 } else if (clock->vco < 3300000) { in cdv_dpll_set_clock_cdv()
311 p |= SET_FIELD(clock->p1, SB_P1_DIVIDER); in cdv_dpll_set_clock_cdv()
312 switch (clock->p2) { in cdv_dpll_set_clock_cdv()
326 DRM_ERROR("Bad P2 clock: %d\n", clock->p2); in cdv_dpll_set_clock_cdv()
327 return -EINVAL; in cdv_dpll_set_clock_cdv()
369 * Now only single-channel LVDS is supported on CDV. If it is in cdv_intel_limit()
370 * incorrect, please add the dual-channel LVDS. in cdv_intel_limit()
394 clock->m = clock->m2 + 2; in cdv_intel_clock()
395 clock->p = clock->p1 * clock->p2; in cdv_intel_clock()
396 clock->vco = (refclk * clock->m) / clock->n; in cdv_intel_clock()
397 clock->dot = clock->vco / clock->p; in cdv_intel_clock()
447 gma_crtc->clock_funcs->clock(refclk, &clock); in cdv_intel_find_dp_pll()
458 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_pipe_enabled()
461 crtc = dev_priv->pipe_to_crtc_mapping[pipe]; in cdv_intel_pipe_enabled()
464 if (crtc->primary->fb == NULL || !gma_crtc->active) in cdv_intel_pipe_enabled()
473 /* Disable self-refresh before adjust WM */ in cdv_disable_sr()
482 REG_WRITE(OV_OVADD, 0/*dev_priv->ovl_offset*/); in cdv_disable_sr()
492 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_update_wm()
518 if (gma_crtc->pipe == 1 && in cdv_update_wm()
533 /* enable self-refresh for single pipe active */ in cdv_update_wm()
550 dev_priv->ops->disable_sr(dev); in cdv_update_wm()
556 * or -1 if the panel fitter is not present or not in use
566 return -1; in cdv_intel_panel_fitter_pipe()
576 struct drm_device *dev = crtc->dev; in cdv_intel_crtc_mode_set()
577 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_crtc_mode_set()
579 int pipe = gma_crtc->pipe; in cdv_intel_crtc_mode_set()
580 const struct psb_offset *map = &dev_priv->regmap[pipe]; in cdv_intel_crtc_mode_set()
587 struct drm_mode_config *mode_config = &dev->mode_config; in cdv_intel_crtc_mode_set()
593 list_for_each_entry(connector, &mode_config->connector_list, head) { in cdv_intel_crtc_mode_set()
597 if (!connector->encoder in cdv_intel_crtc_mode_set()
598 || connector->encoder->crtc != crtc) in cdv_intel_crtc_mode_set()
601 ddi_select = gma_encoder->ddi_select; in cdv_intel_crtc_mode_set()
602 switch (gma_encoder->type) { in cdv_intel_crtc_mode_set()
621 if (dev_priv->dplla_96mhz) in cdv_intel_crtc_mode_set()
622 /* low-end sku, 96/100 mhz */ in cdv_intel_crtc_mode_set()
625 /* high-end sku, 27/100 mhz */ in cdv_intel_crtc_mode_set()
629 * Based on the spec the low-end SKU has only CRT/LVDS. So it is in cdv_intel_crtc_mode_set()
631 * On the high-end SKU, it will use the 27/100M reference clk in cdv_intel_crtc_mode_set()
632 * for DP/eDP. When using SSC clock, the ref clk is 100MHz.Otherwise in cdv_intel_crtc_mode_set()
642 if (is_lvds && dev_priv->lvds_use_ssc) { in cdv_intel_crtc_mode_set()
643 refclk = dev_priv->lvds_ssc_freq * 1000; in cdv_intel_crtc_mode_set()
644 DRM_DEBUG_KMS("Use SSC reference clock %d Mhz\n", dev_priv->lvds_ssc_freq); in cdv_intel_crtc_mode_set()
649 limit = gma_crtc->clock_funcs->limit(crtc, refclk); in cdv_intel_crtc_mode_set()
651 ok = limit->find_pll(limit, crtc, adjusted_mode->clock, refclk, in cdv_intel_crtc_mode_set()
655 adjusted_mode->clock, clock.dot); in cdv_intel_crtc_mode_set()
678 pipeconf = REG_READ(map->conf); in cdv_intel_crtc_mode_set()
682 switch (dev_priv->edp.bpp) { in cdv_intel_crtc_mode_set()
697 /* the BPC will be 6 if it is 18-bit LVDS panel */ in cdv_intel_crtc_mode_set()
716 REG_WRITE(map->dpll, dpll | DPLL_VGA_MODE_DIS | DPLL_SYNCLOCK_ENABLE); in cdv_intel_crtc_mode_set()
717 REG_READ(map->dpll); in cdv_intel_crtc_mode_set()
734 /* Set the B0-B3 data pairs corresponding to in cdv_intel_crtc_mode_set()
736 * set the DPLLs for dual-channel mode or not. in cdv_intel_crtc_mode_set()
743 /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP) in cdv_intel_crtc_mode_set()
761 REG_WRITE(map->dpll, in cdv_intel_crtc_mode_set()
762 (REG_READ(map->dpll) & ~DPLL_LOCK) | DPLL_VCO_ENABLE); in cdv_intel_crtc_mode_set()
763 REG_READ(map->dpll); in cdv_intel_crtc_mode_set()
767 if (!(REG_READ(map->dpll) & DPLL_LOCK)) { in cdv_intel_crtc_mode_set()
768 dev_err(dev->dev, "Failed to get DPLL lock\n"); in cdv_intel_crtc_mode_set()
769 return -EBUSY; in cdv_intel_crtc_mode_set()
773 int sdvo_pixel_multiply = adjusted_mode->clock / mode->clock; in cdv_intel_crtc_mode_set()
774 …REG_WRITE(map->dpll_md, (0 << DPLL_MD_UDI_DIVIDER_SHIFT) | ((sdvo_pixel_multiply - 1) << DPLL_MD_U… in cdv_intel_crtc_mode_set()
777 REG_WRITE(map->htotal, (adjusted_mode->crtc_hdisplay - 1) | in cdv_intel_crtc_mode_set()
778 ((adjusted_mode->crtc_htotal - 1) << 16)); in cdv_intel_crtc_mode_set()
779 REG_WRITE(map->hblank, (adjusted_mode->crtc_hblank_start - 1) | in cdv_intel_crtc_mode_set()
780 ((adjusted_mode->crtc_hblank_end - 1) << 16)); in cdv_intel_crtc_mode_set()
781 REG_WRITE(map->hsync, (adjusted_mode->crtc_hsync_start - 1) | in cdv_intel_crtc_mode_set()
782 ((adjusted_mode->crtc_hsync_end - 1) << 16)); in cdv_intel_crtc_mode_set()
783 REG_WRITE(map->vtotal, (adjusted_mode->crtc_vdisplay - 1) | in cdv_intel_crtc_mode_set()
784 ((adjusted_mode->crtc_vtotal - 1) << 16)); in cdv_intel_crtc_mode_set()
785 REG_WRITE(map->vblank, (adjusted_mode->crtc_vblank_start - 1) | in cdv_intel_crtc_mode_set()
786 ((adjusted_mode->crtc_vblank_end - 1) << 16)); in cdv_intel_crtc_mode_set()
787 REG_WRITE(map->vsync, (adjusted_mode->crtc_vsync_start - 1) | in cdv_intel_crtc_mode_set()
788 ((adjusted_mode->crtc_vsync_end - 1) << 16)); in cdv_intel_crtc_mode_set()
792 REG_WRITE(map->size, in cdv_intel_crtc_mode_set()
793 ((mode->vdisplay - 1) << 16) | (mode->hdisplay - 1)); in cdv_intel_crtc_mode_set()
794 REG_WRITE(map->pos, 0); in cdv_intel_crtc_mode_set()
795 REG_WRITE(map->src, in cdv_intel_crtc_mode_set()
796 ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1)); in cdv_intel_crtc_mode_set()
797 REG_WRITE(map->conf, pipeconf); in cdv_intel_crtc_mode_set()
798 REG_READ(map->conf); in cdv_intel_crtc_mode_set()
802 REG_WRITE(map->cntr, dspcntr); in cdv_intel_crtc_mode_set()
807 crtc->helper_private; in cdv_intel_crtc_mode_set()
808 crtc_funcs->mode_set_base(crtc, x, y, old_fb); in cdv_intel_crtc_mode_set()
822 clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2); in i8xx_clock()
823 clock->p = clock->p1 * clock->p2; in i8xx_clock()
824 clock->vco = refclk * clock->m / (clock->n + 2); in i8xx_clock()
825 clock->dot = clock->vco / clock->p; in i8xx_clock()
832 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_crtc_clock_get()
834 int pipe = gma_crtc->pipe; in cdv_intel_crtc_clock_get()
835 const struct psb_offset *map = &dev_priv->regmap[pipe]; in cdv_intel_crtc_clock_get()
840 struct psb_pipe *p = &dev_priv->regs.pipe[pipe]; in cdv_intel_crtc_clock_get()
843 dpll = REG_READ(map->dpll); in cdv_intel_crtc_clock_get()
845 fp = REG_READ(map->fp0); in cdv_intel_crtc_clock_get()
847 fp = REG_READ(map->fp1); in cdv_intel_crtc_clock_get()
851 dpll = p->dpll; in cdv_intel_crtc_clock_get()
853 fp = p->fp0; in cdv_intel_crtc_clock_get()
855 fp = p->fp1; in cdv_intel_crtc_clock_get()
858 (dev_priv->regs.psb.saveLVDS & LVDS_PORT_EN); in cdv_intel_crtc_clock_get()
872 dev_err(dev->dev, "PLL %d\n", dpll); in cdv_intel_crtc_clock_get()
912 int pipe = gma_crtc->pipe; in cdv_intel_crtc_mode_get()
913 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_crtc_mode_get()
914 struct psb_pipe *p = &dev_priv->regs.pipe[pipe]; in cdv_intel_crtc_mode_get()
915 const struct psb_offset *map = &dev_priv->regmap[pipe]; in cdv_intel_crtc_mode_get()
923 htot = REG_READ(map->htotal); in cdv_intel_crtc_mode_get()
924 hsync = REG_READ(map->hsync); in cdv_intel_crtc_mode_get()
925 vtot = REG_READ(map->vtotal); in cdv_intel_crtc_mode_get()
926 vsync = REG_READ(map->vsync); in cdv_intel_crtc_mode_get()
929 htot = p->htotal; in cdv_intel_crtc_mode_get()
930 hsync = p->hsync; in cdv_intel_crtc_mode_get()
931 vtot = p->vtotal; in cdv_intel_crtc_mode_get()
932 vsync = p->vsync; in cdv_intel_crtc_mode_get()
939 mode->clock = cdv_intel_crtc_clock_get(dev, crtc); in cdv_intel_crtc_mode_get()
940 mode->hdisplay = (htot & 0xffff) + 1; in cdv_intel_crtc_mode_get()
941 mode->htotal = ((htot & 0xffff0000) >> 16) + 1; in cdv_intel_crtc_mode_get()
942 mode->hsync_start = (hsync & 0xffff) + 1; in cdv_intel_crtc_mode_get()
943 mode->hsync_end = ((hsync & 0xffff0000) >> 16) + 1; in cdv_intel_crtc_mode_get()
944 mode->vdisplay = (vtot & 0xffff) + 1; in cdv_intel_crtc_mode_get()
945 mode->vtotal = ((vtot & 0xffff0000) >> 16) + 1; in cdv_intel_crtc_mode_get()
946 mode->vsync_start = (vsync & 0xffff) + 1; in cdv_intel_crtc_mode_get()
947 mode->vsync_end = ((vsync & 0xffff0000) >> 16) + 1; in cdv_intel_crtc_mode_get()