aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_dpll_mgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dpll_mgr.c')
-rw-r--r--drivers/gpu/drm/i915/intel_dpll_mgr.c90
1 files changed, 72 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.c b/drivers/gpu/drm/i915/intel_dpll_mgr.c
index a90ef34a7785..a83af07e3570 100644
--- a/drivers/gpu/drm/i915/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/intel_dpll_mgr.c
@@ -447,6 +447,12 @@ static uint32_t hsw_pll_to_ddi_pll_sel(struct intel_shared_dpll *pll)
447 return PORT_CLK_SEL_WRPLL2; 447 return PORT_CLK_SEL_WRPLL2;
448 case DPLL_ID_SPLL: 448 case DPLL_ID_SPLL:
449 return PORT_CLK_SEL_SPLL; 449 return PORT_CLK_SEL_SPLL;
450 case DPLL_ID_LCPLL_810:
451 return PORT_CLK_SEL_LCPLL_810;
452 case DPLL_ID_LCPLL_1350:
453 return PORT_CLK_SEL_LCPLL_1350;
454 case DPLL_ID_LCPLL_2700:
455 return PORT_CLK_SEL_LCPLL_2700;
450 default: 456 default:
451 return PORT_CLK_SEL_NONE; 457 return PORT_CLK_SEL_NONE;
452 } 458 }
@@ -671,9 +677,13 @@ static struct intel_shared_dpll *
671hsw_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state, 677hsw_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
672 struct intel_encoder *encoder) 678 struct intel_encoder *encoder)
673{ 679{
680 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
674 struct intel_shared_dpll *pll; 681 struct intel_shared_dpll *pll;
675 int clock = crtc_state->port_clock; 682 int clock = crtc_state->port_clock;
676 683
684 memset(&crtc_state->dpll_hw_state, 0,
685 sizeof(crtc_state->dpll_hw_state));
686
677 if (encoder->type == INTEL_OUTPUT_HDMI) { 687 if (encoder->type == INTEL_OUTPUT_HDMI) {
678 uint32_t val; 688 uint32_t val;
679 unsigned p, n2, r2; 689 unsigned p, n2, r2;
@@ -684,21 +694,37 @@ hsw_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
684 WRPLL_DIVIDER_REFERENCE(r2) | WRPLL_DIVIDER_FEEDBACK(n2) | 694 WRPLL_DIVIDER_REFERENCE(r2) | WRPLL_DIVIDER_FEEDBACK(n2) |
685 WRPLL_DIVIDER_POST(p); 695 WRPLL_DIVIDER_POST(p);
686 696
687 memset(&crtc_state->dpll_hw_state, 0,
688 sizeof(crtc_state->dpll_hw_state));
689
690 crtc_state->dpll_hw_state.wrpll = val; 697 crtc_state->dpll_hw_state.wrpll = val;
691 698
692 pll = intel_find_shared_dpll(crtc, crtc_state, 699 pll = intel_find_shared_dpll(crtc, crtc_state,
693 DPLL_ID_WRPLL1, DPLL_ID_WRPLL2); 700 DPLL_ID_WRPLL1, DPLL_ID_WRPLL2);
694 701
702 } else if (encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
703 encoder->type == INTEL_OUTPUT_DP_MST ||
704 encoder->type == INTEL_OUTPUT_EDP) {
705 enum intel_dpll_id pll_id;
706
707 switch (clock / 2) {
708 case 81000:
709 pll_id = DPLL_ID_LCPLL_810;
710 break;
711 case 135000:
712 pll_id = DPLL_ID_LCPLL_1350;
713 break;
714 case 270000:
715 pll_id = DPLL_ID_LCPLL_2700;
716 break;
717 default:
718 DRM_DEBUG_KMS("Invalid clock for DP: %d\n", clock);
719 return NULL;
720 }
721
722 pll = intel_get_shared_dpll_by_id(dev_priv, pll_id);
723
695 } else if (encoder->type == INTEL_OUTPUT_ANALOG) { 724 } else if (encoder->type == INTEL_OUTPUT_ANALOG) {
696 if (WARN_ON(crtc_state->port_clock / 2 != 135000)) 725 if (WARN_ON(crtc_state->port_clock / 2 != 135000))
697 return NULL; 726 return NULL;
698 727
699 memset(&crtc_state->dpll_hw_state, 0,
700 sizeof(crtc_state->dpll_hw_state));
701
702 crtc_state->dpll_hw_state.spll = 728 crtc_state->dpll_hw_state.spll =
703 SPLL_PLL_ENABLE | SPLL_PLL_FREQ_1350MHz | SPLL_PLL_SSC; 729 SPLL_PLL_ENABLE | SPLL_PLL_FREQ_1350MHz | SPLL_PLL_SSC;
704 730
@@ -731,6 +757,29 @@ static const struct intel_shared_dpll_funcs hsw_ddi_spll_funcs = {
731 .get_hw_state = hsw_ddi_spll_get_hw_state, 757 .get_hw_state = hsw_ddi_spll_get_hw_state,
732}; 758};
733 759
760static void hsw_ddi_lcpll_enable(struct drm_i915_private *dev_priv,
761 struct intel_shared_dpll *pll)
762{
763}
764
765static void hsw_ddi_lcpll_disable(struct drm_i915_private *dev_priv,
766 struct intel_shared_dpll *pll)
767{
768}
769
770static bool hsw_ddi_lcpll_get_hw_state(struct drm_i915_private *dev_priv,
771 struct intel_shared_dpll *pll,
772 struct intel_dpll_hw_state *hw_state)
773{
774 return true;
775}
776
777static const struct intel_shared_dpll_funcs hsw_ddi_lcpll_funcs = {
778 .enable = hsw_ddi_lcpll_enable,
779 .disable = hsw_ddi_lcpll_disable,
780 .get_hw_state = hsw_ddi_lcpll_get_hw_state,
781};
782
734struct skl_dpll_regs { 783struct skl_dpll_regs {
735 i915_reg_t ctl, cfgcr1, cfgcr2; 784 i915_reg_t ctl, cfgcr1, cfgcr2;
736}; 785};
@@ -1537,6 +1586,7 @@ struct dpll_info {
1537 const char *name; 1586 const char *name;
1538 const int id; 1587 const int id;
1539 const struct intel_shared_dpll_funcs *funcs; 1588 const struct intel_shared_dpll_funcs *funcs;
1589 uint32_t flags;
1540}; 1590};
1541 1591
1542struct intel_dpll_mgr { 1592struct intel_dpll_mgr {
@@ -1548,9 +1598,9 @@ struct intel_dpll_mgr {
1548}; 1598};
1549 1599
1550static const struct dpll_info pch_plls[] = { 1600static const struct dpll_info pch_plls[] = {
1551 { "PCH DPLL A", DPLL_ID_PCH_PLL_A, &ibx_pch_dpll_funcs }, 1601 { "PCH DPLL A", DPLL_ID_PCH_PLL_A, &ibx_pch_dpll_funcs, 0 },
1552 { "PCH DPLL B", DPLL_ID_PCH_PLL_B, &ibx_pch_dpll_funcs }, 1602 { "PCH DPLL B", DPLL_ID_PCH_PLL_B, &ibx_pch_dpll_funcs, 0 },
1553 { NULL, -1, NULL }, 1603 { NULL, -1, NULL, 0 },
1554}; 1604};
1555 1605
1556static const struct intel_dpll_mgr pch_pll_mgr = { 1606static const struct intel_dpll_mgr pch_pll_mgr = {
@@ -1559,9 +1609,12 @@ static const struct intel_dpll_mgr pch_pll_mgr = {
1559}; 1609};
1560 1610
1561static const struct dpll_info hsw_plls[] = { 1611static const struct dpll_info hsw_plls[] = {
1562 { "WRPLL 1", DPLL_ID_WRPLL1, &hsw_ddi_wrpll_funcs }, 1612 { "WRPLL 1", DPLL_ID_WRPLL1, &hsw_ddi_wrpll_funcs, 0 },
1563 { "WRPLL 2", DPLL_ID_WRPLL2, &hsw_ddi_wrpll_funcs }, 1613 { "WRPLL 2", DPLL_ID_WRPLL2, &hsw_ddi_wrpll_funcs, 0 },
1564 { "SPLL", DPLL_ID_SPLL, &hsw_ddi_spll_funcs }, 1614 { "SPLL", DPLL_ID_SPLL, &hsw_ddi_spll_funcs, 0 },
1615 { "LCPLL 810", DPLL_ID_LCPLL_810, &hsw_ddi_lcpll_funcs, INTEL_DPLL_ALWAYS_ON },
1616 { "LCPLL 1350", DPLL_ID_LCPLL_1350, &hsw_ddi_lcpll_funcs, INTEL_DPLL_ALWAYS_ON },
1617 { "LCPLL 2700", DPLL_ID_LCPLL_2700, &hsw_ddi_lcpll_funcs, INTEL_DPLL_ALWAYS_ON },
1565 { NULL, -1, NULL, }, 1618 { NULL, -1, NULL, },
1566}; 1619};
1567 1620
@@ -1571,9 +1624,9 @@ static const struct intel_dpll_mgr hsw_pll_mgr = {
1571}; 1624};
1572 1625
1573static const struct dpll_info skl_plls[] = { 1626static const struct dpll_info skl_plls[] = {
1574 { "DPPL 1", DPLL_ID_SKL_DPLL1, &skl_ddi_pll_funcs }, 1627 { "DPPL 1", DPLL_ID_SKL_DPLL1, &skl_ddi_pll_funcs, 0 },
1575 { "DPPL 2", DPLL_ID_SKL_DPLL2, &skl_ddi_pll_funcs }, 1628 { "DPPL 2", DPLL_ID_SKL_DPLL2, &skl_ddi_pll_funcs, 0 },
1576 { "DPPL 3", DPLL_ID_SKL_DPLL3, &skl_ddi_pll_funcs }, 1629 { "DPPL 3", DPLL_ID_SKL_DPLL3, &skl_ddi_pll_funcs, 0 },
1577 { NULL, -1, NULL, }, 1630 { NULL, -1, NULL, },
1578}; 1631};
1579 1632
@@ -1583,9 +1636,9 @@ static const struct intel_dpll_mgr skl_pll_mgr = {
1583}; 1636};
1584 1637
1585static const struct dpll_info bxt_plls[] = { 1638static const struct dpll_info bxt_plls[] = {
1586 { "PORT PLL A", 0, &bxt_ddi_pll_funcs }, 1639 { "PORT PLL A", 0, &bxt_ddi_pll_funcs, 0 },
1587 { "PORT PLL B", 1, &bxt_ddi_pll_funcs }, 1640 { "PORT PLL B", 1, &bxt_ddi_pll_funcs, 0 },
1588 { "PORT PLL C", 2, &bxt_ddi_pll_funcs }, 1641 { "PORT PLL C", 2, &bxt_ddi_pll_funcs, 0 },
1589 { NULL, -1, NULL, }, 1642 { NULL, -1, NULL, },
1590}; 1643};
1591 1644
@@ -1623,6 +1676,7 @@ void intel_shared_dpll_init(struct drm_device *dev)
1623 dev_priv->shared_dplls[i].id = dpll_info[i].id; 1676 dev_priv->shared_dplls[i].id = dpll_info[i].id;
1624 dev_priv->shared_dplls[i].name = dpll_info[i].name; 1677 dev_priv->shared_dplls[i].name = dpll_info[i].name;
1625 dev_priv->shared_dplls[i].funcs = *dpll_info[i].funcs; 1678 dev_priv->shared_dplls[i].funcs = *dpll_info[i].funcs;
1679 dev_priv->shared_dplls[i].flags = dpll_info[i].flags;
1626 } 1680 }
1627 1681
1628 dev_priv->dpll_mgr = dpll_mgr; 1682 dev_priv->dpll_mgr = dpll_mgr;