Skip to contentSkip to conversation

drm/i915/mtl: Add Support for C10 chips

PATCH In review Mika Kahola 6 participants 37 messages Mar 27, 2023 – Apr 5, 2023 Page 1 of 2

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drm/i915/mtl: Add Support for C10 chips

Phy programming support for C10 PICA chips. This is the first part of the series that adds support for PICA chips. Later the support for C20 chips are added.

Clint Taylor (1):
drm/i915/mtl: Initial DDI port setup

Mika Kahola (3):
drm/i915/mtl: Add DP rates
drm/i915/mtl: Create separate reg file for PICA registers drm/i915/mtl: Add support for PM DEMAND

Radhakrishna Sripada (3):
drm/i915/mtl: Add Support for C10 PHY message bus and pll programming drm/i915/mtl: Add C10 phy programming for HDMI drm/i915/mtl: Add vswing programming for C10 phys

 drivers/gpu/drm/i915/Makefile                 |    1 +
 drivers/gpu/drm/i915/display/intel_bw.c       |    4 +-
 drivers/gpu/drm/i915/display/intel_bw.h       |    2 +
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 1798 +++++++++++++++++
 drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   46 +
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  178 ++
 drivers/gpu/drm/i915/display/intel_ddi.c      |   26 +-
 .../drm/i915/display/intel_ddi_buf_trans.c    |   31 +-
 .../drm/i915/display/intel_ddi_buf_trans.h    |    6 +
 drivers/gpu/drm/i915/display/intel_display.c  |   20 +-
 .../drm/i915/display/intel_display_power.c    |   11 +-
 .../i915/display/intel_display_power_map.c    |    1 +
 .../i915/display/intel_display_power_well.c   |    2 +-
 .../drm/i915/display/intel_display_types.h    |    6 +
 drivers/gpu/drm/i915/display/intel_dp.c       |   15 +-
 drivers/gpu/drm/i915/display/intel_dpll.c     |   20 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |    2 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c     |    5 +-
 .../drm/i915/display/intel_modeset_verify.c   |    2 +
 drivers/gpu/drm/i915/i915_drv.h               |    6 +
 drivers/gpu/drm/i915/i915_irq.c               |   22 +-
 drivers/gpu/drm/i915/i915_reg.h               |   38 +-
 drivers/gpu/drm/i915/i915_reg_defs.h          |   57 +
 drivers/gpu/drm/i915/intel_pm.c               |  286 +++
 drivers/gpu/drm/i915/intel_pm.h               |   35 +
 25 files changed, 2605 insertions(+), 15 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy.h
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/7 drm/i915/mtl: Initial DDI port setup

From: Clint Taylor <[email protected]>

Initialization sequences and C10 phy are in place to be able to enable the first 2 ports of MTL. The other ports use C20 phy that still need to be properly added. Enable the first ports for now, keeping a TODO comment about the others.

---
 drivers/gpu/drm/i915/display/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +5 -1
index 5a386c7c0bc9..9fe6e33a66d6 100644
@@ -7796,7 +7796,11 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 	if (!HAS_DISPLAY(dev_priv))
 		return;
 
-	if (IS_DG2(dev_priv)) {
+	if (IS_METEORLAKE(dev_priv)) {
+		/* TODO: initialize TC ports as well */
+		intel_ddi_init(dev_priv, PORT_A);
+		intel_ddi_init(dev_priv, PORT_B);
+	} else if (IS_DG2(dev_priv)) {
 		intel_ddi_init(dev_priv, PORT_A);
 		intel_ddi_init(dev_priv, PORT_B);
 		intel_ddi_init(dev_priv, PORT_C);
Signature · 1 line
2.34.1
Reviewed-by on v1 1/7
#2 lore raw

Re: [Intel-gfx] [PATCH 1/7] drm/i915/mtl: Initial DDI port setup

Quoted 11 lines · Mika Kahola

From: Clint Taylor <[email protected]>

Initialization sequences and C10 phy are in place to be able to enable the first 2 ports of MTL. The other ports use C20 phy that still need to be properly added. Enable the first ports for now, keeping a TODO comment about the others.

---

Quoted 21 lines

 drivers/gpu/drm/i915/display/intel_display.c | 6 +++++-

 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index 5a386c7c0bc9..9fe6e33a66d6 100644
@@ -7796,7 +7796,11 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
         if (!HAS_DISPLAY(dev_priv))
                 return;


-       if (IS_DG2(dev_priv)) {
+       if (IS_METEORLAKE(dev_priv)) {
+               /* TODO: initialize TC ports as well */ +               intel_ddi_init(dev_priv, PORT_A); +               intel_ddi_init(dev_priv, PORT_B); +       } else if (IS_DG2(dev_priv)) { intel_ddi_init(dev_priv, PORT_A); intel_ddi_init(dev_priv, PORT_B); intel_ddi_init(dev_priv, PORT_C);

#3 lore raw

PATCH 2/7 drm/i915/mtl: Add DP rates

In reply to Mika Kahola

Add DP rates for Meteorlake.

---
 drivers/gpu/drm/i915/display/intel_dp.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_dp.c +14 -1
index da1c00ee92fb..4927aeb64f23 100644
@@ -420,6 +420,11 @@ static int ehl_max_source_rate(struct intel_dp *intel_dp)
 	return 810000;
 }
 
+static int mtl_max_source_rate(struct intel_dp *intel_dp)
+{
+	return intel_dp_is_edp(intel_dp) ? 675000 : 810000;
+}
+
 static int vbt_max_link_rate(struct intel_dp *intel_dp)
 {
 	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
@@ -444,6 +449,10 @@ static void
 intel_dp_set_source_rates(struct intel_dp *intel_dp)
 {
 	/* The values must be in increasing order */
+	static const int mtl_rates[] = {
+		162000, 216000, 243000, 270000, 324000, 432000, 540000, 675000,
+		810000,
+	};
 	static const int icl_rates[] = {
 		162000, 216000, 270000, 324000, 432000, 540000, 648000, 810000,
 		1000000, 1350000,
@@ -469,7 +478,11 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	drm_WARN_ON(&dev_priv->drm,
 		    intel_dp->source_rates || intel_dp->num_source_rates);
 
-	if (DISPLAY_VER(dev_priv) >= 11) {
+	if (DISPLAY_VER(dev_priv) >= 14) {
+		source_rates = mtl_rates;
+		size = ARRAY_SIZE(mtl_rates);
+		max_rate = mtl_max_source_rate(intel_dp);
+	} else if (DISPLAY_VER(dev_priv) >= 11) {
 		source_rates = icl_rates;
 		size = ARRAY_SIZE(icl_rates);
 		if (IS_DG2(dev_priv))
Signature · 1 line
2.34.1
Reviewed-by on v1 2/7
#4 lore raw

Re: [Intel-gfx] [PATCH 2/7] drm/i915/mtl: Add DP rates

Quoted 5 lines · Mika Kahola

Add DP rates for Meteorlake.

---

Quoted 43 lines

 drivers/gpu/drm/i915/display/intel_dp.c | 15 ++++++++++++++-

 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_dp.c +0 -0
index da1c00ee92fb..4927aeb64f23 100644
@@ -420,6 +420,11 @@ static int ehl_max_source_rate(struct intel_dp *intel_dp)
         return 810000;
  }

drivers/gpu/drm/i915/display/intel_dp.c +5 -0
+static int mtl_max_source_rate(struct intel_dp *intel_dp)
+{
+       return intel_dp_is_edp(intel_dp) ? 675000 : 810000;
+}
+

 static int vbt_max_link_rate(struct intel_dp *intel_dp)
 {
        struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;

drivers/gpu/drm/i915/display/intel_dp.c +4 -0
@@ -444,6 +449,10 @@ static void
  intel_dp_set_source_rates(struct intel_dp *intel_dp)
  {
         /* The values must be in increasing order */
+       static const int mtl_rates[] = {
+               162000, 216000, 243000, 270000, 324000, 432000, 540000, 675000,
+               810000,
+       };
         static const int icl_rates[] = {
                 162000, 216000, 270000, 324000, 432000, 540000, 648000, 810000,
                 1000000, 1350000,
@@ -469,7 +478,11 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
         drm_WARN_ON(&dev_priv->drm,
                     intel_dp->source_rates || intel_dp->num_source_rates);


-       if (DISPLAY_VER(dev_priv) >= 11) {
+       if (DISPLAY_VER(dev_priv) >= 14) {
+               source_rates = mtl_rates;
+               size = ARRAY_SIZE(mtl_rates);
+               max_rate = mtl_max_source_rate(intel_dp); +       } else if (DISPLAY_VER(dev_priv) >= 11) { source_rates = icl_rates;
                size = ARRAY_SIZE(icl_rates);
                if (IS_DG2(dev_priv))

#5 lore raw

PATCH 3/7 drm/i915/mtl: Create separate reg file for PICA registers

In reply to Mika Kahola

Create a separate file to store registers for PICA chips C10 and C20.

v2: Rename file (Jani)
v3: Use _PICK_EVEN_2RANGES() macro (Lucas)
Coding style fixed (Lucas)

---
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 131 ++++++++++++++++++
 1 file changed, 131 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +131 -0
new file mode 100644
index 000000000000..d1ee8a2fc9cf
@@ -0,0 +1,131 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef __INTEL_CX0_PHY_REGS_H__
+#define __INTEL_CX0_PHY_REGS_H__
+
+#include "i915_reg_defs.h"
+
+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A		0x64040
+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B		0x64140
+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1		0x16F240
+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2		0x16F440
+#define XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)		_MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+										 _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \
+										 _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \
+										 _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \
+										 _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2) + (lane) * 4)
+#define   XELPDP_PORT_M2P_TRANSACTION_PENDING		REG_BIT(31)
+#define   XELPDP_PORT_M2P_COMMAND_TYPE_MASK		REG_GENMASK(30, 27)
+#define   XELPDP_PORT_M2P_COMMAND_WRITE_UNCOMMITTED	REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x1)
+#define   XELPDP_PORT_M2P_COMMAND_WRITE_COMMITTED	REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x2)
+#define   XELPDP_PORT_M2P_COMMAND_READ			REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x3)
+#define   XELPDP_PORT_M2P_DATA_MASK			REG_GENMASK(23, 16)
+#define   XELPDP_PORT_M2P_DATA(val)			REG_FIELD_PREP(XELPDP_PORT_M2P_DATA_MASK, val)
+#define   XELPDP_PORT_M2P_TRANSACTION_RESET		REG_BIT(15)
+#define   XELPDP_PORT_M2P_ADDRESS_MASK			REG_GENMASK(11, 0)
+#define   XELPDP_PORT_M2P_ADDRESS(val)			REG_FIELD_PREP(XELPDP_PORT_M2P_ADDRESS_MASK, val)
+#define XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane)	_MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+										 _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \
+										 _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \
+										 _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \
+										 _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2) + (lane) * 4 + 8)
+#define   XELPDP_PORT_P2M_RESPONSE_READY		REG_BIT(31)
+#define   XELPDP_PORT_P2M_COMMAND_TYPE_MASK		REG_GENMASK(30, 27)
+#define   XELPDP_PORT_P2M_COMMAND_READ_ACK		0x4
+#define   XELPDP_PORT_P2M_COMMAND_WRITE_ACK		0x5
+#define   XELPDP_PORT_P2M_DATA_MASK			REG_GENMASK(23, 16)
+#define   XELPDP_PORT_P2M_DATA(val)			REG_FIELD_PREP(XELPDP_PORT_P2M_DATA_MASK, val)
+#define   XELPDP_PORT_P2M_ERROR_SET			REG_BIT(15)
+
+#define XELPDP_MSGBUS_TIMEOUT_SLOW			1
+#define XELPDP_MSGBUS_TIMEOUT_FAST_US			2
+#define XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US		3200
+#define XELPDP_PCLK_PLL_DISABLE_TIMEOUT_US		20
+#define XELPDP_PORT_BUF_SOC_READY_TIMEOUT_US		100
+#define XELPDP_PORT_RESET_START_TIMEOUT_US		5
+#define XELPDP_PORT_POWERDOWN_UPDATE_TIMEOUT_US		100
+#define XELPDP_PORT_RESET_END_TIMEOUT			15
+#define XELPDP_REFCLK_ENABLE_TIMEOUT_US			1
+
+#define _XELPDP_PORT_BUF_CTL1_LN0_A			0x64004
+#define _XELPDP_PORT_BUF_CTL1_LN0_B			0x64104
+#define _XELPDP_PORT_BUF_CTL1_LN0_USBC1			0x16F200
+#define _XELPDP_PORT_BUF_CTL1_LN0_USBC2			0x16F400
+#define XELPDP_PORT_BUF_CTL1(port)			_MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_A, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_B, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_USBC2))
+#define   XELPDP_PORT_BUF_SOC_PHY_READY			REG_BIT(24)
+#define   XELPDP_PORT_REVERSAL				REG_BIT(16)
+#define   XELPDP_TC_PHY_OWNERSHIP			REG_BIT(6)
+#define   XELPDP_TCSS_POWER_REQUEST			REG_BIT(5)
+#define   XELPDP_TCSS_POWER_STATE			REG_BIT(4)
+#define   XELPDP_PORT_WIDTH_MASK			REG_GENMASK(3, 1)
+#define   XELPDP_PORT_WIDTH(val)			REG_FIELD_PREP(XELPDP_PORT_WIDTH_MASK, val)
+
+#define XELPDP_PORT_BUF_CTL2(port)			_MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_A, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_B, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_USBC2) + 4)
+#define   XELPDP_LANE0_PIPE_RESET			REG_BIT(31)
+#define   XELPDP_LANE1_PIPE_RESET			REG_BIT(30)
+#define   XELPDP_LANE0_PHY_CURRENT_STATUS		REG_BIT(29)
+#define   XELPDP_LANE1_PHY_CURRENT_STATUS		REG_BIT(28)
+#define   XELPDP_LANE0_POWERDOWN_UPDATE			REG_BIT(25)
+#define   XELPDP_LANE1_POWERDOWN_UPDATE			REG_BIT(24)
+#define   XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK		REG_GENMASK(23, 20)
+#define   XELPDP_LANE0_POWERDOWN_NEW_STATE(val)		REG_FIELD_PREP(XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK, val)
+#define   XELPDP_LANE1_POWERDOWN_NEW_STATE_MASK		REG_GENMASK(19, 16)
+#define   XELPDP_LANE1_POWERDOWN_NEW_STATE(val)		REG_FIELD_PREP(XELPDP_LANE1_POWERDOWN_NEW_STATE_MASK, val)
+#define   XELPDP_POWER_STATE_READY_MASK			REG_GENMASK(7, 4)
+#define   XELPDP_POWER_STATE_READY(val)			REG_FIELD_PREP(XELPDP_POWER_STATE_READY_MASK, val)
+
+#define XELPDP_PORT_BUF_CTL3(port)			_MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_A, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_B, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
+										 _XELPDP_PORT_BUF_CTL1_LN0_USBC2) + 8)
+#define   XELPDP_PLL_LANE_STAGGERING_DELAY_MASK		REG_GENMASK(15, 8)
+#define   XELPDP_PLL_LANE_STAGGERING_DELAY(val)		REG_FIELD_PREP(XELPDP_PLL_LANE_STAGGERING_DELAY_MASK, val)
+#define   XELPDP_POWER_STATE_ACTIVE_MASK		REG_GENMASK(3, 0)
+#define   XELPDP_POWER_STATE_ACTIVE(val)		REG_FIELD_PREP(XELPDP_POWER_STATE_ACTIVE_MASK, val)
+
+#define _XELPDP_PORT_CLOCK_CTL_A			0x640E0
+#define _XELPDP_PORT_CLOCK_CTL_B			0x641E0
+#define _XELPDP_PORT_CLOCK_CTL_USBC1			0x16F260
+#define _XELPDP_PORT_CLOCK_CTL_USBC2			0x16F460
+#define XELPDP_PORT_CLOCK_CTL(port)			_MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+										 _XELPDP_PORT_CLOCK_CTL_A, \
+										 _XELPDP_PORT_CLOCK_CTL_B, \
+										 _XELPDP_PORT_CLOCK_CTL_USBC1, \
+										 _XELPDP_PORT_CLOCK_CTL_USBC2))
+#define   XELPDP_LANE0_PCLK_PLL_REQUEST			REG_BIT(31)
+#define   XELPDP_LANE0_PCLK_PLL_ACK			REG_BIT(30)
+#define   XELPDP_LANE0_PCLK_REFCLK_REQUEST		REG_BIT(29)
+#define   XELPDP_LANE0_PCLK_REFCLK_ACK			REG_BIT(28)
+#define   XELPDP_LANE1_PCLK_PLL_REQUEST			REG_BIT(27)
+#define   XELPDP_LANE1_PCLK_PLL_ACK			REG_BIT(26)
+#define   XELPDP_LANE1_PCLK_REFCLK_REQUEST		REG_BIT(25)
+#define   XELPDP_LANE1_PCLK_REFCLK_ACK			REG_BIT(24)
+#define   XELPDP_TBT_CLOCK_REQUEST			REG_BIT(19)
+#define   XELPDP_TBT_CLOCK_ACK				REG_BIT(18)
+#define   XELPDP_DDI_CLOCK_SELECT_MASK			REG_GENMASK(15, 12)
+#define   XELPDP_DDI_CLOCK_SELECT(val)			REG_FIELD_PREP(XELPDP_DDI_CLOCK_SELECT_MASK, val)
+#define   XELPDP_DDI_CLOCK_SELECT_NONE			0x0
+#define   XELPDP_DDI_CLOCK_SELECT_MAXPCLK		0x8
+#define   XELPDP_DDI_CLOCK_SELECT_DIV18CLK		0x9
+#define   XELPDP_DDI_CLOCK_SELECT_TBT_162		0xc
+#define   XELPDP_DDI_CLOCK_SELECT_TBT_270		0xd
+#define   XELPDP_DDI_CLOCK_SELECT_TBT_540		0xe
+#define   XELPDP_DDI_CLOCK_SELECT_TBT_810		0xf
+#define   XELPDP_FORWARD_CLOCK_UNGATE			REG_BIT(10)
+#define   XELPDP_LANE1_PHY_CLOCK_SELECT			REG_BIT(8)
+#define   XELPDP_SSC_ENABLE_PLLA			REG_BIT(1)
+#define   XELPDP_SSC_ENABLE_PLLB			REG_BIT(0)
+
+#endif /* __INTEL_CX0_PHY_REGS_H__ */
Signature · 1 line
2.34.1
Reviewed-by on v1 3/7
#6 lore raw

Re: [Intel-gfx] [PATCH 3/7] drm/i915/mtl: Create separate reg file for PICA registers

Quoted 10 lines · Mika Kahola

Create a separate file to store registers for PICA chips C10 and C20.

v2: Rename file (Jani)
v3: Use _PICK_EVEN_2RANGES() macro (Lucas)
    Coding style fixed (Lucas)

---

You might need to adjust some tabs before pushing I feel..

Quoted 186 lines

 .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 131 ++++++++++++++++++

 1 file changed, 131 insertions(+)

 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +16 -0
new file mode 100644
index 000000000000..d1ee8a2fc9cf
@@ -0,0 +1,131 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef __INTEL_CX0_PHY_REGS_H__
+#define __INTEL_CX0_PHY_REGS_H__
+
+#include "i915_reg_defs.h"
+
+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A              0x64040
+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B              0x64140
+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1          0x16F240
+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2          0x16F440
+#define XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)         _MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+                                                                               

_XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \
+
_XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \
+
_XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \
+
_XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2) + (lane) * 4)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +3 -0
+#define   XELPDP_PORT_M2P_TRANSACTION_PENDING          REG_BIT(31)
+#define   XELPDP_PORT_M2P_COMMAND_TYPE_MASK            REG_GENMASK(30, 27)
+#define  

XELPDP_PORT_M2P_COMMAND_WRITE_UNCOMMITTED    REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x1)
+#define
XELPDP_PORT_M2P_COMMAND_WRITE_COMMITTED      REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x2)
+#define
XELPDP_PORT_M2P_COMMAND_READ                 REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x3)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +2 -0
+#define   XELPDP_PORT_M2P_DATA_MASK                    REG_GENMASK(23, 16)
+#define   XELPDP_PORT_M2P_DATA(val)                    REG_FIELD_PREP(XELPDP_PORT_M2P_DATA_MASK,

val)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +3 -0
+#define   XELPDP_PORT_M2P_TRANSACTION_RESET            REG_BIT(15)
+#define   XELPDP_PORT_M2P_ADDRESS_MASK                 REG_GENMASK(11, 0)
+#define  

XELPDP_PORT_M2P_ADDRESS(val)                 REG_FIELD_PREP(XELPDP_PORT_M2P_ADDRESS_MASK, val) +#define XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane)      _MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+
_XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \
+
_XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \
+
_XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \
+
_XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2) + (lane) * 4 + 8)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +6 -0
+#define   XELPDP_PORT_P2M_RESPONSE_READY               REG_BIT(31)
+#define   XELPDP_PORT_P2M_COMMAND_TYPE_MASK            REG_GENMASK(30, 27)
+#define   XELPDP_PORT_P2M_COMMAND_READ_ACK             0x4
+#define   XELPDP_PORT_P2M_COMMAND_WRITE_ACK            0x5
+#define   XELPDP_PORT_P2M_DATA_MASK                    REG_GENMASK(23, 16)
+#define   XELPDP_PORT_P2M_DATA(val)                    REG_FIELD_PREP(XELPDP_PORT_P2M_DATA_MASK,

val)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +18 -0
+#define   XELPDP_PORT_P2M_ERROR_SET                    REG_BIT(15)
+
+#define XELPDP_MSGBUS_TIMEOUT_SLOW                     1
+#define XELPDP_MSGBUS_TIMEOUT_FAST_US                  2
+#define XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US              3200
+#define XELPDP_PCLK_PLL_DISABLE_TIMEOUT_US             20
+#define XELPDP_PORT_BUF_SOC_READY_TIMEOUT_US           100
+#define XELPDP_PORT_RESET_START_TIMEOUT_US             5
+#define XELPDP_PORT_POWERDOWN_UPDATE_TIMEOUT_US                100
+#define XELPDP_PORT_RESET_END_TIMEOUT                  15
+#define XELPDP_REFCLK_ENABLE_TIMEOUT_US                        1
+
+#define _XELPDP_PORT_BUF_CTL1_LN0_A                    0x64004
+#define _XELPDP_PORT_BUF_CTL1_LN0_B                    0x64104
+#define _XELPDP_PORT_BUF_CTL1_LN0_USBC1                        0x16F200
+#define _XELPDP_PORT_BUF_CTL1_LN0_USBC2                        0x16F400
+#define XELPDP_PORT_BUF_CTL1(port)                     _MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+                                                                               

_XELPDP_PORT_BUF_CTL1_LN0_A, \
+
_XELPDP_PORT_BUF_CTL1_LN0_B, \
+
_XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
+
_XELPDP_PORT_BUF_CTL1_LN0_USBC2))

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +7 -0
+#define   XELPDP_PORT_BUF_SOC_PHY_READY                        REG_BIT(24)
+#define   XELPDP_PORT_REVERSAL                         REG_BIT(16)
+#define   XELPDP_TC_PHY_OWNERSHIP                      REG_BIT(6)
+#define   XELPDP_TCSS_POWER_REQUEST                    REG_BIT(5)
+#define   XELPDP_TCSS_POWER_STATE                      REG_BIT(4)
+#define   XELPDP_PORT_WIDTH_MASK                       REG_GENMASK(3, 1)
+#define   XELPDP_PORT_WIDTH(val)                       REG_FIELD_PREP(XELPDP_PORT_WIDTH_MASK,

val)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +3 -0
+
+#define XELPDP_PORT_BUF_CTL2(port)                     _MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+                                                                               

_XELPDP_PORT_BUF_CTL1_LN0_A, \
+
_XELPDP_PORT_BUF_CTL1_LN0_B, \
+
_XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
+
_XELPDP_PORT_BUF_CTL1_LN0_USBC2) + 4)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +8 -0
+#define   XELPDP_LANE0_PIPE_RESET                      REG_BIT(31)
+#define   XELPDP_LANE1_PIPE_RESET                      REG_BIT(30)
+#define   XELPDP_LANE0_PHY_CURRENT_STATUS              REG_BIT(29)
+#define   XELPDP_LANE1_PHY_CURRENT_STATUS              REG_BIT(28)
+#define   XELPDP_LANE0_POWERDOWN_UPDATE                        REG_BIT(25)
+#define   XELPDP_LANE1_POWERDOWN_UPDATE                        REG_BIT(24)
+#define   XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK                REG_GENMASK(23, 20)
+#define  

XELPDP_LANE0_POWERDOWN_NEW_STATE(val)                REG_FIELD_PREP(XELPDP_LANE0_POWERDOWN_NEW_STA TE_MASK, val)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +2 -0
+#define   XELPDP_LANE1_POWERDOWN_NEW_STATE_MASK                REG_GENMASK(19, 16)
+#define  

XELPDP_LANE1_POWERDOWN_NEW_STATE(val)                REG_FIELD_PREP(XELPDP_LANE1_POWERDOWN_NEW_STA TE_MASK, val)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +2 -0
+#define   XELPDP_POWER_STATE_READY_MASK                        REG_GENMASK(7, 4)
+#define  

XELPDP_POWER_STATE_READY(val)                        REG_FIELD_PREP(XELPDP_POWER_STATE_READY_MASK, val)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +3 -0
+
+#define XELPDP_PORT_BUF_CTL3(port)                     _MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+                                                                               

_XELPDP_PORT_BUF_CTL1_LN0_A, \
+
_XELPDP_PORT_BUF_CTL1_LN0_B, \
+
_XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
+
_XELPDP_PORT_BUF_CTL1_LN0_USBC2) + 8)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +2 -0
+#define   XELPDP_PLL_LANE_STAGGERING_DELAY_MASK                REG_GENMASK(15, 8)
+#define  

XELPDP_PLL_LANE_STAGGERING_DELAY(val)                REG_FIELD_PREP(XELPDP_PLL_LANE_STAGGERING_DEL AY_MASK, val)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +2 -0
+#define   XELPDP_POWER_STATE_ACTIVE_MASK               REG_GENMASK(3, 0)
+#define  

XELPDP_POWER_STATE_ACTIVE(val)               REG_FIELD_PREP(XELPDP_POWER_STATE_ACTIVE_MASK, val)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +7 -0
+
+#define _XELPDP_PORT_CLOCK_CTL_A                       0x640E0
+#define _XELPDP_PORT_CLOCK_CTL_B                       0x641E0
+#define _XELPDP_PORT_CLOCK_CTL_USBC1                   0x16F260
+#define _XELPDP_PORT_CLOCK_CTL_USBC2                   0x16F460
+#define XELPDP_PORT_CLOCK_CTL(port)                    _MMIO(_PICK_EVEN_2RANGES(port, PORT_TC1, \
+                                                                               

_XELPDP_PORT_CLOCK_CTL_A, \
+
_XELPDP_PORT_CLOCK_CTL_B, \
+
_XELPDP_PORT_CLOCK_CTL_USBC1, \
+
_XELPDP_PORT_CLOCK_CTL_USBC2))

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +12 -0
+#define   XELPDP_LANE0_PCLK_PLL_REQUEST                        REG_BIT(31)
+#define   XELPDP_LANE0_PCLK_PLL_ACK                    REG_BIT(30)
+#define   XELPDP_LANE0_PCLK_REFCLK_REQUEST             REG_BIT(29)
+#define   XELPDP_LANE0_PCLK_REFCLK_ACK                 REG_BIT(28)
+#define   XELPDP_LANE1_PCLK_PLL_REQUEST                        REG_BIT(27)
+#define   XELPDP_LANE1_PCLK_PLL_ACK                    REG_BIT(26)
+#define   XELPDP_LANE1_PCLK_REFCLK_REQUEST             REG_BIT(25)
+#define   XELPDP_LANE1_PCLK_REFCLK_ACK                 REG_BIT(24)
+#define   XELPDP_TBT_CLOCK_REQUEST                     REG_BIT(19)
+#define   XELPDP_TBT_CLOCK_ACK                         REG_BIT(18)
+#define   XELPDP_DDI_CLOCK_SELECT_MASK                 REG_GENMASK(15, 12)
+#define  

XELPDP_DDI_CLOCK_SELECT(val)                 REG_FIELD_PREP(XELPDP_DDI_CLOCK_SELECT_MASK, val)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h new file +13 -0
+#define   XELPDP_DDI_CLOCK_SELECT_NONE                 0x0
+#define   XELPDP_DDI_CLOCK_SELECT_MAXPCLK              0x8
+#define   XELPDP_DDI_CLOCK_SELECT_DIV18CLK             0x9
+#define   XELPDP_DDI_CLOCK_SELECT_TBT_162              0xc
+#define   XELPDP_DDI_CLOCK_SELECT_TBT_270              0xd
+#define   XELPDP_DDI_CLOCK_SELECT_TBT_540              0xe
+#define   XELPDP_DDI_CLOCK_SELECT_TBT_810              0xf
+#define   XELPDP_FORWARD_CLOCK_UNGATE                  REG_BIT(10)
+#define   XELPDP_LANE1_PHY_CLOCK_SELECT                        REG_BIT(8)
+#define   XELPDP_SSC_ENABLE_PLLA                       REG_BIT(1)
+#define   XELPDP_SSC_ENABLE_PLLB                       REG_BIT(0)
+
+#endif /* __INTEL_CX0_PHY_REGS_H__ */
#7 lore raw

PATCH 4/7 drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

In reply to Mika Kahola

From: Radhakrishna Sripada <[email protected]>

XELPDP has C10 and C20 phys from Synopsys to drive displays. Each phy has a dedicated PIPE 5.2 Message bus for configuration. This message bus is used to configure the phy internal registers.

XELPDP has C10 phys to drive output to the EDP and the native output from the display engine. Add structures, programming hardware state readout logic. Port clock calculations are similar to DG2. Use the DG2 formulae to calculate the port clock but use the relevant pll signals.
Note: PHY lane 0 is always used for PLL programming.

Add sequences for C10 phy enable/disable phy lane reset, powerdown change sequence and phy lane programming.

Bspec: 64539, 64568, 64599, 65100, 65101, 65450, 65451, 67610, 67636

v2: Squash patches related to C10 phy message bus and pll
programming support (Jani)
Move register definitions to a new file i.e. intel_cx0_reg_defs.h (Jani) Move macro definitions (Jani)
DP rates as separate patch (Jani)
Spin out xelpdp register definitions into a separate file (Jani) Replace macro to select registers based on phy lane with function calls (Jani)
Fix styling issues (Jani)
Call XELPDP_PORT_P2M_MSGBUS_STATUS() with port instead of phy (Lucas)
v3: Move clear request flag into try-loop
v4: On PHY idle change drm_err_once() as drm_dbg_kms() (Jani)
use __intel_de_wait_for_register() instead of __intel_wait_for_register and uncomment intel_uncore.h (Jani)
Add DP-alt support for PHY lane programming (Khaled)

---
 drivers/gpu/drm/i915/Makefile                 |    1 +
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 1120 +++++++++++++++++
 drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   43 +
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |   32 +-
 drivers/gpu/drm/i915/display/intel_ddi.c      |   22 +-
 .../drm/i915/display/intel_display_power.c    |    3 +-
 .../i915/display/intel_display_power_well.c   |    2 +-
 .../drm/i915/display/intel_display_types.h    |    6 +
 drivers/gpu/drm/i915/display/intel_dpll.c     |   20 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |    2 +-
 .../drm/i915/display/intel_modeset_verify.c   |    2 +
 drivers/gpu/drm/i915/i915_reg.h               |    5 +
 drivers/gpu/drm/i915/i915_reg_defs.h          |   57 +
 13 files changed, 1309 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy.h
drivers/gpu/drm/i915/Makefile +1 -0
index 057ef22fa9c6..57b1417792b4 100644
@@ -298,6 +298,7 @@ i915-y += \
 	display/icl_dsi.o \
 	display/intel_backlight.o \
 	display/intel_crt.o \
+	display/intel_cx0_phy.o \
 	display/intel_ddi.o \
 	display/intel_ddi_buf_trans.o \
 	display/intel_display_trace.o \
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1120 -0

1,120 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_cx0_phy.h new file +43 -0

43 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +31 -1
index d1ee8a2fc9cf..15e249f46a64 100644
@@ -128,4 +128,34 @@
 #define   XELPDP_SSC_ENABLE_PLLA			REG_BIT(1)
 #define   XELPDP_SSC_ENABLE_PLLB			REG_BIT(0)
 
-#endif /* __INTEL_CX0_PHY_REGS_H__ */
+/* C10 Vendor Registers */
+#define PHY_C10_VDR_PLL(idx)		(0xC00 + (idx))
+#define   C10_PLL0_FRACEN		REG_BIT8(4)
+#define   C10_PLL3_MULTIPLIERH_MASK	REG_GENMASK8(3, 0)
+#define   C10_PLL15_TXCLKDIV_MASK	REG_GENMASK8(2, 0)
+#define PHY_C10_VDR_CMN(idx)		(0xC20 + (idx))
+#define   C10_CMN0_DP_VAL		0x21
+#define   C10_CMN3_TXVBOOST_MASK	REG_GENMASK8(7, 5)
+#define   C10_CMN3_TXVBOOST(val)	REG_FIELD_PREP8(C10_CMN3_TXVBOOST_MASK, val)
+#define PHY_C10_VDR_TX(idx)		(0xC30 + (idx))
+#define   C10_TX0_VAL			0x10
+#define PHY_C10_VDR_CONTROL(idx)	(0xC70 + (idx) - 1)
+#define   C10_VDR_CTRL_MSGBUS_ACCESS	REG_BIT8(2)
+#define   C10_VDR_CTRL_MASTER_LANE	REG_BIT8(1)
+#define   C10_VDR_CTRL_UPDATE_CFG	REG_BIT8(0)
+#define PHY_C10_VDR_CUSTOM_WIDTH	0xD02
+
+#define CX0_P0_STATE_ACTIVE             0x0
+#define CX0_P2_STATE_READY              0x2
+#define CX0_P2PG_STATE_DISABLE          0x9
+#define CX0_P4PG_STATE_DISABLE          0xC
+#define CX0_P2_STATE_RESET              0x2
+
+/* PHY_C10_VDR_PLL0 */
+#define PLL_C10_MPLL_SSC_EN             REG_BIT8(0)
+
+/* PIPE SPEC Defined Registers */
+#define PHY_CX0_TX_CONTROL(tx, control) (0x400 + ((tx) - 1) * 0x200 + (control))
+#define CONTROL2_DISABLE_SINGLE_TX      REG_BIT(6)
+
+#endif /* __INTEL_CX0_REG_DEFS_H__ */
drivers/gpu/drm/i915/display/intel_ddi.c +21 -1
index 73240cf78c8b..a433dea5b9a3 100644
@@ -39,6 +39,7 @@
 #include "intel_combo_phy_regs.h"
 #include "intel_connector.h"
 #include "intel_crtc.h"
+#include "intel_cx0_phy.h"
 #include "intel_ddi.h"
 #include "intel_ddi_buf_trans.h"
 #include "intel_de.h"
@@ -3507,6 +3508,21 @@ void intel_ddi_get_clock(struct intel_encoder *encoder,
 						     &crtc_state->dpll_hw_state);
 }
 
+static void mtl_ddi_get_config(struct intel_encoder *encoder,
+			       struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+
+	intel_c10mpllb_readout_hw_state(encoder, &crtc_state->c10mpllb_state);
+	intel_c10mpllb_dump_hw_state(i915, &crtc_state->c10mpllb_state);
+	crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state->c10mpllb_state);
+
+	intel_ddi_get_config(encoder, crtc_state);
+}
+
 static void dg2_ddi_get_config(struct intel_encoder *encoder,
 				struct intel_crtc_state *crtc_state)
 {
@@ -4413,7 +4429,11 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	encoder->cloneable = 0;
 	encoder->pipe_mask = ~0;
 
-	if (IS_DG2(dev_priv)) {
+	if (DISPLAY_VER(dev_priv) >= 14) {
+		encoder->enable_clock = intel_cx0pll_enable;
+		encoder->disable_clock = intel_cx0pll_disable;
+		encoder->get_config = mtl_ddi_get_config;
+	} else if (IS_DG2(dev_priv)) {
 		encoder->enable_clock = intel_mpllb_enable;
 		encoder->disable_clock = intel_mpllb_disable;
 		encoder->get_config = dg2_ddi_get_config;
drivers/gpu/drm/i915/display/intel_display_power.c +2 -1
index f86060195987..e23fecba446c 100644
@@ -1614,7 +1614,8 @@ static void icl_display_core_init(struct drm_i915_private *dev_priv,
 		return;
 
 	/* 2. Initialize all combo phys */
-	intel_combo_phy_init(dev_priv);
+	if (DISPLAY_VER(dev_priv) < 14)
+		intel_combo_phy_init(dev_priv);
 
 	/*
 	 * 3. Enable Power Well 1 (PG1).
drivers/gpu/drm/i915/display/intel_display_power_well.c +1 -1
index 1676df1dc066..a4c8cb75c0a0 100644
@@ -970,7 +970,7 @@ void gen9_disable_dc_states(struct drm_i915_private *dev_priv)
 	if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
 		bxt_verify_ddi_phy_power_wells(dev_priv);
 
-	if (DISPLAY_VER(dev_priv) >= 11)
+	if (DISPLAY_VER(dev_priv) >= 11 && DISPLAY_VER(dev_priv) < 14)
 		/*
 		 * DMC retains HW context only for port A, the other combo
 		 * PHY's HW context for port B is lost after DC transitions,
drivers/gpu/drm/i915/display/intel_display_types.h +6 -0
index ab146b5b68bd..db7c108e4d86 100644
@@ -985,6 +985,11 @@ struct intel_link_m_n {
 	u32 link_n;
 };
 
+struct intel_c10mpllb_state {
+	u32 clock; /* in KHz */
+	u8 pll[20];
+};
+
 struct intel_crtc_state {
 	/*
 	 * uapi (drm) state. This is the software state shown to userspace.
@@ -1128,6 +1133,7 @@ struct intel_crtc_state {
 	union {
 		struct intel_dpll_hw_state dpll_hw_state;
 		struct intel_mpllb_state mpllb_state;
+		struct intel_c10mpllb_state c10mpllb_state;
 	};
 
 	/*
drivers/gpu/drm/i915/display/intel_dpll.c +19 -1
index 4e9c18be7e1f..da5aa050a5ab 100644
@@ -8,6 +8,7 @@
 
 #include "i915_reg.h"
 #include "intel_crtc.h"
+#include "intel_cx0_phy.h"
 #include "intel_de.h"
 #include "intel_display.h"
 #include "intel_display_types.h"
@@ -995,6 +996,17 @@ static int dg2_crtc_compute_clock(struct intel_atomic_state *state,
 	return 0;
 }
 
+static int mtl_crtc_compute_clock(struct intel_atomic_state *state,
+				  struct intel_crtc *crtc)
+{
+	struct intel_crtc_state *crtc_state =
+		intel_atomic_get_new_crtc_state(state, crtc);
+	struct intel_encoder *encoder =
+		intel_get_crtc_new_encoder(state, crtc_state);
+
+	return intel_cx0mpllb_calc_state(crtc_state, encoder);
+}
+
 static bool ilk_needs_fb_cb_tune(const struct dpll *dpll, int factor)
 {
 	return dpll->m < factor * dpll->n;
@@ -1423,6 +1435,10 @@ static int i8xx_crtc_compute_clock(struct intel_atomic_state *state,
 	return 0;
 }
 
+static const struct intel_dpll_funcs mtl_dpll_funcs = {
+	.crtc_compute_clock = mtl_crtc_compute_clock,
+};
+
 static const struct intel_dpll_funcs dg2_dpll_funcs = {
 	.crtc_compute_clock = dg2_crtc_compute_clock,
 };
@@ -1517,7 +1533,9 @@ int intel_dpll_crtc_get_shared_dpll(struct intel_atomic_state *state,
 void
 intel_dpll_init_clock_hook(struct drm_i915_private *dev_priv)
 {
-	if (IS_DG2(dev_priv))
+	if (DISPLAY_VER(dev_priv) >= 14)
+		dev_priv->display.funcs.dpll = &mtl_dpll_funcs;
+	else if (IS_DG2(dev_priv))
 		dev_priv->display.funcs.dpll = &dg2_dpll_funcs;
 	else if (DISPLAY_VER(dev_priv) >= 9 || HAS_DDI(dev_priv))
 		dev_priv->display.funcs.dpll = &hsw_dpll_funcs;
drivers/gpu/drm/i915/display/intel_dpll_mgr.c +1 -1
index 22fc908b7e5d..ed372d227aa7 100644
@@ -4104,7 +4104,7 @@ void intel_shared_dpll_init(struct drm_i915_private *dev_priv)
 
 	mutex_init(&dev_priv->display.dpll.lock);
 
-	if (IS_DG2(dev_priv))
+	if (DISPLAY_VER(dev_priv) >= 14 || IS_DG2(dev_priv))
 		/* No shared DPLLs on DG2; port PLLs are part of the PHY */
 		dpll_mgr = NULL;
 	else if (IS_ALDERLAKE_P(dev_priv))
drivers/gpu/drm/i915/display/intel_modeset_verify.c +2 -0
index 842d70f0dfd2..ec504470c2f0 100644
@@ -11,6 +11,7 @@
 #include "intel_atomic.h"
 #include "intel_crtc.h"
 #include "intel_crtc_state_dump.h"
+#include "intel_cx0_phy.h"
 #include "intel_display.h"
 #include "intel_display_types.h"
 #include "intel_fdi.h"
@@ -236,6 +237,7 @@ void intel_modeset_verify_crtc(struct intel_crtc *crtc,
 	verify_crtc_state(crtc, old_crtc_state, new_crtc_state);
 	intel_shared_dpll_state_verify(crtc, old_crtc_state, new_crtc_state);
 	intel_mpllb_state_verify(state, new_crtc_state);
+	intel_c10mpllb_state_verify(state, new_crtc_state);
 }
 
 void intel_modeset_verify_disabled(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/i915_reg.h +5 -0
index d22ffd7a32dc..94dd0d3a474b 100644
@@ -2101,6 +2101,11 @@
 #define   TRANS_PUSH_EN			REG_BIT(31)
 #define   TRANS_PUSH_SEND		REG_BIT(30)
 
+/* DDI Buffer Control */
+#define _DDI_CLK_VALFREQ_A		0x64030
+#define _DDI_CLK_VALFREQ_B		0x64130
+#define DDI_CLK_VALFREQ(port)		_MMIO_PORT(port, _DDI_CLK_VALFREQ_A, _DDI_CLK_VALFREQ_B)
+
 /*
  * HSW+ eDP PSR registers
  *
drivers/gpu/drm/i915/i915_reg_defs.h +57 -0

81 lines not on this page · raw message

Signature · 1 line
2.34.1
#8 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Hi Mika

There were some comments from the previous version
https://patchwork.freedesktop.org/patch/517048/#comment_943150

I think you should address them?

BR
vinod

Quoted 1,603 lines · Mika Kahola

From: Radhakrishna Sripada <[email protected]>

XELPDP has C10 and C20 phys from Synopsys to drive displays. Each phy has a dedicated PIPE 5.2 Message bus for configuration. This message bus is used to configure the phy internal registers.

XELPDP has C10 phys to drive output to the EDP and the native output from the display engine. Add structures, programming hardware state readout logic. Port clock calculations are similar to DG2. Use the DG2 formulae to calculate the port clock but use the relevant pll signals.
Note: PHY lane 0 is always used for PLL programming.

Add sequences for C10 phy enable/disable phy lane reset, powerdown change sequence and phy lane programming.

Bspec: 64539, 64568, 64599, 65100, 65101, 65450, 65451, 67610, 67636

v2: Squash patches related to C10 phy message bus and pll programming support (Jani)
    Move register definitions to a new file i.e. intel_cx0_reg_defs.h (Jani) Move macro definitions (Jani)
    DP rates as separate patch (Jani)
    Spin out xelpdp register definitions into a separate file (Jani) Replace macro to select registers based on phy lane with function calls (Jani)
    Fix styling issues (Jani)
    Call XELPDP_PORT_P2M_MSGBUS_STATUS() with port instead of phy (Lucas)
v3: Move clear request flag into try-loop
v4: On PHY idle change drm_err_once() as drm_dbg_kms() (Jani) use __intel_de_wait_for_register() instead of __intel_wait_for_register and uncomment intel_uncore.h (Jani)
    Add DP-alt support for PHY lane programming (Khaled)

---
 drivers/gpu/drm/i915/Makefile                 |    1 + drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 1120 +++++++++++++++++ drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   43 + .../gpu/drm/i915/display/intel_cx0_phy_regs.h |   32 +- drivers/gpu/drm/i915/display/intel_ddi.c      |   22 +- .../drm/i915/display/intel_display_power.c    |    3 +- .../i915/display/intel_display_power_well.c   |    2 +- .../drm/i915/display/intel_display_types.h    |    6 + drivers/gpu/drm/i915/display/intel_dpll.c     |   20 +- drivers/gpu/drm/i915/display/intel_dpll_mgr.c |    2 +- .../drm/i915/display/intel_modeset_verify.c   |    2 + drivers/gpu/drm/i915/i915_reg.h               |    5 + drivers/gpu/drm/i915/i915_reg_defs.h          |   57 +

 13 files changed, 1309 insertions(+), 6 deletions(-)

 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy.c create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy.h

drivers/gpu/drm/i915/Makefile +1 -0
index 057ef22fa9c6..57b1417792b4 100644
@@ -298,6 +298,7 @@ i915-y += \
         display/icl_dsi.o \
         display/intel_backlight.o \
         display/intel_crt.o \
+       display/intel_cx0_phy.o \
         display/intel_ddi.o \
         display/intel_ddi_buf_trans.o \
         display/intel_display_trace.o \
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +42 -0
new file mode 100644
index 000000000000..ced8c8aa6c82
@@ -0,0 +1,1120 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2021 Intel Corporation
+ */
+
+#include "i915_reg.h"
+#include "intel_cx0_phy.h"
+#include "intel_cx0_phy_regs.h"
+#include "intel_de.h"
+#include "intel_display_types.h"
+#include "intel_dp.h"
+#include "intel_panel.h"
+#include "intel_tc.h"
+
+bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)
+{
+       if (IS_METEORLAKE(dev_priv) && (phy < PHY_C))
+               return true;
+
+       return false;
+}
+
+static void intel_cx0_bus_reset(struct drm_i915_private *i915, enum port port, int lane)
+{
+       enum phy phy = intel_port_to_phy(i915, port);
+
+       /* Bring the phy to idle. */
+       intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+                      XELPDP_PORT_M2P_TRANSACTION_RESET);
+
+       /* Wait for Idle Clear. */
+       if (intel_de_wait_for_clear(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+                                   XELPDP_PORT_M2P_TRANSACTION_RESET,
+                                   XELPDP_MSGBUS_TIMEOUT_SLOW)) {
+               drm_dbg_kms(&i915->drm, "Failed to bring PHY %c to idle.\n", phy_name(phy));
+               return;
+       }
+
+       intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1), ~0);
+}
+
+static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port, int lane, u32

*val)

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+{
+       enum phy phy = intel_port_to_phy(i915, port);
+
+       if (__intel_de_wait_for_register(i915,
+                                        XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1),
+                                        XELPDP_PORT_P2M_RESPONSE_READY,
+                                        XELPDP_PORT_P2M_RESPONSE_READY,
+                                        XELPDP_MSGBUS_TIMEOUT_FAST_US,
+                                        XELPDP_MSGBUS_TIMEOUT_SLOW, val)) {
+               drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for message ACK. Status: 0x%x\n",

phy_name(phy), *val);
+               return -ETIMEDOUT;
+       }

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +15 -0
+
+       return 0;
+}
+
+static int __intel_cx0_read(struct drm_i915_private *i915, enum port port,
+                          int lane, u16 addr, u32 *val)
+{
+       enum phy phy = intel_port_to_phy(i915, port);
+       int ack;
+
+       /* Wait for pending transactions.*/
+       if (intel_de_wait_for_clear(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+                                   XELPDP_PORT_M2P_TRANSACTION_PENDING,
+                                   XELPDP_MSGBUS_TIMEOUT_SLOW)) {
+               drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for previous transaction to

complete. Reset the bus and retry.\n", phy_name(phy)); +               intel_cx0_bus_reset(i915, port, lane); +               return -ETIMEDOUT;
+       }

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +17 -0
+
+       /* Issue the read command. */
+       intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+                      XELPDP_PORT_M2P_TRANSACTION_PENDING |
+                      XELPDP_PORT_M2P_COMMAND_READ |
+                      XELPDP_PORT_M2P_ADDRESS(addr));
+
+       /* Wait for response ready. And read response.*/
+       ack = intel_cx0_wait_for_ack(i915, port, lane, val);
+       if (ack < 0) {
+               intel_cx0_bus_reset(i915, port, lane);
+               return ack;
+       }
+
+       /* Check for error. */
+       if (*val & XELPDP_PORT_P2M_ERROR_SET) {
+               drm_dbg_kms(&i915->drm, "PHY %c Error occurred during read command. Status:

0x%x\n", phy_name(phy), *val);
+               intel_cx0_bus_reset(i915, port, lane);
+               return -EINVAL;
+       }
+
+       /* Check for Read Ack. */
+       if (REG_FIELD_GET(XELPDP_PORT_P2M_COMMAND_TYPE_MASK, *val) !=
+                         XELPDP_PORT_P2M_COMMAND_READ_ACK) {
+               drm_dbg_kms(&i915->drm, "PHY %c Not a Read response. MSGBUS Status: 0x%x.\n", phy_name(phy), *val);
+               intel_cx0_bus_reset(i915, port, lane);
+               return -EINVAL;
+       }

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +23 -0
+
+       /* Clear Response Ready flag.*/
+       intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1), ~0);
+
+       return REG_FIELD_GET(XELPDP_PORT_P2M_DATA_MASK, *val);
+}
+
+static u8 intel_cx0_read(struct drm_i915_private *i915, enum port port,
+                        int lane, u16 addr)
+{
+       enum phy phy = intel_port_to_phy(i915, port);
+       int i, status = 0;
+       u32 val;
+
+       for (i = 0; i < 3; i++) {
+               status = __intel_cx0_read(i915, port, lane, addr, &val);
+
+               if (status >= 0)
+                       break;
+       }
+
+       if (i == 3) {
+               drm_err_once(&i915->drm, "PHY %c Read %04x failed after %d retries.\n",

phy_name(phy), addr, i);
+               return 0;
+       }

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +19 -0
+
+       return status;
+}
+
+static int intel_cx0_wait_cwrite_ack(struct drm_i915_private *i915,
+                                     enum port port, int lane)
+{
+       enum phy phy = intel_port_to_phy(i915, port);
+       int ack;
+       u32 val = 0;
+
+       /* Check for write ack. */
+       ack = intel_cx0_wait_for_ack(i915, port, lane, &val);
+       if (ack < 0)
+               return ack;
+
+       if ((REG_FIELD_GET(XELPDP_PORT_P2M_COMMAND_TYPE_MASK, val) !=
+            XELPDP_PORT_P2M_COMMAND_WRITE_ACK) || val & XELPDP_PORT_P2M_ERROR_SET) {
+               drm_dbg_kms(&i915->drm, "PHY %c Unexpected ACK received. MSGBUS STATUS: 0x%x.\n",

phy_name(phy), val);
+               return -EINVAL;
+       }

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +14 -0
+
+       return 0;
+}
+
+static int __intel_cx0_write_once(struct drm_i915_private *i915, enum port port,
+                                 int lane, u16 addr, u8 data, bool committed)
+{
+       enum phy phy = intel_port_to_phy(i915, port);
+
+       /* Wait for pending transactions.*/
+       if (intel_de_wait_for_clear(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+                                   XELPDP_PORT_M2P_TRANSACTION_PENDING,
+                                   XELPDP_MSGBUS_TIMEOUT_SLOW)) {
+               drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for previous transaction to

complete. Reset the bus and retry.\n", phy_name(phy)); +               intel_cx0_bus_reset(i915, port, lane); +               return -ETIMEDOUT;
+       }

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +18 -0
+
+       /* Issue the write command. */
+       intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+                      XELPDP_PORT_M2P_TRANSACTION_PENDING |
+                      (committed ? XELPDP_PORT_M2P_COMMAND_WRITE_COMMITTED :
+                      XELPDP_PORT_M2P_COMMAND_WRITE_UNCOMMITTED) |
+                      XELPDP_PORT_M2P_DATA(data) |
+                      XELPDP_PORT_M2P_ADDRESS(addr));
+
+       /* Check for error. */
+       if (committed) {
+               if (intel_cx0_wait_cwrite_ack(i915, port, lane) < 0) {
+                       intel_cx0_bus_reset(i915, port, lane);
+                       return -EINVAL;
+               }
+       } else if ((intel_de_read(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1)) &
+                           XELPDP_PORT_P2M_ERROR_SET)) {
+               drm_dbg_kms(&i915->drm, "PHY %c Error occurred during write command.\n",

phy_name(phy));
+               intel_cx0_bus_reset(i915, port, lane); +               return -EINVAL;
+       }

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +21 -0
+
+       intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1), ~0);
+
+       return 0;
+}
+
+static void __intel_cx0_write(struct drm_i915_private *i915, enum port port,
+                             int lane, u16 addr, u8 data, bool committed)
+{
+       enum phy phy = intel_port_to_phy(i915, port);
+       int i, status;
+
+       for (i = 0; i < 3; i++) {
+               status = __intel_cx0_write_once(i915, port, lane, addr, data, committed);
+
+               if (status == 0)
+                       break;
+       }
+
+       if (i == 3) {
+               drm_err_once(&i915->drm, "PHY %c Write %04x failed after %d retries.\n",

phy_name(phy), addr, i);
+               return;
+       }

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +403 -0
+}
+
+static void intel_cx0_write(struct drm_i915_private *i915, enum port port,
+                           int lane, u16 addr, u8 data, bool committed)
+{
+       if (lane == INTEL_CX0_BOTH_LANES) {
+               __intel_cx0_write(i915, port, INTEL_CX0_LANE0, addr, data, committed);
+               __intel_cx0_write(i915, port, INTEL_CX0_LANE1, addr, data, committed);
+       } else {
+               __intel_cx0_write(i915, port, lane, addr, data, committed);
+       }
+}
+
+static void __intel_cx0_rmw(struct drm_i915_private *i915, enum port port,
+                           int lane, u16 addr, u8 clear, u8 set, bool committed)
+{
+       u8 old, val;
+
+       old = intel_cx0_read(i915, port, lane, addr);
+       val = (old & ~clear) | set;
+
+       if (val != old)
+               intel_cx0_write(i915, port, lane, addr, val, committed);
+}
+
+static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port,
+                         int lane, u16 addr, u8 clear, u8 set, bool committed)
+{
+       if (lane == INTEL_CX0_BOTH_LANES) {
+               __intel_cx0_rmw(i915, port, INTEL_CX0_LANE0, addr, clear, set, committed);
+               __intel_cx0_rmw(i915, port, INTEL_CX0_LANE1, addr, clear, set, committed);
+       } else {
+               __intel_cx0_rmw(i915, port, lane, addr, clear, set, committed);
+       }
+}
+
+/*
+ * Basic DP link rates with 38.4 MHz reference clock.
+ * Note: The tables below are with SSC. In non-ssc
+ * registers 0xC04 to 0xC08(pll[4] to pll[8]) will be
+ * programmed 0.
+ */
+
+static const struct intel_c10mpllb_state mtl_c10_dp_rbr = {
+       .clock = 162000,
+       .pll[0] = 0xB4,
+       .pll[1] = 0,
+       .pll[2] = 0x30,
+       .pll[3] = 0x1,
+       .pll[4] = 0x26,
+       .pll[5] = 0x0C,
+       .pll[6] = 0x98,
+       .pll[7] = 0x46,
+       .pll[8] = 0x1,
+       .pll[9] = 0x1,
+       .pll[10] = 0,
+       .pll[11] = 0,
+       .pll[12] = 0xC0,
+       .pll[13] = 0,
+       .pll[14] = 0,
+       .pll[15] = 0x2,
+       .pll[16] = 0x84,
+       .pll[17] = 0x4F,
+       .pll[18] = 0xE5,
+       .pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r216 = {
+       .clock = 216000,
+       .pll[0] = 0x4,
+       .pll[1] = 0,
+       .pll[2] = 0xA2,
+       .pll[3] = 0x1,
+       .pll[4] = 0x33,
+       .pll[5] = 0x10,
+       .pll[6] = 0x75,
+       .pll[7] = 0xB3,
+       .pll[8] = 0x1,
+       .pll[9] = 0x1,
+       .pll[10] = 0,
+       .pll[11] = 0,
+       .pll[12] = 0,
+       .pll[13] = 0,
+       .pll[14] = 0,
+       .pll[15] = 0x2,
+       .pll[16] = 0x85,
+       .pll[17] = 0x0F,
+       .pll[18] = 0xE6,
+       .pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r243 = {
+       .clock = 243000,
+       .pll[0] = 0x34,
+       .pll[1] = 0,
+       .pll[2] = 0xDA,
+       .pll[3] = 0x1,
+       .pll[4] = 0x39,
+       .pll[5] = 0x12,
+       .pll[6] = 0xE3,
+       .pll[7] = 0xE9,
+       .pll[8] = 0x1,
+       .pll[9] = 0x1,
+       .pll[10] = 0,
+       .pll[11] = 0,
+       .pll[12] = 0x20,
+       .pll[13] = 0,
+       .pll[14] = 0,
+       .pll[15] = 0x2,
+       .pll[16] = 0x85,
+       .pll[17] = 0x8F,
+       .pll[18] = 0xE6,
+       .pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_dp_hbr1 = {
+       .clock = 270000,
+       .pll[0] = 0xF4,
+       .pll[1] = 0,
+       .pll[2] = 0xF8,
+       .pll[3] = 0x0,
+       .pll[4] = 0x20,
+       .pll[5] = 0x0A,
+       .pll[6] = 0x29,
+       .pll[7] = 0x10,
+       .pll[8] = 0x1,   /* Verify */
+       .pll[9] = 0x1,
+       .pll[10] = 0,
+       .pll[11] = 0,
+       .pll[12] = 0xA0,
+       .pll[13] = 0,
+       .pll[14] = 0,
+       .pll[15] = 0x1,
+       .pll[16] = 0x84,
+       .pll[17] = 0x4F,
+       .pll[18] = 0xE5,
+       .pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r324 = {
+       .clock = 324000,
+       .pll[0] = 0xB4,
+       .pll[1] = 0,
+       .pll[2] = 0x30,
+       .pll[3] = 0x1,
+       .pll[4] = 0x26,
+       .pll[5] = 0x0C,
+       .pll[6] = 0x98,
+       .pll[7] = 0x46,
+       .pll[8] = 0x1,
+       .pll[9] = 0x1,
+       .pll[10] = 0,
+       .pll[11] = 0,
+       .pll[12] = 0xC0,
+       .pll[13] = 0,
+       .pll[14] = 0,
+       .pll[15] = 0x1,
+       .pll[16] = 0x85,
+       .pll[17] = 0x4F,
+       .pll[18] = 0xE6,
+       .pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r432 = {
+       .clock = 432000,
+       .pll[0] = 0x4,
+       .pll[1] = 0,
+       .pll[2] = 0xA2,
+       .pll[3] = 0x1,
+       .pll[4] = 0x33,
+       .pll[5] = 0x10,
+       .pll[6] = 0x75,
+       .pll[7] = 0xB3,
+       .pll[8] = 0x1,
+       .pll[9] = 0x1,
+       .pll[10] = 0,
+       .pll[11] = 0,
+       .pll[12] = 0,
+       .pll[13] = 0,
+       .pll[14] = 0,
+       .pll[15] = 0x1,
+       .pll[16] = 0x85,
+       .pll[17] = 0x0F,
+       .pll[18] = 0xE6,
+       .pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_dp_hbr2 = {
+       .clock = 540000,
+       .pll[0] = 0xF4,
+       .pll[1] = 0,
+       .pll[2] = 0xF8,
+       .pll[3] = 0,
+       .pll[4] = 0x20,
+       .pll[5] = 0x0A,
+       .pll[6] = 0x29,
+       .pll[7] = 0x10,
+       .pll[8] = 0x1,
+       .pll[9] = 0x1,
+       .pll[10] = 0,
+       .pll[11] = 0,
+       .pll[12] = 0xA0,
+       .pll[13] = 0,
+       .pll[14] = 0,
+       .pll[15] = 0,
+       .pll[16] = 0x84,
+       .pll[17] = 0x4F,
+       .pll[18] = 0xE5,
+       .pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r675 = {
+       .clock = 675000,
+       .pll[0] = 0xB4,
+       .pll[1] = 0,
+       .pll[2] = 0x3E,
+       .pll[3] = 0x1,
+       .pll[4] = 0xA8,
+       .pll[5] = 0x0C,
+       .pll[6] = 0x33,
+       .pll[7] = 0x54,
+       .pll[8] = 0x1,
+       .pll[9] = 0x1,
+       .pll[10] = 0,
+       .pll[11] = 0,
+       .pll[12] = 0xC8,
+       .pll[13] = 0,
+       .pll[14] = 0,
+       .pll[15] = 0,
+       .pll[16] = 0x85,
+       .pll[17] = 0x8F,
+       .pll[18] = 0xE6,
+       .pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_dp_hbr3 = {
+       .clock = 810000,
+       .pll[0] = 0x34,
+       .pll[1] = 0,
+       .pll[2] = 0x84,
+       .pll[3] = 0x1,
+       .pll[4] = 0x30,
+       .pll[5] = 0x0F,
+       .pll[6] = 0x3D,
+       .pll[7] = 0x98,
+       .pll[8] = 0x1,
+       .pll[9] = 0x1,
+       .pll[10] = 0,
+       .pll[11] = 0,
+       .pll[12] = 0xF0,
+       .pll[13] = 0,
+       .pll[14] = 0,
+       .pll[15] = 0,
+       .pll[16] = 0x84,
+       .pll[17] = 0x0F,
+       .pll[18] = 0xE5,
+       .pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state * const mtl_c10_dp_tables[] = {
+       &mtl_c10_dp_rbr,
+       &mtl_c10_dp_hbr1,
+       &mtl_c10_dp_hbr2,
+       &mtl_c10_dp_hbr3,
+       NULL,
+};
+
+static const struct intel_c10mpllb_state * const mtl_c10_edp_tables[] = {
+       &mtl_c10_dp_rbr,
+       &mtl_c10_edp_r216,
+       &mtl_c10_edp_r243,
+       &mtl_c10_dp_hbr1,
+       &mtl_c10_edp_r324,
+       &mtl_c10_edp_r432,
+       &mtl_c10_dp_hbr2,
+       &mtl_c10_edp_r675,
+       &mtl_c10_dp_hbr3,
+       NULL,
+};
+
+static const struct intel_c10mpllb_state * const *
+intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
+                          struct intel_encoder *encoder)
+{
+       if (intel_crtc_has_dp_encoder(crtc_state)) {
+               if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP))
+                       return mtl_c10_edp_tables;
+               else
+                       return mtl_c10_dp_tables;
+       }
+
+       /* TODO: Add HDMI Support */
+       MISSING_CASE(encoder->type);
+       return NULL;
+}
+
+static int intel_c10mpllb_calc_state(struct intel_crtc_state *crtc_state,
+                                    struct intel_encoder *encoder)
+{
+       const struct intel_c10mpllb_state * const *tables;
+       int i;
+
+       tables = intel_c10_mpllb_tables_get(crtc_state, encoder);
+       if (!tables)
+               return -EINVAL;
+
+       for (i = 0; tables[i]; i++) {
+               if (crtc_state->port_clock <= tables[i]->clock) {
+                       crtc_state->c10mpllb_state = *tables[i];
+                       return 0;
+               }
+       }
+
+       return -EINVAL;
+}
+
+int intel_cx0mpllb_calc_state(struct intel_crtc_state *crtc_state,
+                             struct intel_encoder *encoder)
+{
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+       enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+       drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+
+       return intel_c10mpllb_calc_state(crtc_state, encoder);
+}
+
+void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
+                                    struct intel_c10mpllb_state *pll_state)
+{
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+       struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+       bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+       u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+                                 INTEL_CX0_LANE0;
+       enum phy phy = intel_port_to_phy(i915, encoder->port);
+       int i;
+       u8 cmn, tx0;
+
+       /*
+        * According to C10 VDR Register programming Sequence we need
+        * to do this to read PHY internal registers from MsgBus.
+        */
+       intel_cx0_rmw(i915, encoder->port, lane, PHY_C10_VDR_CONTROL(1), 0,
+                     C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+
+       for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+               pll_state->pll[i] = intel_cx0_read(i915, encoder->port, lane,
+                                                  PHY_C10_VDR_PLL(i));
+
+       cmn = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_CMN(0));
+       tx0 = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_TX(0));
+
+       if (tx0 != C10_TX0_VAL || cmn != C10_CMN0_DP_VAL)
+               drm_warn(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",
+                        tx0, cmn, phy_name(phy));
+}
+
+static void intel_c10_pll_program(struct drm_i915_private *i915,
+                                 const struct intel_crtc_state *crtc_state,
+                                 struct intel_encoder *encoder)
+{
+       const struct intel_c10mpllb_state *pll_state = &crtc_state->c10mpllb_state;
+       struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+       bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+       u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+                                        INTEL_CX0_LANE0;
+       u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+                                          INTEL_CX0_LANE1;
+
+       int i;
+       struct intel_dp *intel_dp;
+       bool use_ssc = false;
+       u8 cmn0 = 0;
+
+       if (intel_crtc_has_dp_encoder(crtc_state)) {
+               intel_dp = enc_to_intel_dp(encoder);
+               use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+                         DP_MAX_DOWNSPREAD_0_5);
+
+               if (!intel_panel_use_ssc(i915))
+                       use_ssc = false;
+
+               cmn0 = C10_CMN0_DP_VAL;
+       }
+
+       intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
+                       C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+       /* Custom width needs to be programmed to 0 for both the phy lanes */
+       intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+                     PHY_C10_VDR_CUSTOM_WIDTH, 0x3, 0, MB_WRITE_COMMITTED);
+       intel_cx0_rmw(i915, encoder->port, follower_lane, PHY_C10_VDR_CONTROL(1),
+                     C10_VDR_CTRL_MASTER_LANE, C10_VDR_CTRL_UPDATE_CFG,
+                     MB_WRITE_COMMITTED);
+
+       /* Program the pll values only for the master lane */
+       for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+               /* If not using ssc pll[4] through pll[8] must be 0*/
+               intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_PLL(i),
+                               (!use_ssc && (i > 3 && i < 9)) ? 0 : pll_state->pll[i],
+                               (i % 4) ? MB_WRITE_UNCOMMITTED : MB_WRITE_COMMITTED);
+
+       intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CMN(0), cmn0,

MB_WRITE_COMMITTED);
+       intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_TX(0), C10_TX0_VAL, MB_WRITE_COMMITTED);
+       intel_cx0_rmw(i915, encoder->port, master_lane, PHY_C10_VDR_CONTROL(1), +                     C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MASTER_LANE | +                     C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +32 -0
+}
+
+void intel_c10mpllb_dump_hw_state(struct drm_i915_private *dev_priv,
+                                 const struct intel_c10mpllb_state *hw_state)
+{
+       bool fracen;
+       int i;
+       unsigned int frac_quot = 0, frac_rem = 0, frac_den = 1;
+       unsigned int multiplier, tx_clk_div;
+
+       fracen = hw_state->pll[0] & C10_PLL0_FRACEN;
+       drm_dbg_kms(&dev_priv->drm, "c10pll_hw_state: fracen: %s, ",
+                   str_yes_no(fracen));
+
+       if (fracen) {
+               frac_quot = hw_state->pll[12] << 8 | hw_state->pll[11];
+               frac_rem =  hw_state->pll[14] << 8 | hw_state->pll[13];
+               frac_den =  hw_state->pll[10] << 8 | hw_state->pll[9];
+               drm_dbg_kms(&dev_priv->drm, "quot: %u, rem: %u, den: %u,\n",
+                           frac_quot, frac_rem, frac_den);
+       }
+
+       multiplier = (REG_FIELD_GET8(C10_PLL3_MULTIPLIERH_MASK, hw_state->pll[3]) << 8 |
+                     hw_state->pll[2]) / 2 + 16;
+       tx_clk_div = REG_FIELD_GET8(C10_PLL15_TXCLKDIV_MASK, hw_state->pll[15]);
+       drm_dbg_kms(&dev_priv->drm,
+                   "multiplier: %u, tx_clk_div: %u.\n", multiplier, tx_clk_div);
+
+       drm_dbg_kms(&dev_priv->drm, "c10pll_rawhw_state:");
+
+       for (i = 0; i < ARRAY_SIZE(hw_state->pll); i = i + 4)
+               drm_dbg_kms(&dev_priv->drm, "pll[%d] = 0x%x, pll[%d] = 0x%x, pll[%d] = 0x%x,

pll[%d] = 0x%x\n",
+                           i, hw_state->pll[i], i + 1, hw_state->pll[i + 1], +                           i + 2, hw_state->pll[i + 2], i + 3, hw_state->pll[i + 3]);

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +90 -0
+}
+
+int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
+                                  const struct intel_c10mpllb_state *pll_state)
+{
+       unsigned int frac_quot = 0, frac_rem = 0, frac_den = 1;
+       unsigned int multiplier, tx_clk_div, refclk = 38400;
+
+       if (pll_state->pll[0] & C10_PLL0_FRACEN) {
+               frac_quot = pll_state->pll[12] << 8 | pll_state->pll[11];
+               frac_rem =  pll_state->pll[14] << 8 | pll_state->pll[13];
+               frac_den =  pll_state->pll[10] << 8 | pll_state->pll[9];
+       }
+
+       multiplier = (REG_FIELD_GET8(C10_PLL3_MULTIPLIERH_MASK, pll_state->pll[3]) << 8 |
+                     pll_state->pll[2]) / 2 + 16;
+
+       tx_clk_div = REG_FIELD_GET8(C10_PLL15_TXCLKDIV_MASK, pll_state->pll[15]);
+
+       return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(refclk, (multiplier << 16) + frac_quot) +
+                                    DIV_ROUND_CLOSEST(refclk * frac_rem, frac_den),
+                                    10 << (tx_clk_div + 16));
+}
+
+static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
+                                        const struct intel_crtc_state *crtc_state,
+                                        bool lane_reversal)
+{
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+       struct intel_dp *intel_dp;
+       bool ssc_enabled;
+       u32 val = 0;
+
+       intel_de_rmw(i915, XELPDP_PORT_BUF_CTL1(encoder->port), XELPDP_PORT_REVERSAL,
+                    lane_reversal ? XELPDP_PORT_REVERSAL : 0);
+
+       if (lane_reversal)
+               val |= XELPDP_LANE1_PHY_CLOCK_SELECT;
+
+       val |= XELPDP_FORWARD_CLOCK_UNGATE;
+       val |= XELPDP_DDI_CLOCK_SELECT(XELPDP_DDI_CLOCK_SELECT_MAXPCLK);
+
+       if (intel_crtc_has_dp_encoder(crtc_state)) {
+               intel_dp = enc_to_intel_dp(encoder);
+               ssc_enabled = intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+                             DP_MAX_DOWNSPREAD_0_5;
+
+               if (!intel_panel_use_ssc(i915))
+                       ssc_enabled = false;
+
+               /* TODO: DP2.0 10G and 20G rates enable MPLLA*/
+               val |= ssc_enabled ? XELPDP_SSC_ENABLE_PLLB : 0;
+       }
+       intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+                    XELPDP_LANE1_PHY_CLOCK_SELECT |
+                    XELPDP_FORWARD_CLOCK_UNGATE |
+                    XELPDP_DDI_CLOCK_SELECT_MASK |
+                    XELPDP_SSC_ENABLE_PLLB, val);
+}
+
+static u32 intel_cx0_get_powerdown_update(u8 lane)
+{
+       if (lane == INTEL_CX0_LANE0)
+               return XELPDP_LANE0_POWERDOWN_UPDATE;
+       else if (lane == INTEL_CX0_LANE1)
+               return XELPDP_LANE1_POWERDOWN_UPDATE;
+       else
+               return XELPDP_LANE0_POWERDOWN_UPDATE |
+                      XELPDP_LANE1_POWERDOWN_UPDATE;
+}
+
+static u32 intel_cx0_get_powerdown_state(u8 lane, u8 state)
+{
+       if (lane == INTEL_CX0_LANE0)
+               return XELPDP_LANE0_POWERDOWN_NEW_STATE(state);
+       else if (lane == INTEL_CX0_LANE1)
+               return XELPDP_LANE1_POWERDOWN_NEW_STATE(state);
+       else
+               return XELPDP_LANE0_POWERDOWN_NEW_STATE(state) |
+                      XELPDP_LANE1_POWERDOWN_NEW_STATE(state);
+}
+
+static void intel_cx0_powerdown_change_sequence(struct drm_i915_private *i915,
+                                               enum port port,
+                                               u8 lane, u8 state)
+{
+       enum phy phy = intel_port_to_phy(i915, port);
+
+       intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+                    XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK |

XELPDP_LANE1_POWERDOWN_NEW_STATE_MASK,
+                    intel_cx0_get_powerdown_state(lane, state));
+       intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+                    XELPDP_LANE0_POWERDOWN_UPDATE | XELPDP_LANE1_POWERDOWN_UPDATE, +                    intel_cx0_get_powerdown_update(lane));

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +64 -0
+
+       /* Update Timeout Value */
+       if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
+                                        intel_cx0_get_powerdown_update(lane), 0,
+                                        XELPDP_PORT_POWERDOWN_UPDATE_TIMEOUT_US, 0, NULL))
+               drm_warn(&i915->drm, "PHY %c failed to bring out of Lane reset after %dus.\n",
+                        phy_name(phy), XELPDP_PORT_RESET_START_TIMEOUT_US);
+}
+
+static void intel_cx0_setup_powerdown(struct drm_i915_private *i915, enum port port)
+{
+       intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+                    XELPDP_POWER_STATE_READY_MASK,
+                    XELPDP_POWER_STATE_READY(CX0_P2_STATE_READY));
+       intel_de_rmw(i915, XELPDP_PORT_BUF_CTL3(port),
+                    XELPDP_POWER_STATE_ACTIVE_MASK |
+                    XELPDP_PLL_LANE_STAGGERING_DELAY_MASK,
+                    XELPDP_POWER_STATE_ACTIVE(CX0_P0_STATE_ACTIVE) |
+                    XELPDP_PLL_LANE_STAGGERING_DELAY(0));
+}
+
+static u32 intel_cx0_get_pclk_refclk_request(u8 lane)
+{
+       if (lane == INTEL_CX0_LANE0)
+               return XELPDP_LANE0_PCLK_REFCLK_REQUEST;
+       else if (lane == INTEL_CX0_LANE1)
+               return XELPDP_LANE1_PCLK_REFCLK_REQUEST;
+       else
+               return XELPDP_LANE0_PCLK_REFCLK_REQUEST |
+                      XELPDP_LANE1_PCLK_REFCLK_REQUEST;
+}
+
+static u32 intel_cx0_get_pclk_refclk_ack(u8 lane)
+{
+       if (lane == INTEL_CX0_LANE0)
+               return XELPDP_LANE0_PCLK_REFCLK_ACK;
+       else if (lane == INTEL_CX0_LANE1)
+               return XELPDP_LANE1_PCLK_REFCLK_ACK;
+       else
+               return XELPDP_LANE0_PCLK_REFCLK_ACK |
+                      XELPDP_LANE1_PCLK_REFCLK_ACK;
+}
+
+/* FIXME: Some Type-C cases need not reset both the lanes. Handle those cases. */
+static void intel_cx0_phy_lane_reset(struct drm_i915_private *i915, enum port port,
+                                    bool lane_reversal)
+{
+       enum phy phy = intel_port_to_phy(i915, port);
+       u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+                                 INTEL_CX0_LANE0;
+
+       if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL1(port),
+                                        XELPDP_PORT_BUF_SOC_PHY_READY,
+                                        XELPDP_PORT_BUF_SOC_PHY_READY,
+                                        XELPDP_PORT_BUF_SOC_READY_TIMEOUT_US, 0, NULL))
+               drm_warn(&i915->drm, "PHY %c failed to bring out of SOC reset after %dus.\n",
+                        phy_name(phy), XELPDP_PORT_BUF_SOC_READY_TIMEOUT_US);
+
+       intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+                    XELPDP_LANE0_PIPE_RESET | XELPDP_LANE1_PIPE_RESET,
+                    XELPDP_LANE0_PIPE_RESET | XELPDP_LANE1_PIPE_RESET);
+
+       if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
+                                        XELPDP_LANE0_PHY_CURRENT_STATUS |

XELPDP_LANE1_PHY_CURRENT_STATUS,
+                                        XELPDP_LANE0_PHY_CURRENT_STATUS | XELPDP_LANE1_PHY_CURRENT_STATUS,
+                                        XELPDP_PORT_RESET_START_TIMEOUT_US, 0, NULL)) +               drm_warn(&i915->drm, "PHY %c failed to bring out of Lane reset after %dus.\n", +                        phy_name(phy), XELPDP_PORT_RESET_START_TIMEOUT_US);

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +71 -0
+
+       intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(port),
+                    intel_cx0_get_pclk_refclk_request(INTEL_CX0_BOTH_LANES),
+                    intel_cx0_get_pclk_refclk_request(lane));
+
+       if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(port),
+                                        intel_cx0_get_pclk_refclk_ack(INTEL_CX0_BOTH_LANES),
+                                        intel_cx0_get_pclk_refclk_ack(lane),
+                                        XELPDP_REFCLK_ENABLE_TIMEOUT_US, 0, NULL))
+               drm_warn(&i915->drm, "PHY %c failed to request refclk after %dus.\n",
+                        phy_name(phy), XELPDP_REFCLK_ENABLE_TIMEOUT_US);
+
+       intel_cx0_powerdown_change_sequence(i915, port, INTEL_CX0_BOTH_LANES,
+                                           CX0_P2_STATE_RESET);
+       intel_cx0_setup_powerdown(i915, port);
+
+       intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+                    XELPDP_LANE0_PIPE_RESET | XELPDP_LANE1_PIPE_RESET, 0);
+
+       if (intel_de_wait_for_clear(i915, XELPDP_PORT_BUF_CTL2(port),
+                                   XELPDP_LANE0_PHY_CURRENT_STATUS |
+                                   XELPDP_LANE1_PHY_CURRENT_STATUS,
+                                   XELPDP_PORT_RESET_END_TIMEOUT))
+               drm_warn(&i915->drm, "PHY %c failed to bring out of Lane reset after %dms.\n",
+                        phy_name(phy), XELPDP_PORT_RESET_END_TIMEOUT);
+}
+
+static void intel_c10_program_phy_lane(struct drm_i915_private *i915,
+                                      struct intel_encoder *encoder, int lane_count,
+                                      bool lane_reversal)
+{
+       u8 l0t1, l0t2, l1t1, l1t2;
+       bool dp_alt_mode = intel_tc_port_in_dp_alt_mode(enc_to_dig_port(encoder));
+       enum port port = encoder->port;
+
+       intel_cx0_rmw(i915, port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
+                     C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MSGBUS_ACCESS,
+                     MB_WRITE_COMMITTED);
+
+       l0t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2));
+       l0t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2));
+       l1t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(1, 2));
+       l1t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(2, 2));
+
+       if (lane_reversal) {
+               switch (lane_count) {
+               case 1:
+                       /* Disable MLs 1(lane0), 2(lane0), 3(lane1) */
+                       intel_cx0_write(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(1, 2),
+                                       l1t1 | CONTROL2_DISABLE_SINGLE_TX,
+                                       MB_WRITE_COMMITTED);
+                       fallthrough;
+               case 2:
+                       /* Disable MLs 1(lane0), 2(lane0) */
+                       intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2),
+                                       l0t2 | CONTROL2_DISABLE_SINGLE_TX,
+                                       MB_WRITE_COMMITTED);
+                       fallthrough;
+               case 3:
+                       /* Disable MLs 1(lane0) */
+                       intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2),
+                                       l0t1 | CONTROL2_DISABLE_SINGLE_TX,
+                                       MB_WRITE_COMMITTED);
+                       break;
+               }
+       } else {
+               switch (lane_count) {
+               case 1:
+                       if (dp_alt_mode) {
+                               /* Disable MLs 1(lane0), 3(lane1), 4(lane1) */
+                               intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1,

2),
+                                               l0t1 | CONTROL2_DISABLE_SINGLE_TX, +                                               MB_WRITE_COMMITTED);
+                       } else {
+                               /* Disable MLs 2(lane0), 3(lane1), 4(lane1) */
+                               intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2),
+                                               l0t2 | CONTROL2_DISABLE_SINGLE_TX, +                                               MB_WRITE_COMMITTED);
+                       }
+                       fallthrough;
+               case 2:
+                       /* Disable MLs 3(lane1), 4(lane1) */
+                       intel_cx0_write(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(1, 2), +                                       l1t1 | CONTROL2_DISABLE_SINGLE_TX,
+                                       MB_WRITE_COMMITTED);
+                       fallthrough;
+               case 3:
+                       /* Disable MLs 4(lane1) */
+                       intel_cx0_write(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(2, 2), +                                       l1t2 | CONTROL2_DISABLE_SINGLE_TX,
+                                       MB_WRITE_COMMITTED);
+                       break;
+               }
+       }
+
+       if (intel_is_c10phy(i915, intel_port_to_phy(i915, port))) {
+               intel_cx0_rmw(i915, port, INTEL_CX0_LANE1, PHY_C10_VDR_CONTROL(1), +                             C10_VDR_CTRL_UPDATE_CFG | C10_VDR_CTRL_MSGBUS_ACCESS, +                             C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+               intel_cx0_rmw(i915, port, INTEL_CX0_LANE0, PHY_C10_VDR_CONTROL(1), +                             C10_VDR_CTRL_UPDATE_CFG | C10_VDR_CTRL_MSGBUS_ACCESS, +                             C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+       }

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +203 -0
+}
+
+static u32 intel_cx0_get_pclk_pll_request(u8 lane)
+{
+       if (lane == INTEL_CX0_LANE0)
+               return XELPDP_LANE0_PCLK_PLL_REQUEST;
+       else if (lane == INTEL_CX0_LANE1)
+               return XELPDP_LANE1_PCLK_PLL_REQUEST;
+       else
+               return XELPDP_LANE0_PCLK_PLL_REQUEST |
+                      XELPDP_LANE1_PCLK_PLL_REQUEST;
+}
+
+static u32 intel_cx0_get_pclk_pll_ack(u8 lane)
+{
+       if (lane == INTEL_CX0_LANE0)
+               return XELPDP_LANE0_PCLK_PLL_ACK;
+       else if (lane == INTEL_CX0_LANE1)
+               return XELPDP_LANE1_PCLK_PLL_ACK;
+       else
+               return XELPDP_LANE0_PCLK_PLL_ACK |
+                      XELPDP_LANE1_PCLK_PLL_ACK;
+}
+
+static void intel_c10pll_enable(struct intel_encoder *encoder,
+                               const struct intel_crtc_state *crtc_state)
+{
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+       enum phy phy = intel_port_to_phy(i915, encoder->port);
+       struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+       bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+       u8 maxpclk_lane = lane_reversal ? INTEL_CX0_LANE1 :
+                                         INTEL_CX0_LANE0;
+
+       /*
+        * 1. Program PORT_CLOCK_CTL REGISTER to configure
+        * clock muxes, gating and SSC
+        */
+       intel_program_port_clock_ctl(encoder, crtc_state, lane_reversal);
+
+       /* 2. Bring PHY out of reset. */
+       intel_cx0_phy_lane_reset(i915, encoder->port, lane_reversal);
+
+       /*
+        * 3. Change Phy power state to Ready.
+        * TODO: For DP alt mode use only one lane.
+        */
+       intel_cx0_powerdown_change_sequence(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+                                           CX0_P2_STATE_READY);
+
+       /* 4. Program PHY internal PLL internal registers. */
+       intel_c10_pll_program(i915, crtc_state, encoder);
+
+       /*
+        * 5. Program the enabled and disabled owned PHY lane
+        * transmitters over message bus
+        */
+       intel_c10_program_phy_lane(i915, encoder, crtc_state->lane_count, lane_reversal);
+
+       /*
+        * 6. Follow the Display Voltage Frequency Switching - Sequence
+        * Before Frequency Change. We handle this step in bxt_set_cdclk().
+        */
+
+       /*
+        * 7. Program DDI_CLK_VALFREQ to match intended DDI
+        * clock frequency.
+        */
+       intel_de_write(i915, DDI_CLK_VALFREQ(encoder->port),
+                      crtc_state->port_clock);
+       /*
+        * 8. Set PORT_CLOCK_CTL register PCLK PLL Request
+        * LN<Lane for maxPCLK> to "1" to enable PLL.
+        */
+       intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+                    intel_cx0_get_pclk_pll_request(INTEL_CX0_BOTH_LANES),
+                    intel_cx0_get_pclk_pll_request(maxpclk_lane));
+
+       /* 9. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK> == "1". */
+       if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+                                        intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES),
+                                        intel_cx0_get_pclk_pll_ack(maxpclk_lane),
+                                        XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US, 0, NULL))
+               drm_warn(&i915->drm, "Port %c PLL not locked after %dus.\n",
+                        phy_name(phy), XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US);
+
+       /*
+        * 10. Follow the Display Voltage Frequency Switching Sequence After
+        * Frequency Change. We handle this step in bxt_set_cdclk().
+        */
+}
+
+void intel_cx0pll_enable(struct intel_encoder *encoder,
+                        const struct intel_crtc_state *crtc_state)
+{
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+       enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+       drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+       intel_c10pll_enable(encoder, crtc_state);
+}
+
+static void intel_c10pll_disable(struct intel_encoder *encoder)
+{
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+       enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+       /* 1. Change owned PHY lane power to Disable state. */
+       intel_cx0_powerdown_change_sequence(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+                                           CX0_P2PG_STATE_DISABLE);
+
+       /*
+        * 2. Follow the Display Voltage Frequency Switching Sequence Before
+        * Frequency Change. We handle this step in bxt_set_cdclk().
+        */
+
+       /*
+        * 3. Set PORT_CLOCK_CTL register PCLK PLL Request LN<Lane for maxPCLK>
+        * to "0" to disable PLL.
+        */
+       intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+                    intel_cx0_get_pclk_pll_request(INTEL_CX0_BOTH_LANES) |
+                    intel_cx0_get_pclk_refclk_request(INTEL_CX0_BOTH_LANES), 0);
+
+       /* 4. Program DDI_CLK_VALFREQ to 0. */
+       intel_de_write(i915, DDI_CLK_VALFREQ(encoder->port), 0);
+
+       /*
+        * 5. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK**> == "0".
+        */
+       if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+                                        intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES) |
+                                        intel_cx0_get_pclk_refclk_ack(INTEL_CX0_BOTH_LANES), 0,
+                                        XELPDP_PCLK_PLL_DISABLE_TIMEOUT_US, 0, NULL))
+               drm_warn(&i915->drm, "Port %c PLL not unlocked after %dus.\n",
+                        phy_name(phy), XELPDP_PCLK_PLL_DISABLE_TIMEOUT_US);
+
+       /*
+        * 6. Follow the Display Voltage Frequency Switching Sequence After
+        * Frequency Change. We handle this step in bxt_set_cdclk().
+        */
+
+       /* 7. Program PORT_CLOCK_CTL register to disable and gate clocks. */
+       intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+                    XELPDP_DDI_CLOCK_SELECT_MASK |
+                    XELPDP_FORWARD_CLOCK_UNGATE, 0);
+}
+
+void intel_cx0pll_disable(struct intel_encoder *encoder)
+{
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+       enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+       drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+       intel_c10pll_disable(encoder);
+}
+
+void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
+                                struct intel_crtc_state *new_crtc_state)
+{
+       struct drm_i915_private *i915 = to_i915(state->base.dev);
+       struct intel_c10mpllb_state mpllb_hw_state = { 0 };
+       struct intel_c10mpllb_state *mpllb_sw_state = &new_crtc_state->c10mpllb_state;
+       struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
+       struct intel_encoder *encoder;
+       struct intel_dp *intel_dp;
+       enum phy phy;
+       int i;
+       bool use_ssc = false;
+
+       if (DISPLAY_VER(i915) < 14)
+               return;
+
+       if (!new_crtc_state->hw.active)
+               return;
+
+       encoder = intel_get_crtc_new_encoder(state, new_crtc_state);
+       phy = intel_port_to_phy(i915, encoder->port);
+
+       if (intel_crtc_has_dp_encoder(new_crtc_state)) {
+               intel_dp = enc_to_intel_dp(encoder);
+               use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+                         DP_MAX_DOWNSPREAD_0_5);
+
+               if (!intel_panel_use_ssc(i915))
+                       use_ssc = false;
+       }
+
+       if (!intel_is_c10phy(i915, phy))
+               return;
+
+       intel_c10mpllb_readout_hw_state(encoder, &mpllb_hw_state);
+
+       for (i = 0; i < ARRAY_SIZE(mpllb_sw_state->pll); i++) {
+               u8 expected;
+
+               if (!use_ssc && i > 3 && i < 9)
+                       expected = 0;
+               else
+                       expected = mpllb_sw_state->pll[i];
+
+               I915_STATE_WARN(mpllb_hw_state.pll[i] != expected,
+                               "[CRTC:%d:%s] mismatch in C10MPLLB: Register[%d] (expected 0x%02x,

found 0x%02x)",
+                               crtc->base.base.id, crtc->base.name, +                               i, expected, mpllb_hw_state.pll[i]); +       }

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+}
drivers/gpu/drm/i915/display/intel_cx0_phy.h new file +43 -0
new file mode 100644
index 000000000000..8cf340509097
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2021 Intel Corporation
+ */
+
+#ifndef __INTEL_CX0_PHY_H__
+#define __INTEL_CX0_PHY_H__
+
+#include <linux/types.h>
+#include <linux/bitfield.h>
+#include <linux/bits.h>
+
+#include "i915_drv.h"
+#include "intel_display_types.h"
+
+struct drm_i915_private;
+struct intel_encoder;
+struct intel_crtc_state;
+enum phy;
+
+#define INTEL_CX0_LANE0                0x1
+#define INTEL_CX0_LANE1                0x2
+#define INTEL_CX0_BOTH_LANES   0x3
+
+#define MB_WRITE_COMMITTED             1
+#define MB_WRITE_UNCOMMITTED           0
+
+bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy);
+void intel_cx0pll_enable(struct intel_encoder *encoder,
+                        const struct intel_crtc_state *crtc_state);
+void intel_cx0pll_disable(struct intel_encoder *encoder);
+void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
+                                    struct intel_c10mpllb_state *pll_state);
+int intel_cx0mpllb_calc_state(struct intel_crtc_state *crtc_state,
+                             struct intel_encoder *encoder);
+void intel_c10mpllb_dump_hw_state(struct drm_i915_private *dev_priv,
+                                 const struct intel_c10mpllb_state *hw_state);
+int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
+                                  const struct intel_c10mpllb_state *pll_state);
+void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
+                                struct intel_crtc_state *new_crtc_state);
+
+#endif /* __INTEL_CX0_PHY_H__ */
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0 -0
index d1ee8a2fc9cf..15e249f46a64 100644
@@ -128,4 +128,34 @@
  #define   XELPDP_SSC_ENABLE_PLLA                       REG_BIT(1)
  #define   XELPDP_SSC_ENABLE_PLLB                       REG_BIT(0)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +31 -1
-#endif /* __INTEL_CX0_PHY_REGS_H__ */
+/* C10 Vendor Registers */
+#define PHY_C10_VDR_PLL(idx)           (0xC00 + (idx))
+#define   C10_PLL0_FRACEN              REG_BIT8(4)
+#define   C10_PLL3_MULTIPLIERH_MASK    REG_GENMASK8(3, 0)
+#define   C10_PLL15_TXCLKDIV_MASK      REG_GENMASK8(2, 0)
+#define PHY_C10_VDR_CMN(idx)           (0xC20 + (idx))
+#define   C10_CMN0_DP_VAL              0x21
+#define   C10_CMN3_TXVBOOST_MASK       REG_GENMASK8(7, 5)
+#define   C10_CMN3_TXVBOOST(val)       REG_FIELD_PREP8(C10_CMN3_TXVBOOST_MASK, val)
+#define PHY_C10_VDR_TX(idx)            (0xC30 + (idx))
+#define   C10_TX0_VAL                  0x10
+#define PHY_C10_VDR_CONTROL(idx)       (0xC70 + (idx) - 1)
+#define   C10_VDR_CTRL_MSGBUS_ACCESS   REG_BIT8(2)
+#define   C10_VDR_CTRL_MASTER_LANE     REG_BIT8(1)
+#define   C10_VDR_CTRL_UPDATE_CFG      REG_BIT8(0)
+#define PHY_C10_VDR_CUSTOM_WIDTH       0xD02
+
+#define CX0_P0_STATE_ACTIVE             0x0
+#define CX0_P2_STATE_READY              0x2
+#define CX0_P2PG_STATE_DISABLE          0x9
+#define CX0_P4PG_STATE_DISABLE          0xC
+#define CX0_P2_STATE_RESET              0x2
+
+/* PHY_C10_VDR_PLL0 */
+#define PLL_C10_MPLL_SSC_EN             REG_BIT8(0)
+
+/* PIPE SPEC Defined Registers */
+#define PHY_CX0_TX_CONTROL(tx, control) (0x400 + ((tx) - 1) * 0x200 + (control))
+#define CONTROL2_DISABLE_SINGLE_TX      REG_BIT(6)
+
+#endif /* __INTEL_CX0_REG_DEFS_H__ */
drivers/gpu/drm/i915/display/intel_ddi.c +1 -0
index 73240cf78c8b..a433dea5b9a3 100644
@@ -39,6 +39,7 @@
  #include "intel_combo_phy_regs.h"
  #include "intel_connector.h"
  #include "intel_crtc.h"
+#include "intel_cx0_phy.h"
  #include "intel_ddi.h"
  #include "intel_ddi_buf_trans.h"
  #include "intel_de.h"
@@ -3507,6 +3508,21 @@ void intel_ddi_get_clock(struct intel_encoder *encoder,
                                                      &crtc_state->dpll_hw_state);
  }

drivers/gpu/drm/i915/display/intel_ddi.c +11 -0
+static void mtl_ddi_get_config(struct intel_encoder *encoder,
+                              struct intel_crtc_state *crtc_state)
+{
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+       enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+       drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+
+       intel_c10mpllb_readout_hw_state(encoder, &crtc_state->c10mpllb_state);
+       intel_c10mpllb_dump_hw_state(i915, &crtc_state->c10mpllb_state);
+       crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state-
Quoted 1 line

c10mpllb_state);

drivers/gpu/drm/i915/display/intel_ddi.c +4 -0
+
+       intel_ddi_get_config(encoder, crtc_state);
+}
+

 static void dg2_ddi_get_config(struct intel_encoder *encoder, struct intel_crtc_state *crtc_state) {

drivers/gpu/drm/i915/display/intel_ddi.c +0 -0
@@ -4413,7 +4429,11 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
         encoder->cloneable = 0;
         encoder->pipe_mask = ~0;


-       if (IS_DG2(dev_priv)) {
+       if (DISPLAY_VER(dev_priv) >= 14) {
+               encoder->enable_clock = intel_cx0pll_enable; +               encoder->disable_clock = intel_cx0pll_disable; +               encoder->get_config = mtl_ddi_get_config; +       } else if (IS_DG2(dev_priv)) { encoder->enable_clock = intel_mpllb_enable; encoder->disable_clock = intel_mpllb_disable; encoder->get_config = dg2_ddi_get_config;

drivers/gpu/drm/i915/display/intel_display_power.c +0 -0
index f86060195987..e23fecba446c 100644
@@ -1614,7 +1614,8 @@ static void icl_display_core_init(struct drm_i915_private *dev_priv,
                 return;


        /* 2. Initialize all combo phys */
-       intel_combo_phy_init(dev_priv);
+       if (DISPLAY_VER(dev_priv) < 14)
+               intel_combo_phy_init(dev_priv);

        /*
         * 3. Enable Power Well 1 (PG1).

drivers/gpu/drm/i915/display/intel_display_power_well.c +0 -0
index 1676df1dc066..a4c8cb75c0a0 100644
@@ -970,7 +970,7 @@ void gen9_disable_dc_states(struct drm_i915_private *dev_priv)
         if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
                 bxt_verify_ddi_phy_power_wells(dev_priv);


-       if (DISPLAY_VER(dev_priv) >= 11)
+       if (DISPLAY_VER(dev_priv) >= 11 && DISPLAY_VER(dev_priv) < 14) /*
                 * DMC retains HW context only for port A, the other combo
                 * PHY's HW context for port B is lost after DC transitions,

drivers/gpu/drm/i915/display/intel_display_types.h +0 -0
index ab146b5b68bd..db7c108e4d86 100644
@@ -985,6 +985,11 @@ struct intel_link_m_n {
         u32 link_n;
  };

drivers/gpu/drm/i915/display/intel_display_types.h +5 -0
+struct intel_c10mpllb_state {
+       u32 clock; /* in KHz */
+       u8 pll[20];
+};
+

 struct intel_crtc_state {
        /*
         * uapi (drm) state. This is the software state shown to userspace.

drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
@@ -1128,6 +1133,7 @@ struct intel_crtc_state {
         union {
                 struct intel_dpll_hw_state dpll_hw_state;
                 struct intel_mpllb_state mpllb_state;
+               struct intel_c10mpllb_state c10mpllb_state;
         };


        /*

drivers/gpu/drm/i915/display/intel_dpll.c +0 -0
index 4e9c18be7e1f..da5aa050a5ab 100644
@@ -8,6 +8,7 @@


 #include "i915_reg.h"
 #include "intel_crtc.h"
+#include "intel_cx0_phy.h"
 #include "intel_de.h"
 #include "intel_display.h"
 #include "intel_display_types.h"

drivers/gpu/drm/i915/display/intel_dpll.c +0 -0
@@ -995,6 +996,17 @@ static int dg2_crtc_compute_clock(struct intel_atomic_state *state,
         return 0;
  }

drivers/gpu/drm/i915/display/intel_dpll.c +11 -0
+static int mtl_crtc_compute_clock(struct intel_atomic_state *state,
+                                 struct intel_crtc *crtc)
+{
+       struct intel_crtc_state *crtc_state =
+               intel_atomic_get_new_crtc_state(state, crtc);
+       struct intel_encoder *encoder =
+               intel_get_crtc_new_encoder(state, crtc_state);
+
+       return intel_cx0mpllb_calc_state(crtc_state, encoder);
+}
+

 static bool ilk_needs_fb_cb_tune(const struct dpll *dpll, int factor) {
        return dpll->m < factor * dpll->n;

drivers/gpu/drm/i915/display/intel_dpll.c +0 -0
@@ -1423,6 +1435,10 @@ static int i8xx_crtc_compute_clock(struct intel_atomic_state *state,
         return 0;
  }

drivers/gpu/drm/i915/display/intel_dpll.c +4 -0
+static const struct intel_dpll_funcs mtl_dpll_funcs = {
+       .crtc_compute_clock = mtl_crtc_compute_clock,
+};
+

 static const struct intel_dpll_funcs dg2_dpll_funcs = { .crtc_compute_clock = dg2_crtc_compute_clock, };

drivers/gpu/drm/i915/display/intel_dpll.c +0 -0
@@ -1517,7 +1533,9 @@ int intel_dpll_crtc_get_shared_dpll(struct intel_atomic_state *state,

 void
 intel_dpll_init_clock_hook(struct drm_i915_private *dev_priv) {
-       if (IS_DG2(dev_priv))
+       if (DISPLAY_VER(dev_priv) >= 14)
+               dev_priv->display.funcs.dpll = &mtl_dpll_funcs; +       else if (IS_DG2(dev_priv)) dev_priv->display.funcs.dpll = &dg2_dpll_funcs; else if (DISPLAY_VER(dev_priv) >= 9 || HAS_DDI(dev_priv)) dev_priv->display.funcs.dpll = &hsw_dpll_funcs;

drivers/gpu/drm/i915/display/intel_dpll_mgr.c +0 -0
index 22fc908b7e5d..ed372d227aa7 100644
@@ -4104,7 +4104,7 @@ void intel_shared_dpll_init(struct drm_i915_private *dev_priv)


        mutex_init(&dev_priv->display.dpll.lock);

-       if (IS_DG2(dev_priv))
+       if (DISPLAY_VER(dev_priv) >= 14 || IS_DG2(dev_priv))
                /* No shared DPLLs on DG2; port PLLs are part of the PHY */ dpll_mgr = NULL;
        else if (IS_ALDERLAKE_P(dev_priv))

drivers/gpu/drm/i915/display/intel_modeset_verify.c +2 -0
index 842d70f0dfd2..ec504470c2f0 100644
@@ -11,6 +11,7 @@
  #include "intel_atomic.h"
  #include "intel_crtc.h"
  #include "intel_crtc_state_dump.h"
+#include "intel_cx0_phy.h"
  #include "intel_display.h"
  #include "intel_display_types.h"
  #include "intel_fdi.h"
@@ -236,6 +237,7 @@ void intel_modeset_verify_crtc(struct intel_crtc *crtc,
         verify_crtc_state(crtc, old_crtc_state, new_crtc_state);
         intel_shared_dpll_state_verify(crtc, old_crtc_state, new_crtc_state);
         intel_mpllb_state_verify(state, new_crtc_state);
+       intel_c10mpllb_state_verify(state, new_crtc_state);
  }


 void intel_modeset_verify_disabled(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/i915_reg.h +0 -0
index d22ffd7a32dc..94dd0d3a474b 100644
@@ -2101,6 +2101,11 @@
  #define   TRANS_PUSH_EN                        REG_BIT(31)
  #define   TRANS_PUSH_SEND              REG_BIT(30)

drivers/gpu/drm/i915/i915_reg.h +5 -0
+/* DDI Buffer Control */
+#define _DDI_CLK_VALFREQ_A             0x64030
+#define _DDI_CLK_VALFREQ_B             0x64130
+#define DDI_CLK_VALFREQ(port)          _MMIO_PORT(port, _DDI_CLK_VALFREQ_A, _DDI_CLK_VALFREQ_B)
+

 /*
  * HSW+ eDP PSR registers
  *

drivers/gpu/drm/i915/i915_reg_defs.h +0 -0
index db26de6b57bc..f9d7c03e95d6 100644
@@ -22,6 +22,19 @@
                BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&         \
                                  ((__n) < 0 || (__n) > 31))))

drivers/gpu/drm/i915/i915_reg_defs.h +13 -0
+/**
+ * REG_BIT8() - Prepare a u8 bit value
+ * @__n: 0-based bit number
+ *
+ * Local wrapper for BIT() to force u8, with compile time checks.
+ *
+ * @return: Value with bit @__n set.
+ */
+#define REG_BIT8(__n)                                                   \
+       ((u8)(BIT(__n) +                                                \
+              BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&         \
+                                ((__n) < 0 || (__n) > 7))))
+

 /**
  * REG_GENMASK() - Prepare a continuous u32 bitmask
  * @__high: 0-based high bit

drivers/gpu/drm/i915/i915_reg_defs.h +0 -0
@@ -52,6 +65,21 @@
                                  __is_constexpr(__low) &&               \
                                  ((__low) < 0 || (__high) > 63 || (__low) > (__high)))))

drivers/gpu/drm/i915/i915_reg_defs.h +15 -0
+/**
+ * REG_GENMASK8() - Prepare a continuous u8 bitmask
+ * @__high: 0-based high bit
+ * @__low: 0-based low bit
+ *
+ * Local wrapper for GENMASK() to force u8, with compile time checks.
+ *
+ * @return: Continuous bitmask from @__high to @__low, inclusive.
+ */
+#define REG_GENMASK8(__high, __low)                                     \
+       ((u8)(GENMASK(__high, __low) +                                  \
+              BUILD_BUG_ON_ZERO(__is_constexpr(__high) &&      \
+                                __is_constexpr(__low) &&               \
+                                ((__low) < 0 || (__high) > 7 || (__low) > (__high)))))
+

 /*
  * Local integer constant expression version of is_power_of_2(). */

drivers/gpu/drm/i915/i915_reg_defs.h +0 -0
@@ -74,6 +102,23 @@
                BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \

               BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))

drivers/gpu/drm/i915/i915_reg_defs.h +16 -0
+/**
+ * REG_FIELD_PREP8() - Prepare a u8 bitfield value
+ * @__mask: shifted mask defining the field's length and position
+ * @__val: value to put in the field
+ *
+ * Local copy of FIELD_PREP8() to generate an integer constant expression, force
+ * u8 and for consistency with REG_FIELD_GET8(), REG_BIT8() and REG_GENMASK8().
+ *
+ * @return: @__val masked and shifted into the field defined by @__mask.
+ */
+#define REG_FIELD_PREP8(__mask, __val)                                          \
+       ((u8)((((typeof(__mask))(__val) << __bf_shf(__mask)) & (__mask)) +      \
+              BUILD_BUG_ON_ZERO(!__is_constexpr(__mask)) +             \
+              BUILD_BUG_ON_ZERO((__mask) == 0 || (__mask) > U8_MAX) +          \
+              BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
+              BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >>

__bf_shf(__mask)) & (__val)), 0))))
+
 /**
  * REG_FIELD_GET() - Extract a u32 bitfield value
  * @__mask: shifted mask defining the field's length and position

drivers/gpu/drm/i915/i915_reg_defs.h +0 -0
@@ -155,6 +200,18 @@
   */
  #define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])

drivers/gpu/drm/i915/i915_reg_defs.h +12 -0
+/**
+ * REG_FIELD_GET8() - Extract a u8 bitfield value
+ * @__mask: shifted mask defining the field's length and position
+ * @__val: value to extract the bitfield value from
+ *
+ * Local wrapper for FIELD_GET() to force u8 and for consistency with
+ * REG_FIELD_PREP(), REG_BIT() and REG_GENMASK().
+ *
+ * @return: Masked and shifted value of the field defined by @__mask in @__val.
+ */
+#define REG_FIELD_GET8(__mask, __val)   ((u8)FIELD_GET(__mask, __val))
+

 typedef struct {
        u32 reg;
 } i915_reg_t;

#9 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

In reply to Mika Kahola
Quoted 93 lines · Mika Kahola

From: Radhakrishna Sripada <[email protected]>

XELPDP has C10 and C20 phys from Synopsys to drive displays. Each phy has a dedicated PIPE 5.2 Message bus for configuration. This message bus is used to configure the phy internal registers.

XELPDP has C10 phys to drive output to the EDP and the native output from the display engine. Add structures, programming hardware state readout logic. Port clock calculations are similar to DG2. Use the DG2 formulae to calculate the port clock but use the relevant pll signals.
Note: PHY lane 0 is always used for PLL programming.

Add sequences for C10 phy enable/disable phy lane reset, powerdown change sequence and phy lane programming.

Bspec: 64539, 64568, 64599, 65100, 65101, 65450, 65451, 67610, 67636

v2: Squash patches related to C10 phy message bus and pll
programming support (Jani)
Move register definitions to a new file i.e. intel_cx0_reg_defs.h (Jani) Move macro definitions (Jani)
DP rates as separate patch (Jani)
Spin out xelpdp register definitions into a separate file (Jani) Replace macro to select registers based on phy lane with function calls (Jani)
Fix styling issues (Jani)
Call XELPDP_PORT_P2M_MSGBUS_STATUS() with port instead of phy (Lucas)
v3: Move clear request flag into try-loop
v4: On PHY idle change drm_err_once() as drm_dbg_kms() (Jani)
use __intel_de_wait_for_register() instead of __intel_wait_for_register and uncomment intel_uncore.h (Jani)
Add DP-alt support for PHY lane programming (Khaled)

---
 drivers/gpu/drm/i915/Makefile                 |    1 +
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 1120 +++++++++++++++++
 drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   43 +
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |   32 +-
 drivers/gpu/drm/i915/display/intel_ddi.c      |   22 +-
 .../drm/i915/display/intel_display_power.c    |    3 +-
 .../i915/display/intel_display_power_well.c   |    2 +-
 .../drm/i915/display/intel_display_types.h    |    6 +
 drivers/gpu/drm/i915/display/intel_dpll.c     |   20 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |    2 +-
 .../drm/i915/display/intel_modeset_verify.c   |    2 +
 drivers/gpu/drm/i915/i915_reg.h               |    5 +
 drivers/gpu/drm/i915/i915_reg_defs.h          |   57 +
 13 files changed, 1309 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy.h
drivers/gpu/drm/i915/Makefile +1 -0
index 057ef22fa9c6..57b1417792b4 100644
@@ -298,6 +298,7 @@ i915-y += \
 	display/icl_dsi.o \
 	display/intel_backlight.o \
 	display/intel_crt.o \
+	display/intel_cx0_phy.o \
 	display/intel_ddi.o \
 	display/intel_ddi_buf_trans.o \
 	display/intel_display_trace.o \
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +18 -0
new file mode 100644
index 000000000000..ced8c8aa6c82
@@ -0,0 +1,1120 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2021 Intel Corporation
+ */
+
+#include "i915_reg.h"
+#include "intel_cx0_phy.h"
+#include "intel_cx0_phy_regs.h"
+#include "intel_de.h"
+#include "intel_display_types.h"
+#include "intel_dp.h"
+#include "intel_panel.h"
+#include "intel_tc.h"
+
+bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)
+{
+	if (IS_METEORLAKE(dev_priv) && (phy < PHY_C))
+		return true;

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 28

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+	return false;
+}
+
+static void intel_cx0_bus_reset(struct drm_i915_private *i915, enum port port, int lane)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+
+	/* Bring the phy to idle. */
+	intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),

For the above and every other place taking a lane mask parameter or converting the lane mask to a lane:

I think the function parameter should be an 'u8 lane_mask' for clarity and instead of open-coding the conversion should be done by a lane_mask_to_lane() helper which also sanity checks lane_mask (that it's either INTEL_CX0_LANE0 or INTEL_CX0_LANE1, but not both).

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 39

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +11 -0
+		       XELPDP_PORT_M2P_TRANSACTION_RESET);
+
+	/* Wait for Idle Clear. */
+	if (intel_de_wait_for_clear(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+				    XELPDP_PORT_M2P_TRANSACTION_RESET,
+				    XELPDP_MSGBUS_TIMEOUT_SLOW)) {
+		drm_dbg_kms(&i915->drm, "Failed to bring PHY %c to idle.\n", phy_name(phy));
+		return;
+	}
+
+	intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1), ~0);

The above should write only the XELPDP_PORT_P2M_RESPONSE_READY and XELPDP_PORT_P2M_ERROR_SET flags to get those cleared.

Could factor out a function for it since the same is also used later.

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 47

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +8 -0
+}
+
+static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port, int lane, u32 *val)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+
+	if (__intel_de_wait_for_register(i915,
+					 XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1),

As above this function should take the 0-based lane value.

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +13 -0
+					 XELPDP_PORT_P2M_RESPONSE_READY,
+					 XELPDP_PORT_P2M_RESPONSE_READY,
+					 XELPDP_MSGBUS_TIMEOUT_FAST_US,
+					 XELPDP_MSGBUS_TIMEOUT_SLOW, val)) {
+		drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for message ACK. Status: 0x%x\n", phy_name(phy), *val);
+		return -ETIMEDOUT;
+	}
+
+	return 0;
+}
+
+static int __intel_cx0_read(struct drm_i915_private *i915, enum port port,
+			   int lane, u16 addr, u32 *val)

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 70

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+	int ack;
+
+	/* Wait for pending transactions.*/
+	if (intel_de_wait_for_clear(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+				    XELPDP_PORT_M2P_TRANSACTION_PENDING,
+				    XELPDP_MSGBUS_TIMEOUT_SLOW)) {
+		drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for previous transaction to complete. Reset the bus and retry.\n", phy_name(phy));
+		intel_cx0_bus_reset(i915, port, lane);

Does bspec describe somewhere that this reset is needed?

Quoted 23 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +23 -0
+		return -ETIMEDOUT;
+	}
+
+	/* Issue the read command. */
+	intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+		       XELPDP_PORT_M2P_TRANSACTION_PENDING |
+		       XELPDP_PORT_M2P_COMMAND_READ |
+		       XELPDP_PORT_M2P_ADDRESS(addr));
+
+	/* Wait for response ready. And read response.*/
+	ack = intel_cx0_wait_for_ack(i915, port, lane, val);
+	if (ack < 0) {
+		intel_cx0_bus_reset(i915, port, lane);
+		return ack;
+	}
+
+	/* Check for error. */
+	if (*val & XELPDP_PORT_P2M_ERROR_SET) {
+		drm_dbg_kms(&i915->drm, "PHY %c Error occurred during read command. Status: 0x%x\n", phy_name(phy), *val);
+		intel_cx0_bus_reset(i915, port, lane);
+		return -EINVAL;
+	}
+

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 103

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+	/* Check for Read Ack. */
+	if (REG_FIELD_GET(XELPDP_PORT_P2M_COMMAND_TYPE_MASK, *val) !=
+			  XELPDP_PORT_P2M_COMMAND_READ_ACK) {
+		drm_dbg_kms(&i915->drm, "PHY %c Not a Read response. MSGBUS Status: 0x%x.\n", phy_name(phy), *val);
+		intel_cx0_bus_reset(i915, port, lane);
+		return -EINVAL;
+	}
+
+	/* Clear Response Ready flag.*/
+	intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1), ~0);

Could use a helper for the above.

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 115

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +12 -0
+
+	return REG_FIELD_GET(XELPDP_PORT_P2M_DATA_MASK, *val);
+}
+
+static u8 intel_cx0_read(struct drm_i915_private *i915, enum port port,
+			 int lane, u16 addr)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+	int i, status = 0;
+	u32 val;
+
+	for (i = 0; i < 3; i++) {

Please add a comment why this retries 3 times, doesn't seem to be described by the spec.

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 116

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		status = __intel_cx0_read(i915, port, lane, addr, &val);

val could be removed as it's not used, and remove the last param from __intel_cx0_read() accordingly.

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 119

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+
+		if (status >= 0)
+			break;

Returning status here would simplify the code below.

Quoted 40 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +40 -0
+	}
+
+	if (i == 3) {
+		drm_err_once(&i915->drm, "PHY %c Read %04x failed after %d retries.\n", phy_name(phy), addr, i);
+		return 0;
+	}
+
+	return status;
+}
+
+static int intel_cx0_wait_cwrite_ack(struct drm_i915_private *i915,
+				      enum port port, int lane)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+	int ack;
+	u32 val = 0;
+
+	/* Check for write ack. */
+	ack = intel_cx0_wait_for_ack(i915, port, lane, &val);
+	if (ack < 0)
+		return ack;
+
+	if ((REG_FIELD_GET(XELPDP_PORT_P2M_COMMAND_TYPE_MASK, val) !=
+	     XELPDP_PORT_P2M_COMMAND_WRITE_ACK) || val & XELPDP_PORT_P2M_ERROR_SET) {
+		drm_dbg_kms(&i915->drm, "PHY %c Unexpected ACK received. MSGBUS STATUS: 0x%x.\n", phy_name(phy), val);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int __intel_cx0_write_once(struct drm_i915_private *i915, enum port port,
+				  int lane, u16 addr, u8 data, bool committed)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+
+	/* Wait for pending transactions.*/
+	if (intel_de_wait_for_clear(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+				    XELPDP_PORT_M2P_TRANSACTION_PENDING,
+				    XELPDP_MSGBUS_TIMEOUT_SLOW)) {

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 169

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+		drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for previous transaction to complete. Reset the bus and retry.\n", phy_name(phy));
+		intel_cx0_bus_reset(i915, port, lane);
+		return -ETIMEDOUT;
+	}
+
+	/* Issue the write command. */
+	intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+		       XELPDP_PORT_M2P_TRANSACTION_PENDING |
+		       (committed ? XELPDP_PORT_M2P_COMMAND_WRITE_COMMITTED :
+		       XELPDP_PORT_M2P_COMMAND_WRITE_UNCOMMITTED) |

Could better indent the above line for clarity.

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 172

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+		       XELPDP_PORT_M2P_DATA(data) |
+		       XELPDP_PORT_M2P_ADDRESS(addr));
+

The spec requires to wait here MSGBUS_CTL / XELPDP_PORT_M2P_TRANSACTION_PENDING to clear (for both commited/uncommited writes).

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+	/* Check for error. */
+	if (committed) {
+		if (intel_cx0_wait_cwrite_ack(i915, port, lane) < 0) {
+			intel_cx0_bus_reset(i915, port, lane);

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 186

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+			return -EINVAL;
+		}
+	} else if ((intel_de_read(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1)) &
+			    XELPDP_PORT_P2M_ERROR_SET)) {
+		drm_dbg_kms(&i915->drm, "PHY %c Error occurred during write command.\n", phy_name(phy));
+		intel_cx0_bus_reset(i915, port, lane);
+		return -EINVAL;
+	}
+
+	intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1), ~0);

Could use a helper for the above.

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+
+	return 0;
+}
+
+static void __intel_cx0_write(struct drm_i915_private *i915, enum port port,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 201

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+			      int lane, u16 addr, u8 data, bool committed)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+	int i, status;
+
+	for (i = 0; i < 3; i++) {
+		status = __intel_cx0_write_once(i915, port, lane, addr, data, committed);
+
+		if (status == 0)
+			break;

Could simplify by the code below by returning here.

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+	}
+
+	if (i == 3) {
+		drm_err_once(&i915->drm, "PHY %c Write %04x failed after %d retries.\n", phy_name(phy), addr, i);
+		return;
+	}

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 217

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+}
+
+static void intel_cx0_write(struct drm_i915_private *i915, enum port port,
+			    int lane, u16 addr, u8 data, bool committed)
+{
+	if (lane == INTEL_CX0_BOTH_LANES) {
+		__intel_cx0_write(i915, port, INTEL_CX0_LANE0, addr, data, committed);
+		__intel_cx0_write(i915, port, INTEL_CX0_LANE1, addr, data, committed);
+	} else {
+		__intel_cx0_write(i915, port, lane, addr, data, committed);

Could add a helper and simplify the above by

	for_each_cx0_lane_in_mask(lane, lane_mask)
		__intel_cx0_write(i915, port, lane, addr, data, committed);
Quoted 14 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +14 -0
+	}
+}
+
+static void __intel_cx0_rmw(struct drm_i915_private *i915, enum port port,
+			    int lane, u16 addr, u8 clear, u8 set, bool committed)
+{
+	u8 old, val;
+
+	old = intel_cx0_read(i915, port, lane, addr);
+	val = (old & ~clear) | set;
+
+	if (val != old)
+		intel_cx0_write(i915, port, lane, addr, val, committed);
+}

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 241

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port,
+			  int lane, u16 addr, u8 clear, u8 set, bool committed)
+{
+	if (lane == INTEL_CX0_BOTH_LANES) {
+		__intel_cx0_rmw(i915, port, INTEL_CX0_LANE0, addr, clear, set, committed);
+		__intel_cx0_rmw(i915, port, INTEL_CX0_LANE1, addr, clear, set, committed);
+	} else {
+		__intel_cx0_rmw(i915, port, lane, addr, clear, set, committed);
+	}

Could use a for_each_cx0_lane_in_mask() helper here too.

Quoted 264 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +264 -0
+}
+
+/*
+ * Basic DP link rates with 38.4 MHz reference clock.
+ * Note: The tables below are with SSC. In non-ssc
+ * registers 0xC04 to 0xC08(pll[4] to pll[8]) will be
+ * programmed 0.
+ */
+
+static const struct intel_c10mpllb_state mtl_c10_dp_rbr = {
+	.clock = 162000,
+	.pll[0] = 0xB4,
+	.pll[1] = 0,
+	.pll[2] = 0x30,
+	.pll[3] = 0x1,
+	.pll[4] = 0x26,
+	.pll[5] = 0x0C,
+	.pll[6] = 0x98,
+	.pll[7] = 0x46,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xC0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x2,
+	.pll[16] = 0x84,
+	.pll[17] = 0x4F,
+	.pll[18] = 0xE5,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r216 = {
+	.clock = 216000,
+	.pll[0] = 0x4,
+	.pll[1] = 0,
+	.pll[2] = 0xA2,
+	.pll[3] = 0x1,
+	.pll[4] = 0x33,
+	.pll[5] = 0x10,
+	.pll[6] = 0x75,
+	.pll[7] = 0xB3,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x2,
+	.pll[16] = 0x85,
+	.pll[17] = 0x0F,
+	.pll[18] = 0xE6,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r243 = {
+	.clock = 243000,
+	.pll[0] = 0x34,
+	.pll[1] = 0,
+	.pll[2] = 0xDA,
+	.pll[3] = 0x1,
+	.pll[4] = 0x39,
+	.pll[5] = 0x12,
+	.pll[6] = 0xE3,
+	.pll[7] = 0xE9,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0x20,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x2,
+	.pll[16] = 0x85,
+	.pll[17] = 0x8F,
+	.pll[18] = 0xE6,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_dp_hbr1 = {
+	.clock = 270000,
+	.pll[0] = 0xF4,
+	.pll[1] = 0,
+	.pll[2] = 0xF8,
+	.pll[3] = 0x0,
+	.pll[4] = 0x20,
+	.pll[5] = 0x0A,
+	.pll[6] = 0x29,
+	.pll[7] = 0x10,
+	.pll[8] = 0x1,   /* Verify */
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xA0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x1,
+	.pll[16] = 0x84,
+	.pll[17] = 0x4F,
+	.pll[18] = 0xE5,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r324 = {
+	.clock = 324000,
+	.pll[0] = 0xB4,
+	.pll[1] = 0,
+	.pll[2] = 0x30,
+	.pll[3] = 0x1,
+	.pll[4] = 0x26,
+	.pll[5] = 0x0C,
+	.pll[6] = 0x98,
+	.pll[7] = 0x46,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xC0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x1,
+	.pll[16] = 0x85,
+	.pll[17] = 0x4F,
+	.pll[18] = 0xE6,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r432 = {
+	.clock = 432000,
+	.pll[0] = 0x4,
+	.pll[1] = 0,
+	.pll[2] = 0xA2,
+	.pll[3] = 0x1,
+	.pll[4] = 0x33,
+	.pll[5] = 0x10,
+	.pll[6] = 0x75,
+	.pll[7] = 0xB3,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x1,
+	.pll[16] = 0x85,
+	.pll[17] = 0x0F,
+	.pll[18] = 0xE6,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_dp_hbr2 = {
+	.clock = 540000,
+	.pll[0] = 0xF4,
+	.pll[1] = 0,
+	.pll[2] = 0xF8,
+	.pll[3] = 0,
+	.pll[4] = 0x20,
+	.pll[5] = 0x0A,
+	.pll[6] = 0x29,
+	.pll[7] = 0x10,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xA0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0,
+	.pll[16] = 0x84,
+	.pll[17] = 0x4F,
+	.pll[18] = 0xE5,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r675 = {
+	.clock = 675000,
+	.pll[0] = 0xB4,
+	.pll[1] = 0,
+	.pll[2] = 0x3E,
+	.pll[3] = 0x1,
+	.pll[4] = 0xA8,
+	.pll[5] = 0x0C,
+	.pll[6] = 0x33,
+	.pll[7] = 0x54,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xC8,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0,
+	.pll[16] = 0x85,
+	.pll[17] = 0x8F,
+	.pll[18] = 0xE6,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_dp_hbr3 = {
+	.clock = 810000,
+	.pll[0] = 0x34,
+	.pll[1] = 0,
+	.pll[2] = 0x84,
+	.pll[3] = 0x1,
+	.pll[4] = 0x30,
+	.pll[5] = 0x0F,
+	.pll[6] = 0x3D,
+	.pll[7] = 0x98,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xF0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0,
+	.pll[16] = 0x84,
+	.pll[17] = 0x0F,
+	.pll[18] = 0xE5,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state * const mtl_c10_dp_tables[] = {
+	&mtl_c10_dp_rbr,
+	&mtl_c10_dp_hbr1,
+	&mtl_c10_dp_hbr2,
+	&mtl_c10_dp_hbr3,
+	NULL,
+};
+
+static const struct intel_c10mpllb_state * const mtl_c10_edp_tables[] = {
+	&mtl_c10_dp_rbr,
+	&mtl_c10_edp_r216,
+	&mtl_c10_edp_r243,
+	&mtl_c10_dp_hbr1,
+	&mtl_c10_edp_r324,
+	&mtl_c10_edp_r432,
+	&mtl_c10_dp_hbr2,
+	&mtl_c10_edp_r675,
+	&mtl_c10_dp_hbr3,
+	NULL,
+};
+
+static const struct intel_c10mpllb_state * const *
+intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
+			   struct intel_encoder *encoder)
+{
+	if (intel_crtc_has_dp_encoder(crtc_state)) {
+		if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP))
+			return mtl_c10_edp_tables;
+		else
+			return mtl_c10_dp_tables;
+	}
+
+	/* TODO: Add HDMI Support */
+	MISSING_CASE(encoder->type);
+	return NULL;
+}
+
+static int intel_c10mpllb_calc_state(struct intel_crtc_state *crtc_state,
+				     struct intel_encoder *encoder)

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 515

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+{
+	const struct intel_c10mpllb_state * const *tables;
+	int i;
+
+	tables = intel_c10_mpllb_tables_get(crtc_state, encoder);
+	if (!tables)
+		return -EINVAL;
+
+	for (i = 0; tables[i]; i++) {
+		if (crtc_state->port_clock <= tables[i]->clock) {

Not sure how an inaccurate PLL clock would work, shouldn't the above accept only a matching clock?

Quoted 34 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +34 -0
+			crtc_state->c10mpllb_state = *tables[i];
+			return 0;
+		}
+	}
+
+	return -EINVAL;
+}
+
+int intel_cx0mpllb_calc_state(struct intel_crtc_state *crtc_state,
+			      struct intel_encoder *encoder)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+
+	return intel_c10mpllb_calc_state(crtc_state, encoder);
+}
+
+void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
+				     struct intel_c10mpllb_state *pll_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+	u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+				  INTEL_CX0_LANE0;
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+	int i;
+	u8 cmn, tx0;
+
+	/*
+	 * According to C10 VDR Register programming Sequence we need
+	 * to do this to read PHY internal registers from MsgBus.

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 559

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+	 */
+	intel_cx0_rmw(i915, encoder->port, lane, PHY_C10_VDR_CONTROL(1), 0,
+		      C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+
+	for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+		pll_state->pll[i] = intel_cx0_read(i915, encoder->port, lane,
+						   PHY_C10_VDR_PLL(i));
+
+	cmn = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_CMN(0));
+	tx0 = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_TX(0));

The driver programs these registers, so why aren't they also stored in the intell_c20pll_state struct?

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 563

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+
+	if (tx0 != C10_TX0_VAL || cmn != C10_CMN0_DP_VAL)
+		drm_warn(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",
+			 tx0, cmn, phy_name(phy));

Shouldn't PHY_C10_VDR_CONTROL(1)/C10_VDR_CTRL_MSGBUS_ACCESS be cleared here?

Quoted 18 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +18 -0
+}
+
+static void intel_c10_pll_program(struct drm_i915_private *i915,
+				  const struct intel_crtc_state *crtc_state,
+				  struct intel_encoder *encoder)
+{
+	const struct intel_c10mpllb_state *pll_state = &crtc_state->c10mpllb_state;
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+	u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+					 INTEL_CX0_LANE0;
+	u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+					   INTEL_CX0_LANE1;
+
+	int i;
+	struct intel_dp *intel_dp;
+	bool use_ssc = false;
+	u8 cmn0 = 0;

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 591

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+	if (intel_crtc_has_dp_encoder(crtc_state)) {
+		intel_dp = enc_to_intel_dp(encoder);
+		use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+			  DP_MAX_DOWNSPREAD_0_5);
+
+		if (!intel_panel_use_ssc(i915))
+			use_ssc = false;
+
+		cmn0 = C10_CMN0_DP_VAL;

Would be clearer by stg like:

		/* Using x MHz reference */
		cmn0 = C10_CMN0_REF_RANGE(1) | C10_CMN0_REF_CLK_MPLLB_DIV(2);

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 595

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+	}
+
+	intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
+			C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);

For DP-alt MFD the PHY lane not owned by display shouldn't be programmed, no?

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 598

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+	/* Custom width needs to be programmed to 0 for both the phy lanes */
+	intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+		      PHY_C10_VDR_CUSTOM_WIDTH, 0x3, 0, MB_WRITE_COMMITTED);

The above hard-coded values should have a macro definiton.

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 607

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+	intel_cx0_rmw(i915, encoder->port, follower_lane, PHY_C10_VDR_CONTROL(1),
+		      C10_VDR_CTRL_MASTER_LANE, C10_VDR_CTRL_UPDATE_CFG,
+		      MB_WRITE_COMMITTED);
+
+	/* Program the pll values only for the master lane */
+	for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+		/* If not using ssc pll[4] through pll[8] must be 0*/
+		intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_PLL(i),
+				(!use_ssc && (i > 3 && i < 9)) ? 0 : pll_state->pll[i],

pll_state->pll should be setup already intel_c10mpllb_calc_state() taking into account SSC as well.

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 611

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+				(i % 4) ? MB_WRITE_UNCOMMITTED : MB_WRITE_COMMITTED);
+
+	intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);
+	intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_TX(0), C10_TX0_VAL, MB_WRITE_COMMITTED);

Instead of C10_TX0_VAL the flags programmed should be better described here as cmn0 above.

Quoted 68 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +68 -0
+	intel_cx0_rmw(i915, encoder->port, master_lane, PHY_C10_VDR_CONTROL(1),
+		      C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MASTER_LANE |
+		      C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+}
+
+void intel_c10mpllb_dump_hw_state(struct drm_i915_private *dev_priv,
+				  const struct intel_c10mpllb_state *hw_state)
+{
+	bool fracen;
+	int i;
+	unsigned int frac_quot = 0, frac_rem = 0, frac_den = 1;
+	unsigned int multiplier, tx_clk_div;
+
+	fracen = hw_state->pll[0] & C10_PLL0_FRACEN;
+	drm_dbg_kms(&dev_priv->drm, "c10pll_hw_state: fracen: %s, ",
+		    str_yes_no(fracen));
+
+	if (fracen) {
+		frac_quot = hw_state->pll[12] << 8 | hw_state->pll[11];
+		frac_rem =  hw_state->pll[14] << 8 | hw_state->pll[13];
+		frac_den =  hw_state->pll[10] << 8 | hw_state->pll[9];
+		drm_dbg_kms(&dev_priv->drm, "quot: %u, rem: %u, den: %u,\n",
+			    frac_quot, frac_rem, frac_den);
+	}
+
+	multiplier = (REG_FIELD_GET8(C10_PLL3_MULTIPLIERH_MASK, hw_state->pll[3]) << 8 |
+		      hw_state->pll[2]) / 2 + 16;
+	tx_clk_div = REG_FIELD_GET8(C10_PLL15_TXCLKDIV_MASK, hw_state->pll[15]);
+	drm_dbg_kms(&dev_priv->drm,
+		    "multiplier: %u, tx_clk_div: %u.\n", multiplier, tx_clk_div);
+
+	drm_dbg_kms(&dev_priv->drm, "c10pll_rawhw_state:");
+
+	for (i = 0; i < ARRAY_SIZE(hw_state->pll); i = i + 4)
+		drm_dbg_kms(&dev_priv->drm, "pll[%d] = 0x%x, pll[%d] = 0x%x, pll[%d] = 0x%x, pll[%d] = 0x%x\n",
+			    i, hw_state->pll[i], i + 1, hw_state->pll[i + 1],
+			    i + 2, hw_state->pll[i + 2], i + 3, hw_state->pll[i + 3]);
+}
+
+int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
+				   const struct intel_c10mpllb_state *pll_state)
+{
+	unsigned int frac_quot = 0, frac_rem = 0, frac_den = 1;
+	unsigned int multiplier, tx_clk_div, refclk = 38400;
+
+	if (pll_state->pll[0] & C10_PLL0_FRACEN) {
+		frac_quot = pll_state->pll[12] << 8 | pll_state->pll[11];
+		frac_rem =  pll_state->pll[14] << 8 | pll_state->pll[13];
+		frac_den =  pll_state->pll[10] << 8 | pll_state->pll[9];
+	}
+
+	multiplier = (REG_FIELD_GET8(C10_PLL3_MULTIPLIERH_MASK, pll_state->pll[3]) << 8 |
+		      pll_state->pll[2]) / 2 + 16;
+
+	tx_clk_div = REG_FIELD_GET8(C10_PLL15_TXCLKDIV_MASK, pll_state->pll[15]);
+
+	return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(refclk, (multiplier << 16) + frac_quot) +
+				     DIV_ROUND_CLOSEST(refclk * frac_rem, frac_den),
+				     10 << (tx_clk_div + 16));
+}
+
+static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
+					 const struct intel_crtc_state *crtc_state,
+					 bool lane_reversal)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_dp *intel_dp;
+	bool ssc_enabled;

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 689

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+	u32 val = 0;
+
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL1(encoder->port), XELPDP_PORT_REVERSAL,
+		     lane_reversal ? XELPDP_PORT_REVERSAL : 0);
+
+	if (lane_reversal)
+		val |= XELPDP_LANE1_PHY_CLOCK_SELECT;
+
+	val |= XELPDP_FORWARD_CLOCK_UNGATE;
+	val |= XELPDP_DDI_CLOCK_SELECT(XELPDP_DDI_CLOCK_SELECT_MAXPCLK);

TODO: HDMI FRL?

Quoted 18 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +18 -0
+
+	if (intel_crtc_has_dp_encoder(crtc_state)) {
+		intel_dp = enc_to_intel_dp(encoder);
+		ssc_enabled = intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+			      DP_MAX_DOWNSPREAD_0_5;
+
+		if (!intel_panel_use_ssc(i915))
+			ssc_enabled = false;
+
+		/* TODO: DP2.0 10G and 20G rates enable MPLLA*/
+		val |= ssc_enabled ? XELPDP_SSC_ENABLE_PLLB : 0;
+	}
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+		     XELPDP_LANE1_PHY_CLOCK_SELECT |
+		     XELPDP_FORWARD_CLOCK_UNGATE |
+		     XELPDP_DDI_CLOCK_SELECT_MASK |
+		     XELPDP_SSC_ENABLE_PLLB, val);
+}

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 717

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+static u32 intel_cx0_get_powerdown_update(u8 lane)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_POWERDOWN_UPDATE;
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_POWERDOWN_UPDATE;
+	else
+		return XELPDP_LANE0_POWERDOWN_UPDATE |
+		       XELPDP_LANE1_POWERDOWN_UPDATE;

Could simplify by

	val = 0;
	for_each_cx0_lane_in_mask(lane, lane_mask)
		val |= XELPDP_LANE_POWERDOWN_UPDATE(lane);

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 728

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +11 -0
+}
+
+static u32 intel_cx0_get_powerdown_state(u8 lane, u8 state)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_POWERDOWN_NEW_STATE(state);
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_POWERDOWN_NEW_STATE(state);
+	else
+		return XELPDP_LANE0_POWERDOWN_NEW_STATE(state) |
+		       XELPDP_LANE1_POWERDOWN_NEW_STATE(state);

Could simplify similarly to the above.

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+}
+
+static void intel_cx0_powerdown_change_sequence(struct drm_i915_private *i915,
+						enum port port,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 742

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+						u8 lane, u8 state)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+		     XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK | XELPDP_LANE1_POWERDOWN_NEW_STATE_MASK,
+		     intel_cx0_get_powerdown_state(lane, state));
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+		     XELPDP_LANE0_POWERDOWN_UPDATE | XELPDP_LANE1_POWERDOWN_UPDATE,
+		     intel_cx0_get_powerdown_update(lane));

The spec says (65451):
"Only update powerdown for one port at a time. Wait for powerdown update to finish for one port before initiating update on another port."

both could be updated at the same time if a non-zero stagger delay was programmed, but for C10/C20 it must be programmed as 0.

Quoted 32 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +32 -0
+
+	/* Update Timeout Value */
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
+					 intel_cx0_get_powerdown_update(lane), 0,
+					 XELPDP_PORT_POWERDOWN_UPDATE_TIMEOUT_US, 0, NULL))
+		drm_warn(&i915->drm, "PHY %c failed to bring out of Lane reset after %dus.\n",
+			 phy_name(phy), XELPDP_PORT_RESET_START_TIMEOUT_US);
+}
+
+static void intel_cx0_setup_powerdown(struct drm_i915_private *i915, enum port port)
+{
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+		     XELPDP_POWER_STATE_READY_MASK,
+		     XELPDP_POWER_STATE_READY(CX0_P2_STATE_READY));
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL3(port),
+		     XELPDP_POWER_STATE_ACTIVE_MASK |
+		     XELPDP_PLL_LANE_STAGGERING_DELAY_MASK,
+		     XELPDP_POWER_STATE_ACTIVE(CX0_P0_STATE_ACTIVE) |
+		     XELPDP_PLL_LANE_STAGGERING_DELAY(0));
+}
+
+static u32 intel_cx0_get_pclk_refclk_request(u8 lane)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_PCLK_REFCLK_REQUEST;
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_PCLK_REFCLK_REQUEST;
+	else
+		return XELPDP_LANE0_PCLK_REFCLK_REQUEST |
+		       XELPDP_LANE1_PCLK_REFCLK_REQUEST;
+}
+

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 784

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+static u32 intel_cx0_get_pclk_refclk_ack(u8 lane)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_PCLK_REFCLK_ACK;
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_PCLK_REFCLK_ACK;
+	else
+		return XELPDP_LANE0_PCLK_REFCLK_ACK |
+		       XELPDP_LANE1_PCLK_REFCLK_ACK;
+}

Could simplify both of the above functions.

Quoted 54 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +54 -0
+
+/* FIXME: Some Type-C cases need not reset both the lanes. Handle those cases. */
+static void intel_cx0_phy_lane_reset(struct drm_i915_private *i915, enum port port,
+				     bool lane_reversal)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+	u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+				  INTEL_CX0_LANE0;
+
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL1(port),
+					 XELPDP_PORT_BUF_SOC_PHY_READY,
+					 XELPDP_PORT_BUF_SOC_PHY_READY,
+					 XELPDP_PORT_BUF_SOC_READY_TIMEOUT_US, 0, NULL))
+		drm_warn(&i915->drm, "PHY %c failed to bring out of SOC reset after %dus.\n",
+			 phy_name(phy), XELPDP_PORT_BUF_SOC_READY_TIMEOUT_US);
+
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+		     XELPDP_LANE0_PIPE_RESET | XELPDP_LANE1_PIPE_RESET,
+		     XELPDP_LANE0_PIPE_RESET | XELPDP_LANE1_PIPE_RESET);
+
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
+					 XELPDP_LANE0_PHY_CURRENT_STATUS | XELPDP_LANE1_PHY_CURRENT_STATUS,
+					 XELPDP_LANE0_PHY_CURRENT_STATUS | XELPDP_LANE1_PHY_CURRENT_STATUS,
+					 XELPDP_PORT_RESET_START_TIMEOUT_US, 0, NULL))
+		drm_warn(&i915->drm, "PHY %c failed to bring out of Lane reset after %dus.\n",
+			 phy_name(phy), XELPDP_PORT_RESET_START_TIMEOUT_US);
+
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(port),
+		     intel_cx0_get_pclk_refclk_request(INTEL_CX0_BOTH_LANES),
+		     intel_cx0_get_pclk_refclk_request(lane));
+
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(port),
+					 intel_cx0_get_pclk_refclk_ack(INTEL_CX0_BOTH_LANES),
+					 intel_cx0_get_pclk_refclk_ack(lane),
+					 XELPDP_REFCLK_ENABLE_TIMEOUT_US, 0, NULL))
+		drm_warn(&i915->drm, "PHY %c failed to request refclk after %dus.\n",
+			 phy_name(phy), XELPDP_REFCLK_ENABLE_TIMEOUT_US);
+
+	intel_cx0_powerdown_change_sequence(i915, port, INTEL_CX0_BOTH_LANES,
+					    CX0_P2_STATE_RESET);
+	intel_cx0_setup_powerdown(i915, port);
+
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+		     XELPDP_LANE0_PIPE_RESET | XELPDP_LANE1_PIPE_RESET, 0);
+
+	if (intel_de_wait_for_clear(i915, XELPDP_PORT_BUF_CTL2(port),
+				    XELPDP_LANE0_PHY_CURRENT_STATUS |
+				    XELPDP_LANE1_PHY_CURRENT_STATUS,
+				    XELPDP_PORT_RESET_END_TIMEOUT))
+		drm_warn(&i915->drm, "PHY %c failed to bring out of Lane reset after %dms.\n",
+			 phy_name(phy), XELPDP_PORT_RESET_END_TIMEOUT);
+}
+
+static void intel_c10_program_phy_lane(struct drm_i915_private *i915,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 848

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+				       struct intel_encoder *encoder, int lane_count,
+				       bool lane_reversal)
+{
+	u8 l0t1, l0t2, l1t1, l1t2;
+	bool dp_alt_mode = intel_tc_port_in_dp_alt_mode(enc_to_dig_port(encoder));
+	enum port port = encoder->port;
+
+	intel_cx0_rmw(i915, port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
+		      C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MSGBUS_ACCESS,
+		      MB_WRITE_COMMITTED);

TODO: DP-alt MFD case where only one PHY lane should be programmed.

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 854

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+
+	l0t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2));
+	l0t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2));
+	l1t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(1, 2));
+	l1t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(2, 2));
+

Would be clearer setting here CONTROL2_DISABLE_SINGLE_TX in all of l[0/1]t[1/2], and then

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 857

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+	if (lane_reversal) {
+		switch (lane_count) {
+		case 1:
			l1t1 &= ~CONTROL2_DISABLE_SINGLE_TX;
			break;

			etc. for 2,3,4 lanes and then
Quoted 39 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +37 -0
+			/* Disable MLs 1(lane0), 2(lane0), 3(lane1) */
+			intel_cx0_write(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(1, 2),
+					l1t1 | CONTROL2_DISABLE_SINGLE_TX,
+					MB_WRITE_COMMITTED);
+			fallthrough;
 
 
+		case 2:
+			/* Disable MLs 1(lane0), 2(lane0) */
+			intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2),
+					l0t2 | CONTROL2_DISABLE_SINGLE_TX,
+					MB_WRITE_COMMITTED);
+			fallthrough;
+		case 3:
+			/* Disable MLs 1(lane0) */
+			intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2),
+					l0t1 | CONTROL2_DISABLE_SINGLE_TX,
+					MB_WRITE_COMMITTED);
+			break;
+		}
+	} else {
+		switch (lane_count) {
+		case 1:
+			if (dp_alt_mode) {
+				/* Disable MLs 1(lane0), 3(lane1), 4(lane1) */
+				intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2),
+						l0t1 | CONTROL2_DISABLE_SINGLE_TX,
+						MB_WRITE_COMMITTED);
+			} else {
+				/* Disable MLs 2(lane0), 3(lane1), 4(lane1) */
+				intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2),
+						l0t2 | CONTROL2_DISABLE_SINGLE_TX,
+						MB_WRITE_COMMITTED);
+			}
+			fallthrough;
+		case 2:
+			/* Disable MLs 3(lane1), 4(lane1) */
+			intel_cx0_write(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(1, 2),
+					l1t1 | CONTROL2_DISABLE_SINGLE_TX,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 904

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+					MB_WRITE_COMMITTED);
+			fallthrough;
+		case 3:
+			/* Disable MLs 4(lane1) */
+			intel_cx0_write(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(2, 2),
+					l1t2 | CONTROL2_DISABLE_SINGLE_TX,
+					MB_WRITE_COMMITTED);
+			break;
+		}
+	}

write here PHY_CX0_LANE[0/1], PHY_CX0_TX_CONTROL([1/2], 2)

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 906

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+
+	if (intel_is_c10phy(i915, intel_port_to_phy(i915, port))) {

This check is not needed, as we get here only for C10 PHY.

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+		intel_cx0_rmw(i915, port, INTEL_CX0_LANE1, PHY_C10_VDR_CONTROL(1),
+			      C10_VDR_CTRL_UPDATE_CFG | C10_VDR_CTRL_MSGBUS_ACCESS,

Should the above clear C10_VDR_CTRL_MASTER_LANE?

Quoted 18 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +18 -0
+			      C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+		intel_cx0_rmw(i915, port, INTEL_CX0_LANE0, PHY_C10_VDR_CONTROL(1),
+			      C10_VDR_CTRL_UPDATE_CFG | C10_VDR_CTRL_MSGBUS_ACCESS,
+			      C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+	}
+}
+
+static u32 intel_cx0_get_pclk_pll_request(u8 lane)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_PCLK_PLL_REQUEST;
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_PCLK_PLL_REQUEST;
+	else
+		return XELPDP_LANE0_PCLK_PLL_REQUEST |
+		       XELPDP_LANE1_PCLK_PLL_REQUEST;
+}
+

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 936

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+static u32 intel_cx0_get_pclk_pll_ack(u8 lane)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_PCLK_PLL_ACK;
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_PCLK_PLL_ACK;
+	else
+		return XELPDP_LANE0_PCLK_PLL_ACK |
+		       XELPDP_LANE1_PCLK_PLL_ACK;
+}

Could simplify the above functions.

Quoted 67 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +67 -0
+
+static void intel_c10pll_enable(struct intel_encoder *encoder,
+				const struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+	u8 maxpclk_lane = lane_reversal ? INTEL_CX0_LANE1 :
+					  INTEL_CX0_LANE0;
+
+	/*
+	 * 1. Program PORT_CLOCK_CTL REGISTER to configure
+	 * clock muxes, gating and SSC
+	 */
+	intel_program_port_clock_ctl(encoder, crtc_state, lane_reversal);
+
+	/* 2. Bring PHY out of reset. */
+	intel_cx0_phy_lane_reset(i915, encoder->port, lane_reversal);
+
+	/*
+	 * 3. Change Phy power state to Ready.
+	 * TODO: For DP alt mode use only one lane.
+	 */
+	intel_cx0_powerdown_change_sequence(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+					    CX0_P2_STATE_READY);
+
+	/* 4. Program PHY internal PLL internal registers. */
+	intel_c10_pll_program(i915, crtc_state, encoder);
+
+	/*
+	 * 5. Program the enabled and disabled owned PHY lane
+	 * transmitters over message bus
+	 */
+	intel_c10_program_phy_lane(i915, encoder, crtc_state->lane_count, lane_reversal);
+
+	/*
+	 * 6. Follow the Display Voltage Frequency Switching - Sequence
+	 * Before Frequency Change. We handle this step in bxt_set_cdclk().
+	 */
+
+	/*
+	 * 7. Program DDI_CLK_VALFREQ to match intended DDI
+	 * clock frequency.
+	 */
+	intel_de_write(i915, DDI_CLK_VALFREQ(encoder->port),
+		       crtc_state->port_clock);
+	/*
+	 * 8. Set PORT_CLOCK_CTL register PCLK PLL Request
+	 * LN<Lane for maxPCLK> to "1" to enable PLL.
+	 */
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+		     intel_cx0_get_pclk_pll_request(INTEL_CX0_BOTH_LANES),
+		     intel_cx0_get_pclk_pll_request(maxpclk_lane));
+
+	/* 9. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK> == "1". */
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+					 intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES),
+					 intel_cx0_get_pclk_pll_ack(maxpclk_lane),
+					 XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US, 0, NULL))
+		drm_warn(&i915->drm, "Port %c PLL not locked after %dus.\n",
+			 phy_name(phy), XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US);
+
+	/*
+	 * 10. Follow the Display Voltage Frequency Switching Sequence After
+	 * Frequency Change. We handle this step in bxt_set_cdclk().
+	 */

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 1013

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+}
+
+void intel_cx0pll_enable(struct intel_encoder *encoder,
+			 const struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+	intel_c10pll_enable(encoder, crtc_state);

TBT-alt is not handled, so needs a TODO: comment.

Quoted 90 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +90 -0
+}
+
+static void intel_c10pll_disable(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	/* 1. Change owned PHY lane power to Disable state. */
+	intel_cx0_powerdown_change_sequence(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+					    CX0_P2PG_STATE_DISABLE);
+
+	/*
+	 * 2. Follow the Display Voltage Frequency Switching Sequence Before
+	 * Frequency Change. We handle this step in bxt_set_cdclk().
+	 */
+
+	/*
+	 * 3. Set PORT_CLOCK_CTL register PCLK PLL Request LN<Lane for maxPCLK>
+	 * to "0" to disable PLL.
+	 */
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+		     intel_cx0_get_pclk_pll_request(INTEL_CX0_BOTH_LANES) |
+		     intel_cx0_get_pclk_refclk_request(INTEL_CX0_BOTH_LANES), 0);
+
+	/* 4. Program DDI_CLK_VALFREQ to 0. */
+	intel_de_write(i915, DDI_CLK_VALFREQ(encoder->port), 0);
+
+	/*
+	 * 5. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK**> == "0".
+	 */
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+					 intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES) |
+					 intel_cx0_get_pclk_refclk_ack(INTEL_CX0_BOTH_LANES), 0,
+					 XELPDP_PCLK_PLL_DISABLE_TIMEOUT_US, 0, NULL))
+		drm_warn(&i915->drm, "Port %c PLL not unlocked after %dus.\n",
+			 phy_name(phy), XELPDP_PCLK_PLL_DISABLE_TIMEOUT_US);
+
+	/*
+	 * 6. Follow the Display Voltage Frequency Switching Sequence After
+	 * Frequency Change. We handle this step in bxt_set_cdclk().
+	 */
+
+	/* 7. Program PORT_CLOCK_CTL register to disable and gate clocks. */
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+		     XELPDP_DDI_CLOCK_SELECT_MASK |
+		     XELPDP_FORWARD_CLOCK_UNGATE, 0);
+}
+
+void intel_cx0pll_disable(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+	intel_c10pll_disable(encoder);
+}
+
+void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
+				 struct intel_crtc_state *new_crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(state->base.dev);
+	struct intel_c10mpllb_state mpllb_hw_state = { 0 };
+	struct intel_c10mpllb_state *mpllb_sw_state = &new_crtc_state->c10mpllb_state;
+	struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
+	struct intel_encoder *encoder;
+	struct intel_dp *intel_dp;
+	enum phy phy;
+	int i;
+	bool use_ssc = false;
+
+	if (DISPLAY_VER(i915) < 14)
+		return;
+
+	if (!new_crtc_state->hw.active)
+		return;
+
+	encoder = intel_get_crtc_new_encoder(state, new_crtc_state);
+	phy = intel_port_to_phy(i915, encoder->port);
+
+	if (intel_crtc_has_dp_encoder(new_crtc_state)) {
+		intel_dp = enc_to_intel_dp(encoder);
+		use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+			  DP_MAX_DOWNSPREAD_0_5);
+
+		if (!intel_panel_use_ssc(i915))
+			use_ssc = false;
+	}
+
+	if (!intel_is_c10phy(i915, phy))
+		return;

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 1113

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+	intel_c10mpllb_readout_hw_state(encoder, &mpllb_hw_state);
+
+	for (i = 0; i < ARRAY_SIZE(mpllb_sw_state->pll); i++) {
+		u8 expected;
+
+		if (!use_ssc && i > 3 && i < 9)
+			expected = 0;
+		else
+			expected = mpllb_sw_state->pll[i];

The above isn't needed if PLL state is setup correctly in intel_c10mpllb_calc_state(), taking into account SSC as well.

Quoted 26 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+
+		I915_STATE_WARN(mpllb_hw_state.pll[i] != expected,
+				"[CRTC:%d:%s] mismatch in C10MPLLB: Register[%d] (expected 0x%02x, found 0x%02x)",
+				crtc->base.base.id, crtc->base.name,
+				i, expected, mpllb_hw_state.pll[i]);
+	}
+}
drivers/gpu/drm/i915/display/intel_cx0_phy.h new file +13 -0
new file mode 100644
index 000000000000..8cf340509097
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2021 Intel Corporation
+ */
+
+#ifndef __INTEL_CX0_PHY_H__
+#define __INTEL_CX0_PHY_H__
+
+#include <linux/types.h>
+#include <linux/bitfield.h>
+#include <linux/bits.h>
+
+#include "i915_drv.h"

drivers/gpu/drm/i915/display/intel_cx0_phy.h line 23

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h new file +10 -0
+#include "intel_display_types.h"
+
+struct drm_i915_private;
+struct intel_encoder;
+struct intel_crtc_state;
+enum phy;
+
+#define INTEL_CX0_LANE0		0x1
+#define INTEL_CX0_LANE1		0x2
+#define INTEL_CX0_BOTH_LANES	0x3

Please use INTEL_CX0_LANE0/1 instead of open-coding them.

drivers/gpu/drm/i915/display/intel_cx0_phy.h line 26

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h new file +3 -0
+
+#define MB_WRITE_COMMITTED		1
+#define MB_WRITE_UNCOMMITTED		0

The above should be bool values.

Could the above be moved to intel_cx0_phy.c ?

Quoted 109 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h new file +17 -0
+
+bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy);
+void intel_cx0pll_enable(struct intel_encoder *encoder,
+			 const struct intel_crtc_state *crtc_state);
+void intel_cx0pll_disable(struct intel_encoder *encoder);
+void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
+				     struct intel_c10mpllb_state *pll_state);
+int intel_cx0mpllb_calc_state(struct intel_crtc_state *crtc_state,
+			      struct intel_encoder *encoder);
+void intel_c10mpllb_dump_hw_state(struct drm_i915_private *dev_priv,
+				  const struct intel_c10mpllb_state *hw_state);
+int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
+				   const struct intel_c10mpllb_state *pll_state);
+void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
+				 struct intel_crtc_state *new_crtc_state);
+
+#endif /* __INTEL_CX0_PHY_H__ */
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +31 -1
index d1ee8a2fc9cf..15e249f46a64 100644
@@ -128,4 +128,34 @@
 #define   XELPDP_SSC_ENABLE_PLLA			REG_BIT(1)
 #define   XELPDP_SSC_ENABLE_PLLB			REG_BIT(0)
 
-#endif /* __INTEL_CX0_PHY_REGS_H__ */
+/* C10 Vendor Registers */
+#define PHY_C10_VDR_PLL(idx)		(0xC00 + (idx))
+#define   C10_PLL0_FRACEN		REG_BIT8(4)
+#define   C10_PLL3_MULTIPLIERH_MASK	REG_GENMASK8(3, 0)
+#define   C10_PLL15_TXCLKDIV_MASK	REG_GENMASK8(2, 0)
+#define PHY_C10_VDR_CMN(idx)		(0xC20 + (idx))
+#define   C10_CMN0_DP_VAL		0x21
+#define   C10_CMN3_TXVBOOST_MASK	REG_GENMASK8(7, 5)
+#define   C10_CMN3_TXVBOOST(val)	REG_FIELD_PREP8(C10_CMN3_TXVBOOST_MASK, val)
+#define PHY_C10_VDR_TX(idx)		(0xC30 + (idx))
+#define   C10_TX0_VAL			0x10
+#define PHY_C10_VDR_CONTROL(idx)	(0xC70 + (idx) - 1)
+#define   C10_VDR_CTRL_MSGBUS_ACCESS	REG_BIT8(2)
+#define   C10_VDR_CTRL_MASTER_LANE	REG_BIT8(1)
+#define   C10_VDR_CTRL_UPDATE_CFG	REG_BIT8(0)
+#define PHY_C10_VDR_CUSTOM_WIDTH	0xD02
+
+#define CX0_P0_STATE_ACTIVE             0x0
+#define CX0_P2_STATE_READY              0x2
+#define CX0_P2PG_STATE_DISABLE          0x9
+#define CX0_P4PG_STATE_DISABLE          0xC
+#define CX0_P2_STATE_RESET              0x2
+
+/* PHY_C10_VDR_PLL0 */
+#define PLL_C10_MPLL_SSC_EN             REG_BIT8(0)
+
+/* PIPE SPEC Defined Registers */
+#define PHY_CX0_TX_CONTROL(tx, control) (0x400 + ((tx) - 1) * 0x200 + (control))
+#define CONTROL2_DISABLE_SINGLE_TX      REG_BIT(6)
+
+#endif /* __INTEL_CX0_REG_DEFS_H__ */
drivers/gpu/drm/i915/display/intel_ddi.c +21 -1
index 73240cf78c8b..a433dea5b9a3 100644
@@ -39,6 +39,7 @@
 #include "intel_combo_phy_regs.h"
 #include "intel_connector.h"
 #include "intel_crtc.h"
+#include "intel_cx0_phy.h"
 #include "intel_ddi.h"
 #include "intel_ddi_buf_trans.h"
 #include "intel_de.h"
@@ -3507,6 +3508,21 @@ void intel_ddi_get_clock(struct intel_encoder *encoder,
 						     &crtc_state->dpll_hw_state);
 }
 
+static void mtl_ddi_get_config(struct intel_encoder *encoder,
+			       struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+
+	intel_c10mpllb_readout_hw_state(encoder, &crtc_state->c10mpllb_state);
+	intel_c10mpllb_dump_hw_state(i915, &crtc_state->c10mpllb_state);
+	crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state->c10mpllb_state);
+
+	intel_ddi_get_config(encoder, crtc_state);
+}
+
 static void dg2_ddi_get_config(struct intel_encoder *encoder,
 				struct intel_crtc_state *crtc_state)
 {
@@ -4413,7 +4429,11 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	encoder->cloneable = 0;
 	encoder->pipe_mask = ~0;
 
-	if (IS_DG2(dev_priv)) {
+	if (DISPLAY_VER(dev_priv) >= 14) {
+		encoder->enable_clock = intel_cx0pll_enable;
+		encoder->disable_clock = intel_cx0pll_disable;
+		encoder->get_config = mtl_ddi_get_config;
+	} else if (IS_DG2(dev_priv)) {
 		encoder->enable_clock = intel_mpllb_enable;
 		encoder->disable_clock = intel_mpllb_disable;
 		encoder->get_config = dg2_ddi_get_config;
drivers/gpu/drm/i915/display/intel_display_power.c +0 -0
index f86060195987..e23fecba446c 100644

drivers/gpu/drm/i915/display/intel_display_power.c static void icl_display_core_init(struct drm_i915_private *dev_priv, · line 1618

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display_power.c +2 -1
@@ -1614,7 +1614,8 @@ static void icl_display_core_init(struct drm_i915_private *dev_priv,
 		return;
 
 	/* 2. Initialize all combo phys */
-	intel_combo_phy_init(dev_priv);
+	if (DISPLAY_VER(dev_priv) < 14)
+		intel_combo_phy_init(dev_priv);

This shouldn't be needed, intel_combo_phy_init() handles only combo PHYs.

drivers/gpu/drm/i915/display/intel_display_power_well.c void gen9_disable_dc_states(struct drm_i915_private *dev_priv) · line 973

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_display_power.c +0 -0
 	/*
 	 * 3. Enable Power Well 1 (PG1).
drivers/gpu/drm/i915/display/intel_display_power_well.c +1 -1
index 1676df1dc066..a4c8cb75c0a0 100644
@@ -970,7 +970,7 @@ void gen9_disable_dc_states(struct drm_i915_private *dev_priv)
 	if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
 		bxt_verify_ddi_phy_power_wells(dev_priv);
 
-	if (DISPLAY_VER(dev_priv) >= 11)
+	if (DISPLAY_VER(dev_priv) >= 11 && DISPLAY_VER(dev_priv) < 14)

Isn't needed.

Quoted 220 lines
drivers/gpu/drm/i915/display/intel_display_power_well.c +0 -0
 		/*
 		 * DMC retains HW context only for port A, the other combo
 		 * PHY's HW context for port B is lost after DC transitions,
drivers/gpu/drm/i915/display/intel_display_types.h +6 -0
index ab146b5b68bd..db7c108e4d86 100644
@@ -985,6 +985,11 @@ struct intel_link_m_n {
 	u32 link_n;
 };
 
+struct intel_c10mpllb_state {
+	u32 clock; /* in KHz */
+	u8 pll[20];
+};
+
 struct intel_crtc_state {
 	/*
 	 * uapi (drm) state. This is the software state shown to userspace.
@@ -1128,6 +1133,7 @@ struct intel_crtc_state {
 	union {
 		struct intel_dpll_hw_state dpll_hw_state;
 		struct intel_mpllb_state mpllb_state;
+		struct intel_c10mpllb_state c10mpllb_state;
 	};
 
 	/*
drivers/gpu/drm/i915/display/intel_dpll.c +19 -1
index 4e9c18be7e1f..da5aa050a5ab 100644
@@ -8,6 +8,7 @@
 
 #include "i915_reg.h"
 #include "intel_crtc.h"
+#include "intel_cx0_phy.h"
 #include "intel_de.h"
 #include "intel_display.h"
 #include "intel_display_types.h"
@@ -995,6 +996,17 @@ static int dg2_crtc_compute_clock(struct intel_atomic_state *state,
 	return 0;
 }
 
+static int mtl_crtc_compute_clock(struct intel_atomic_state *state,
+				  struct intel_crtc *crtc)
+{
+	struct intel_crtc_state *crtc_state =
+		intel_atomic_get_new_crtc_state(state, crtc);
+	struct intel_encoder *encoder =
+		intel_get_crtc_new_encoder(state, crtc_state);
+
+	return intel_cx0mpllb_calc_state(crtc_state, encoder);
+}
+
 static bool ilk_needs_fb_cb_tune(const struct dpll *dpll, int factor)
 {
 	return dpll->m < factor * dpll->n;
@@ -1423,6 +1435,10 @@ static int i8xx_crtc_compute_clock(struct intel_atomic_state *state,
 	return 0;
 }
 
+static const struct intel_dpll_funcs mtl_dpll_funcs = {
+	.crtc_compute_clock = mtl_crtc_compute_clock,
+};
+
 static const struct intel_dpll_funcs dg2_dpll_funcs = {
 	.crtc_compute_clock = dg2_crtc_compute_clock,
 };
@@ -1517,7 +1533,9 @@ int intel_dpll_crtc_get_shared_dpll(struct intel_atomic_state *state,
 void
 intel_dpll_init_clock_hook(struct drm_i915_private *dev_priv)
 {
-	if (IS_DG2(dev_priv))
+	if (DISPLAY_VER(dev_priv) >= 14)
+		dev_priv->display.funcs.dpll = &mtl_dpll_funcs;
+	else if (IS_DG2(dev_priv))
 		dev_priv->display.funcs.dpll = &dg2_dpll_funcs;
 	else if (DISPLAY_VER(dev_priv) >= 9 || HAS_DDI(dev_priv))
 		dev_priv->display.funcs.dpll = &hsw_dpll_funcs;
drivers/gpu/drm/i915/display/intel_dpll_mgr.c +1 -1
index 22fc908b7e5d..ed372d227aa7 100644
@@ -4104,7 +4104,7 @@ void intel_shared_dpll_init(struct drm_i915_private *dev_priv)
 
 	mutex_init(&dev_priv->display.dpll.lock);
 
-	if (IS_DG2(dev_priv))
+	if (DISPLAY_VER(dev_priv) >= 14 || IS_DG2(dev_priv))
 		/* No shared DPLLs on DG2; port PLLs are part of the PHY */
 		dpll_mgr = NULL;
 	else if (IS_ALDERLAKE_P(dev_priv))
drivers/gpu/drm/i915/display/intel_modeset_verify.c +2 -0
index 842d70f0dfd2..ec504470c2f0 100644
@@ -11,6 +11,7 @@
 #include "intel_atomic.h"
 #include "intel_crtc.h"
 #include "intel_crtc_state_dump.h"
+#include "intel_cx0_phy.h"
 #include "intel_display.h"
 #include "intel_display_types.h"
 #include "intel_fdi.h"
@@ -236,6 +237,7 @@ void intel_modeset_verify_crtc(struct intel_crtc *crtc,
 	verify_crtc_state(crtc, old_crtc_state, new_crtc_state);
 	intel_shared_dpll_state_verify(crtc, old_crtc_state, new_crtc_state);
 	intel_mpllb_state_verify(state, new_crtc_state);
+	intel_c10mpllb_state_verify(state, new_crtc_state);
 }
 
 void intel_modeset_verify_disabled(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/i915_reg.h +5 -0
index d22ffd7a32dc..94dd0d3a474b 100644
@@ -2101,6 +2101,11 @@
 #define   TRANS_PUSH_EN			REG_BIT(31)
 #define   TRANS_PUSH_SEND		REG_BIT(30)
 
+/* DDI Buffer Control */
+#define _DDI_CLK_VALFREQ_A		0x64030
+#define _DDI_CLK_VALFREQ_B		0x64130
+#define DDI_CLK_VALFREQ(port)		_MMIO_PORT(port, _DDI_CLK_VALFREQ_A, _DDI_CLK_VALFREQ_B)
+
 /*
  * HSW+ eDP PSR registers
  *
drivers/gpu/drm/i915/i915_reg_defs.h +57 -0
index db26de6b57bc..f9d7c03e95d6 100644
@@ -22,6 +22,19 @@
 	       BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&		\
 				 ((__n) < 0 || (__n) > 31))))
 
+/**
+ * REG_BIT8() - Prepare a u8 bit value
+ * @__n: 0-based bit number
+ *
+ * Local wrapper for BIT() to force u8, with compile time checks.
+ *
+ * @return: Value with bit @__n set.
+ */
+#define REG_BIT8(__n)                                                   \
+	((u8)(BIT(__n) +                                                \
+	       BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&         \
+				 ((__n) < 0 || (__n) > 7))))
+
 /**
  * REG_GENMASK() - Prepare a continuous u32 bitmask
  * @__high: 0-based high bit
@@ -52,6 +65,21 @@
 				 __is_constexpr(__low) &&		\
 				 ((__low) < 0 || (__high) > 63 || (__low) > (__high)))))
 
+/**
+ * REG_GENMASK8() - Prepare a continuous u8 bitmask
+ * @__high: 0-based high bit
+ * @__low: 0-based low bit
+ *
+ * Local wrapper for GENMASK() to force u8, with compile time checks.
+ *
+ * @return: Continuous bitmask from @__high to @__low, inclusive.
+ */
+#define REG_GENMASK8(__high, __low)                                     \
+	((u8)(GENMASK(__high, __low) +                                  \
+	       BUILD_BUG_ON_ZERO(__is_constexpr(__high) &&      \
+				 __is_constexpr(__low) &&               \
+				 ((__low) < 0 || (__high) > 7 || (__low) > (__high)))))
+
 /*
  * Local integer constant expression version of is_power_of_2().
  */
@@ -74,6 +102,23 @@
 	       BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
 	       BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
 
+/**
+ * REG_FIELD_PREP8() - Prepare a u8 bitfield value
+ * @__mask: shifted mask defining the field's length and position
+ * @__val: value to put in the field
+ *
+ * Local copy of FIELD_PREP8() to generate an integer constant expression, force
+ * u8 and for consistency with REG_FIELD_GET8(), REG_BIT8() and REG_GENMASK8().
+ *
+ * @return: @__val masked and shifted into the field defined by @__mask.
+ */
+#define REG_FIELD_PREP8(__mask, __val)                                          \
+	((u8)((((typeof(__mask))(__val) << __bf_shf(__mask)) & (__mask)) +      \
+	       BUILD_BUG_ON_ZERO(!__is_constexpr(__mask)) +             \
+	       BUILD_BUG_ON_ZERO((__mask) == 0 || (__mask) > U8_MAX) +          \
+	       BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
+	       BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
+
 /**
  * REG_FIELD_GET() - Extract a u32 bitfield value
  * @__mask: shifted mask defining the field's length and position
@@ -155,6 +200,18 @@
  */
 #define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
 
+/**
+ * REG_FIELD_GET8() - Extract a u8 bitfield value
+ * @__mask: shifted mask defining the field's length and position
+ * @__val: value to extract the bitfield value from
+ *
+ * Local wrapper for FIELD_GET() to force u8 and for consistency with
+ * REG_FIELD_PREP(), REG_BIT() and REG_GENMASK().
+ *
+ * @return: Masked and shifted value of the field defined by @__mask in @__val.
+ */
+#define REG_FIELD_GET8(__mask, __val)   ((u8)FIELD_GET(__mask, __val))
+
 typedef struct {
 	u32 reg;
 } i915_reg_t;
Signature · 1 line
2.34.1
#10 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 12 lines · Imre Deak

On Mon, Mar 27, 2023 at 03:34:30PM +0300, Mika Kahola wrote:
[...]

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 47

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +8 -0
+}
+
+static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port, int lane, u32 *val)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+
+	if (__intel_de_wait_for_register(i915,
+					 XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1),

As above this function should take the 0-based lane value.

Err, I meant here as earlier the function param should be 'u8 lane_mask' and use a helper to convert this mask to a lane.

--Imre

#11 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

In reply to Imre Deak
Quoted 120 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Wednesday, March 29, 2023 6:41 PM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; Sripada, Radhakrishna <[email protected]>; Shankar, Uma <[email protected]>; Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Review

Quoted 70 lines · Mika Kahola

From: Radhakrishna Sripada <[email protected]>

XELPDP has C10 and C20 phys from Synopsys to drive displays. Each phy has a dedicated PIPE 5.2 Message bus for configuration. This message bus is used to configure the phy internal registers.

XELPDP has C10 phys to drive output to the EDP and the native output from the display engine. Add structures, programming hardware state readout logic. Port clock calculations are similar to DG2. Use the DG2 formulae to calculate the port clock but use the relevant pll signals.
Note: PHY lane 0 is always used for PLL programming.

Add sequences for C10 phy enable/disable phy lane reset, powerdown change sequence and phy lane programming.

Bspec: 64539, 64568, 64599, 65100, 65101, 65450, 65451, 67610, 67636

v2: Squash patches related to C10 phy message bus and pll
programming support (Jani)
Move register definitions to a new file i.e. intel_cx0_reg_defs.h (Jani) Move macro definitions (Jani)
DP rates as separate patch (Jani)
Spin out xelpdp register definitions into a separate file (Jani) Replace macro to select registers based on phy lane with function calls (Jani)
Fix styling issues (Jani)
Call XELPDP_PORT_P2M_MSGBUS_STATUS() with port instead of phy (Lucas)
v3: Move clear request flag into try-loop
v4: On PHY idle change drm_err_once() as drm_dbg_kms() (Jani)
use __intel_de_wait_for_register() instead of __intel_wait_for_register and uncomment intel_uncore.h (Jani)
Add DP-alt support for PHY lane programming (Khaled)

---
 drivers/gpu/drm/i915/Makefile                 |    1 +
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 1120 +++++++++++++++++
 drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   43 +
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |   32 +-
 drivers/gpu/drm/i915/display/intel_ddi.c      |   22 +-
 .../drm/i915/display/intel_display_power.c    |    3 +-
 .../i915/display/intel_display_power_well.c   |    2 +-
 .../drm/i915/display/intel_display_types.h    |    6 +
 drivers/gpu/drm/i915/display/intel_dpll.c     |   20 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |    2 +-
 .../drm/i915/display/intel_modeset_verify.c   |    2 +
 drivers/gpu/drm/i915/i915_reg.h               |    5 +
 drivers/gpu/drm/i915/i915_reg_defs.h          |   57 +
 13 files changed, 1309 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy.h
drivers/gpu/drm/i915/Makefile +1 -0
index 057ef22fa9c6..57b1417792b4 100644
@@ -298,6 +298,7 @@ i915-y += \
 	display/icl_dsi.o \
 	display/intel_backlight.o \
 	display/intel_crt.o \
+	display/intel_cx0_phy.o \
 	display/intel_ddi.o \
 	display/intel_ddi_buf_trans.o \
 	display/intel_display_trace.o \
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 18 lines

new file mode 100644
index 000000000000..ced8c8aa6c82

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +13 -0
@@ -0,0 +1,1120 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2021 Intel Corporation
+ */
+
+#include "i915_reg.h"
+#include "intel_cx0_phy.h"
+#include "intel_cx0_phy_regs.h"
+#include "intel_de.h"
+#include "intel_display_types.h"
+#include "intel_dp.h"
+#include "intel_panel.h"
+#include "intel_tc.h"

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 23

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)
+{
+	if (IS_METEORLAKE(dev_priv) && (phy < PHY_C))
+		return true;
+
+	return false;
+}
+
+static void intel_cx0_bus_reset(struct drm_i915_private *i915, enum port

port, int lane)

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 28

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+
+	/* Bring the phy to idle. */
+	intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),

For the above and every other place taking a lane mask parameter or converting the lane mask to a lane:

Quoted 4 lines

I think the function parameter should be an 'u8 lane_mask' for clarity and instead of open-coding the conversion should be done by a lane_mask_to_lane() helper which also sanity checks lane_mask (that it's either INTEL_CX0_LANE0 or INTEL_CX0_LANE1, but not both).

I will add this type of helper function for sanity check.

Quoted 17 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+		       XELPDP_PORT_M2P_TRANSACTION_RESET);
+
+	/* Wait for Idle Clear. */
+	if (intel_de_wait_for_clear(i915,

XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+				    XELPDP_PORT_M2P_TRANSACTION_RESET,
+				    XELPDP_MSGBUS_TIMEOUT_SLOW)) {
+		drm_dbg_kms(&i915->drm, "Failed to bring PHY %c to idle.\n",

phy_name(phy));

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+		return;
+	}
+
+	intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane -

1), ~0);

Quoted 4 lines

The above should write only the XELPDP_PORT_P2M_RESPONSE_READY and XELPDP_PORT_P2M_ERROR_SET flags to get those cleared.

Could factor out a function for it since the same is also used later.

Ok. There are couple of occasions where this is used.

Quoted 5 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+}
+
+static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port

port, int lane, u32 *val)

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 55

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+
+	if (__intel_de_wait_for_register(i915,
+

XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1),

As above this function should take the 0-based lane value.

Sure.

Quoted 26 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 48

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+

XELPDP_PORT_P2M_RESPONSE_READY,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 49

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+

XELPDP_PORT_P2M_RESPONSE_READY,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 50

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+

XELPDP_MSGBUS_TIMEOUT_FAST_US,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 51

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+					 XELPDP_MSGBUS_TIMEOUT_SLOW,

val)) {

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 52

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for

message ACK. Status: 0x%x\n", phy_name(phy), *val);

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+		return -ETIMEDOUT;
+	}
+
+	return 0;

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+}
+
+static int __intel_cx0_read(struct drm_i915_private *i915, enum port port,
+			   int lane, u16 addr, u32 *val)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+	int ack;
+
+	/* Wait for pending transactions.*/
+	if (intel_de_wait_for_clear(i915,

XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 67

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+

XELPDP_PORT_M2P_TRANSACTION_PENDING,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 69

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+				    XELPDP_MSGBUS_TIMEOUT_SLOW)) {
+		drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for

previous transaction to complete. Reset the bus and retry.\n", phy_name(phy));

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 70

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		intel_cx0_bus_reset(i915, port, lane);

Does bspec describe somewhere that this reset is needed?

I think this plays on the safe side. If transaction is not completed withing reasonable time, we set the bus in known state. What would be the alternative? Just leave the bus state as is?

Quoted 39 lines
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+		return -ETIMEDOUT;
+	}
+
+	/* Issue the read command. */
+	intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+		       XELPDP_PORT_M2P_TRANSACTION_PENDING |
+		       XELPDP_PORT_M2P_COMMAND_READ |
+		       XELPDP_PORT_M2P_ADDRESS(addr));
+

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+	/* Wait for response ready. And read response.*/
+	ack = intel_cx0_wait_for_ack(i915, port, lane, val);
+	if (ack < 0) {
+		intel_cx0_bus_reset(i915, port, lane);
+		return ack;
+	}
+
+	/* Check for error. */
+	if (*val & XELPDP_PORT_P2M_ERROR_SET) {
+		drm_dbg_kms(&i915->drm, "PHY %c Error occurred during read

command. Status: 0x%x\n", phy_name(phy), *val);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+		intel_cx0_bus_reset(i915, port, lane);
+		return -EINVAL;
+	}
+
+	/* Check for Read Ack. */
+	if (REG_FIELD_GET(XELPDP_PORT_P2M_COMMAND_TYPE_MASK, *val)

!=

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 97

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+			  XELPDP_PORT_P2M_COMMAND_READ_ACK) {
+		drm_dbg_kms(&i915->drm, "PHY %c Not a Read response.

MSGBUS Status: 0x%x.\n", phy_name(phy), *val);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+		intel_cx0_bus_reset(i915, port, lane);
+		return -EINVAL;
+	}
+
+	/* Clear Response Ready flag.*/
+	intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane -

1), ~0);

Quoted 1 line

Could use a helper for the above.

Yes.

Quoted 16 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 115

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +12 -0
+
+	return REG_FIELD_GET(XELPDP_PORT_P2M_DATA_MASK, *val);
+}
+
+static u8 intel_cx0_read(struct drm_i915_private *i915, enum port port,
+			 int lane, u16 addr)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+	int i, status = 0;
+	u32 val;
+
+	for (i = 0; i < 3; i++) {

Please add a comment why this retries 3 times, doesn't seem to be described by the spec.

Ok, I'll add a comment for read/write tries. This hasn't been specified in spec so the number of retries could be anything.

Quoted 11 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 116

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		status = __intel_cx0_read(i915, port, lane, addr, &val);

val could be removed as it's not used, and remove the last param from __intel_cx0_read() accordingly.

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 119

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+
+		if (status >= 0)
+			break;

Returning status here would simplify the code below.

Yes. Let's just return here.

Quoted 59 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+	}
+
+	if (i == 3) {
+		drm_err_once(&i915->drm, "PHY %c Read %04x failed after %d

retries.\n", phy_name(phy), addr, i);

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+		return 0;
+	}
+
+	return status;
+}
+
+static int intel_cx0_wait_cwrite_ack(struct drm_i915_private *i915,
+				      enum port port, int lane)
+{

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+	enum phy phy = intel_port_to_phy(i915, port);
+	int ack;
+	u32 val = 0;
+
+	/* Check for write ack. */
+	ack = intel_cx0_wait_for_ack(i915, port, lane, &val);
+	if (ack < 0)
+		return ack;
+
+	if ((REG_FIELD_GET(XELPDP_PORT_P2M_COMMAND_TYPE_MASK, val)

!=

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 143

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+	     XELPDP_PORT_P2M_COMMAND_WRITE_ACK) || val &

XELPDP_PORT_P2M_ERROR_SET) {

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 144

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		drm_dbg_kms(&i915->drm, "PHY %c Unexpected ACK received.

MSGBUS STATUS: 0x%x.\n", phy_name(phy), val);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int __intel_cx0_write_once(struct drm_i915_private *i915, enum port

port,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+				  int lane, u16 addr, u8 data, bool committed)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+
+	/* Wait for pending transactions.*/
+	if (intel_de_wait_for_clear(i915,

XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 158

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+

XELPDP_PORT_M2P_TRANSACTION_PENDING,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 160

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+				    XELPDP_MSGBUS_TIMEOUT_SLOW)) {
+		drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for

previous transaction to complete. Reset the bus and retry.\n", phy_name(phy));

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +8 -0
+		intel_cx0_bus_reset(i915, port, lane);
+		return -ETIMEDOUT;
+	}
+
+	/* Issue the write command. */
+	intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+		       XELPDP_PORT_M2P_TRANSACTION_PENDING |
+		       (committed ?

XELPDP_PORT_M2P_COMMAND_WRITE_COMMITTED :

Quoted 4 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 169

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		       XELPDP_PORT_M2P_COMMAND_WRITE_UNCOMMITTED)

|

Could better indent the above line for clarity.

Ah, ok.

Quoted 20 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 172

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+		       XELPDP_PORT_M2P_DATA(data) |
+		       XELPDP_PORT_M2P_ADDRESS(addr));
+

The spec requires to wait here MSGBUS_CTL /
XELPDP_PORT_M2P_TRANSACTION_PENDING
to clear (for both commited/uncommited writes).

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+	/* Check for error. */
+	if (committed) {
+		if (intel_cx0_wait_cwrite_ack(i915, port, lane) < 0) {
+			intel_cx0_bus_reset(i915, port, lane);
+			return -EINVAL;
+		}
+	} else if ((intel_de_read(i915,

XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane - 1)) &

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 181

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+			    XELPDP_PORT_P2M_ERROR_SET)) {
+		drm_dbg_kms(&i915->drm, "PHY %c Error occurred during write

command.\n", phy_name(phy));

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+		intel_cx0_bus_reset(i915, port, lane);
+		return -EINVAL;
+	}
+
+	intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane -

1), ~0);

Could use a helper for the above.

Yes.

Quoted 14 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +12 -0
+
+	return 0;
+}
+
+static void __intel_cx0_write(struct drm_i915_private *i915, enum port port,
+			      int lane, u16 addr, u8 data, bool committed)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+	int i, status;
+
+	for (i = 0; i < 3; i++) {
+		status = __intel_cx0_write_once(i915, port, lane, addr, data,

committed);

Quoted 5 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 201

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+
+		if (status == 0)
+			break;

Could simplify by the code below by returning here.

I will return here as well.

Quoted 18 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+	}
+
+	if (i == 3) {
+		drm_err_once(&i915->drm, "PHY %c Write %04x failed after %d

retries.\n", phy_name(phy), addr, i);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+		return;
+	}
+}
+
+static void intel_cx0_write(struct drm_i915_private *i915, enum port port,
+			    int lane, u16 addr, u8 data, bool committed)
+{
+	if (lane == INTEL_CX0_BOTH_LANES) {
+		__intel_cx0_write(i915, port, INTEL_CX0_LANE0, addr, data,

committed);

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 215

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		__intel_cx0_write(i915, port, INTEL_CX0_LANE1, addr, data,

committed);

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 217

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+	} else {
+		__intel_cx0_write(i915, port, lane, addr, data, committed);

Could add a helper and simplify the above by

	for_each_cx0_lane_in_mask(lane, lane_mask)
		__intel_cx0_write(i915, port, lane, addr, data, committed);

Yes, let's add this kind of helper. It will help with rmw case as well.

Quoted 21 lines
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+	}
+}
+
+static void __intel_cx0_rmw(struct drm_i915_private *i915, enum port port,
+			    int lane, u16 addr, u8 clear, u8 set, bool committed)
+{
+	u8 old, val;
+
+	old = intel_cx0_read(i915, port, lane, addr);
+	val = (old & ~clear) | set;

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+	if (val != old)
+		intel_cx0_write(i915, port, lane, addr, val, committed);
+}
+
+static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port,
+			  int lane, u16 addr, u8 clear, u8 set, bool committed)
+{
+	if (lane == INTEL_CX0_BOTH_LANES) {
+		__intel_cx0_rmw(i915, port, INTEL_CX0_LANE0, addr, clear,

set, committed);

Quoted 7 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 238

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		__intel_cx0_rmw(i915, port, INTEL_CX0_LANE1, addr, clear,

set, committed);

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 241

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+	} else {
+		__intel_cx0_rmw(i915, port, lane, addr, clear, set, committed);
+	}

Could use a for_each_cx0_lane_in_mask() helper here too.

Sure.

Quoted 270 lines
Quoted 270 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +269 -0
+}
+
+/*
+ * Basic DP link rates with 38.4 MHz reference clock.
+ * Note: The tables below are with SSC. In non-ssc
+ * registers 0xC04 to 0xC08(pll[4] to pll[8]) will be
+ * programmed 0.
+ */
+
+static const struct intel_c10mpllb_state mtl_c10_dp_rbr = {
+	.clock = 162000,
+	.pll[0] = 0xB4,
+	.pll[1] = 0,
+	.pll[2] = 0x30,
+	.pll[3] = 0x1,
+	.pll[4] = 0x26,
+	.pll[5] = 0x0C,
+	.pll[6] = 0x98,
+	.pll[7] = 0x46,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xC0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x2,
+	.pll[16] = 0x84,
+	.pll[17] = 0x4F,
+	.pll[18] = 0xE5,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r216 = {
+	.clock = 216000,
+	.pll[0] = 0x4,
+	.pll[1] = 0,
+	.pll[2] = 0xA2,
+	.pll[3] = 0x1,
+	.pll[4] = 0x33,
+	.pll[5] = 0x10,
+	.pll[6] = 0x75,
+	.pll[7] = 0xB3,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x2,
+	.pll[16] = 0x85,
+	.pll[17] = 0x0F,
+	.pll[18] = 0xE6,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r243 = {
+	.clock = 243000,
+	.pll[0] = 0x34,
+	.pll[1] = 0,
+	.pll[2] = 0xDA,
+	.pll[3] = 0x1,
+	.pll[4] = 0x39,
+	.pll[5] = 0x12,
+	.pll[6] = 0xE3,
+	.pll[7] = 0xE9,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0x20,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x2,
+	.pll[16] = 0x85,
+	.pll[17] = 0x8F,
+	.pll[18] = 0xE6,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_dp_hbr1 = {
+	.clock = 270000,
+	.pll[0] = 0xF4,
+	.pll[1] = 0,
+	.pll[2] = 0xF8,
+	.pll[3] = 0x0,
+	.pll[4] = 0x20,
+	.pll[5] = 0x0A,
+	.pll[6] = 0x29,
+	.pll[7] = 0x10,
+	.pll[8] = 0x1,   /* Verify */
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xA0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x1,
+	.pll[16] = 0x84,
+	.pll[17] = 0x4F,
+	.pll[18] = 0xE5,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r324 = {
+	.clock = 324000,
+	.pll[0] = 0xB4,
+	.pll[1] = 0,
+	.pll[2] = 0x30,
+	.pll[3] = 0x1,
+	.pll[4] = 0x26,
+	.pll[5] = 0x0C,
+	.pll[6] = 0x98,
+	.pll[7] = 0x46,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xC0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x1,
+	.pll[16] = 0x85,
+	.pll[17] = 0x4F,
+	.pll[18] = 0xE6,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r432 = {
+	.clock = 432000,
+	.pll[0] = 0x4,
+	.pll[1] = 0,
+	.pll[2] = 0xA2,
+	.pll[3] = 0x1,
+	.pll[4] = 0x33,
+	.pll[5] = 0x10,
+	.pll[6] = 0x75,
+	.pll[7] = 0xB3,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x1,
+	.pll[16] = 0x85,
+	.pll[17] = 0x0F,
+	.pll[18] = 0xE6,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_dp_hbr2 = {
+	.clock = 540000,
+	.pll[0] = 0xF4,
+	.pll[1] = 0,
+	.pll[2] = 0xF8,
+	.pll[3] = 0,
+	.pll[4] = 0x20,
+	.pll[5] = 0x0A,
+	.pll[6] = 0x29,
+	.pll[7] = 0x10,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xA0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0,
+	.pll[16] = 0x84,
+	.pll[17] = 0x4F,
+	.pll[18] = 0xE5,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_edp_r675 = {
+	.clock = 675000,
+	.pll[0] = 0xB4,
+	.pll[1] = 0,
+	.pll[2] = 0x3E,
+	.pll[3] = 0x1,
+	.pll[4] = 0xA8,
+	.pll[5] = 0x0C,
+	.pll[6] = 0x33,
+	.pll[7] = 0x54,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xC8,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0,
+	.pll[16] = 0x85,
+	.pll[17] = 0x8F,
+	.pll[18] = 0xE6,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_dp_hbr3 = {
+	.clock = 810000,
+	.pll[0] = 0x34,
+	.pll[1] = 0,
+	.pll[2] = 0x84,
+	.pll[3] = 0x1,
+	.pll[4] = 0x30,
+	.pll[5] = 0x0F,
+	.pll[6] = 0x3D,
+	.pll[7] = 0x98,
+	.pll[8] = 0x1,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0xF0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0,
+	.pll[16] = 0x84,
+	.pll[17] = 0x0F,
+	.pll[18] = 0xE5,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state * const mtl_c10_dp_tables[] = {
+	&mtl_c10_dp_rbr,
+	&mtl_c10_dp_hbr1,
+	&mtl_c10_dp_hbr2,
+	&mtl_c10_dp_hbr3,
+	NULL,
+};
+
+static const struct intel_c10mpllb_state * const mtl_c10_edp_tables[] = {
+	&mtl_c10_dp_rbr,
+	&mtl_c10_edp_r216,
+	&mtl_c10_edp_r243,
+	&mtl_c10_dp_hbr1,
+	&mtl_c10_edp_r324,
+	&mtl_c10_edp_r432,
+	&mtl_c10_dp_hbr2,
+	&mtl_c10_edp_r675,
+	&mtl_c10_dp_hbr3,
+	NULL,
+};
+
+static const struct intel_c10mpllb_state * const *
+intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
+			   struct intel_encoder *encoder)
+{
+	if (intel_crtc_has_dp_encoder(crtc_state)) {
+		if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP))
+			return mtl_c10_edp_tables;
+		else
+			return mtl_c10_dp_tables;
+	}
+
+	/* TODO: Add HDMI Support */
+	MISSING_CASE(encoder->type);
+	return NULL;
+}
+
+static int intel_c10mpllb_calc_state(struct intel_crtc_state *crtc_state,
+				     struct intel_encoder *encoder)
+{
+	const struct intel_c10mpllb_state * const *tables;
+	int i;
+
+	tables = intel_c10_mpllb_tables_get(crtc_state, encoder);
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 515

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+	if (!tables)
+		return -EINVAL;
+
+	for (i = 0; tables[i]; i++) {
+		if (crtc_state->port_clock <= tables[i]->clock) {

Not sure how an inaccurate PLL clock would work, shouldn't the above accept only a matching clock?

Matching clock is sufficient. It will be helpful in later cases.

Quoted 48 lines
Quoted 16 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +15 -0
+			crtc_state->c10mpllb_state = *tables[i];
+			return 0;
+		}
+	}
+
+	return -EINVAL;
+}
+
+int intel_cx0mpllb_calc_state(struct intel_crtc_state *crtc_state,
+			      struct intel_encoder *encoder)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+	return intel_c10mpllb_calc_state(crtc_state, encoder);
+}
+
+void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
+				     struct intel_c10mpllb_state *pll_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	bool lane_reversal = dig_port->saved_port_bits &

DDI_BUF_PORT_REVERSAL;

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +11 -0
+	u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+				  INTEL_CX0_LANE0;
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+	int i;
+	u8 cmn, tx0;
+
+	/*
+	 * According to C10 VDR Register programming Sequence we need
+	 * to do this to read PHY internal registers from MsgBus.
+	 */
+	intel_cx0_rmw(i915, encoder->port, lane, PHY_C10_VDR_CONTROL(1),

0,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 552

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		      C10_VDR_CTRL_MSGBUS_ACCESS,

MB_WRITE_COMMITTED);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+
+	for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+		pll_state->pll[i] = intel_cx0_read(i915, encoder->port, lane,
+						   PHY_C10_VDR_PLL(i));
+
+	cmn = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_CMN(0));

Quoted 4 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 559

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+	tx0 = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_TX(0));

The driver programs these registers, so why aren't they also stored in the intell_c20pll_state struct?

Maybe I'm not really following here but intel_c20pll_state has its own tx, cmn and mplla/mpllb stored.

Quoted 10 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+
+	if (tx0 != C10_TX0_VAL || cmn != C10_CMN0_DP_VAL)
+		drm_warn(&i915->drm, "Unexpected tx: %x or cmn: %x for phy:

%c.\n",

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 563

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			 tx0, cmn, phy_name(phy));

Shouldn't PHY_C10_VDR_CONTROL(1)/C10_VDR_CTRL_MSGBUS_ACCESS be cleared
here?

Usually this means that we are not accessing these values from the register. Was this in the spec that we would need to clear it?

Quoted 33 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+}
+
+static void intel_c10_pll_program(struct drm_i915_private *i915,
+				  const struct intel_crtc_state *crtc_state,
+				  struct intel_encoder *encoder)
+{
+	const struct intel_c10mpllb_state *pll_state = &crtc_state-

c10mpllb_state;

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	bool lane_reversal = dig_port->saved_port_bits &

DDI_BUF_PORT_REVERSAL;

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+	u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+					 INTEL_CX0_LANE0;
+	u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+					   INTEL_CX0_LANE1;
+
+	int i;
+	struct intel_dp *intel_dp;
+	bool use_ssc = false;
+	u8 cmn0 = 0;

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 591

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+	if (intel_crtc_has_dp_encoder(crtc_state)) {
+		intel_dp = enc_to_intel_dp(encoder);
+		use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+			  DP_MAX_DOWNSPREAD_0_5);
+
+		if (!intel_panel_use_ssc(i915))
+			use_ssc = false;
+
+		cmn0 = C10_CMN0_DP_VAL;

Would be clearer by stg like:

Quoted 3 lines
		/* Using x MHz reference */
		cmn0 = C10_CMN0_REF_RANGE(1) |

C10_CMN0_REF_CLK_MPLLB_DIV(2);

Ok. I will do the change.

Quoted 10 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+	}
+
+	intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES,

PHY_C10_VDR_CONTROL(1),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			C10_VDR_CTRL_MSGBUS_ACCESS,

MB_WRITE_COMMITTED);

For DP-alt MFD the PHY lane not owned by display shouldn't be programmed, no?

The spec says that with pin assignment D the lane 0 is owned by display. Lane 1 is owned by USB and shouldn't be programmed as the PHY will not respond.

Quoted 7 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+	/* Custom width needs to be programmed to 0 for both the phy lanes */
+	intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+		      PHY_C10_VDR_CUSTOM_WIDTH, 0x3, 0,

MB_WRITE_COMMITTED);

The above hard-coded values should have a macro definiton.

Ok. I add these values as definitions

Quoted 12 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+	intel_cx0_rmw(i915, encoder->port, follower_lane,

PHY_C10_VDR_CONTROL(1),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		      C10_VDR_CTRL_MASTER_LANE,

C10_VDR_CTRL_UPDATE_CFG,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+		      MB_WRITE_COMMITTED);
+
+	/* Program the pll values only for the master lane */
+	for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+		/* If not using ssc pll[4] through pll[8] must be 0*/
+		intel_cx0_write(i915, encoder->port, master_lane,

PHY_C10_VDR_PLL(i),

Quoted 5 lines
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+				(!use_ssc && (i > 3 && i < 9)) ? 0 : pll_state-

pll[i],

pll_state->pll should be setup already intel_c10mpllb_calc_state() taking into account SSC as well.

Yes, I will need this state calculation fixed.

Quoted 11 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+				(i % 4) ? MB_WRITE_UNCOMMITTED :

MB_WRITE_COMMITTED);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+
+	intel_cx0_write(i915, encoder->port, master_lane,

PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+	intel_cx0_write(i915, encoder->port, master_lane,

PHY_C10_VDR_TX(0), C10_TX0_VAL, MB_WRITE_COMMITTED);

Instead of C10_TX0_VAL the flags programmed should be better described here as cmn0 above.

Ok. I'll try to fix this.

Quoted 93 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+	intel_cx0_rmw(i915, encoder->port, master_lane,

PHY_C10_VDR_CONTROL(1),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		      C10_VDR_CTRL_MSGBUS_ACCESS,

C10_VDR_CTRL_MASTER_LANE |

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+		      C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+}
+
+void intel_c10mpllb_dump_hw_state(struct drm_i915_private *dev_priv,
+				  const struct intel_c10mpllb_state *hw_state)
+{
+	bool fracen;
+	int i;
+	unsigned int frac_quot = 0, frac_rem = 0, frac_den = 1;
+	unsigned int multiplier, tx_clk_div;

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+	fracen = hw_state->pll[0] & C10_PLL0_FRACEN;
+	drm_dbg_kms(&dev_priv->drm, "c10pll_hw_state: fracen: %s, ",
+		    str_yes_no(fracen));
+
+	if (fracen) {
+		frac_quot = hw_state->pll[12] << 8 | hw_state->pll[11];
+		frac_rem =  hw_state->pll[14] << 8 | hw_state->pll[13];
+		frac_den =  hw_state->pll[10] << 8 | hw_state->pll[9];
+		drm_dbg_kms(&dev_priv->drm, "quot: %u, rem: %u, den:

%u,\n",

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+			    frac_quot, frac_rem, frac_den);
+	}
+
+	multiplier = (REG_FIELD_GET8(C10_PLL3_MULTIPLIERH_MASK,

hw_state->pll[3]) << 8 |

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+		      hw_state->pll[2]) / 2 + 16;
+	tx_clk_div = REG_FIELD_GET8(C10_PLL15_TXCLKDIV_MASK, hw_state-

pll[15]);

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+	drm_dbg_kms(&dev_priv->drm,
+		    "multiplier: %u, tx_clk_div: %u.\n", multiplier, tx_clk_div);
+
+	drm_dbg_kms(&dev_priv->drm, "c10pll_rawhw_state:");
+
+	for (i = 0; i < ARRAY_SIZE(hw_state->pll); i = i + 4)
+		drm_dbg_kms(&dev_priv->drm, "pll[%d] = 0x%x, pll[%d] = 0x%x,

pll[%d] = 0x%x, pll[%d] = 0x%x\n",

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+			    i, hw_state->pll[i], i + 1, hw_state->pll[i + 1],
+			    i + 2, hw_state->pll[i + 2], i + 3, hw_state->pll[i + 3]);
+}
+
+int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
+				   const struct intel_c10mpllb_state *pll_state)
+{

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+	unsigned int frac_quot = 0, frac_rem = 0, frac_den = 1;
+	unsigned int multiplier, tx_clk_div, refclk = 38400;
+
+	if (pll_state->pll[0] & C10_PLL0_FRACEN) {
+		frac_quot = pll_state->pll[12] << 8 | pll_state->pll[11];
+		frac_rem =  pll_state->pll[14] << 8 | pll_state->pll[13];
+		frac_den =  pll_state->pll[10] << 8 | pll_state->pll[9];
+	}
+
+	multiplier = (REG_FIELD_GET8(C10_PLL3_MULTIPLIERH_MASK,

pll_state->pll[3]) << 8 |

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+		      pll_state->pll[2]) / 2 + 16;
+
+	tx_clk_div = REG_FIELD_GET8(C10_PLL15_TXCLKDIV_MASK, pll_state-

pll[15]);

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+
+	return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(refclk, (multiplier <<

16) + frac_quot) +

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+				     DIV_ROUND_CLOSEST(refclk * frac_rem,

frac_den),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+				     10 << (tx_clk_div + 16));
+}
+
+static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
+					 const struct intel_crtc_state

*crtc_state,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +8 -0
+					 bool lane_reversal)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_dp *intel_dp;
+	bool ssc_enabled;
+	u32 val = 0;
+
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL1(encoder->port),

XELPDP_PORT_REVERSAL,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+		     lane_reversal ? XELPDP_PORT_REVERSAL : 0);
+
+	if (lane_reversal)
+		val |= XELPDP_LANE1_PHY_CLOCK_SELECT;
+
+	val |= XELPDP_FORWARD_CLOCK_UNGATE;
+	val |=

XELPDP_DDI_CLOCK_SELECT(XELPDP_DDI_CLOCK_SELECT_MAXPCLK);

Quoted 1 line

TODO: HDMI FRL?

At this point this TODO can be added.

Quoted 31 lines
Quoted 19 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +18 -0
+
+	if (intel_crtc_has_dp_encoder(crtc_state)) {
+		intel_dp = enc_to_intel_dp(encoder);
+		ssc_enabled = intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+			      DP_MAX_DOWNSPREAD_0_5;
+
+		if (!intel_panel_use_ssc(i915))
+			ssc_enabled = false;
+
+		/* TODO: DP2.0 10G and 20G rates enable MPLLA*/
+		val |= ssc_enabled ? XELPDP_SSC_ENABLE_PLLB : 0;
+	}
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+		     XELPDP_LANE1_PHY_CLOCK_SELECT |
+		     XELPDP_FORWARD_CLOCK_UNGATE |
+		     XELPDP_DDI_CLOCK_SELECT_MASK |
+		     XELPDP_SSC_ENABLE_PLLB, val);
+}

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 717

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+static u32 intel_cx0_get_powerdown_update(u8 lane)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_POWERDOWN_UPDATE;
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_POWERDOWN_UPDATE;
+	else
+		return XELPDP_LANE0_POWERDOWN_UPDATE |
+		       XELPDP_LANE1_POWERDOWN_UPDATE;

Could simplify by

Quoted 3 lines
	val = 0;
	for_each_cx0_lane_in_mask(lane, lane_mask)
		val |= XELPDP_LANE_POWERDOWN_UPDATE(lane);

Yes, now that we have this macro defined.

Quoted 14 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 728

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +11 -0
+}
+
+static u32 intel_cx0_get_powerdown_state(u8 lane, u8 state)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_POWERDOWN_NEW_STATE(state);
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_POWERDOWN_NEW_STATE(state);
+	else
+		return XELPDP_LANE0_POWERDOWN_NEW_STATE(state) |
+		       XELPDP_LANE1_POWERDOWN_NEW_STATE(state);

Could simplify similarly to the above.

Yes.

Quoted 17 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+}
+
+static void intel_cx0_powerdown_change_sequence(struct drm_i915_private

*i915,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+						enum port port,
+						u8 lane, u8 state)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+		     XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK |

XELPDP_LANE1_POWERDOWN_NEW_STATE_MASK,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+		     intel_cx0_get_powerdown_state(lane, state));
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+		     XELPDP_LANE0_POWERDOWN_UPDATE |

XELPDP_LANE1_POWERDOWN_UPDATE,

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 742

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		     intel_cx0_get_powerdown_update(lane));

The spec says (65451):
"Only update powerdown for one port at a time. Wait for powerdown update to finish for one port before initiating update on another port."

both could be updated at the same time if a non-zero stagger delay was programmed, but for C10/C20 it must be programmed as 0.

So this needs to be updated so that we update one port and wait for transaction to complete before updating the second port.

Quoted 42 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 751

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+
+	/* Update Timeout Value */
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
+

intel_cx0_get_powerdown_update(lane), 0,

Quoted 1 line

+

XELPDP_PORT_POWERDOWN_UPDATE_TIMEOUT_US, 0, NULL))

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		drm_warn(&i915->drm, "PHY %c failed to bring out of Lane

reset after %dus.\n",

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			 phy_name(phy),

XELPDP_PORT_RESET_START_TIMEOUT_US);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+}
+
+static void intel_cx0_setup_powerdown(struct drm_i915_private *i915, enum

port port)

Quoted 26 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +26 -0
+{
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+		     XELPDP_POWER_STATE_READY_MASK,
+		     XELPDP_POWER_STATE_READY(CX0_P2_STATE_READY));
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL3(port),
+		     XELPDP_POWER_STATE_ACTIVE_MASK |
+		     XELPDP_PLL_LANE_STAGGERING_DELAY_MASK,
+		     XELPDP_POWER_STATE_ACTIVE(CX0_P0_STATE_ACTIVE) |
+		     XELPDP_PLL_LANE_STAGGERING_DELAY(0));
+}
+
+static u32 intel_cx0_get_pclk_refclk_request(u8 lane)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_PCLK_REFCLK_REQUEST;
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_PCLK_REFCLK_REQUEST;
+	else
+		return XELPDP_LANE0_PCLK_REFCLK_REQUEST |
+		       XELPDP_LANE1_PCLK_REFCLK_REQUEST;
+}
+
+static u32 intel_cx0_get_pclk_refclk_ack(u8 lane)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_PCLK_REFCLK_ACK;
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 784

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_PCLK_REFCLK_ACK;
+	else
+		return XELPDP_LANE0_PCLK_REFCLK_ACK |
+		       XELPDP_LANE1_PCLK_REFCLK_ACK;
+}

Could simplify both of the above functions.

Yes.

Quoted 87 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+
+/* FIXME: Some Type-C cases need not reset both the lanes. Handle those

cases. */

Quoted 1 line

+static void intel_cx0_phy_lane_reset(struct drm_i915_private *i915, enum

port port,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 800

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+				     bool lane_reversal)
+{
+	enum phy phy = intel_port_to_phy(i915, port);
+	u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+				  INTEL_CX0_LANE0;
+
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL1(port),
+					 XELPDP_PORT_BUF_SOC_PHY_READY,
+					 XELPDP_PORT_BUF_SOC_PHY_READY,
+

XELPDP_PORT_BUF_SOC_READY_TIMEOUT_US, 0, NULL))

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		drm_warn(&i915->drm, "PHY %c failed to bring out of SOC reset

after %dus.\n",

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			 phy_name(phy),

XELPDP_PORT_BUF_SOC_READY_TIMEOUT_US);

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 811

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+		     XELPDP_LANE0_PIPE_RESET | XELPDP_LANE1_PIPE_RESET,
+		     XELPDP_LANE0_PIPE_RESET | XELPDP_LANE1_PIPE_RESET);
+
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
+

XELPDP_LANE0_PHY_CURRENT_STATUS |
XELPDP_LANE1_PHY_CURRENT_STATUS,

Quoted 1 line

+

XELPDP_LANE0_PHY_CURRENT_STATUS |
XELPDP_LANE1_PHY_CURRENT_STATUS,

Quoted 1 line

+

XELPDP_PORT_RESET_START_TIMEOUT_US, 0, NULL))

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		drm_warn(&i915->drm, "PHY %c failed to bring out of Lane

reset after %dus.\n",

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			 phy_name(phy),

XELPDP_PORT_RESET_START_TIMEOUT_US);

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 815

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(port),
+

intel_cx0_get_pclk_refclk_request(INTEL_CX0_BOTH_LANES),

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 822

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+		     intel_cx0_get_pclk_refclk_request(lane));
+
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(port),
+

intel_cx0_get_pclk_refclk_ack(INTEL_CX0_BOTH_LANES),

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 822

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+					 intel_cx0_get_pclk_refclk_ack(lane),
+

XELPDP_REFCLK_ENABLE_TIMEOUT_US, 0, NULL))

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		drm_warn(&i915->drm, "PHY %c failed to request refclk after

%dus.\n",

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			 phy_name(phy),

XELPDP_REFCLK_ENABLE_TIMEOUT_US);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+
+	intel_cx0_powerdown_change_sequence(i915, port,

INTEL_CX0_BOTH_LANES,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+					    CX0_P2_STATE_RESET);
+	intel_cx0_setup_powerdown(i915, port);
+
+	intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+		     XELPDP_LANE0_PIPE_RESET | XELPDP_LANE1_PIPE_RESET,

0);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+
+	if (intel_de_wait_for_clear(i915, XELPDP_PORT_BUF_CTL2(port),
+				    XELPDP_LANE0_PHY_CURRENT_STATUS |
+				    XELPDP_LANE1_PHY_CURRENT_STATUS,
+				    XELPDP_PORT_RESET_END_TIMEOUT))
+		drm_warn(&i915->drm, "PHY %c failed to bring out of Lane

reset after %dms.\n",

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			 phy_name(phy),

XELPDP_PORT_RESET_END_TIMEOUT);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+}
+
+static void intel_c10_program_phy_lane(struct drm_i915_private *i915,
+				       struct intel_encoder *encoder, int

lane_count,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+				       bool lane_reversal)
+{
+	u8 l0t1, l0t2, l1t1, l1t2;
+	bool dp_alt_mode =

intel_tc_port_in_dp_alt_mode(enc_to_dig_port(encoder));

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+	enum port port = encoder->port;
+
+	intel_cx0_rmw(i915, port, INTEL_CX0_BOTH_LANES,

PHY_C10_VDR_CONTROL(1),

Quoted 5 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		      C10_VDR_CTRL_MSGBUS_ACCESS,

C10_VDR_CTRL_MSGBUS_ACCESS,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		      MB_WRITE_COMMITTED);

TODO: DP-alt MFD case where only one PHY lane should be programmed.

TODO comment here or should I add the fix for DP-alt MFD case here?

Quoted 80 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+
+	l0t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(1, 2));

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+	l0t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(2, 2));

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+	l1t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE1,

PHY_CX0_TX_CONTROL(1, 2));

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+	l1t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE1,

PHY_CX0_TX_CONTROL(2, 2));

Quoted 1 line

+

Would be clearer setting here CONTROL2_DISABLE_SINGLE_TX in all of l[0/1]t[1/2], and then

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 857

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+	if (lane_reversal) {
+		switch (lane_count) {
+		case 1:
			l1t1 &= ~CONTROL2_DISABLE_SINGLE_TX;
			break;

			etc. for 2,3,4 lanes and then

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+			/* Disable MLs 1(lane0), 2(lane0), 3(lane1) */
+			intel_cx0_write(i915, port, INTEL_CX0_LANE1,

PHY_CX0_TX_CONTROL(1, 2),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+					l1t1 |

CONTROL2_DISABLE_SINGLE_TX,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+					MB_WRITE_COMMITTED);
+			fallthrough;
 
 
+		case 2:
+			/* Disable MLs 1(lane0), 2(lane0) */
+			intel_cx0_write(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(2, 2),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+					l0t2 |

CONTROL2_DISABLE_SINGLE_TX,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+					MB_WRITE_COMMITTED);
+			fallthrough;
+		case 3:
+			/* Disable MLs 1(lane0) */
+			intel_cx0_write(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(1, 2),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+					l0t1 |

CONTROL2_DISABLE_SINGLE_TX,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+					MB_WRITE_COMMITTED);
+			break;
+		}
+	} else {
+		switch (lane_count) {
+		case 1:
+			if (dp_alt_mode) {
+				/* Disable MLs 1(lane0), 3(lane1), 4(lane1) */
+				intel_cx0_write(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(1, 2),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+						l0t1 |

CONTROL2_DISABLE_SINGLE_TX,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+						MB_WRITE_COMMITTED);
+			} else {
+				/* Disable MLs 2(lane0), 3(lane1), 4(lane1) */
+				intel_cx0_write(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(2, 2),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+						l0t2 |

CONTROL2_DISABLE_SINGLE_TX,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+						MB_WRITE_COMMITTED);
+			}
+			fallthrough;
+		case 2:
+			/* Disable MLs 3(lane1), 4(lane1) */
+			intel_cx0_write(i915, port, INTEL_CX0_LANE1,

PHY_CX0_TX_CONTROL(1, 2),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+					l1t1 |

CONTROL2_DISABLE_SINGLE_TX,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+					MB_WRITE_COMMITTED);
+			fallthrough;
+		case 3:
+			/* Disable MLs 4(lane1) */
+			intel_cx0_write(i915, port, INTEL_CX0_LANE1,

PHY_CX0_TX_CONTROL(2, 2),

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+					l1t2 |

CONTROL2_DISABLE_SINGLE_TX,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 889

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+					MB_WRITE_COMMITTED);
+			break;
+		}
+	}

write here PHY_CX0_LANE[0/1], PHY_CX0_TX_CONTROL([1/2], 2)

Ok.

Quoted 5 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 906

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+
+	if (intel_is_c10phy(i915, intel_port_to_phy(i915, port))) {

This check is not needed, as we get here only for C10 PHY.

Right. I will remove that.

Quoted 34 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		intel_cx0_rmw(i915, port, INTEL_CX0_LANE1,

PHY_C10_VDR_CONTROL(1),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			      C10_VDR_CTRL_UPDATE_CFG |

C10_VDR_CTRL_MSGBUS_ACCESS,

Should the above clear C10_VDR_CTRL_MASTER_LANE?

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			      C10_VDR_CTRL_UPDATE_CFG,

MB_WRITE_COMMITTED);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		intel_cx0_rmw(i915, port, INTEL_CX0_LANE0,

PHY_C10_VDR_CONTROL(1),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			      C10_VDR_CTRL_UPDATE_CFG |

C10_VDR_CTRL_MSGBUS_ACCESS,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			      C10_VDR_CTRL_MASTER_LANE |

C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);

Quoted 18 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +18 -0
+	}
+}
+
+static u32 intel_cx0_get_pclk_pll_request(u8 lane)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_PCLK_PLL_REQUEST;
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_PCLK_PLL_REQUEST;
+	else
+		return XELPDP_LANE0_PCLK_PLL_REQUEST |
+		       XELPDP_LANE1_PCLK_PLL_REQUEST;
+}
+
+static u32 intel_cx0_get_pclk_pll_ack(u8 lane)
+{
+	if (lane == INTEL_CX0_LANE0)
+		return XELPDP_LANE0_PCLK_PLL_ACK;
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 936

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+	else if (lane == INTEL_CX0_LANE1)
+		return XELPDP_LANE1_PCLK_PLL_ACK;
+	else
+		return XELPDP_LANE0_PCLK_PLL_ACK |
+		       XELPDP_LANE1_PCLK_PLL_ACK;
+}

Could simplify the above functions.

Yes.

Quoted 81 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +8 -0
+
+static void intel_c10pll_enable(struct intel_encoder *encoder,
+				const struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	bool lane_reversal = dig_port->saved_port_bits &

DDI_BUF_PORT_REVERSAL;

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+	u8 maxpclk_lane = lane_reversal ? INTEL_CX0_LANE1 :
+					  INTEL_CX0_LANE0;
+
+	/*
+	 * 1. Program PORT_CLOCK_CTL REGISTER to configure
+	 * clock muxes, gating and SSC
+	 */

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+	intel_program_port_clock_ctl(encoder, crtc_state, lane_reversal);
+
+	/* 2. Bring PHY out of reset. */
+	intel_cx0_phy_lane_reset(i915, encoder->port, lane_reversal);
+
+	/*
+	 * 3. Change Phy power state to Ready.
+	 * TODO: For DP alt mode use only one lane.
+	 */
+	intel_cx0_powerdown_change_sequence(i915, encoder->port,

INTEL_CX0_BOTH_LANES,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+					    CX0_P2_STATE_READY);
+
+	/* 4. Program PHY internal PLL internal registers. */
+	intel_c10_pll_program(i915, crtc_state, encoder);
+
+	/*
+	 * 5. Program the enabled and disabled owned PHY lane
+	 * transmitters over message bus
+	 */
+	intel_c10_program_phy_lane(i915, encoder, crtc_state->lane_count,

lane_reversal);

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +11 -0
+
+	/*
+	 * 6. Follow the Display Voltage Frequency Switching - Sequence
+	 * Before Frequency Change. We handle this step in bxt_set_cdclk().
+	 */
+
+	/*
+	 * 7. Program DDI_CLK_VALFREQ to match intended DDI
+	 * clock frequency.
+	 */
+	intel_de_write(i915, DDI_CLK_VALFREQ(encoder->port),

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+		       crtc_state->port_clock);
+	/*
+	 * 8. Set PORT_CLOCK_CTL register PCLK PLL Request
+	 * LN<Lane for maxPCLK> to "1" to enable PLL.
+	 */
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+		     intel_cx0_get_pclk_pll_request(INTEL_CX0_BOTH_LANES),
+		     intel_cx0_get_pclk_pll_request(maxpclk_lane));
+
+	/* 9. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK> ==

"1". */

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 46

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+	if (__intel_de_wait_for_register(i915,

XELPDP_PORT_CLOCK_CTL(encoder->port),

Quoted 1 line

+

intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES),

Quoted 1 line

+

intel_cx0_get_pclk_pll_ack(maxpclk_lane),

Quoted 1 line

+

XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US, 0, NULL))

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+		drm_warn(&i915->drm, "Port %c PLL not locked after %dus.\n",
+			 phy_name(phy),

XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US);

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+
+	/*
+	 * 10. Follow the Display Voltage Frequency Switching Sequence After
+	 * Frequency Change. We handle this step in bxt_set_cdclk().
+	 */
+}
+
+void intel_cx0pll_enable(struct intel_encoder *encoder,
+			 const struct intel_crtc_state *crtc_state)
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 1013

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+	intel_c10pll_enable(encoder, crtc_state);

TBT-alt is not handled, so needs a TODO: comment.

At least this point it's not handled.

Quoted 107 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+}
+
+static void intel_c10pll_disable(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	/* 1. Change owned PHY lane power to Disable state. */
+	intel_cx0_powerdown_change_sequence(i915, encoder->port,

INTEL_CX0_BOTH_LANES,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+					    CX0_P2PG_STATE_DISABLE);
+
+	/*
+	 * 2. Follow the Display Voltage Frequency Switching Sequence Before
+	 * Frequency Change. We handle this step in bxt_set_cdclk().
+	 */
+
+	/*
+	 * 3. Set PORT_CLOCK_CTL register PCLK PLL Request LN<Lane for

maxPCLK>

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 1037

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+	 * to "0" to disable PLL.
+	 */
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+		     intel_cx0_get_pclk_pll_request(INTEL_CX0_BOTH_LANES) |
+

intel_cx0_get_pclk_refclk_request(INTEL_CX0_BOTH_LANES), 0);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+
+	/* 4. Program DDI_CLK_VALFREQ to 0. */
+	intel_de_write(i915, DDI_CLK_VALFREQ(encoder->port), 0);
+
+	/*
+	 * 5. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK**>

== "0".

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 46

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+	 */
+	if (__intel_de_wait_for_register(i915,

XELPDP_PORT_CLOCK_CTL(encoder->port),

Quoted 1 line

+

intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES) |

Quoted 1 line

+

intel_cx0_get_pclk_refclk_ack(INTEL_CX0_BOTH_LANES), 0,

Quoted 1 line

+

XELPDP_PCLK_PLL_DISABLE_TIMEOUT_US, 0, NULL))

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+		drm_warn(&i915->drm, "Port %c PLL not unlocked after

%dus.\n",

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +1 -0
+			 phy_name(phy),

XELPDP_PCLK_PLL_DISABLE_TIMEOUT_US);

Quoted 60 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +27 -0
+
+	/*
+	 * 6. Follow the Display Voltage Frequency Switching Sequence After
+	 * Frequency Change. We handle this step in bxt_set_cdclk().
+	 */
+
+	/* 7. Program PORT_CLOCK_CTL register to disable and gate clocks. */
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+		     XELPDP_DDI_CLOCK_SELECT_MASK |
+		     XELPDP_FORWARD_CLOCK_UNGATE, 0);
+}
+
+void intel_cx0pll_disable(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
+	intel_c10pll_disable(encoder);
+}
+
+void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
+				 struct intel_crtc_state *new_crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(state->base.dev);
+	struct intel_c10mpllb_state mpllb_hw_state = { 0 };
+	struct intel_c10mpllb_state *mpllb_sw_state = &new_crtc_state-

c10mpllb_state;

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +32 -0
+	struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
+	struct intel_encoder *encoder;
+	struct intel_dp *intel_dp;
+	enum phy phy;
+	int i;
+	bool use_ssc = false;
+
+	if (DISPLAY_VER(i915) < 14)
+		return;
+
+	if (!new_crtc_state->hw.active)
+		return;
+
+	encoder = intel_get_crtc_new_encoder(state, new_crtc_state);
+	phy = intel_port_to_phy(i915, encoder->port);
+
+	if (intel_crtc_has_dp_encoder(new_crtc_state)) {
+		intel_dp = enc_to_intel_dp(encoder);
+		use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+			  DP_MAX_DOWNSPREAD_0_5);
+
+		if (!intel_panel_use_ssc(i915))
+			use_ssc = false;
+	}
+
+	if (!intel_is_c10phy(i915, phy))
+		return;
+
+	intel_c10mpllb_readout_hw_state(encoder, &mpllb_hw_state);
+
+	for (i = 0; i < ARRAY_SIZE(mpllb_sw_state->pll); i++) {
+		u8 expected;
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 1113

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+
+		if (!use_ssc && i > 3 && i < 9)
+			expected = 0;
+		else
+			expected = mpllb_sw_state->pll[i];

The above isn't needed if PLL state is setup correctly in intel_c10mpllb_calc_state(), taking into account SSC as well.

Yes, this can be simplified with that change.

Quoted 42 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+
+		I915_STATE_WARN(mpllb_hw_state.pll[i] != expected,
+				"[CRTC:%d:%s] mismatch in C10MPLLB:

Register[%d] (expected 0x%02x, found 0x%02x)",

35 lines not shown · raw message

Quoted 7 lines

5 lines not shown · raw message

395 lines not shown · raw message

Part of this message is not shown here. View the raw message.

#12 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 16 lines · Mika

[...]

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+static int __intel_cx0_read(struct drm_i915_private *i915, enum port port,
+                      int lane, u16 addr, u32 *val)
+{
+   enum phy phy = intel_port_to_phy(i915, port);
+   int ack;
+
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 70

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+   /* Wait for pending transactions.*/
+   if (intel_de_wait_for_clear(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),
+				      XELPDP_PORT_M2P_TRANSACTION_PENDING,
+                               XELPDP_MSGBUS_TIMEOUT_SLOW)) {
+           drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for previous transaction to complete. Reset the bus and retry.\n", phy_name(phy));
+           intel_cx0_bus_reset(i915, port, lane);

Does bspec describe somewhere that this reset is needed?

Quoted 3 lines

I think this plays on the safe side. If transaction is not completed withing reasonable time, we set the bus in known state. What would be the alternative? Just leave the bus state as is?

Not sure, since it's not specified; neither it is clear if it has side-effects. In any case as I understand someone has actually seen this being required after a transaction times out. If so please add a comment both to here and to the 3-time retry loop, that neither of these are required by the spec, but used as a workaround for these timeouts. (Also I guess we'd need open HSD/bspec tickets for such WAs we came up with).

Quoted 35 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+           return -ETIMEDOUT;
+   }
+

[...]

Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +20 -0
+void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
+                                struct intel_c10mpllb_state *pll_state)
+{
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+   u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+                             INTEL_CX0_LANE0;
+   enum phy phy = intel_port_to_phy(i915, encoder->port);
+   int i;
+   u8 cmn, tx0;
+
+   /*
+    * According to C10 VDR Register programming Sequence we need
+    * to do this to read PHY internal registers from MsgBus.
+    */
+   intel_cx0_rmw(i915, encoder->port, lane, PHY_C10_VDR_CONTROL(1), 0,
+                 C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 559

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+           pll_state->pll[i] = intel_cx0_read(i915, encoder->port, lane,
+                                              PHY_C10_VDR_PLL(i));
+
+   cmn = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_CMN(0));
+   tx0 = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_TX(0));

The driver programs these registers, so why aren't they also stored in the intell_c20pll_state struct?

Quoted 2 lines

Maybe I'm not really following here but intel_c20pll_state has its own tx, cmn and mplla/mpllb stored.

Yes, just typoed that, I meant struct intel_c10mpllb_state which doesn't include tx and cmn.

Quoted 10 lines
Quoted 7 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 563

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+
+   if (tx0 != C10_TX0_VAL || cmn != C10_CMN0_DP_VAL)
+           drm_warn(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",
+                    tx0, cmn, phy_name(phy));

Shouldn't PHY_C10_VDR_CONTROL(1)/C10_VDR_CTRL_MSGBUS_ACCESS be cleared here?

Usually this means that we are not accessing these values from the register. Was this in the spec that we would need to clear it?

It does get cleared at the end of intel_c10_pll_program(), at least from one of the PHY lanes, so was wondering why things are done differently here. Yes, the spec doesn't require clearing it, but then it should not be cleared at other places either (has related comments on this in follow-up reviews).

Quoted 41 lines
Quoted 30 lines
Quoted 18 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +18 -0
+}
+
+static void intel_c10_pll_program(struct drm_i915_private *i915,
+                             const struct intel_crtc_state *crtc_state,
+                             struct intel_encoder *encoder)
+{
+   const struct intel_c10mpllb_state *pll_state = &crtc_state->c10mpllb_state;
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+   u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+                                    INTEL_CX0_LANE0;
+   u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+                                      INTEL_CX0_LANE1;
+
+   int i;
+   struct intel_dp *intel_dp;
+   bool use_ssc = false;
+   u8 cmn0 = 0;

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 591

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+   if (intel_crtc_has_dp_encoder(crtc_state)) {
+           intel_dp = enc_to_intel_dp(encoder);
+           use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+                     DP_MAX_DOWNSPREAD_0_5);
+
+           if (!intel_panel_use_ssc(i915))
+                   use_ssc = false;
+
+           cmn0 = C10_CMN0_DP_VAL;

Would be clearer by stg like:

Quoted 2 lines
              /* Using x MHz reference */
              cmn0 = C10_CMN0_REF_RANGE(1) | C10_CMN0_REF_CLK_MPLLB_DIV(2);

Ok. I will do the change.

Quoted 6 lines
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+   }
+
+   intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
+                   C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
Quoted 6 lines
Quoted 2 lines

For DP-alt MFD the PHY lane not owned by display shouldn't be programmed, no?

The spec says that with pin assignment D the lane 0 is owned by display. Lane 1 is owned by USB and shouldn't be programmed as the PHY will not respond.

Right, but both lanes are programmed. So would need a "FIXME: program only lane 0 for DP-alt / MFD" comment.

Quoted 57 lines
Quoted 5 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 598

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+   /* Custom width needs to be programmed to 0 for both the phy lanes */
+   intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+                 PHY_C10_VDR_CUSTOM_WIDTH, 0x3, 0, MB_WRITE_COMMITTED);

The above hard-coded values should have a macro definiton.

Ok. I add these values as definitions

Quoted 10 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 607

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+   intel_cx0_rmw(i915, encoder->port, follower_lane, PHY_C10_VDR_CONTROL(1),
+                 C10_VDR_CTRL_MASTER_LANE, C10_VDR_CTRL_UPDATE_CFG,
+                 MB_WRITE_COMMITTED);
+
+   /* Program the pll values only for the master lane */
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+           /* If not using ssc pll[4] through pll[8] must be 0*/
+           intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_PLL(i),
+                           (!use_ssc && (i > 3 && i < 9)) ? 0 : pll_state->pll[i],
Quoted 2 lines

pll_state->pll should be setup already intel_c10mpllb_calc_state() taking into account SSC as well.

Yes, I will need this state calculation fixed.

Quoted 7 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 611

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+                           (i % 4) ? MB_WRITE_UNCOMMITTED : MB_WRITE_COMMITTED);
+
+   intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);
+   intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_TX(0), C10_TX0_VAL, MB_WRITE_COMMITTED);

Instead of C10_TX0_VAL the flags programmed should be better described here as cmn0 above.

Ok. I'll try to fix this.

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+   intel_cx0_rmw(i915, encoder->port, master_lane, PHY_C10_VDR_CONTROL(1),
+                 C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MASTER_LANE |
+                 C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+}

[...]

Quoted 17 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 742

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +12 -0
+static void intel_cx0_powerdown_change_sequence(struct drm_i915_private *i915,
+                                           enum port port,
+                                           u8 lane, u8 state)
+{
+   enum phy phy = intel_port_to_phy(i915, port);
+
+   intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+                XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK | XELPDP_LANE1_POWERDOWN_NEW_STATE_MASK,
+                intel_cx0_get_powerdown_state(lane, state));
+   intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+                XELPDP_LANE0_POWERDOWN_UPDATE | XELPDP_LANE1_POWERDOWN_UPDATE,
+                intel_cx0_get_powerdown_update(lane));

The spec says (65451):
"Only update powerdown for one port at a time. Wait for powerdown update to finish for one port before initiating update on another port."

Quoted 5 lines
Quoted 2 lines

both could be updated at the same time if a non-zero stagger delay was programmed, but for C10/C20 it must be programmed as 0.

So this needs to be updated so that we update one port and wait for transaction to complete before updating the second port.

Yes.

Quoted 27 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+
+   /* Update Timeout Value */
+   if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
+					   intel_cx0_get_powerdown_update(lane), 0,
+					   XELPDP_PORT_POWERDOWN_UPDATE_TIMEOUT_US, 0, NULL))
+           drm_warn(&i915->drm, "PHY %c failed to bring out of Lane reset after %dus.\n",
+                    phy_name(phy), XELPDP_PORT_RESET_START_TIMEOUT_US);
+}
+

[...]

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+
+static void intel_c10_program_phy_lane(struct drm_i915_private *i915,
+                                  struct intel_encoder *encoder, int lane_count,
+                                  bool lane_reversal)
+{
+   u8 l0t1, l0t2, l1t1, l1t2;
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 848

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+   bool dp_alt_mode = intel_tc_port_in_dp_alt_mode(enc_to_dig_port(encoder));
+   enum port port = encoder->port;
+
+   intel_cx0_rmw(i915, port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
+                 C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MSGBUS_ACCESS,
+                 MB_WRITE_COMMITTED);

TODO: DP-alt MFD case where only one PHY lane should be programmed.

Quoted 1 line

TODO comment here or should I add the fix for DP-alt MFD case here?

I think it could be fixed up later with all other places programming now both PHY lanes unconditionally, adding only a TODO: comment here for now.

--Imre

Quoted 92 lines
Quoted 70 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 854

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+
+   l0t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2));
+   l0t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2));
+   l1t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(1, 2));
+   l1t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(2, 2));
+

Would be clearer setting here CONTROL2_DISABLE_SINGLE_TX in all of l[0/1]t[1/2], and then

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 857

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+   if (lane_reversal) {
+           switch (lane_count) {
+           case 1:
                      l1t1 &= ~CONTROL2_DISABLE_SINGLE_TX;
                      break;

                      etc. for 2,3,4 lanes and then
Quoted 39 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +37 -0
+                   /* Disable MLs 1(lane0), 2(lane0), 3(lane1) */
+                   intel_cx0_write(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(1, 2),
+                                   l1t1 | CONTROL2_DISABLE_SINGLE_TX,
+                                   MB_WRITE_COMMITTED);
+                   fallthrough;
 
 
+           case 2:
+                   /* Disable MLs 1(lane0), 2(lane0) */
+                   intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2),
+                                   l0t2 | CONTROL2_DISABLE_SINGLE_TX,
+                                   MB_WRITE_COMMITTED);
+                   fallthrough;
+           case 3:
+                   /* Disable MLs 1(lane0) */
+                   intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2),
+                                   l0t1 | CONTROL2_DISABLE_SINGLE_TX,
+                                   MB_WRITE_COMMITTED);
+                   break;
+           }
+   } else {
+           switch (lane_count) {
+           case 1:
+                   if (dp_alt_mode) {
+                           /* Disable MLs 1(lane0), 3(lane1), 4(lane1) */
+                           intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2),
+                                           l0t1 | CONTROL2_DISABLE_SINGLE_TX,
+                                           MB_WRITE_COMMITTED);
+                   } else {
+                           /* Disable MLs 2(lane0), 3(lane1), 4(lane1) */
+                           intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2),
+                                           l0t2 | CONTROL2_DISABLE_SINGLE_TX,
+                                           MB_WRITE_COMMITTED);
+                   }
+                   fallthrough;
+           case 2:
+                   /* Disable MLs 3(lane1), 4(lane1) */
+                   intel_cx0_write(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(1, 2),
+                                   l1t1 | CONTROL2_DISABLE_SINGLE_TX,

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 904

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+                                   MB_WRITE_COMMITTED);
+                   fallthrough;
+           case 3:
+                   /* Disable MLs 4(lane1) */
+                   intel_cx0_write(i915, port, INTEL_CX0_LANE1, PHY_CX0_TX_CONTROL(2, 2),
+                                   l1t2 | CONTROL2_DISABLE_SINGLE_TX,
+                                   MB_WRITE_COMMITTED);
+                   break;
+           }
+   }
Quoted 1 line

write here PHY_CX0_LANE[0/1], PHY_CX0_TX_CONTROL([1/2], 2)

Ok.

Quoted 5 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 906

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+
+   if (intel_is_c10phy(i915, intel_port_to_phy(i915, port))) {

This check is not needed, as we get here only for C10 PHY.

Right. I will remove that.

Quoted 12 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+           intel_cx0_rmw(i915, port, INTEL_CX0_LANE1, PHY_C10_VDR_CONTROL(1),
+                         C10_VDR_CTRL_UPDATE_CFG | C10_VDR_CTRL_MSGBUS_ACCESS,

Should the above clear C10_VDR_CTRL_MASTER_LANE?

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+                         C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+           intel_cx0_rmw(i915, port, INTEL_CX0_LANE0, PHY_C10_VDR_CONTROL(1),
+                         C10_VDR_CTRL_UPDATE_CFG |  C10_VDR_CTRL_MSGBUS_ACCESS,
+                         C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+   }
+}
#13 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 34 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Tuesday, April 4, 2023 2:47 PM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; Sripada, Radhakrishna <[email protected]>; Shankar, Uma <[email protected]>; Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 2 lines · Mika

[...]

Quoted 1 line
Quoted 1 line

+static int __intel_cx0_read(struct drm_i915_private *i915, enum port

port,

Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+                      int lane, u16 addr, u32 *val) {
+   enum phy phy = intel_port_to_phy(i915, port);
+   int ack;
+
+   /* Wait for pending transactions.*/
+   if (intel_de_wait_for_clear(i915,

XELPDP_PORT_M2P_MSGBUS_CTL(port, lane - 1),

Quoted 1 line
Quoted 1 line
Quoted 1 line

+

XELPDP_PORT_M2P_TRANSACTION_PENDING,

Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+                               XELPDP_MSGBUS_TIMEOUT_SLOW)) {
+           drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for previous

transaction to complete. Reset the bus and retry.\n", phy_name(phy));

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+ intel_cx0_bus_reset(i915, port, lane);

Does bspec describe somewhere that this reset is needed?

I think this plays on the safe side. If transaction is not completed withing reasonable time, we set the bus in known state. What would be the alternative? Just leave the bus state as is?

Quoted 6 lines

Not sure, since it's not specified; neither it is clear if it has side-effects. In any case as I understand someone has actually seen this being required after a transaction times out. If so please add a comment both to here and to the 3- time retry loop, that neither of these are required by the spec, but used as a workaround for these timeouts. (Also I guess we'd need open HSD/bspec tickets for such WAs we came up with).

Let's play it safe. I add a comment here for the reset.

Quoted 38 lines
Quoted 5 lines
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 55

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+           return -ETIMEDOUT;
+   }
+
Quoted 8 lines

[...]

Quoted 6 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
+                                struct intel_c10mpllb_state
+*pll_state) {
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits &

DDI_BUF_PORT_REVERSAL;

Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +11 -0
+   u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+                             INTEL_CX0_LANE0;
+   enum phy phy = intel_port_to_phy(i915, encoder->port);
+   int i;
+   u8 cmn, tx0;
+
+   /*
+    * According to C10 VDR Register programming Sequence we need
+    * to do this to read PHY internal registers from MsgBus.
+    */
+   intel_cx0_rmw(i915, encoder->port, lane, PHY_C10_VDR_CONTROL(1),

0,

Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +8 -0
+                 C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+           pll_state->pll[i] = intel_cx0_read(i915, encoder->port, lane,
+
+ PHY_C10_VDR_PLL(i));
+
+   cmn = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_CMN(0));

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

+ tx0 = intel_cx0_read(i915, encoder->port, lane,
+ PHY_C10_VDR_TX(0));

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The driver programs these registers, so why aren't they also stored in the intell_c20pll_state struct?

Maybe I'm not really following here but intel_c20pll_state has its own tx, cmn and mplla/mpllb stored.

Yes, just typoed that, I meant struct intel_c10mpllb_state which doesn't include tx and cmn.

Yes, for C10 tx and cmn is missing. Maybe we could add those here as well. It seems that currently these are not necessary required but for the future use, these could be defined.

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+
+   if (tx0 != C10_TX0_VAL || cmn != C10_CMN0_DP_VAL)
+           drm_warn(&i915->drm, "Unexpected tx: %x or cmn: %x for phy:

%c.\n",

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

+ tx0, cmn, phy_name(phy));

Shouldn't PHY_C10_VDR_CONTROL(1)/C10_VDR_CTRL_MSGBUS_ACCESS be cleared here?

Quoted 7 lines
Quoted 2 lines

Usually this means that we are not accessing these values from the register. Was this in the spec that we would need to clear it?

It does get cleared at the end of intel_c10_pll_program(), at least from one of the PHY lanes, so was wondering why things are done differently here. Yes, the spec doesn't require clearing it, but then it should not be cleared at other places either (has related comments on this in follow-up reviews).

To be consistent maybe we can clear this here as well.

Quoted 49 lines
Quoted 10 lines
Quoted 7 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+}
+
+static void intel_c10_pll_program(struct drm_i915_private *i915,
+                             const struct intel_crtc_state *crtc_state,
+                             struct intel_encoder *encoder) {
+   const struct intel_c10mpllb_state *pll_state = &crtc_state-

c10mpllb_state;

Quoted 2 lines
Quoted 2 lines
(quoted diff) +2 -0
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits &

DDI_BUF_PORT_REVERSAL;

Quoted 25 lines
Quoted 21 lines
Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +9 -0
+   u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+                                    INTEL_CX0_LANE0;
+   u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+                                      INTEL_CX0_LANE1;
+
+   int i;
+   struct intel_dp *intel_dp;
+   bool use_ssc = false;
+   u8 cmn0 = 0;

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 591

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+
+   if (intel_crtc_has_dp_encoder(crtc_state)) {
+           intel_dp = enc_to_intel_dp(encoder);
+           use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+                     DP_MAX_DOWNSPREAD_0_5);
+
+           if (!intel_panel_use_ssc(i915))
+                   use_ssc = false;
+
+           cmn0 = C10_CMN0_DP_VAL;

Would be clearer by stg like:

Quoted 3 lines
              /* Using x MHz reference */
              cmn0 = C10_CMN0_REF_RANGE(1) |

C10_CMN0_REF_CLK_MPLLB_DIV(2);

Quoted 6 lines

Ok. I will do the change.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+   }
+
+   intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES,

PHY_C10_VDR_CONTROL(1),

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

+ C10_VDR_CTRL_MSGBUS_ACCESS,
+ MB_WRITE_COMMITTED);

For DP-alt MFD the PHY lane not owned by display shouldn't be programmed, no?

Quoted 6 lines
Quoted 3 lines

The spec says that with pin assignment D the lane 0 is owned by display. Lane 1 is owned by USB and shouldn't be programmed as the PHY will not respond.

Right, but both lanes are programmed. So would need a "FIXME: program only lane 0 for DP-alt / MFD" comment.

Yes, at least, we need this FIXME for now.

Quoted 224 lines
Quoted 11 lines
Quoted 7 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 601

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+   /* Custom width needs to be programmed to 0 for both the phy lanes */
+   intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+                 PHY_C10_VDR_CUSTOM_WIDTH, 0x3, 0,
+ MB_WRITE_COMMITTED);

The above hard-coded values should have a macro definiton.

Ok. I add these values as definitions

Quoted 1 line
Quoted 1 line

+ intel_cx0_rmw(i915, encoder->port, follower_lane,

PHY_C10_VDR_CONTROL(1),

Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+                 C10_VDR_CTRL_MASTER_LANE, C10_VDR_CTRL_UPDATE_CFG,
+                 MB_WRITE_COMMITTED);
+
+   /* Program the pll values only for the master lane */
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+           /* If not using ssc pll[4] through pll[8] must be 0*/
+           intel_cx0_write(i915, encoder->port, master_lane,

PHY_C10_VDR_PLL(i),

Quoted 12 lines
Quoted 5 lines
Quoted 2 lines

+ (!use_ssc && (i > 3 && i < 9)) ? 0 :
+ pll_state->pll[i],

pll_state->pll should be setup already intel_c10mpllb_calc_state() taking into account SSC as well.

Yes, I will need this state calculation fixed.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+                           (i % 4) ? MB_WRITE_UNCOMMITTED :
+ MB_WRITE_COMMITTED);
+
+   intel_cx0_write(i915, encoder->port, master_lane,

PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

+ intel_cx0_write(i915, encoder->port, master_lane,
+ PHY_C10_VDR_TX(0), C10_TX0_VAL, MB_WRITE_COMMITTED);

Instead of C10_TX0_VAL the flags programmed should be better described here as cmn0 above.

Ok. I'll try to fix this.

Quoted 2 lines
Quoted 2 lines

+ intel_cx0_rmw(i915, encoder->port, master_lane,

PHY_C10_VDR_CONTROL(1),

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ C10_VDR_CTRL_MSGBUS_ACCESS,

C10_VDR_CTRL_MASTER_LANE |

Quoted 5 lines
Quoted 1 line
Quoted 1 line

+ C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED); }

[...]

Quoted 1 line
Quoted 1 line

+static void intel_cx0_powerdown_change_sequence(struct

drm_i915_private *i915,

Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+                                           enum port port,
+                                           u8 lane, u8 state) {
+   enum phy phy = intel_port_to_phy(i915, port);
+
+   intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+                XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK |

XELPDP_LANE1_POWERDOWN_NEW_STATE_MASK,

Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+                intel_cx0_get_powerdown_state(lane, state));
+   intel_de_rmw(i915, XELPDP_PORT_BUF_CTL2(port),
+                XELPDP_LANE0_POWERDOWN_UPDATE |

XELPDP_LANE1_POWERDOWN_UPDATE,

Quoted 11 lines
Quoted 8 lines
Quoted 1 line

+ intel_cx0_get_powerdown_update(lane));

The spec says (65451):
"Only update powerdown for one port at a time. Wait for powerdown update to finish for one port before initiating update on another port."

both could be updated at the same time if a non-zero stagger delay was programmed, but for C10/C20 it must be programmed as 0.

So this needs to be updated so that we update one port and wait for transaction to complete before updating the second port.

Yes.

Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 751

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+
+   /* Update Timeout Value */
+   if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
+

intel_cx0_get_powerdown_update(lane), 0,

Quoted 1 line
Quoted 1 line
Quoted 1 line

+

XELPDP_PORT_POWERDOWN_UPDATE_TIMEOUT_US, 0, NULL))

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ drm_warn(&i915->drm, "PHY %c failed to bring out of Lane reset

after %dus.\n",

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+                    phy_name(phy),
+XELPDP_PORT_RESET_START_TIMEOUT_US);
+}
+

[...]

Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+
+static void intel_c10_program_phy_lane(struct drm_i915_private *i915,
+                                  struct intel_encoder *encoder, int lane_count,
+                                  bool lane_reversal) {
+   u8 l0t1, l0t2, l1t1, l1t2;
+   bool dp_alt_mode =

intel_tc_port_in_dp_alt_mode(enc_to_dig_port(encoder));

Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+   enum port port = encoder->port;
+
+   intel_cx0_rmw(i915, port, INTEL_CX0_BOTH_LANES,

PHY_C10_VDR_CONTROL(1),

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ C10_VDR_CTRL_MSGBUS_ACCESS,

C10_VDR_CTRL_MSGBUS_ACCESS,

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+ MB_WRITE_COMMITTED);

TODO: DP-alt MFD case where only one PHY lane should be programmed.

TODO comment here or should I add the fix for DP-alt MFD case here?

I think it could be fixed up later with all other places programming now both PHY lanes unconditionally, adding only a TODO: comment here for now.

--Imre

Quoted 4 lines
Quoted 4 lines

Review

Quoted 4 lines
(quoted diff) +2 -0
+
+   l0t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(1, 2));

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ l0t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(2, 2));

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ l1t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE1,

PHY_CX0_TX_CONTROL(1, 2));

Quoted 10 lines
Quoted 10 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+   l1t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE1,
+ PHY_CX0_TX_CONTROL(2, 2));
+

Would be clearer setting here CONTROL2_DISABLE_SINGLE_TX in all of l[0/1]t[1/2], and then

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+   if (lane_reversal) {
+           switch (lane_count) {
+           case 1:
Quoted 7 lines
Quoted 7 lines
                      l1t1 &= ~CONTROL2_DISABLE_SINGLE_TX;
                      break;

                      etc. for 2,3,4 lanes and then
Quoted 2 lines
(quoted diff) +2 -0
+                   /* Disable MLs 1(lane0), 2(lane0), 3(lane1) */
+                   intel_cx0_write(i915, port, INTEL_CX0_LANE1,

PHY_CX0_TX_CONTROL(1, 2),

Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+                                   l1t1 | CONTROL2_DISABLE_SINGLE_TX,
+                                   MB_WRITE_COMMITTED);
+                   fallthrough;
 
 
+           case 2:
+                   /* Disable MLs 1(lane0), 2(lane0) */
+                   intel_cx0_write(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(2, 2),

Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+                                   l0t2 | CONTROL2_DISABLE_SINGLE_TX,
+                                   MB_WRITE_COMMITTED);
+                   fallthrough;
+           case 3:
+                   /* Disable MLs 1(lane0) */
+                   intel_cx0_write(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(1, 2),

Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+                                   l0t1 | CONTROL2_DISABLE_SINGLE_TX,
+                                   MB_WRITE_COMMITTED);
+                   break;
+           }
+   } else {
+           switch (lane_count) {
+           case 1:
+                   if (dp_alt_mode) {
+                           /* Disable MLs 1(lane0), 3(lane1), 4(lane1) */
+                           intel_cx0_write(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(1, 2),

Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+                                           l0t1 | CONTROL2_DISABLE_SINGLE_TX,
+                                           MB_WRITE_COMMITTED);
+                   } else {
+                           /* Disable MLs 2(lane0), 3(lane1), 4(lane1) */
+                           intel_cx0_write(i915, port, INTEL_CX0_LANE0,

PHY_CX0_TX_CONTROL(2, 2),

Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+                                           l0t2 | CONTROL2_DISABLE_SINGLE_TX,
+                                           MB_WRITE_COMMITTED);
+                   }
+                   fallthrough;
+           case 2:
+                   /* Disable MLs 3(lane1), 4(lane1) */
+                   intel_cx0_write(i915, port, INTEL_CX0_LANE1,

PHY_CX0_TX_CONTROL(1, 2),

Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+                                   l1t1 | CONTROL2_DISABLE_SINGLE_TX,
+                                   MB_WRITE_COMMITTED);
+                   fallthrough;
+           case 3:
+                   /* Disable MLs 4(lane1) */
+                   intel_cx0_write(i915, port, INTEL_CX0_LANE1,

PHY_CX0_TX_CONTROL(2, 2),

Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 904

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+                                   l1t2 | CONTROL2_DISABLE_SINGLE_TX,
+                                   MB_WRITE_COMMITTED);
+                   break;
+           }
+   }

write here PHY_CX0_LANE[0/1], PHY_CX0_TX_CONTROL([1/2], 2)

Quoted 11 lines

Ok.

Quoted 5 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 906

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+
+   if (intel_is_c10phy(i915, intel_port_to_phy(i915, port))) {

This check is not needed, as we get here only for C10 PHY.

Right. I will remove that.

Quoted 2 lines
Quoted 2 lines

+ intel_cx0_rmw(i915, port, INTEL_CX0_LANE1,

PHY_C10_VDR_CONTROL(1),

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

+ C10_VDR_CTRL_UPDATE_CFG |
+ C10_VDR_CTRL_MSGBUS_ACCESS,

Should the above clear C10_VDR_CTRL_MASTER_LANE?

Quoted 2 lines
(quoted diff) +2 -0
+                         C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+           intel_cx0_rmw(i915, port, INTEL_CX0_LANE0,

PHY_C10_VDR_CONTROL(1),

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ C10_VDR_CTRL_UPDATE_CFG |

C10_VDR_CTRL_MSGBUS_ACCESS,

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ C10_VDR_CTRL_MASTER_LANE |

C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2 -0
+   }
+}
#14 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 33 lines · Mika

[...]

Quoted 32 lines
Quoted 31 lines
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +19 -0
+void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
+                                struct intel_c10mpllb_state
+*pll_state) {
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+   u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+                             INTEL_CX0_LANE0;
+   enum phy phy = intel_port_to_phy(i915, encoder->port);
+   int i;
+   u8 cmn, tx0;
+
+   /*
+    * According to C10 VDR Register programming Sequence we need
+    * to do this to read PHY internal registers from MsgBus.
+    */
+   intel_cx0_rmw(i915, encoder->port, lane, PHY_C10_VDR_CONTROL(1), 0,
+                 C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 559

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+           pll_state->pll[i] = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_PLL(i));
+
+   cmn = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_CMN(0));
+   tx0 = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_TX(0));

The driver programs these registers, so why aren't they also stored in the intell_c20pll_state struct?

Maybe I'm not really following here but intel_c20pll_state has its own tx, cmn and mplla/mpllb stored.

Quoted 6 lines
Quoted 2 lines

Yes, just typoed that, I meant struct intel_c10mpllb_state which doesn't include tx and cmn.

Yes, for C10 tx and cmn is missing. Maybe we could add those here as well. It seems that currently these are not necessary required but for the future use, these could be defined.

These are needed already now to make the state computation / HW readout / state checking work for these two params the same way they do for the rest of PLL state.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 563

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+
+   if (tx0 != C10_TX0_VAL || cmn != C10_CMN0_DP_VAL)
+           drm_warn(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",
+                    tx0, cmn, phy_name(phy));

Shouldn't PHY_C10_VDR_CONTROL(1)/C10_VDR_CTRL_MSGBUS_ACCESS be cleared here?

Usually this means that we are not accessing these values from the register. Was this in the spec that we would need to clear it?

Quoted 7 lines
Quoted 5 lines

It does get cleared at the end of intel_c10_pll_program(), at least from one of the PHY lanes, so was wondering why things are done differently here. Yes, the spec doesn't require clearing it, but then it should not be cleared at other places either (has related comments on this in follow-up reviews).

To be consistent maybe we can clear this here as well.

If there is no need for it, let's follow the spec and not clear it at any other spot either.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
(quoted diff) +2 -0
+}
+
#15 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 56 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Tuesday, April 4, 2023 6:28 AM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; Sripada, Radhakrishna <[email protected]>; Shankar, Uma <[email protected]>; Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 3 lines · Mika

[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+void intel_c10mpllb_readout_hw_state(struct intel_encoder

*encoder,

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+                                struct intel_c10mpllb_state
+*pll_state) {
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits &

DDI_BUF_PORT_REVERSAL;

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +11 -0
+   u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+                             INTEL_CX0_LANE0;
+   enum phy phy = intel_port_to_phy(i915, encoder->port);
+   int i;
+   u8 cmn, tx0;
+
+   /*
+    * According to C10 VDR Register programming Sequence we need
+    * to do this to read PHY internal registers from MsgBus.
+    */
+   intel_cx0_rmw(i915, encoder->port, lane,

PHY_C10_VDR_CONTROL(1), 0,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ C10_VDR_CTRL_MSGBUS_ACCESS,

MB_WRITE_COMMITTED);

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 555

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+           pll_state->pll[i] = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_PLL(i));

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+   cmn = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_CMN(0));

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ tx0 = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_TX(0));

Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

The driver programs these registers, so why aren't they also stored in the intell_c20pll_state struct?

Maybe I'm not really following here but intel_c20pll_state has its own tx, cmn and mplla/mpllb stored.

Yes, just typoed that, I meant struct intel_c10mpllb_state which doesn't include tx and cmn.

Quoted 7 lines
Quoted 3 lines

Yes, for C10 tx and cmn is missing. Maybe we could add those here as well. It seems that currently these are not necessary required but for the future use, these could be defined.

These are needed already now to make the state computation / HW readout / state checking work for these two params the same way they do for the rest of PLL state.

I believe C10 tx and cmn values are not changing across frequencies. Cmn on ly Changes for DP and HDMI so does it make sense to include in the pll structure?

-RK

Quoted 29 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+
+   if (tx0 != C10_TX0_VAL || cmn != C10_CMN0_DP_VAL)
+           drm_warn(&i915->drm, "Unexpected tx: %x or cmn: %x for phy:

%c.\n",

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+ tx0, cmn, phy_name(phy));

Shouldn't

PHY_C10_VDR_CONTROL(1)/C10_VDR_CTRL_MSGBUS_ACCESS be

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

cleared here?

Usually this means that we are not accessing these values from the register. Was this in the spec that we would need to clear it?

Quoted 7 lines
Quoted 5 lines

It does get cleared at the end of intel_c10_pll_program(), at least from one of the PHY lanes, so was wondering why things are done differently here. Yes, the spec doesn't require clearing it, but then it should not be cleared at other places either (has related comments on this in follow-up reviews).

To be consistent maybe we can clear this here as well.

If there is no need for it, let's follow the spec and not clear it at any other spot either.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
(quoted diff) +2 -0
+}
+
#16 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 52 lines · Radhakrishna
Quoted 52 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Tuesday, April 4, 2023 6:28 AM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; Sripada, Radhakrishna <[email protected]>; Shankar, Uma <[email protected]>; Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 38 lines · Mika

[...]

Quoted 28 lines
Quoted 28 lines
Quoted 27 lines
Quoted 14 lines
(quoted diff) +13 -0
+void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
+                                struct intel_c10mpllb_state pll_state) {
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+   u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+                             INTEL_CX0_LANE0;
+   enum phy phy = intel_port_to_phy(i915, encoder->port);
+   int i;
+   u8 cmn, tx0;
+
+   /*
+    * According to C10 VDR Register programming Sequence we need

Review

Quoted 10 lines
(quoted diff) +10 -0
+    * to do this to read PHY internal registers from MsgBus.
+    */
+   intel_cx0_rmw(i915, encoder->port, lane, PHY_C10_VDR_CONTROL(1), 0,
+                 C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+           pll_state->pll[i] = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_PLL(i));
+
+   cmn = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_CMN(0));
+   tx0 = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_TX(0));

The driver programs these registers, so why aren't they also stored in the intell_c20pll_state struct?

Quoted 5 lines
Quoted 2 lines

Maybe I'm not really following here but intel_c20pll_state has its own tx, cmn and mplla/mpllb stored.

Yes, just typoed that, I meant struct intel_c10mpllb_state which doesn't include tx and cmn.

Yes, for C10 tx and cmn is missing. Maybe we could add those here as well. It seems that currently these are not necessary required but for the future use, these could be defined.

Quoted 6 lines
Quoted 3 lines

These are needed already now to make the state computation / HW readout / state checking work for these two params the same way they do for the rest of PLL state.

I believe C10 tx and cmn values are not changing across frequencies. Cmn only Changes for DP and HDMI so does it make sense to include in the pll structure?

They should be part of the atomic state. To save the bytes in the precomputed tables they could be added to intel_cx0pll_state, something like:

struct intel_cx0pll_state {
        union {
                struct {
                        struct intel_c10mpllb_state pllb;
                        u8 cmn;
                        u8 tx;
                } c10;
                struct intel_c20pll_state c20pll_state;
        };
};

--Imre

#17 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 87 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Tuesday, April 4, 2023 11:03 AM
To: Sripada, Radhakrishna <[email protected]>
Cc: Kahola, Mika <[email protected]>; [email protected]; Shankar, Uma <[email protected]>; Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 8 lines · Radhakrishna
Quoted 8 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Tuesday, April 4, 2023 6:28 AM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; Sripada, Radhakrishna <[email protected]>; Shankar, Uma

<[email protected]>;

Quoted 2 lines
Quoted 2 lines

Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message

bus

Quoted 6 lines
Quoted 6 lines

and pll programming

Quoted 3 lines · Mika

[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+void intel_c10mpllb_readout_hw_state(struct intel_encoder

*encoder,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+                                struct intel_c10mpllb_state pll_state) {
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits &

DDI_BUF_PORT_REVERSAL;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+   u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+                             INTEL_CX0_LANE0;
+   enum phy phy = intel_port_to_phy(i915, encoder->port);
+   int i;
+   u8 cmn, tx0;
+
+   /*
+    * According to C10 VDR Register programming Sequence we

need

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+    * to do this to read PHY internal registers from MsgBus.
+    */
+   intel_cx0_rmw(i915, encoder->port, lane,

PHY_C10_VDR_CONTROL(1), 0,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ C10_VDR_CTRL_MSGBUS_ACCESS,

MB_WRITE_COMMITTED);

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+           pll_state->pll[i] = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_PLL(i));

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+   cmn = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_CMN(0));

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ tx0 = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_TX(0));

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

The driver programs these registers, so why aren't they also stored in the intell_c20pll_state struct?

Maybe I'm not really following here but intel_c20pll_state has its own tx, cmn and mplla/mpllb stored.

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Yes, just typoed that, I meant struct intel_c10mpllb_state which doesn't include tx and cmn.

Yes, for C10 tx and cmn is missing. Maybe we could add those here as well. It seems that currently these are not necessary required but for the future use, these could be defined.

These are needed already now to make the state computation / HW readout

/

Quoted 5 lines
Quoted 2 lines

state checking work for these two params the same way they do for the rest of PLL state.

I believe C10 tx and cmn values are not changing across frequencies. Cmn only Changes for DP and HDMI so does it make sense to include in the pll structure?

They should be part of the atomic state. To save the bytes in the precomputed tables they could be added to intel_cx0pll_state, something like:

Quoted 11 lines
struct intel_cx0pll_state {
        union {
                struct {
                        struct intel_c10mpllb_state pllb;
                        u8 cmn;
                        u8 tx;
                } c10;
                struct intel_c20pll_state c20pll_state;
        };
};

I am bit concerned about the mismatch in the names for c10 and c20 states, adding further complexity in the structure may look more ugly. Let us afford the extra space in the tables if they need to be part of the atomic state and maintain homogeneity across c10 and c20 structures.

Thoughts?

-RK

Quoted 1 line

--Imre

#18 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 98 lines · Radhakrishna
Quoted 87 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Tuesday, April 4, 2023 11:03 AM
To: Sripada, Radhakrishna <[email protected]>
Cc: Kahola, Mika <[email protected]>; [email protected]; Shankar, Uma <[email protected]>; Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 8 lines · Radhakrishna
Quoted 8 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Tuesday, April 4, 2023 6:28 AM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; Sripada, Radhakrishna <[email protected]>; Shankar, Uma

<[email protected]>;

Quoted 2 lines
Quoted 2 lines

Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message

bus

Quoted 6 lines
Quoted 6 lines

and pll programming

Quoted 3 lines · Mika

[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+void intel_c10mpllb_readout_hw_state(struct intel_encoder

*encoder,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+                                struct intel_c10mpllb_state pll_state) {
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits &

DDI_BUF_PORT_REVERSAL;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+   u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
+                             INTEL_CX0_LANE0;
+   enum phy phy = intel_port_to_phy(i915, encoder->port);
+   int i;
+   u8 cmn, tx0;
+
+   /*
+    * According to C10 VDR Register programming Sequence we

need

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+    * to do this to read PHY internal registers from MsgBus.
+    */
+   intel_cx0_rmw(i915, encoder->port, lane,

PHY_C10_VDR_CONTROL(1), 0,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ C10_VDR_CTRL_MSGBUS_ACCESS,

MB_WRITE_COMMITTED);

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+           pll_state->pll[i] = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_PLL(i));

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+   cmn = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_CMN(0));

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ tx0 = intel_cx0_read(i915, encoder->port, lane,

PHY_C10_VDR_TX(0));

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

The driver programs these registers, so why aren't they also stored in the intell_c20pll_state struct?

Maybe I'm not really following here but intel_c20pll_state has its own tx, cmn and mplla/mpllb stored.

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Yes, just typoed that, I meant struct intel_c10mpllb_state which doesn't include tx and cmn.

Yes, for C10 tx and cmn is missing. Maybe we could add those here as well. It seems that currently these are not necessary required but for the future use, these could be defined.

These are needed already now to make the state computation / HW readout

/

Quoted 5 lines
Quoted 2 lines

state checking work for these two params the same way they do for the rest of PLL state.

I believe C10 tx and cmn values are not changing across frequencies. Cmn only Changes for DP and HDMI so does it make sense to include in the pll structure?

They should be part of the atomic state. To save the bytes in the precomputed tables they could be added to intel_cx0pll_state, something like:

Quoted 11 lines
struct intel_cx0pll_state {
        union {
                struct {
                        struct intel_c10mpllb_state pllb;
                        u8 cmn;
                        u8 tx;
                } c10;
                struct intel_c20pll_state c20pll_state;
        };
};
Quoted 4 lines

I am bit concerned about the mismatch in the names for c10 and c20 states, adding further complexity in the structure may look more ugly. Let us afford the extra space in the tables if they need to be part of the atomic state and maintain homogeneity across c10 and c20 structures.

Both ways are better than the current way and fine by me.

Quoted 5 lines

Thoughts?

-RK

Quoted 1 line

--Imre

#19 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

In reply to Mika Kahola
Quoted 12 lines · Mika Kahola

From: Radhakrishna Sripada <[email protected]>

XELPDP has C10 and C20 phys from Synopsys to drive displays. Each phy has a dedicated PIPE 5.2 Message bus for configuration. This message bus is used to configure the phy internal registers.

XELPDP has C10 phys to drive output to the EDP and the native output from the display engine. Add structures, programming hardware state readout logic. Port clock calculations are similar to DG2. Use the DG2 formulae to calculate the port clock but use the relevant pll signals.
Note: PHY lane 0 is always used for PLL programming.

Quoted 4 lines

Add sequences for C10 phy enable/disable phy lane reset, powerdown change sequence and phy lane programming.

Bspec: 64539, 64568, 64599, 65100, 65101, 65450, 65451, 67610, 67636

Shouldn't the basic MTL DP/HDMI modeset sequences be part of this patchset? I can't see how things would work otherwise. For DP it is the

"drm/i915/mtl/display: Implement DisplayPort sequences"

patch in the internal tree.

More things below, besides my earlier review comments.

Quoted 33 lines

[...]

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +32 -0
+
+static void intel_c10_pll_program(struct drm_i915_private *i915,
+				  const struct intel_crtc_state *crtc_state,
+				  struct intel_encoder *encoder)
+{
+	const struct intel_c10mpllb_state *pll_state = &crtc_state->c10mpllb_state;
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+	u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+					 INTEL_CX0_LANE0;
+	u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+					   INTEL_CX0_LANE1;
+
+	int i;
+	struct intel_dp *intel_dp;
+	bool use_ssc = false;
+	u8 cmn0 = 0;
+
+	if (intel_crtc_has_dp_encoder(crtc_state)) {
+		intel_dp = enc_to_intel_dp(encoder);
+		use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+			  DP_MAX_DOWNSPREAD_0_5);
+
+		if (!intel_panel_use_ssc(i915))
+			use_ssc = false;
+
+		cmn0 = C10_CMN0_DP_VAL;
+	}
+
+	intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
+			C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+	/* Custom width needs to be programmed to 0 for both the phy lanes */

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 606

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+	intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+		      PHY_C10_VDR_CUSTOM_WIDTH, 0x3, 0, MB_WRITE_COMMITTED);
+	intel_cx0_rmw(i915, encoder->port, follower_lane, PHY_C10_VDR_CONTROL(1),
+		      C10_VDR_CTRL_MASTER_LANE, C10_VDR_CTRL_UPDATE_CFG,
+		      MB_WRITE_COMMITTED);
+
+	/* Program the pll values only for the master lane */
+	for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+		/* If not using ssc pll[4] through pll[8] must be 0*/
+		intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_PLL(i),

This programs the PLL via the INTEL_CX0_LANE1 lane in the lane_reversal=true case. However, I haven't found any trace of this being correct in the spec. It just says that PLL must be programmed via INTEL_CX0_LANE0 in all the cases, so both for lane_reversal and !lane_reversal (see Bspec/64539 "Phy Lane and Transmitter Usage" table/"Lane for message bus PLL programming" column).

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 614

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +8 -0
+				(!use_ssc && (i > 3 && i < 9)) ? 0 : pll_state->pll[i],
+				(i % 4) ? MB_WRITE_UNCOMMITTED : MB_WRITE_COMMITTED);
+
+	intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);
+	intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_TX(0), C10_TX0_VAL, MB_WRITE_COMMITTED);
+	intel_cx0_rmw(i915, encoder->port, master_lane, PHY_C10_VDR_CONTROL(1),
+		      C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MASTER_LANE |
+		      C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);

For all the above writes, programming INTEL_CX0_LANE1 looks incorrect in the lane_reversal=true case, should program INTEL_CX0_LANE0 instead.

Quoted 29 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+}
+
 
[...]
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +15 -1
index d1ee8a2fc9cf..15e249f46a64 100644
@@ -128,4 +128,34 @@
 #define   XELPDP_SSC_ENABLE_PLLA			REG_BIT(1)
 #define   XELPDP_SSC_ENABLE_PLLB			REG_BIT(0)
 
-#endif /* __INTEL_CX0_PHY_REGS_H__ */
+/* C10 Vendor Registers */
+#define PHY_C10_VDR_PLL(idx)		(0xC00 + (idx))
+#define   C10_PLL0_FRACEN		REG_BIT8(4)
+#define   C10_PLL3_MULTIPLIERH_MASK	REG_GENMASK8(3, 0)
+#define   C10_PLL15_TXCLKDIV_MASK	REG_GENMASK8(2, 0)
+#define PHY_C10_VDR_CMN(idx)		(0xC20 + (idx))
+#define   C10_CMN0_DP_VAL		0x21
+#define   C10_CMN3_TXVBOOST_MASK	REG_GENMASK8(7, 5)
+#define   C10_CMN3_TXVBOOST(val)	REG_FIELD_PREP8(C10_CMN3_TXVBOOST_MASK, val)
+#define PHY_C10_VDR_TX(idx)		(0xC30 + (idx))
+#define   C10_TX0_VAL			0x10
+#define PHY_C10_VDR_CONTROL(idx)	(0xC70 + (idx) - 1)
+#define   C10_VDR_CTRL_MSGBUS_ACCESS	REG_BIT8(2)
+#define   C10_VDR_CTRL_MASTER_LANE	REG_BIT8(1)
+#define   C10_VDR_CTRL_UPDATE_CFG	REG_BIT8(0)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 155

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +10 -0
+#define PHY_C10_VDR_CUSTOM_WIDTH	0xD02
+
+#define CX0_P0_STATE_ACTIVE             0x0
+#define CX0_P2_STATE_READY              0x2
+#define CX0_P2PG_STATE_DISABLE          0x9
+#define CX0_P4PG_STATE_DISABLE          0xC
+#define CX0_P2_STATE_RESET              0x2
+
+/* PHY_C10_VDR_PLL0 */
+#define PLL_C10_MPLL_SSC_EN             REG_BIT8(0)

These should be indented and moved to be under their register (XELPDP_PORT_BUF_CTL3, PHY_C10_VDR_PLL).

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 159

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +4 -0
+
+/* PIPE SPEC Defined Registers */
+#define PHY_CX0_TX_CONTROL(tx, control) (0x400 + ((tx) - 1) * 0x200 + (control))
+#define CONTROL2_DISABLE_SINGLE_TX      REG_BIT(6)

The flag should be indented.

Quoted 52 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2 -0
+
+#endif /* __INTEL_CX0_REG_DEFS_H__ */
 
[...]
drivers/gpu/drm/i915/i915_reg_defs.h +28 -0
index db26de6b57bc..f9d7c03e95d6 100644
@@ -22,6 +22,19 @@
 	       BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&		\
 				 ((__n) < 0 || (__n) > 31))))
 
+/**
+ * REG_BIT8() - Prepare a u8 bit value
+ * @__n: 0-based bit number
+ *
+ * Local wrapper for BIT() to force u8, with compile time checks.
+ *
+ * @return: Value with bit @__n set.
+ */
+#define REG_BIT8(__n)                                                   \
+	((u8)(BIT(__n) +                                                \
+	       BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&         \
+				 ((__n) < 0 || (__n) > 7))))
+
 /**
  * REG_GENMASK() - Prepare a continuous u32 bitmask
  * @__high: 0-based high bit
@@ -52,6 +65,21 @@
 				 __is_constexpr(__low) &&		\
 				 ((__low) < 0 || (__high) > 63 || (__low) > (__high)))))
 
+/**
+ * REG_GENMASK8() - Prepare a continuous u8 bitmask
+ * @__high: 0-based high bit
+ * @__low: 0-based low bit
+ *
+ * Local wrapper for GENMASK() to force u8, with compile time checks.
+ *
+ * @return: Continuous bitmask from @__high to @__low, inclusive.
+ */
+#define REG_GENMASK8(__high, __low)                                     \
+	((u8)(GENMASK(__high, __low) +                                  \
+	       BUILD_BUG_ON_ZERO(__is_constexpr(__high) &&      \
+				 __is_constexpr(__low) &&               \
+				 ((__low) < 0 || (__high) > 7 || (__low) > (__high)))))
+
 /*
  * Local integer constant expression version of is_power_of_2().
  */

drivers/gpu/drm/i915/i915_reg_defs.h line 110

Quoted 9 lines
drivers/gpu/drm/i915/i915_reg_defs.h +6 -0
@@ -74,6 +102,23 @@
 	       BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
 	       BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
 
+/**
+ * REG_FIELD_PREP8() - Prepare a u8 bitfield value
+ * @__mask: shifted mask defining the field's length and position
+ * @__val: value to put in the field
+ *
+ * Local copy of FIELD_PREP8() to generate an integer constant expression, force

The above is FIELD_PREP() only.

Quoted 36 lines
drivers/gpu/drm/i915/i915_reg_defs.h +23 -0
+ * u8 and for consistency with REG_FIELD_GET8(), REG_BIT8() and REG_GENMASK8().
+ *
+ * @return: @__val masked and shifted into the field defined by @__mask.
+ */
+#define REG_FIELD_PREP8(__mask, __val)                                          \
+	((u8)((((typeof(__mask))(__val) << __bf_shf(__mask)) & (__mask)) +      \
+	       BUILD_BUG_ON_ZERO(!__is_constexpr(__mask)) +             \
+	       BUILD_BUG_ON_ZERO((__mask) == 0 || (__mask) > U8_MAX) +          \
+	       BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
+	       BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
+
 /**
  * REG_FIELD_GET() - Extract a u32 bitfield value
  * @__mask: shifted mask defining the field's length and position
@@ -155,6 +200,18 @@
  */
 #define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
 
+/**
+ * REG_FIELD_GET8() - Extract a u8 bitfield value
+ * @__mask: shifted mask defining the field's length and position
+ * @__val: value to extract the bitfield value from
+ *
+ * Local wrapper for FIELD_GET() to force u8 and for consistency with
+ * REG_FIELD_PREP(), REG_BIT() and REG_GENMASK().
+ *
+ * @return: Masked and shifted value of the field defined by @__mask in @__val.
+ */
+#define REG_FIELD_GET8(__mask, __val)   ((u8)FIELD_GET(__mask, __val))
+
 typedef struct {
 	u32 reg;
 } i915_reg_t;
Signature · 1 line
2.34.1
#20 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 26 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Monday, April 3, 2023 1:12 PM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; Sripada, Radhakrishna <[email protected]>; Shankar, Uma <[email protected]>; Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 15 lines · Mika Kahola

From: Radhakrishna Sripada <[email protected]>

XELPDP has C10 and C20 phys from Synopsys to drive displays. Each phy has a dedicated PIPE 5.2 Message bus for configuration. This message bus is used to configure the phy internal registers.

XELPDP has C10 phys to drive output to the EDP and the native output from the display engine. Add structures, programming hardware state readout logic. Port clock calculations are similar to DG2. Use the DG2 formulae to calculate the port clock but use the relevant pll signals.
Note: PHY lane 0 is always used for PLL programming.

Add sequences for C10 phy enable/disable phy lane reset, powerdown change sequence and phy lane programming.

Quoted 8 lines
Quoted 1 line

Bspec: 64539, 64568, 64599, 65100, 65101, 65450, 65451, 67610, 67636

Shouldn't the basic MTL DP/HDMI modeset sequences be part of this patchset? I can't see how things would work otherwise. For DP it is the

"drm/i915/mtl/display: Implement DisplayPort sequences"

patch in the internal tree.

The idea was to get the eDP supported with this C10 series. We could go back to the original form and have all C10/C20/TBT patches in one series.

Quoted 71 lines

More things below, besides my earlier review comments.

Review

Quoted 10 lines

[...]

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +6 -0
+
+static void intel_c10_pll_program(struct drm_i915_private *i915,
+				  const struct intel_crtc_state *crtc_state,
+				  struct intel_encoder *encoder)
+{
+	const struct intel_c10mpllb_state *pll_state = &crtc_state-

c10mpllb_state;

(quoted diff) +2 -0
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	bool lane_reversal = dig_port->saved_port_bits &

DDI_BUF_PORT_REVERSAL;

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +12 -0
+	u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+					 INTEL_CX0_LANE0;
+	u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+					   INTEL_CX0_LANE1;
+
+	int i;
+	struct intel_dp *intel_dp;
+	bool use_ssc = false;
+	u8 cmn0 = 0;
+
+	if (intel_crtc_has_dp_encoder(crtc_state)) {
+		intel_dp = enc_to_intel_dp(encoder);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+		use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+			  DP_MAX_DOWNSPREAD_0_5);
+
+		if (!intel_panel_use_ssc(i915))
+			use_ssc = false;
+
+		cmn0 = C10_CMN0_DP_VAL;
+	}
+
+	intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES,

PHY_C10_VDR_CONTROL(1),

Review

Quoted 1 line
(quoted diff) +1 -0
+			C10_VDR_CTRL_MSGBUS_ACCESS,

MB_WRITE_COMMITTED);

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +3 -0
+	/* Custom width needs to be programmed to 0 for both the phy lanes */
+	intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+		      PHY_C10_VDR_CUSTOM_WIDTH, 0x3, 0,

MB_WRITE_COMMITTED);

Review

Quoted 1 line
(quoted diff) +1 -0
+	intel_cx0_rmw(i915, encoder->port, follower_lane,

PHY_C10_VDR_CONTROL(1),

Review

Quoted 1 line
(quoted diff) +1 -0
+		      C10_VDR_CTRL_MASTER_LANE,

C10_VDR_CTRL_UPDATE_CFG,

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +7 -0
+		      MB_WRITE_COMMITTED);
+
+	/* Program the pll values only for the master lane */
+	for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+		/* If not using ssc pll[4] through pll[8] must be 0*/
+		intel_cx0_write(i915, encoder->port, master_lane,
+PHY_C10_VDR_PLL(i),

This programs the PLL via the INTEL_CX0_LANE1 lane in the lane_reversal=true case. However, I haven't found any trace of this being correct in the spec. It just says that PLL must be programmed via
INTEL_CX0_LANE0 in all the cases, so both for lane_reversal and !lane_reversal (see Bspec/64539 "Phy Lane and Transmitter Usage"
table/"Lane for message bus PLL programming" column).

Review

Quoted 3 lines
(quoted diff) +1 -0
+				(!use_ssc && (i > 3 && i < 9)) ? 0 : pll_state-

pll[i],

(quoted diff) +1 -0
+				(i % 4) ? MB_WRITE_UNCOMMITTED :

MB_WRITE_COMMITTED);

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+	intel_cx0_write(i915, encoder->port, master_lane,

PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);

Review

Quoted 1 line
(quoted diff) +1 -0
+	intel_cx0_write(i915, encoder->port, master_lane,

PHY_C10_VDR_TX(0), C10_TX0_VAL, MB_WRITE_COMMITTED);

Quoted 8 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	intel_cx0_rmw(i915, encoder->port, master_lane,

PHY_C10_VDR_CONTROL(1),

Review

Quoted 1 line
(quoted diff) +1 -0
+		      C10_VDR_CTRL_MSGBUS_ACCESS,

C10_VDR_CTRL_MASTER_LANE |

Review

Quoted 1 line
(quoted diff) +1 -0
+		      C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);

For all the above writes, programming INTEL_CX0_LANE1 looks incorrect in the lane_reversal=true case, should program INTEL_CX0_LANE0 instead.

So in any case we should program INTEL_CX0_LANE0?

Quoted 37 lines
Quoted 15 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +2 -0
+}
+
 
[...]
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0 -0
index d1ee8a2fc9cf..15e249f46a64 100644
@@ -128,4 +128,34 @@
 #define   XELPDP_SSC_ENABLE_PLLA			REG_BIT(1)
 #define   XELPDP_SSC_ENABLE_PLLB			REG_BIT(0)
 

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 139

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +9 -1
-#endif /* __INTEL_CX0_PHY_REGS_H__ */
+/* C10 Vendor Registers */
+#define PHY_C10_VDR_PLL(idx)		(0xC00 + (idx))
+#define   C10_PLL0_FRACEN		REG_BIT8(4)
+#define   C10_PLL3_MULTIPLIERH_MASK	REG_GENMASK8(3, 0)
+#define   C10_PLL15_TXCLKDIV_MASK	REG_GENMASK8(2, 0)
+#define PHY_C10_VDR_CMN(idx)		(0xC20 + (idx))
+#define   C10_CMN0_DP_VAL		0x21
+#define   C10_CMN3_TXVBOOST_MASK	REG_GENMASK8(7, 5)
+#define   C10_CMN3_TXVBOOST(val)
	REG_FIELD_PREP8(C10_CMN3_TXVBOOST_MASK, val)
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +11 -0
+#define PHY_C10_VDR_TX(idx)		(0xC30 + (idx))
+#define   C10_TX0_VAL			0x10
+#define PHY_C10_VDR_CONTROL(idx)	(0xC70 + (idx) - 1)
+#define   C10_VDR_CTRL_MSGBUS_ACCESS	REG_BIT8(2)
+#define   C10_VDR_CTRL_MASTER_LANE	REG_BIT8(1)
+#define   C10_VDR_CTRL_UPDATE_CFG	REG_BIT8(0)
+#define PHY_C10_VDR_CUSTOM_WIDTH	0xD02
+
+#define CX0_P0_STATE_ACTIVE             0x0
+#define CX0_P2_STATE_READY              0x2
+#define CX0_P2PG_STATE_DISABLE          0x9
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 155

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +5 -0
+#define CX0_P4PG_STATE_DISABLE          0xC
+#define CX0_P2_STATE_RESET              0x2
+
+/* PHY_C10_VDR_PLL0 */
+#define PLL_C10_MPLL_SSC_EN             REG_BIT8(0)

These should be indented and moved to be under their register (XELPDP_PORT_BUF_CTL3, PHY_C10_VDR_PLL).

Ok. Let's move these to correct places.

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +3 -0
+
+/* PIPE SPEC Defined Registers */
+#define PHY_CX0_TX_CONTROL(tx, control) (0x400 + ((tx) - 1) * 0x200 +

(control))

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 159

Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1 -0
+#define CONTROL2_DISABLE_SINGLE_TX      REG_BIT(6)

The flag should be indented.

Ok.

Quoted 62 lines
Quoted 32 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2 -0
+
+#endif /* __INTEL_CX0_REG_DEFS_H__ */
 
[...]
drivers/gpu/drm/i915/i915_reg_defs.h +13 -0
index db26de6b57bc..f9d7c03e95d6 100644
@@ -22,6 +22,19 @@
 	       BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&		\
 				 ((__n) < 0 || (__n) > 31))))
 
+/**
+ * REG_BIT8() - Prepare a u8 bit value
+ * @__n: 0-based bit number
+ *
+ * Local wrapper for BIT() to force u8, with compile time checks.
+ *
+ * @return: Value with bit @__n set.
+ */
+#define REG_BIT8(__n)                                                   \
+	((u8)(BIT(__n) +                                                \
+	       BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&         \
+				 ((__n) < 0 || (__n) > 7))))
+
 /**
  * REG_GENMASK() - Prepare a continuous u32 bitmask
  * @__high: 0-based high bit

drivers/gpu/drm/i915/i915_reg_defs.h line 66

Quoted 2 lines
drivers/gpu/drm/i915/i915_reg_defs.h +0 -0
@@ -52,6 +65,21 @@
 				 __is_constexpr(__low) &&		\
 				 ((__low) < 0 || (__high) > 63 || (__low) >

(__high)))))

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg_defs.h +4 -0
+/**
+ * REG_GENMASK8() - Prepare a continuous u8 bitmask
+ * @__high: 0-based high bit
+ * @__low: 0-based low bit

drivers/gpu/drm/i915/i915_reg_defs.h

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg_defs.h +10 -0
+ *
+ * Local wrapper for GENMASK() to force u8, with compile time checks.
+ *
+ * @return: Continuous bitmask from @__high to @__low, inclusive.
+ */
+#define REG_GENMASK8(__high, __low)                                     \
+	((u8)(GENMASK(__high, __low) +                                  \
+	       BUILD_BUG_ON_ZERO(__is_constexpr(__high) &&      \
+				 __is_constexpr(__low) &&               \
+				 ((__low) < 0 || (__high) > 7 || (__low) >

(__high)))))

drivers/gpu/drm/i915/i915_reg_defs.h line 102

Quoted 6 lines
drivers/gpu/drm/i915/i915_reg_defs.h +1 -0
+
 /*
  * Local integer constant expression version of is_power_of_2().
  */
@@ -74,6 +102,23 @@
 	       BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL <<

__bf_shf(__mask)))) + \

Quoted 4 lines
drivers/gpu/drm/i915/i915_reg_defs.h +0 -0
 BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val),
 (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
 
Quoted 9 lines

drivers/gpu/drm/i915/i915_reg_defs.h

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg_defs.h +7 -0
+/**
+ * REG_FIELD_PREP8() - Prepare a u8 bitfield value
+ * @__mask: shifted mask defining the field's length and position
+ * @__val: value to put in the field
+ *
+ * Local copy of FIELD_PREP8() to generate an integer constant
+expression, force

The above is FIELD_PREP() only.

So use FIELD_PREP() instead of FIELD_PREP8()?

Quoted 44 lines

drivers/gpu/drm/i915/i915_reg_defs.h line 113

Quoted 2 lines
drivers/gpu/drm/i915/i915_reg_defs.h +1 -0
+ * u8 and for consistency with REG_FIELD_GET8(), REG_BIT8() and

REG_GENMASK8().

drivers/gpu/drm/i915/i915_reg_defs.h

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg_defs.h +7 -0
+ *
+ * @return: @__val masked and shifted into the field defined by @__mask.
+ */
+#define REG_FIELD_PREP8(__mask, __val)                                          \
+	((u8)((((typeof(__mask))(__val) << __bf_shf(__mask)) & (__mask)) +      \
+	       BUILD_BUG_ON_ZERO(!__is_constexpr(__mask)) +             \
+	       BUILD_BUG_ON_ZERO((__mask) == 0 || (__mask) > U8_MAX) +

\

drivers/gpu/drm/i915/i915_reg_defs.h line 121

Quoted 1 line
drivers/gpu/drm/i915/i915_reg_defs.h +1 -0
+	       BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL <<

__bf_shf(__mask)))) + \

Quoted 12 lines
drivers/gpu/drm/i915/i915_reg_defs.h +4 -1
+
+BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val),
+(~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
+
 /**
  * REG_FIELD_GET() - Extract a u32 bitfield value
  * @__mask: shifted mask defining the field's length and position @@
-155,6 +200,18 @@
  */
 #define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__

})[__index])

Quoted 9 lines

+/**
+ * REG_FIELD_GET8() - Extract a u8 bitfield value
+ * @__mask: shifted mask defining the field's length and position
+ * @__val: value to extract the bitfield value from
+ *
+ * Local wrapper for FIELD_GET() to force u8 and for consistency with
+ * REG_FIELD_PREP(), REG_BIT() and REG_GENMASK().
+ *
+ * @return: Masked and shifted value of the field defined by @__mask in

@__val.

Quoted 9 lines

+ */

drivers/gpu/drm/i915/i915_reg_defs.h +2 -1
+#define REG_FIELD_GET8(__mask, __val)   ((u8)FIELD_GET(__mask, __val))
+
 typedef struct {
 	u32 reg;
 } i915_reg_t;
--

2.34.1

#21 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 31 lines · Mika
Quoted 31 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Monday, April 3, 2023 1:12 PM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; Sripada, Radhakrishna <[email protected]>; Shankar, Uma <[email protected]>; Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 12 lines · Mika Kahola

From: Radhakrishna Sripada <[email protected]>

XELPDP has C10 and C20 phys from Synopsys to drive displays. Each phy has a dedicated PIPE 5.2 Message bus for configuration. This message bus is used to configure the phy internal registers.

XELPDP has C10 phys to drive output to the EDP and the native output from the display engine. Add structures, programming hardware state readout logic. Port clock calculations are similar to DG2. Use the DG2 formulae to calculate the port clock but use the relevant pll signals.
Note: PHY lane 0 is always used for PLL programming.

Quoted 4 lines

Add sequences for C10 phy enable/disable phy lane reset, powerdown change sequence and phy lane programming.

Bspec: 64539, 64568, 64599, 65100, 65101, 65450, 65451, 67610, 67636

Shouldn't the basic MTL DP/HDMI modeset sequences be part of this patchset? I can't see how things would work otherwise. For DP it is the

Quoted 7 lines
Quoted 3 lines

"drm/i915/mtl/display: Implement DisplayPort sequences"

patch in the internal tree.

The idea was to get the eDP supported with this C10 series. We could go back to the original form and have all C10/C20/TBT patches in one series.

As this series enables eDP and HDMI on C10, the parts that make this working should be in this patchset imo. C20 and TBT doesn't need to be, but I don't see how eDP or HDMI on C10 would work if the modeset sequence used for both C10 and C20 and both DP and HDMI modes is not updated for MTL.

Quoted 62 lines
Quoted 62 lines

More things below, besides my earlier review comments.

Quoted 33 lines

[...]

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +32 -0
+
+static void intel_c10_pll_program(struct drm_i915_private *i915,
+                             const struct intel_crtc_state *crtc_state,
+                             struct intel_encoder *encoder)
+{
+   const struct intel_c10mpllb_state *pll_state = &crtc_state->c10mpllb_state;
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+   u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+                                    INTEL_CX0_LANE0;
+   u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+                                      INTEL_CX0_LANE1;
+
+   int i;
+   struct intel_dp *intel_dp;
+   bool use_ssc = false;
+   u8 cmn0 = 0;
+
+   if (intel_crtc_has_dp_encoder(crtc_state)) {
+           intel_dp = enc_to_intel_dp(encoder);
+           use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+                     DP_MAX_DOWNSPREAD_0_5);
+
+           if (!intel_panel_use_ssc(i915))
+                   use_ssc = false;
+
+           cmn0 = C10_CMN0_DP_VAL;
+   }
+
+   intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
+                   C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+   /* Custom width needs to be programmed to 0 for both the phy lanes */

drivers/gpu/drm/i915/display/intel_cx0_phy.c line 606

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +10 -0
+   intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+                 PHY_C10_VDR_CUSTOM_WIDTH, 0x3, 0, MB_WRITE_COMMITTED);
+   intel_cx0_rmw(i915, encoder->port, follower_lane, PHY_C10_VDR_CONTROL(1),
+                 C10_VDR_CTRL_MASTER_LANE, C10_VDR_CTRL_UPDATE_CFG,
+                 MB_WRITE_COMMITTED);
+
+   /* Program the pll values only for the master lane */
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+           /* If not using ssc pll[4] through pll[8] must be 0*/
+           intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_PLL(i),

This programs the PLL via the INTEL_CX0_LANE1 lane in the lane_reversal=true case. However, I haven't found any trace of this being correct in the spec. It just says that PLL must be programmed via
INTEL_CX0_LANE0 in all the cases, so both for lane_reversal and !lane_reversal (see Bspec/64539 "Phy Lane and Transmitter Usage"
table/"Lane for message bus PLL programming" column).

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +8 -0
+                           (!use_ssc && (i > 3 && i < 9)) ? 0 : pll_state->pll[i],
+                           (i % 4) ? MB_WRITE_UNCOMMITTED : MB_WRITE_COMMITTED);
+
+   intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);
+   intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_TX(0), C10_TX0_VAL, MB_WRITE_COMMITTED);
+   intel_cx0_rmw(i915, encoder->port, master_lane, PHY_C10_VDR_CONTROL(1),
+                 C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MASTER_LANE |
+                 C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
Quoted 4 lines
Quoted 2 lines

For all the above writes, programming INTEL_CX0_LANE1 looks incorrect in the lane_reversal=true case, should program INTEL_CX0_LANE0 instead.

So in any case we should program INTEL_CX0_LANE0?

That's what the spec says at least, so I don't see a reason to not follow that.

Quoted 20 lines

[...]

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/i915/i915_reg_defs.h +1 -0
+
 /*
  * Local integer constant expression version of is_power_of_2().
  */
@@ -74,6 +102,23 @@
           BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
 
 BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val),
 (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
 
Quoted 8 lines

drivers/gpu/drm/i915/i915_reg_defs.h line 110

Quoted 6 lines
drivers/gpu/drm/i915/i915_reg_defs.h +6 -0
+/**
+ * REG_FIELD_PREP8() - Prepare a u8 bitfield value
+ * @__mask: shifted mask defining the field's length and position
+ * @__val: value to put in the field
+ *
+ * Local copy of FIELD_PREP8() to generate an integer constant expression, force

The above is FIELD_PREP() only.

Quoted 1 line

So use FIELD_PREP() instead of FIELD_PREP8()?

Yes, there is no FIELD_PREP8(), so I assume the reference was about FIELD_PREP().

--Imre

#22 lore raw

Re: [Intel-gfx] [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 49 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Monday, April 3, 2023 1:36 PM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; Sripada, Radhakrishna <[email protected]>; Shankar, Uma <[email protected]>; Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 13 lines · Mika
Quoted 13 lines

-----Original Message-----
From: Deak, Imre <[email protected]>
Sent: Monday, April 3, 2023 1:12 PM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; Sripada, Radhakrishna <[email protected]>; Shankar, Uma <[email protected]>; Sousa, Gustavo <[email protected]>
Subject: Re: [PATCH 4/7] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming

Quoted 2 lines · Mika Kahola

From: Radhakrishna Sripada <[email protected]>

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

XELPDP has C10 and C20 phys from Synopsys to drive displays. Each phy has a dedicated PIPE 5.2 Message bus for configuration. This message bus is used to configure the phy internal registers.

XELPDP has C10 phys to drive output to the EDP and the native output from the display engine. Add structures, programming hardware state readout logic. Port clock calculations are similar to DG2. Use the DG2 formulae to calculate the port clock but use the

relevant pll signals.

Quoted 16 lines
Quoted 15 lines
Quoted 7 lines

Note: PHY lane 0 is always used for PLL programming.

Add sequences for C10 phy enable/disable phy lane reset, powerdown change sequence and phy lane programming.

Bspec: 64539, 64568, 64599, 65100, 65101, 65450, 65451, 67610, 67636

Shouldn't the basic MTL DP/HDMI modeset sequences be part of this patchset? I can't see how things would work otherwise. For DP it is the

"drm/i915/mtl/display: Implement DisplayPort sequences"

patch in the internal tree.

Quoted 8 lines
Quoted 3 lines

The idea was to get the eDP supported with this C10 series. We could go back to the original form and have all C10/C20/TBT patches in one series.

As this series enables eDP and HDMI on C10, the parts that make this working should be in this patchset imo. C20 and TBT doesn't need to be, but I don't see how eDP or HDMI on C10 would work if the modeset sequence used for both C10 and C20 and both DP and HDMI modes is not updated for MTL.

The whole split is a bit artificial as it was really hard to get any reviews done for the whole series. But you are right, the hdmi is not needed to eDP support. Maybe for the next round, I drop these hdmi related patches out from the C10 series so we can get only eDP support reviewed and merged at some point.

Quoted 74 lines
Quoted 12 lines
Quoted 9 lines

More things below, besides my earlier review comments.

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 6 lines

[...]

drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +5 -0
+
+static void intel_c10_pll_program(struct drm_i915_private *i915,
+                             const struct intel_crtc_state *crtc_state,
+                             struct intel_encoder *encoder) {
+   const struct intel_c10mpllb_state *pll_state = &crtc_state-

c10mpllb_state;

Quoted 2 lines
Quoted 2 lines
(quoted diff) +2 -0
+   struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+   bool lane_reversal = dig_port->saved_port_bits &

DDI_BUF_PORT_REVERSAL;

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +14 -0
+   u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+                                    INTEL_CX0_LANE0;
+   u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+                                      INTEL_CX0_LANE1;
+
+   int i;
+   struct intel_dp *intel_dp;
+   bool use_ssc = false;
+   u8 cmn0 = 0;
+
+   if (intel_crtc_has_dp_encoder(crtc_state)) {
+           intel_dp = enc_to_intel_dp(encoder);
+           use_ssc = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+                     DP_MAX_DOWNSPREAD_0_5);
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +8 -0
+
+           if (!intel_panel_use_ssc(i915))
+                   use_ssc = false;
+
+           cmn0 = C10_CMN0_DP_VAL;
+   }
+
+   intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES,

PHY_C10_VDR_CONTROL(1),

Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +4 -0
+                   C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+   /* Custom width needs to be programmed to 0 for both the phy lanes */
+   intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES,
+                 PHY_C10_VDR_CUSTOM_WIDTH, 0x3, 0,

MB_WRITE_COMMITTED);

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ intel_cx0_rmw(i915, encoder->port, follower_lane,

PHY_C10_VDR_CONTROL(1),

Quoted 17 lines
Quoted 17 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c new file +8 -0
+                 C10_VDR_CTRL_MASTER_LANE, C10_VDR_CTRL_UPDATE_CFG,
+                 MB_WRITE_COMMITTED);
+
+   /* Program the pll values only for the master lane */
+   for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
+           /* If not using ssc pll[4] through pll[8] must be 0*/
+           intel_cx0_write(i915, encoder->port, master_lane,
+ PHY_C10_VDR_PLL(i),

This programs the PLL via the INTEL_CX0_LANE1 lane in the lane_reversal=true case. However, I haven't found any trace of this being correct in the spec. It just says that PLL must be programmed via
INTEL_CX0_LANE0 in all the cases, so both for lane_reversal and !lane_reversal (see Bspec/64539 "Phy Lane and Transmitter Usage" table/"Lane for message bus PLL programming" column).

Quoted 5 lines
Quoted 5 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+                           (!use_ssc && (i > 3 && i < 9)) ? 0 : pll_state->pll[i],
+                           (i % 4) ? MB_WRITE_UNCOMMITTED :
+ MB_WRITE_COMMITTED);
+
+   intel_cx0_write(i915, encoder->port, master_lane,

PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ intel_cx0_write(i915, encoder->port, master_lane,

PHY_C10_VDR_TX(0), C10_TX0_VAL, MB_WRITE_COMMITTED);

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ intel_cx0_rmw(i915, encoder->port, master_lane,

PHY_C10_VDR_CONTROL(1),

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ C10_VDR_CTRL_MSGBUS_ACCESS,

C10_VDR_CTRL_MASTER_LANE |

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

+ C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

For all the above writes, programming INTEL_CX0_LANE1 looks incorrect in the lane_reversal=true case, should program INTEL_CX0_LANE0

instead.

Quoted 2 lines

So in any case we should program INTEL_CX0_LANE0?

That's what the spec says at least, so I don't see a reason to not follow that.

Let's go with what the spec says.

Quoted 23 lines
Quoted 23 lines

[...]

Quoted 20 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg_defs.h +1 -0
+
 /*
  * Local integer constant expression version of is_power_of_2().
  */
@@ -74,6 +102,23 @@
           BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL <<
 __bf_shf(__mask)))) + \
 

drivers/gpu/drm/i915/i915_reg_defs.h line 114

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg_defs.h +7 -0
 BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val),
 (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
 
+/**
+ * REG_FIELD_PREP8() - Prepare a u8 bitfield value
+ * @__mask: shifted mask defining the field's length and position
+ * @__val: value to put in the field
+ *
+ * Local copy of FIELD_PREP8() to generate an integer constant
+expression, force

The above is FIELD_PREP() only.

Quoted 4 lines
Quoted 1 line

So use FIELD_PREP() instead of FIELD_PREP8()?

Yes, there is no FIELD_PREP8(), so I assume the reference was about FIELD_PREP().

Ok.

Quoted 2 lines

--Imre

#23 lore raw

PATCH 5/7 drm/i915/mtl: Add C10 phy programming for HDMI

In reply to Mika Kahola

From: Radhakrishna Sripada <[email protected]>

Like DG2, we still don't have a proper algorithm that can be used for calculating PHY settings, but we do have tables of register values for a handful of the more common link rates. Some support is better than none, so let's go ahead and add/use these tables when we can, and also add some logic to hdmi_port_clock_valid() to filter the modelist to just the modes we can actually support with these link rates.

Hopefully we'll have a proper / non-encumbered algorithm to calculate these registers by the time we upstream and we'll be able to replace this patch with something more general purpose.

Bspec: 64568

v2: Rebasing with Clint's HDMI C10 PLL tables (Mika)
v3: Add missing use_hdmi checks from Clint's HDMI implementation changes (Ankit)

---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 576 +++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   1 +
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  13 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c     |   5 +-
 4 files changed, 579 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +566 -10
index ced8c8aa6c82..3aa8031f8373 100644
@@ -485,6 +485,538 @@ static const struct intel_c10mpllb_state * const mtl_c10_edp_tables[] = {
 	NULL,
 };
 
+/*
+ * HDMI link rates with 38.4 MHz reference clock.
+ */
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_25_2 = {
+	.clock = 25200,
+	.pll[0] = 0x4,
+	.pll[1] = 0,
+	.pll[2] = 0xB2,
+	.pll[3] = 0,
+	.pll[4] = 0,
+	.pll[5] = 0,
+	.pll[6] = 0,
+	.pll[7] = 0,
+	.pll[8] = 0x20,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0xD,
+	.pll[16] = 0x6,
+	.pll[17] = 0x8F,
+	.pll[18] = 0x84,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_27_0 = {
+	.clock = 27000,
+	.pll[0] = 0x34,
+	.pll[1] = 0,
+	.pll[2] = 0xC0,
+	.pll[3] = 0,
+	.pll[4] = 0,
+	.pll[5] = 0,
+	.pll[6] = 0,
+	.pll[7] = 0,
+	.pll[8] = 0x20,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0x80,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0xD,
+	.pll[16] = 0x6,
+	.pll[17] = 0xCF,
+	.pll[18] = 0x84,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_74_25 = {
+	.clock = 74250,
+	.pll[0] = 0xF4,
+	.pll[1] = 0,
+	.pll[2] = 0x7A,
+	.pll[3] = 0,
+	.pll[4] = 0,
+	.pll[5] = 0,
+	.pll[6] = 0,
+	.pll[7] = 0,
+	.pll[8] = 0x20,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0x58,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0xB,
+	.pll[16] = 0x6,
+	.pll[17] = 0xF,
+	.pll[18] = 0x85,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_148_5 = {
+	.clock = 148500,
+	.pll[0] = 0xF4,
+	.pll[1] = 0,
+	.pll[2] = 0x7A,
+	.pll[3] = 0,
+	.pll[4] = 0,
+	.pll[5] = 0,
+	.pll[6] = 0,
+	.pll[7] = 0,
+	.pll[8] = 0x20,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0x58,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0xA,
+	.pll[16] = 0x6,
+	.pll[17] = 0xF,
+	.pll[18] = 0x85,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_594 = {
+	.clock = 594000,
+	.pll[0] = 0xF4,
+	.pll[1] = 0,
+	.pll[2] = 0x7A,
+	.pll[3] = 0,
+	.pll[4] = 0,
+	.pll[5] = 0,
+	.pll[6] = 0,
+	.pll[7] = 0,
+	.pll[8] = 0x20,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0x58,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x8,
+	.pll[16] = 0x6,
+	.pll[17] = 0xF,
+	.pll[18] = 0x85,
+	.pll[19] = 0x23,
+};
+
+/* Precomputed C10 HDMI PLL tables */
+static const struct intel_c10mpllb_state mtl_c10_hdmi_25175 = {
+	.clock = 25175,
+	.pll[0]=0x34,
+	.pll[1]=0x00,
+	.pll[2]=0xB0,
+	.pll[3]=0x00,
+	.pll[4]=0x00,
+	.pll[5]=0x00,
+	.pll[6]=0x00,
+	.pll[7]=0x00,
+	.pll[8]=0x20,
+	.pll[9]=0xFF,
+	.pll[10]=0xFF,
+	.pll[11]=0x55,
+	.pll[12]=0xE5,
+	.pll[13]=0x55,
+	.pll[14]=0x55,
+	.pll[15]=0x0D,
+	.pll[16]=0x09,
+	.pll[17]=0x8F,
+	.pll[18]=0x84,
+	.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_27027 = {
+	.clock = 27027,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xC0, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
+	.pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_28320 = {
+	.clock = 28320,
+	.pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xCC, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_30240 = {
+	.clock = 30240,
+	.pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xDC, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_31500 = {
+	.clock = 31500,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x62, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_36000 = {
+	.clock = 36000,
+	.pll[0]=0xC4, .pll[1]=0x00, .pll[2]=0x76, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_40000 = {
+	.clock = 40000,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x86, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_49500 = {
+	.clock = 49500,
+	.pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_50000 = {
+	.clock = 50000,
+	.pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xB0, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_57284 = {
+	.clock = 57284,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xCE, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_58000 = {
+	.clock = 58000,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD0, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_65000 = {
+	.clock = 65000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x66, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_71000 = {
+	.clock = 71000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x72, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_74176 = {
+	.clock = 74176,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x44,.pll[12]=0x44,.pll[13]=0x44,.pll[14]=0x44,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_75000 = {
+	.clock = 75000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7C, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_78750 = {
+	.clock = 78750,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x84, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x08,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_85500 = {
+	.clock = 85500,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x92, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x10,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_88750 = {
+	.clock = 88750,
+	.pll[0]=0x74, .pll[1]=0x00, .pll[2]=0x98, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x72,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_106500 = {
+	.clock = 106500,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xBC, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xF0,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_108000 = {
+	.clock = 108000,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xC0, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x80,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_115500 = {
+	.clock = 115500,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD0, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x50,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_119000 = {
+	.clock = 119000,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD6, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_135000 = {
+	.clock = 135000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x6C, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x50,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0A,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_138500 = {
+	.clock = 138500,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x70, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x22,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_147160 = {
+	.clock = 147160,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x78, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xA5,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_148352 = {
+	.clock = 148352,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x44,.pll[12]=0x44,.pll[13]=0x44,.pll[14]=0x44,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_154000 = {
+	.clock = 154000,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x80, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x35,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_162000 = {
+	.clock = 162000,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x88, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x60,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_167000 = {
+	.clock = 167000,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x8C, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0xFA,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_197802 = {
+	.clock = 197802,
+	.pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x99,.pll[12]=0x05,.pll[13]=0x98,.pll[14]=0x99,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_198000 = {
+	.clock = 198000,
+	.pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_209800 = {
+	.clock = 209800,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xBA, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x45,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_241500 = {
+	.clock = 241500,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xDA, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xC8,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_262750 = {
+	.clock = 262750,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x68, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x6C,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x09,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_268500 = {
+	.clock = 268500,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x6A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xEC,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x09,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_296703 = {
+	.clock = 296703,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x33,.pll[12]=0x44,.pll[13]=0x33,.pll[14]=0x33,
+	.pll[15]=0x09,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_297000 = {
+	.clock = 297000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x58,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x09,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_319750 = {
+	.clock = 319750,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x86, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x44,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x09,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_497750 = {
+	.clock = 497750,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xE2, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x9F,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x09,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_592000 = {
+	.clock = 592000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x15,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x08,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_593407 = {
+	.clock = 593407,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x3B,.pll[12]=0x44,.pll[13]=0xBA,.pll[14]=0xBB,
+	.pll[15]=0x08,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state * const mtl_c10_hdmi_tables[] = {
+	&mtl_c10_hdmi_25175,
+	&mtl_c10_hdmi_25_2, /* Consolidated Table */
+	&mtl_c10_hdmi_27_0, /* Consolidated Table */
+	&mtl_c10_hdmi_27027,
+	&mtl_c10_hdmi_28320,
+	&mtl_c10_hdmi_30240,
+	&mtl_c10_hdmi_31500,
+	&mtl_c10_hdmi_36000,
+	&mtl_c10_hdmi_40000,
+	&mtl_c10_hdmi_49500,
+	&mtl_c10_hdmi_50000,
+	&mtl_c10_hdmi_57284,
+	&mtl_c10_hdmi_58000,
+	&mtl_c10_hdmi_65000,
+	&mtl_c10_hdmi_71000,
+	&mtl_c10_hdmi_74176,
+	&mtl_c10_hdmi_74_25, /* Consolidated Table */
+	&mtl_c10_hdmi_75000,
+	&mtl_c10_hdmi_78750,
+	&mtl_c10_hdmi_85500,
+	&mtl_c10_hdmi_88750,
+	&mtl_c10_hdmi_106500,
+	&mtl_c10_hdmi_108000,
+	&mtl_c10_hdmi_115500,
+	&mtl_c10_hdmi_119000,
+	&mtl_c10_hdmi_135000,
+	&mtl_c10_hdmi_138500,
+	&mtl_c10_hdmi_147160,
+	&mtl_c10_hdmi_148352,
+	&mtl_c10_hdmi_148_5, /* Consolidated Table */
+	&mtl_c10_hdmi_154000,
+	&mtl_c10_hdmi_162000,
+	&mtl_c10_hdmi_167000,
+	&mtl_c10_hdmi_197802,
+	&mtl_c10_hdmi_198000,
+	&mtl_c10_hdmi_209800,
+	&mtl_c10_hdmi_241500,
+	&mtl_c10_hdmi_262750,
+	&mtl_c10_hdmi_268500,
+	&mtl_c10_hdmi_296703,
+	&mtl_c10_hdmi_297000,
+	&mtl_c10_hdmi_319750,
+	&mtl_c10_hdmi_497750,
+	&mtl_c10_hdmi_592000,
+	&mtl_c10_hdmi_593407,
+	&mtl_c10_hdmi_594, /* Consolidated Table */
+	NULL,
+};
+
+int intel_c10_phy_check_hdmi_link_rate(int clock)
+{
+	const struct intel_c10mpllb_state * const *tables = mtl_c10_hdmi_tables;
+	int i;
+
+	for (i = 0; tables[i]; i++) {
+		if (clock == tables[i]->clock)
+			return MODE_OK;
+	}
+
+	return MODE_CLOCK_RANGE;
+}
+
 static const struct intel_c10mpllb_state * const *
 intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
 			   struct intel_encoder *encoder)
@@ -494,9 +1026,10 @@ intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
 			return mtl_c10_edp_tables;
 		else
 			return mtl_c10_dp_tables;
+	} else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
+		return mtl_c10_hdmi_tables;
 	}
 
-	/* TODO: Add HDMI Support */
 	MISSING_CASE(encoder->type);
 	return NULL;
 }
@@ -504,9 +1037,20 @@ intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
 static int intel_c10mpllb_calc_state(struct intel_crtc_state *crtc_state,
 				     struct intel_encoder *encoder)
 {
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	const struct intel_c10mpllb_state * const *tables;
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
 	int i;
 
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
+		if (intel_c10_phy_check_hdmi_link_rate(crtc_state->port_clock)
+		    != MODE_OK) {
+			drm_dbg_kms(&i915->drm, "Can't support HDMI link rate %d on phy %c.\n",
+				      crtc_state->port_clock, phy_name(phy));
+			return -EINVAL;
+		}
+	}
+
 	tables = intel_c10_mpllb_tables_get(crtc_state, encoder);
 	if (!tables)
 		return -EINVAL;
@@ -558,9 +1102,10 @@ void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
 	cmn = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_CMN(0));
 	tx0 = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_TX(0));
 
-	if (tx0 != C10_TX0_VAL || cmn != C10_CMN0_DP_VAL)
-		drm_warn(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",
-			 tx0, cmn, phy_name(phy));
+	if (tx0 != C10_TX0_VAL || (cmn != C10_CMN0_DP_VAL &&
+				   cmn != C10_CMN0_HDMI_VAL))
+		drm_dbg_kms(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",
+			    tx0, cmn, phy_name(phy));
 }
 
 static void intel_c10_pll_program(struct drm_i915_private *i915,
@@ -574,11 +1119,11 @@ static void intel_c10_pll_program(struct drm_i915_private *i915,
 					 INTEL_CX0_LANE0;
 	u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
 					   INTEL_CX0_LANE1;
-
 	int i;
 	struct intel_dp *intel_dp;
 	bool use_ssc = false;
-	u8 cmn0 = 0;
+	bool use_hdmi = false;
+	u8 cmn0;
 
 	if (intel_crtc_has_dp_encoder(crtc_state)) {
 		intel_dp = enc_to_intel_dp(encoder);
@@ -589,6 +1134,9 @@ static void intel_c10_pll_program(struct drm_i915_private *i915,
 			use_ssc = false;
 
 		cmn0 = C10_CMN0_DP_VAL;
+	} else {
+		use_hdmi = true;
+		cmn0 = C10_CMN0_HDMI_VAL;
 	}
 
 	intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
@@ -604,7 +1152,7 @@ static void intel_c10_pll_program(struct drm_i915_private *i915,
 	for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
 		/* If not using ssc pll[4] through pll[8] must be 0*/
 		intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_PLL(i),
-				(!use_ssc && (i > 3 && i < 9)) ? 0 : pll_state->pll[i],
+				(!(use_ssc || use_hdmi) && (i > 3 && i < 9)) ? 0 : pll_state->pll[i],
 				(i % 4) ? MB_WRITE_UNCOMMITTED : MB_WRITE_COMMITTED);
 
 	intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);
@@ -652,7 +1200,8 @@ int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
 				   const struct intel_c10mpllb_state *pll_state)
 {
 	unsigned int frac_quot = 0, frac_rem = 0, frac_den = 1;
-	unsigned int multiplier, tx_clk_div, refclk = 38400;
+	unsigned int multiplier, tx_clk_div, hdmi_div, refclk = 38400;
+	int tmpclk = 0;
 
 	if (pll_state->pll[0] & C10_PLL0_FRACEN) {
 		frac_quot = pll_state->pll[12] << 8 | pll_state->pll[11];
@@ -664,10 +1213,14 @@ int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
 		      pll_state->pll[2]) / 2 + 16;
 
 	tx_clk_div = REG_FIELD_GET8(C10_PLL15_TXCLKDIV_MASK, pll_state->pll[15]);
+	hdmi_div = REG_FIELD_GET8(C10_PLL15_HDMIDIV_MASK, pll_state->pll[15]);
 
-	return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(refclk, (multiplier << 16) + frac_quot) +
+	tmpclk = DIV_ROUND_CLOSEST_ULL(mul_u32_u32(refclk, (multiplier << 16) + frac_quot) +
 				     DIV_ROUND_CLOSEST(refclk * frac_rem, frac_den),
 				     10 << (tx_clk_div + 16));
+	tmpclk *= (hdmi_div ? 2 : 1);
+
+	return tmpclk;
 }
 
 static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
@@ -1080,6 +1633,7 @@ void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 	enum phy phy;
 	int i;
 	bool use_ssc = false;
+	bool use_hdmi = false;
 
 	if (DISPLAY_VER(i915) < 14)
 		return;
@@ -1097,6 +1651,8 @@ void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 
 		if (!intel_panel_use_ssc(i915))
 			use_ssc = false;
+	} else {
+		use_hdmi = true;
 	}
 
 	if (!intel_is_c10phy(i915, phy))
@@ -1107,7 +1663,7 @@ void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 	for (i = 0; i < ARRAY_SIZE(mpllb_sw_state->pll); i++) {
 		u8 expected;
 
-		if (!use_ssc && i > 3 && i < 9)
+		if (!(use_ssc || use_hdmi) && i > 3 && i < 9)
 			expected = 0;
 		else
 			expected = mpllb_sw_state->pll[i];
drivers/gpu/drm/i915/display/intel_cx0_phy.h +1 -0
index 8cf340509097..f8023f240727 100644
@@ -39,5 +39,6 @@ int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
 				   const struct intel_c10mpllb_state *pll_state);
 void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 				 struct intel_crtc_state *new_crtc_state);
+int intel_c10_phy_check_hdmi_link_rate(int clock);
 
 #endif /* __INTEL_CX0_PHY_H__ */
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +8 -5
index 15e249f46a64..91e2f88f43f7 100644
@@ -133,8 +133,11 @@
 #define   C10_PLL0_FRACEN		REG_BIT8(4)
 #define   C10_PLL3_MULTIPLIERH_MASK	REG_GENMASK8(3, 0)
 #define   C10_PLL15_TXCLKDIV_MASK	REG_GENMASK8(2, 0)
+#define   C10_PLL15_HDMIDIV_MASK	REG_GENMASK8(5, 3)
+
 #define PHY_C10_VDR_CMN(idx)		(0xC20 + (idx))
 #define   C10_CMN0_DP_VAL		0x21
+#define   C10_CMN0_HDMI_VAL		0x1
 #define   C10_CMN3_TXVBOOST_MASK	REG_GENMASK8(7, 5)
 #define   C10_CMN3_TXVBOOST(val)	REG_FIELD_PREP8(C10_CMN3_TXVBOOST_MASK, val)
 #define PHY_C10_VDR_TX(idx)		(0xC30 + (idx))
@@ -145,11 +148,11 @@
 #define   C10_VDR_CTRL_UPDATE_CFG	REG_BIT8(0)
 #define PHY_C10_VDR_CUSTOM_WIDTH	0xD02
 
-#define CX0_P0_STATE_ACTIVE             0x0
-#define CX0_P2_STATE_READY              0x2
-#define CX0_P2PG_STATE_DISABLE          0x9
-#define CX0_P4PG_STATE_DISABLE          0xC
-#define CX0_P2_STATE_RESET              0x2
+#define CX0_P0_STATE_ACTIVE		0x0
+#define CX0_P2_STATE_READY		0x2
+#define CX0_P2PG_STATE_DISABLE		0x9
+#define CX0_P4PG_STATE_DISABLE		0xC
+#define CX0_P2_STATE_RESET		0x2
 
 /* PHY_C10_VDR_PLL0 */
 #define PLL_C10_MPLL_SSC_EN             REG_BIT8(0)
drivers/gpu/drm/i915/display/intel_hdmi.c +4 -1
index c7e9e1fbed37..baa9ef7568af 100644
@@ -46,6 +46,7 @@
 #include "intel_atomic.h"
 #include "intel_audio.h"
 #include "intel_connector.h"
+#include "intel_cx0_phy.h"
 #include "intel_ddi.h"
 #include "intel_de.h"
 #include "intel_display_types.h"
@@ -1865,7 +1866,9 @@ hdmi_port_clock_valid(struct intel_hdmi *hdmi,
 	 * FIXME: We will hopefully get an algorithmic way of programming
 	 * the MPLLB for HDMI in the future.
 	 */
-	if (IS_DG2(dev_priv))
+	if (IS_METEORLAKE(dev_priv))
+		return intel_c10_phy_check_hdmi_link_rate(clock);
+	else if (IS_DG2(dev_priv))
 		return intel_snps_phy_check_hdmi_link_rate(clock);
 
 	return MODE_OK;
Signature · 1 line
2.34.1
#24 lore raw

Re: [Intel-gfx] [PATCH 5/7] drm/i915/mtl: Add C10 phy programming for HDMI

Quoted 186 lines · Mika Kahola

From: Radhakrishna Sripada <[email protected]>

Like DG2, we still don't have a proper algorithm that can be used for calculating PHY settings, but we do have tables of register values for a handful of the more common link rates. Some support is better than none, so let's go ahead and add/use these tables when we can, and also add some logic to hdmi_port_clock_valid() to filter the modelist to just the modes we can actually support with these link rates.

Hopefully we'll have a proper / non-encumbered algorithm to calculate these registers by the time we upstream and we'll be able to replace this patch with something more general purpose.

Bspec: 64568

v2: Rebasing with Clint's HDMI C10 PLL tables (Mika)
v3: Add missing use_hdmi checks from Clint's HDMI implementation changes (Ankit)

---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 576 +++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   1 +
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  13 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c     |   5 +-
 4 files changed, 579 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +146 -0
index ced8c8aa6c82..3aa8031f8373 100644
@@ -485,6 +485,538 @@ static const struct intel_c10mpllb_state * const mtl_c10_edp_tables[] = {
 	NULL,
 };
 
+/*
+ * HDMI link rates with 38.4 MHz reference clock.
+ */
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_25_2 = {
+	.clock = 25200,
+	.pll[0] = 0x4,
+	.pll[1] = 0,
+	.pll[2] = 0xB2,
+	.pll[3] = 0,
+	.pll[4] = 0,
+	.pll[5] = 0,
+	.pll[6] = 0,
+	.pll[7] = 0,
+	.pll[8] = 0x20,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0xD,
+	.pll[16] = 0x6,
+	.pll[17] = 0x8F,
+	.pll[18] = 0x84,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_27_0 = {
+	.clock = 27000,
+	.pll[0] = 0x34,
+	.pll[1] = 0,
+	.pll[2] = 0xC0,
+	.pll[3] = 0,
+	.pll[4] = 0,
+	.pll[5] = 0,
+	.pll[6] = 0,
+	.pll[7] = 0,
+	.pll[8] = 0x20,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0x80,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0xD,
+	.pll[16] = 0x6,
+	.pll[17] = 0xCF,
+	.pll[18] = 0x84,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_74_25 = {
+	.clock = 74250,
+	.pll[0] = 0xF4,
+	.pll[1] = 0,
+	.pll[2] = 0x7A,
+	.pll[3] = 0,
+	.pll[4] = 0,
+	.pll[5] = 0,
+	.pll[6] = 0,
+	.pll[7] = 0,
+	.pll[8] = 0x20,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0x58,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0xB,
+	.pll[16] = 0x6,
+	.pll[17] = 0xF,
+	.pll[18] = 0x85,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_148_5 = {
+	.clock = 148500,
+	.pll[0] = 0xF4,
+	.pll[1] = 0,
+	.pll[2] = 0x7A,
+	.pll[3] = 0,
+	.pll[4] = 0,
+	.pll[5] = 0,
+	.pll[6] = 0,
+	.pll[7] = 0,
+	.pll[8] = 0x20,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0x58,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0xA,
+	.pll[16] = 0x6,
+	.pll[17] = 0xF,
+	.pll[18] = 0x85,
+	.pll[19] = 0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_594 = {
+	.clock = 594000,
+	.pll[0] = 0xF4,
+	.pll[1] = 0,
+	.pll[2] = 0x7A,
+	.pll[3] = 0,
+	.pll[4] = 0,
+	.pll[5] = 0,
+	.pll[6] = 0,
+	.pll[7] = 0,
+	.pll[8] = 0x20,
+	.pll[9] = 0x1,
+	.pll[10] = 0,
+	.pll[11] = 0,
+	.pll[12] = 0x58,
+	.pll[13] = 0,
+	.pll[14] = 0,
+	.pll[15] = 0x8,
+	.pll[16] = 0x6,
+	.pll[17] = 0xF,
+	.pll[18] = 0x85,
+	.pll[19] = 0x23,
+};
+
+/* Precomputed C10 HDMI PLL tables */
+static const struct intel_c10mpllb_state mtl_c10_hdmi_25175 = {
+	.clock = 25175,
+	.pll[0]=0x34,
+	.pll[1]=0x00,
+	.pll[2]=0xB0,
+	.pll[3]=0x00,
+	.pll[4]=0x00,
+	.pll[5]=0x00,
+	.pll[6]=0x00,
+	.pll[7]=0x00,
+	.pll[8]=0x20,
+	.pll[9]=0xFF,
+	.pll[10]=0xFF,
+	.pll[11]=0x55,
+	.pll[12]=0xE5,
+	.pll[13]=0x55,
+	.pll[14]=0x55,
+	.pll[15]=0x0D,
+	.pll[16]=0x09,
+	.pll[17]=0x8F,
+	.pll[18]=0x84,

drivers/gpu/drm/i915/display/intel_cx0_phy.c static const struct intel_c10mpllb_state * const mtl_c10_edp_tables[] = { · line 643

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +10 -0
+	.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_27027 = {
+	.clock = 27027,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xC0, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
+	.pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};

These tables should have the same formatting, also matching the formatting of the C20 tables.

Quoted 398 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +380 -1
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_28320 = {
+	.clock = 28320,
+	.pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xCC, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_30240 = {
+	.clock = 30240,
+	.pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xDC, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_31500 = {
+	.clock = 31500,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x62, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_36000 = {
+	.clock = 36000,
+	.pll[0]=0xC4, .pll[1]=0x00, .pll[2]=0x76, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_40000 = {
+	.clock = 40000,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x86, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_49500 = {
+	.clock = 49500,
+	.pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_50000 = {
+	.clock = 50000,
+	.pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xB0, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_57284 = {
+	.clock = 57284,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xCE, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_58000 = {
+	.clock = 58000,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD0, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_65000 = {
+	.clock = 65000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x66, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_71000 = {
+	.clock = 71000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x72, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_74176 = {
+	.clock = 74176,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x44,.pll[12]=0x44,.pll[13]=0x44,.pll[14]=0x44,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_75000 = {
+	.clock = 75000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7C, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_78750 = {
+	.clock = 78750,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x84, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x08,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_85500 = {
+	.clock = 85500,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x92, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x10,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_88750 = {
+	.clock = 88750,
+	.pll[0]=0x74, .pll[1]=0x00, .pll[2]=0x98, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x72,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_106500 = {
+	.clock = 106500,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xBC, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xF0,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_108000 = {
+	.clock = 108000,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xC0, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x80,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_115500 = {
+	.clock = 115500,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD0, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x50,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_119000 = {
+	.clock = 119000,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD6, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_135000 = {
+	.clock = 135000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x6C, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x50,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0A,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_138500 = {
+	.clock = 138500,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x70, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x22,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_147160 = {
+	.clock = 147160,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x78, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xA5,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_148352 = {
+	.clock = 148352,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x44,.pll[12]=0x44,.pll[13]=0x44,.pll[14]=0x44,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_154000 = {
+	.clock = 154000,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x80, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x35,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_162000 = {
+	.clock = 162000,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x88, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x60,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_167000 = {
+	.clock = 167000,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x8C, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0xFA,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_197802 = {
+	.clock = 197802,
+	.pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x99,.pll[12]=0x05,.pll[13]=0x98,.pll[14]=0x99,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_198000 = {
+	.clock = 198000,
+	.pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_209800 = {
+	.clock = 209800,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xBA, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x45,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_241500 = {
+	.clock = 241500,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xDA, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xC8,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x0A,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_262750 = {
+	.clock = 262750,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x68, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x6C,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x09,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_268500 = {
+	.clock = 268500,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x6A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xEC,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x09,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_296703 = {
+	.clock = 296703,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x33,.pll[12]=0x44,.pll[13]=0x33,.pll[14]=0x33,
+	.pll[15]=0x09,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_297000 = {
+	.clock = 297000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x58,.pll[13]=0x00,.pll[14]=0x00,
+	.pll[15]=0x09,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_319750 = {
+	.clock = 319750,
+	.pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x86, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x44,.pll[13]=0xA9,.pll[14]=0xAA,
+	.pll[15]=0x09,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_497750 = {
+	.clock = 497750,
+	.pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xE2, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x9F,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x09,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_592000 = {
+	.clock = 592000,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x15,.pll[13]=0x55,.pll[14]=0x55,
+	.pll[15]=0x08,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state mtl_c10_hdmi_593407 = {
+	.clock = 593407,
+	.pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
+	.pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
+	.pll[10]=0xFF,.pll[11]=0x3B,.pll[12]=0x44,.pll[13]=0xBA,.pll[14]=0xBB,
+	.pll[15]=0x08,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
+};
+
+static const struct intel_c10mpllb_state * const mtl_c10_hdmi_tables[] = {
+	&mtl_c10_hdmi_25175,
+	&mtl_c10_hdmi_25_2, /* Consolidated Table */
+	&mtl_c10_hdmi_27_0, /* Consolidated Table */
+	&mtl_c10_hdmi_27027,
+	&mtl_c10_hdmi_28320,
+	&mtl_c10_hdmi_30240,
+	&mtl_c10_hdmi_31500,
+	&mtl_c10_hdmi_36000,
+	&mtl_c10_hdmi_40000,
+	&mtl_c10_hdmi_49500,
+	&mtl_c10_hdmi_50000,
+	&mtl_c10_hdmi_57284,
+	&mtl_c10_hdmi_58000,
+	&mtl_c10_hdmi_65000,
+	&mtl_c10_hdmi_71000,
+	&mtl_c10_hdmi_74176,
+	&mtl_c10_hdmi_74_25, /* Consolidated Table */
+	&mtl_c10_hdmi_75000,
+	&mtl_c10_hdmi_78750,
+	&mtl_c10_hdmi_85500,
+	&mtl_c10_hdmi_88750,
+	&mtl_c10_hdmi_106500,
+	&mtl_c10_hdmi_108000,
+	&mtl_c10_hdmi_115500,
+	&mtl_c10_hdmi_119000,
+	&mtl_c10_hdmi_135000,
+	&mtl_c10_hdmi_138500,
+	&mtl_c10_hdmi_147160,
+	&mtl_c10_hdmi_148352,
+	&mtl_c10_hdmi_148_5, /* Consolidated Table */
+	&mtl_c10_hdmi_154000,
+	&mtl_c10_hdmi_162000,
+	&mtl_c10_hdmi_167000,
+	&mtl_c10_hdmi_197802,
+	&mtl_c10_hdmi_198000,
+	&mtl_c10_hdmi_209800,
+	&mtl_c10_hdmi_241500,
+	&mtl_c10_hdmi_262750,
+	&mtl_c10_hdmi_268500,
+	&mtl_c10_hdmi_296703,
+	&mtl_c10_hdmi_297000,
+	&mtl_c10_hdmi_319750,
+	&mtl_c10_hdmi_497750,
+	&mtl_c10_hdmi_592000,
+	&mtl_c10_hdmi_593407,
+	&mtl_c10_hdmi_594, /* Consolidated Table */
+	NULL,
+};
+
+int intel_c10_phy_check_hdmi_link_rate(int clock)
+{
+	const struct intel_c10mpllb_state * const *tables = mtl_c10_hdmi_tables;
+	int i;
+
+	for (i = 0; tables[i]; i++) {
+		if (clock == tables[i]->clock)
+			return MODE_OK;
+	}
+
+	return MODE_CLOCK_RANGE;
+}
+
 static const struct intel_c10mpllb_state * const *
 intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
 			   struct intel_encoder *encoder)
@@ -494,9 +1026,10 @@ intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
 			return mtl_c10_edp_tables;
 		else
 			return mtl_c10_dp_tables;
+	} else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
+		return mtl_c10_hdmi_tables;
 	}
 
-	/* TODO: Add HDMI Support */
 	MISSING_CASE(encoder->type);
 	return NULL;
 }
@@ -504,9 +1037,20 @@ intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
 static int intel_c10mpllb_calc_state(struct intel_crtc_state *crtc_state,
 				     struct intel_encoder *encoder)
 {
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	const struct intel_c10mpllb_state * const *tables;
+	enum phy phy = intel_port_to_phy(i915, encoder->port);

drivers/gpu/drm/i915/display/intel_cx0_phy.c intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state, · line 1052

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +8 -0
 	int i;
 
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
+		if (intel_c10_phy_check_hdmi_link_rate(crtc_state->port_clock)
+		    != MODE_OK) {
+			drm_dbg_kms(&i915->drm, "Can't support HDMI link rate %d on phy %c.\n",
+				      crtc_state->port_clock, phy_name(phy));
+			return -EINVAL;
+		}
+	}

The above is redundant if the table selection later is fixed to check for an exact match between crtc_state->port_clock and tables[i].clock.

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1 -0
+
 	tables = intel_c10_mpllb_tables_get(crtc_state, encoder);
 	if (!tables)
 		return -EINVAL;

drivers/gpu/drm/i915/display/intel_cx0_phy.c void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder, · line 1108

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +4 -3
@@ -558,9 +1102,10 @@ void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
 	cmn = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_CMN(0));
 	tx0 = intel_cx0_read(i915, encoder->port, lane, PHY_C10_VDR_TX(0));
 
-	if (tx0 != C10_TX0_VAL || cmn != C10_CMN0_DP_VAL)
-		drm_warn(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",
-			 tx0, cmn, phy_name(phy));
+	if (tx0 != C10_TX0_VAL || (cmn != C10_CMN0_DP_VAL &&
+				   cmn != C10_CMN0_HDMI_VAL))
+		drm_dbg_kms(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",
+			    tx0, cmn, phy_name(phy));

This should just read out the cmn0 and tx0 registers and store them to pll_state, while the check should be done in intel_c10mpllb_state_verify().

Quoted 18 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -2
 }
 
 static void intel_c10_pll_program(struct drm_i915_private *i915,
@@ -574,11 +1119,11 @@ static void intel_c10_pll_program(struct drm_i915_private *i915,
 					 INTEL_CX0_LANE0;
 	u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
 					   INTEL_CX0_LANE1;
-
 	int i;
 	struct intel_dp *intel_dp;
 	bool use_ssc = false;
-	u8 cmn0 = 0;
+	bool use_hdmi = false;
+	u8 cmn0;
 
 	if (intel_crtc_has_dp_encoder(crtc_state)) {
 		intel_dp = enc_to_intel_dp(encoder);

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10_pll_program(struct drm_i915_private *i915, · line 1139

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +3 -0
@@ -589,6 +1134,9 @@ static void intel_c10_pll_program(struct drm_i915_private *i915,
 			use_ssc = false;
 
 		cmn0 = C10_CMN0_DP_VAL;
+	} else {
+		use_hdmi = true;
+		cmn0 = C10_CMN0_HDMI_VAL;

This should be set up with the rest of pll values and the tx0 value in intel_c10mpllb_calc_state(), storing them to crtc_state->cx0pll_state.c10mpllb_state, while this function should just program these to their registers.

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10_pll_program(struct drm_i915_private *i915, · line 1155

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1 -1
 	}
 
 	intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
@@ -604,7 +1152,7 @@ static void intel_c10_pll_program(struct drm_i915_private *i915,
 	for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
 		/* If not using ssc pll[4] through pll[8] must be 0*/
 		intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_PLL(i),
-				(!use_ssc && (i > 3 && i < 9)) ? 0 : pll_state->pll[i],
+				(!(use_ssc || use_hdmi) && (i > 3 && i < 9)) ? 0 : pll_state->pll[i],

Same as above.

Quoted 38 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +8 -2
 				(i % 4) ? MB_WRITE_UNCOMMITTED : MB_WRITE_COMMITTED);
 
 	intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);
@@ -652,7 +1200,8 @@ int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
 				   const struct intel_c10mpllb_state *pll_state)
 {
 	unsigned int frac_quot = 0, frac_rem = 0, frac_den = 1;
-	unsigned int multiplier, tx_clk_div, refclk = 38400;
+	unsigned int multiplier, tx_clk_div, hdmi_div, refclk = 38400;
+	int tmpclk = 0;
 
 	if (pll_state->pll[0] & C10_PLL0_FRACEN) {
 		frac_quot = pll_state->pll[12] << 8 | pll_state->pll[11];
@@ -664,10 +1213,14 @@ int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
 		      pll_state->pll[2]) / 2 + 16;
 
 	tx_clk_div = REG_FIELD_GET8(C10_PLL15_TXCLKDIV_MASK, pll_state->pll[15]);
+	hdmi_div = REG_FIELD_GET8(C10_PLL15_HDMIDIV_MASK, pll_state->pll[15]);
 
-	return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(refclk, (multiplier << 16) + frac_quot) +
+	tmpclk = DIV_ROUND_CLOSEST_ULL(mul_u32_u32(refclk, (multiplier << 16) + frac_quot) +
 				     DIV_ROUND_CLOSEST(refclk * frac_rem, frac_den),
 				     10 << (tx_clk_div + 16));
+	tmpclk *= (hdmi_div ? 2 : 1);
+
+	return tmpclk;
 }
 
 static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
@@ -1080,6 +1633,7 @@ void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 	enum phy phy;
 	int i;
 	bool use_ssc = false;
+	bool use_hdmi = false;
 
 	if (DISPLAY_VER(i915) < 14)
 		return;

drivers/gpu/drm/i915/display/intel_cx0_phy.c void intel_c10mpllb_state_verify(struct intel_atomic_state *state, · line 1656

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -0
@@ -1097,6 +1651,8 @@ void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 
 		if (!intel_panel_use_ssc(i915))
 			use_ssc = false;
+	} else {
+		use_hdmi = true;
 	}

The above should rely only on the HW state, not the SW new_crtc_state. To deduct the HDMI/DP mode C10_PLL15_HDMIDIV_MASK/pll_state->pll[15] can be used.

drivers/gpu/drm/i915/display/intel_cx0_phy.c void intel_c10mpllb_state_verify(struct intel_atomic_state *state, · line 1658

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0 -0
 	if (!intel_is_c10phy(i915, phy))

The above should be earlier in the function.

drivers/gpu/drm/i915/display/intel_cx0_phy.c void intel_c10mpllb_state_verify(struct intel_atomic_state *state, · line 1666

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1 -1
@@ -1107,7 +1663,7 @@ void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 	for (i = 0; i < ARRAY_SIZE(mpllb_sw_state->pll); i++) {
 		u8 expected;
 
-		if (!use_ssc && i > 3 && i < 9)
+		if (!(use_ssc || use_hdmi) && i > 3 && i < 9)

The above should be handled already in intel_c10mpllb_calc_state().

Quoted 19 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0 -0
 			expected = 0;
 		else
 			expected = mpllb_sw_state->pll[i];
drivers/gpu/drm/i915/display/intel_cx0_phy.h +1 -0
index 8cf340509097..f8023f240727 100644
@@ -39,5 +39,6 @@ int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
 				   const struct intel_c10mpllb_state *pll_state);
 void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 				 struct intel_crtc_state *new_crtc_state);
+int intel_c10_phy_check_hdmi_link_rate(int clock);
 
 #endif /* __INTEL_CX0_PHY_H__ */
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0 -0
index 15e249f46a64..91e2f88f43f7 100644

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 140

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +3 -0
@@ -133,8 +133,11 @@
 #define   C10_PLL0_FRACEN		REG_BIT8(4)
 #define   C10_PLL3_MULTIPLIERH_MASK	REG_GENMASK8(3, 0)
 #define   C10_PLL15_TXCLKDIV_MASK	REG_GENMASK8(2, 0)
+#define   C10_PLL15_HDMIDIV_MASK	REG_GENMASK8(5, 3)
+
 #define PHY_C10_VDR_CMN(idx)		(0xC20 + (idx))
 #define   C10_CMN0_DP_VAL		0x21
+#define   C10_CMN0_HDMI_VAL		0x1

The above should be defined using the actual register field names/values, instead of hard-coding the whole register value.

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0 -0
 #define   C10_CMN3_TXVBOOST_MASK	REG_GENMASK8(7, 5)
 #define   C10_CMN3_TXVBOOST(val)	REG_FIELD_PREP8(C10_CMN3_TXVBOOST_MASK, val)
 #define PHY_C10_VDR_TX(idx)		(0xC30 + (idx))
@@ -145,11 +148,11 @@
 #define   C10_VDR_CTRL_UPDATE_CFG	REG_BIT8(0)
 #define PHY_C10_VDR_CUSTOM_WIDTH	0xD02
 

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 155

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +5 -5
-#define CX0_P0_STATE_ACTIVE             0x0
-#define CX0_P2_STATE_READY              0x2
-#define CX0_P2PG_STATE_DISABLE          0x9
-#define CX0_P4PG_STATE_DISABLE          0xC
-#define CX0_P2_STATE_RESET              0x2
+#define CX0_P0_STATE_ACTIVE		0x0
+#define CX0_P2_STATE_READY		0x2
+#define CX0_P2PG_STATE_DISABLE		0x9
+#define CX0_P4PG_STATE_DISABLE		0xC
+#define CX0_P2_STATE_RESET		0x2

Looks like a w/s fixup, to be done already in the patch where the flags were added.

Quoted 29 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0 -0
 /* PHY_C10_VDR_PLL0 */
 #define PLL_C10_MPLL_SSC_EN             REG_BIT8(0)
drivers/gpu/drm/i915/display/intel_hdmi.c +4 -1
index c7e9e1fbed37..baa9ef7568af 100644
@@ -46,6 +46,7 @@
 #include "intel_atomic.h"
 #include "intel_audio.h"
 #include "intel_connector.h"
+#include "intel_cx0_phy.h"
 #include "intel_ddi.h"
 #include "intel_de.h"
 #include "intel_display_types.h"
@@ -1865,7 +1866,9 @@ hdmi_port_clock_valid(struct intel_hdmi *hdmi,
 	 * FIXME: We will hopefully get an algorithmic way of programming
 	 * the MPLLB for HDMI in the future.
 	 */
-	if (IS_DG2(dev_priv))
+	if (IS_METEORLAKE(dev_priv))
+		return intel_c10_phy_check_hdmi_link_rate(clock);
+	else if (IS_DG2(dev_priv))
 		return intel_snps_phy_check_hdmi_link_rate(clock);
 
 	return MODE_OK;
Signature · 1 line
2.34.1
#25 lore raw

PATCH 6/7 drm/i915/mtl: Add vswing programming for C10 phys

In reply to Mika Kahola

From: Radhakrishna Sripada <[email protected]>

C10 phys uses direct mapping internally for voltage and pre-emphasis levels. Program the levels directly to the fields in the VDR Registers.

Bspec: 65449

v2: From table "C10: Tx EQ settings for DP 1.4x" it shows level 1
and preemphasis 1 instead of two times of level 1 preemphasis 0. Fix this in the driver code as well.
v3: VSwing update (Clint)

---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 140 ++++++++++++++++--
 drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   2 +
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  14 ++
 drivers/gpu/drm/i915/display/intel_ddi.c      |   4 +-
 .../drm/i915/display/intel_ddi_buf_trans.c    |  31 +++-
 .../drm/i915/display/intel_ddi_buf_trans.h    |   6 +
 .../i915/display/intel_display_power_map.c    |   1 +
 7 files changed, 187 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +131 -9
index 3aa8031f8373..fb54f56ac5ef 100644
@@ -6,11 +6,15 @@
 #include "i915_reg.h"
 #include "intel_cx0_phy.h"
 #include "intel_cx0_phy_regs.h"
+#include "intel_ddi.h"
+#include "intel_ddi_buf_trans.h"
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_dp.h"
 #include "intel_panel.h"
+#include "intel_psr.h"
 #include "intel_tc.h"
+#include "intel_uncore.h"
 
 bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)
 {
@@ -20,6 +24,15 @@ bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)
 	return false;
 }
 
+static void
+assert_dc_off(struct drm_i915_private *i915)
+{
+	bool enabled;
+
+	enabled = intel_display_power_is_enabled(i915, POWER_DOMAIN_DC_OFF);
+	drm_WARN_ON(&i915->drm, !enabled);
+}
+
 static void intel_cx0_bus_reset(struct drm_i915_private *i915, enum port port, int lane)
 {
 	enum phy phy = intel_port_to_phy(i915, port);
@@ -112,6 +125,8 @@ static u8 intel_cx0_read(struct drm_i915_private *i915, enum port port,
 	int i, status = 0;
 	u32 val;
 
+	assert_dc_off(i915);
+
 	for (i = 0; i < 3; i++) {
 		status = __intel_cx0_read(i915, port, lane, addr, &val);
 
@@ -194,6 +209,8 @@ static void __intel_cx0_write(struct drm_i915_private *i915, enum port port,
 	enum phy phy = intel_port_to_phy(i915, port);
 	int i, status;
 
+	assert_dc_off(i915);
+
 	for (i = 0; i < 3; i++) {
 		status = __intel_cx0_write_once(i915, port, lane, addr, data, committed);
 
@@ -241,6 +258,89 @@ static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port,
 	}
 }
 
+/*
+ * Prepare HW for CX0 phy transactions.
+ *
+ * It is required that PSR and DC5/6 are disabled before any CX0 message
+ * bus transaction is executed.
+ */
+static intel_wakeref_t intel_cx0_phy_transaction_begin(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+	intel_psr_pause(intel_dp);
+	return intel_display_power_get(i915, POWER_DOMAIN_DC_OFF);
+}
+
+static void intel_cx0_phy_transaction_end(struct intel_encoder *encoder, intel_wakeref_t wakeref)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+	intel_psr_resume(intel_dp);
+	intel_display_power_put(i915, POWER_DOMAIN_DC_OFF, wakeref);
+}
+
+void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder,
+				     const struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+	u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+					 INTEL_CX0_LANE0;
+	u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+					   INTEL_CX0_LANE1;
+	const struct intel_ddi_buf_trans *trans;
+	intel_wakeref_t wakeref;
+	int n_entries, ln;
+
+	wakeref = intel_cx0_phy_transaction_begin(encoder);
+
+	trans = encoder->get_buf_trans(encoder, crtc_state, &n_entries);
+	if (drm_WARN_ON_ONCE(&i915->drm, !trans))
+		return;
+
+	intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
+		      0, C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+
+	for (ln = 0; ln < 4; ln++) {
+		int level = intel_ddi_level(encoder, crtc_state, ln);
+		int lane, tx;
+
+		lane = ln / 2;
+		tx = ln % 2 + 1;
+
+		intel_cx0_rmw(i915, encoder->port, lane + 1, PHY_CX0_VDR_OVRD_CONTROL(lane, tx, 0),
+				C10_PHY_OVRD_LEVEL_MASK,
+				C10_PHY_OVRD_LEVEL(trans->entries[level].snps.pre_cursor),
+				MB_WRITE_COMMITTED);
+		intel_cx0_rmw(i915, encoder->port, lane + 1, PHY_CX0_VDR_OVRD_CONTROL(lane, tx, 1),
+				C10_PHY_OVRD_LEVEL_MASK,
+				C10_PHY_OVRD_LEVEL(trans->entries[level].snps.vswing),
+				MB_WRITE_COMMITTED);
+		intel_cx0_rmw(i915, encoder->port, lane + 1, PHY_CX0_VDR_OVRD_CONTROL(lane, tx, 2),
+				C10_PHY_OVRD_LEVEL_MASK,
+				C10_PHY_OVRD_LEVEL(trans->entries[level].snps.post_cursor),
+				MB_WRITE_COMMITTED);
+	}
+
+	/* Write Override enables in 0xD71 */
+	intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_OVRD,
+			PHY_C10_VDR_OVRD_TX1 | PHY_C10_VDR_OVRD_TX2,
+			PHY_C10_VDR_OVRD_TX1 | PHY_C10_VDR_OVRD_TX2,
+			MB_WRITE_COMMITTED);
+	intel_cx0_write(i915, encoder->port, follower_lane, PHY_C10_VDR_CONTROL(1),
+			C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG,
+			MB_WRITE_COMMITTED);
+	intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CONTROL(1),
+			C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_MSGBUS_ACCESS |
+			C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+
+	intel_cx0_phy_transaction_end(encoder, wakeref);
+}
+
 /*
  * Basic DP link rates with 38.4 MHz reference clock.
  * Note: The tables below are with SSC. In non-ssc
@@ -1085,9 +1185,12 @@ void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
 	u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
 				  INTEL_CX0_LANE0;
 	enum phy phy = intel_port_to_phy(i915, encoder->port);
+	intel_wakeref_t wakeref;
 	int i;
 	u8 cmn, tx0;
 
+	wakeref = intel_cx0_phy_transaction_begin(encoder);
+
 	/*
 	 * According to C10 VDR Register programming Sequence we need
 	 * to do this to read PHY internal registers from MsgBus.
@@ -1106,6 +1209,8 @@ void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
 				   cmn != C10_CMN0_HDMI_VAL))
 		drm_dbg_kms(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",
 			    tx0, cmn, phy_name(phy));
+
+	intel_cx0_phy_transaction_end(encoder, wakeref);
 }
 
 static void intel_c10_pll_program(struct drm_i915_private *i915,
@@ -1243,8 +1348,11 @@ static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
 
 	if (intel_crtc_has_dp_encoder(crtc_state)) {
 		intel_dp = enc_to_intel_dp(encoder);
-		ssc_enabled = intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
-			      DP_MAX_DOWNSPREAD_0_5;
+		ssc_enabled = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+			      DP_MAX_DOWNSPREAD_0_5);
+
+		if (intel_dp_is_edp(intel_dp) && !intel_panel_use_ssc(i915))
+			ssc_enabled = false;
 
 		if (!intel_panel_use_ssc(i915))
 			ssc_enabled = false;
@@ -1252,11 +1360,11 @@ static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
 		/* TODO: DP2.0 10G and 20G rates enable MPLLA*/
 		val |= ssc_enabled ? XELPDP_SSC_ENABLE_PLLB : 0;
 	}
+
 	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
-		     XELPDP_LANE1_PHY_CLOCK_SELECT |
-		     XELPDP_FORWARD_CLOCK_UNGATE |
+		     XELPDP_LANE1_PHY_CLOCK_SELECT | XELPDP_FORWARD_CLOCK_UNGATE |
 		     XELPDP_DDI_CLOCK_SELECT_MASK |
-		     XELPDP_SSC_ENABLE_PLLB, val);
+		     XELPDP_SSC_ENABLE_PLLA | XELPDP_SSC_ENABLE_PLLB, val);
 }
 
 static u32 intel_cx0_get_powerdown_update(u8 lane)
@@ -1396,9 +1504,12 @@ static void intel_c10_program_phy_lane(struct drm_i915_private *i915,
 	bool dp_alt_mode = intel_tc_port_in_dp_alt_mode(enc_to_dig_port(encoder));
 	enum port port = encoder->port;
 
-	intel_cx0_rmw(i915, port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
-		      C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MSGBUS_ACCESS,
-		      MB_WRITE_COMMITTED);
+	intel_cx0_rmw(i915, port, INTEL_CX0_LANE1, PHY_C10_VDR_CONTROL(1),
+		      C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG,
+		      C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+	intel_cx0_rmw(i915, port, INTEL_CX0_LANE0, PHY_C10_VDR_CONTROL(1),
+		      C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG,
+		      C10_VDR_CTRL_MASTER_LANE  | C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
 
 	l0t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2));
 	l0t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2));
@@ -1561,9 +1672,14 @@ void intel_cx0pll_enable(struct intel_encoder *encoder,
 {
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	enum phy phy = intel_port_to_phy(i915, encoder->port);
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_cx0_phy_transaction_begin(encoder);
 
 	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
 	intel_c10pll_enable(encoder, crtc_state);
+
+	intel_cx0_phy_transaction_end(encoder, wakeref);
 }
 
 static void intel_c10pll_disable(struct intel_encoder *encoder)
@@ -1608,7 +1724,8 @@ static void intel_c10pll_disable(struct intel_encoder *encoder)
 
 	/* 7. Program PORT_CLOCK_CTL register to disable and gate clocks. */
 	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
-		     XELPDP_DDI_CLOCK_SELECT_MASK |
+		     XELPDP_DDI_CLOCK_SELECT_MASK, 0);
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
 		     XELPDP_FORWARD_CLOCK_UNGATE, 0);
 }
 
@@ -1616,9 +1733,14 @@ void intel_cx0pll_disable(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	enum phy phy = intel_port_to_phy(i915, encoder->port);
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_cx0_phy_transaction_begin(encoder);
 
 	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
 	intel_c10pll_disable(encoder);
+
+	intel_cx0_phy_transaction_end(encoder, wakeref);
 }
 
 void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
drivers/gpu/drm/i915/display/intel_cx0_phy.h +2 -0
index f8023f240727..952c7deeffaa 100644
@@ -40,5 +40,7 @@ int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
 void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 				 struct intel_crtc_state *new_crtc_state);
 int intel_c10_phy_check_hdmi_link_rate(int clock);
+void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder,
+				     const struct intel_crtc_state *crtc_state);
 
 #endif /* __INTEL_CX0_PHY_H__ */
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +14 -0
index 91e2f88f43f7..7a578a30ee45 100644
@@ -154,6 +154,14 @@
 #define CX0_P4PG_STATE_DISABLE		0xC
 #define CX0_P2_STATE_RESET		0x2
 
+#define PHY_C10_VDR_OVRD		0xD71
+#define   PHY_C10_VDR_OVRD_TX1		REG_BIT8(0)
+#define   PHY_C10_VDR_OVRD_TX2		REG_BIT8(2)
+#define PHY_C10_VDR_PRE_OVRD_TX1	0xD80
+#define C10_PHY_OVRD_LEVEL_MASK		REG_GENMASK8(5, 0)
+#define C10_PHY_OVRD_LEVEL(val)		REG_FIELD_PREP8(C10_PHY_OVRD_LEVEL_MASK, val)
+#define PHY_CX0_VDR_OVRD_CONTROL(lane, tx, control) (PHY_C10_VDR_PRE_OVRD_TX1 + ((lane) ^ ((tx) - 1)) * 0x10 + (control))
+
 /* PHY_C10_VDR_PLL0 */
 #define PLL_C10_MPLL_SSC_EN             REG_BIT8(0)
 
@@ -161,4 +169,10 @@
 #define PHY_CX0_TX_CONTROL(tx, control) (0x400 + ((tx) - 1) * 0x200 + (control))
 #define CONTROL2_DISABLE_SINGLE_TX      REG_BIT(6)
 
+/* C10 Phy VSWING Masks */
+#define C10_PHY_VSWING_LEVEL_MASK	REG_GENMASK8(2, 0)
+#define C10_PHY_VSWING_LEVEL(val)	REG_FIELD_PREP8(C10_PHY_VSWING_LEVEL_MASK, val)
+#define C10_PHY_VSWING_PREEMPH_MASK	REG_GENMASK8(1, 0)
+#define C10_PHY_VSWING_PREEMPH(val)	REG_FIELD_PREP8(C10_PHY_VSWING_PREEMPH_MASK, val)
+
 #endif /* __INTEL_CX0_REG_DEFS_H__ */
drivers/gpu/drm/i915/display/intel_ddi.c +3 -1
index a433dea5b9a3..e8269fcc595e 100644
@@ -4493,7 +4493,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 		encoder->get_config = hsw_ddi_get_config;
 	}
 
-	if (IS_DG2(dev_priv)) {
+	if (DISPLAY_VER(dev_priv) >= 14) {
+		encoder->set_signal_levels = intel_cx0_phy_set_signal_levels;
+	} else if (IS_DG2(dev_priv)) {
 		encoder->set_signal_levels = intel_snps_phy_set_signal_levels;
 	} else if (DISPLAY_VER(dev_priv) >= 12) {
 		if (intel_phy_is_combo(dev_priv, phy))
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c +30 -1
index 006a2e979000..cd4becbae098 100644
@@ -1035,6 +1035,25 @@ static const struct intel_ddi_buf_trans dg2_snps_trans_uhbr = {
 	.num_entries = ARRAY_SIZE(_dg2_snps_trans_uhbr),
 };
 
+static const union intel_ddi_buf_trans_entry _mtl_c10_trans_dp14[] = {
+	{ .snps = { 26, 0, 0  } },      /* preset 0 */
+	{ .snps = { 33, 0, 6  } },      /* preset 1 */
+	{ .snps = { 38, 0, 11 } },      /* preset 2 */
+	{ .snps = { 43, 0, 19 } },      /* preset 3 */
+	{ .snps = { 39, 0, 0  } },      /* preset 4 */
+	{ .snps = { 45, 0, 7  } },      /* preset 5 */
+	{ .snps = { 46, 0, 13 } },      /* preset 6 */
+	{ .snps = { 46, 0, 0  } },      /* preset 7 */
+	{ .snps = { 55, 0, 7  } },      /* preset 8 */
+	{ .snps = { 62, 0, 0  } },      /* preset 9 */
+};
+
+static const struct intel_ddi_buf_trans mtl_cx0c10_trans = {
+	.entries = _mtl_c10_trans_dp14,
+	.num_entries = ARRAY_SIZE(_mtl_c10_trans_dp14),
+	.hdmi_default_entry = ARRAY_SIZE(_mtl_c10_trans_dp14) - 1,
+};
+
 bool is_hobl_buf_trans(const struct intel_ddi_buf_trans *table)
 {
 	return table == &tgl_combo_phy_trans_edp_hbr2_hobl;
@@ -1606,12 +1625,22 @@ dg2_get_snps_buf_trans(struct intel_encoder *encoder,
 		return intel_get_buf_trans(&dg2_snps_trans, n_entries);
 }
 
+static const struct intel_ddi_buf_trans *
+mtl_get_cx0_buf_trans(struct intel_encoder *encoder,
+		      const struct intel_crtc_state *crtc_state,
+		      int *n_entries)
+{
+	return intel_get_buf_trans(&mtl_cx0c10_trans, n_entries);
+}
+
 void intel_ddi_buf_trans_init(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	enum phy phy = intel_port_to_phy(i915, encoder->port);
 
-	if (IS_DG2(i915)) {
+	if (DISPLAY_VER(i915) >= 14) {
+		encoder->get_buf_trans = mtl_get_cx0_buf_trans;
+	} else if (IS_DG2(i915)) {
 		encoder->get_buf_trans = dg2_get_snps_buf_trans;
 	} else if (IS_ALDERLAKE_P(i915)) {
 		if (intel_phy_is_combo(i915, phy))
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h +6 -0
index 2133984a572b..e4a857b9829d 100644
@@ -51,6 +51,11 @@ struct dg2_snps_phy_buf_trans {
 	u8 post_cursor;
 };
 
+struct direct_phy_buf_trans {
+	u8 level;
+	u8 preemph;
+};
+
 union intel_ddi_buf_trans_entry {
 	struct hsw_ddi_buf_trans hsw;
 	struct bxt_ddi_buf_trans bxt;
@@ -58,6 +63,7 @@ union intel_ddi_buf_trans_entry {
 	struct icl_mg_phy_ddi_buf_trans mg;
 	struct tgl_dkl_phy_ddi_buf_trans dkl;
 	struct dg2_snps_phy_buf_trans snps;
+	struct direct_phy_buf_trans direct;
 };
 
 struct intel_ddi_buf_trans {
drivers/gpu/drm/i915/display/intel_display_power_map.c +1 -0
index 6645eb1911d8..5ec2b9a109ae 100644
@@ -1427,6 +1427,7 @@ I915_DECL_PW_DOMAINS(xelpdp_pwdoms_dc_off,
 	XELPDP_PW_2_POWER_DOMAINS,
 	POWER_DOMAIN_AUDIO_MMIO,
 	POWER_DOMAIN_MODESET,
+	POWER_DOMAIN_DC_OFF,
 	POWER_DOMAIN_AUX_A,
 	POWER_DOMAIN_AUX_B,
 	POWER_DOMAIN_DC_OFF,
Signature · 1 line
2.34.1
#26 lore raw

Re: [Intel-gfx] [PATCH 6/7] drm/i915/mtl: Add vswing programming for C10 phys

Quoted 64 lines · Mika Kahola

From: Radhakrishna Sripada <[email protected]>

C10 phys uses direct mapping internally for voltage and pre-emphasis levels. Program the levels directly to the fields in the VDR Registers.

Bspec: 65449

v2: From table "C10: Tx EQ settings for DP 1.4x" it shows level 1
and preemphasis 1 instead of two times of level 1 preemphasis 0. Fix this in the driver code as well.
v3: VSwing update (Clint)

---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 140 ++++++++++++++++--
 drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   2 +
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  14 ++
 drivers/gpu/drm/i915/display/intel_ddi.c      |   4 +-
 .../drm/i915/display/intel_ddi_buf_trans.c    |  31 +++-
 .../drm/i915/display/intel_ddi_buf_trans.h    |   6 +
 .../i915/display/intel_display_power_map.c    |   1 +
 7 files changed, 187 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +13 -0
index 3aa8031f8373..fb54f56ac5ef 100644
@@ -6,11 +6,15 @@
 #include "i915_reg.h"
 #include "intel_cx0_phy.h"
 #include "intel_cx0_phy_regs.h"
+#include "intel_ddi.h"
+#include "intel_ddi_buf_trans.h"
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_dp.h"
 #include "intel_panel.h"
+#include "intel_psr.h"
 #include "intel_tc.h"
+#include "intel_uncore.h"
 
 bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)
 {
@@ -20,6 +24,15 @@ bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)
 	return false;
 }
 
+static void
+assert_dc_off(struct drm_i915_private *i915)
+{
+	bool enabled;
+
+	enabled = intel_display_power_is_enabled(i915, POWER_DOMAIN_DC_OFF);
+	drm_WARN_ON(&i915->drm, !enabled);
+}
+
 static void intel_cx0_bus_reset(struct drm_i915_private *i915, enum port port, int lane)
 {
 	enum phy phy = intel_port_to_phy(i915, port);

drivers/gpu/drm/i915/display/intel_cx0_phy.c static u8 intel_cx0_read(struct drm_i915_private *i915, enum port port, · line 129

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -0
@@ -112,6 +125,8 @@ static u8 intel_cx0_read(struct drm_i915_private *i915, enum port port,
 	int i, status = 0;
 	u32 val;
 
+	assert_dc_off(i915);
+

This along with intel_cx0_phy_transaction_begin()/end() could be moved to the patch adding intel_cx0_bus_reset().

Quoted 52 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +38 -0
 	for (i = 0; i < 3; i++) {
 		status = __intel_cx0_read(i915, port, lane, addr, &val);
 
@@ -194,6 +209,8 @@ static void __intel_cx0_write(struct drm_i915_private *i915, enum port port,
 	enum phy phy = intel_port_to_phy(i915, port);
 	int i, status;
 
+	assert_dc_off(i915);
+
 	for (i = 0; i < 3; i++) {
 		status = __intel_cx0_write_once(i915, port, lane, addr, data, committed);
 
@@ -241,6 +258,89 @@ static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port,
 	}
 }
 
+/*
+ * Prepare HW for CX0 phy transactions.
+ *
+ * It is required that PSR and DC5/6 are disabled before any CX0 message
+ * bus transaction is executed.
+ */
+static intel_wakeref_t intel_cx0_phy_transaction_begin(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+	intel_psr_pause(intel_dp);
+	return intel_display_power_get(i915, POWER_DOMAIN_DC_OFF);
+}
+
+static void intel_cx0_phy_transaction_end(struct intel_encoder *encoder, intel_wakeref_t wakeref)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+	intel_psr_resume(intel_dp);
+	intel_display_power_put(i915, POWER_DOMAIN_DC_OFF, wakeref);
+}
+
+void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder,
+				     const struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
+	u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :
+					 INTEL_CX0_LANE0;
+	u8 follower_lane = lane_reversal ? INTEL_CX0_LANE0 :
+					   INTEL_CX0_LANE1;
+	const struct intel_ddi_buf_trans *trans;
+	intel_wakeref_t wakeref;

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port, · line 306

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +10 -0
+	int n_entries, ln;
+
+	wakeref = intel_cx0_phy_transaction_begin(encoder);
+
+	trans = encoder->get_buf_trans(encoder, crtc_state, &n_entries);
+	if (drm_WARN_ON_ONCE(&i915->drm, !trans))
+		return;
+
+	intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
+		      0, C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);

The spec says to program here the
VDR common offset 12'hC31 for TX termination control and
VDR common offset 12'hC23 for TX vboost level

see bspec/74103.

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port, · line 308

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -0
+
+	for (ln = 0; ln < 4; ln++) {

Should program only the lanes up to crtc_state->lane_count.

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port, · line 315

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +7 -0
+		int level = intel_ddi_level(encoder, crtc_state, ln);
+		int lane, tx;
+
+		lane = ln / 2;
+		tx = ln % 2 + 1;
+
+		intel_cx0_rmw(i915, encoder->port, lane + 1, PHY_CX0_VDR_OVRD_CONTROL(lane, tx, 0),

Instead of the above magic conversions, would be better to have helpers, stg like:

phy_lane = lane_to_phy_lane(ln);
tx = lane_to_phy_lane_tx(ln);
phy_lane_mask = lane_to_phy_lane_mask(ln);

lane_reversal and the DP-alt mode is not accounted for here, for instance phy lane#0/tx#1 will be programmed instead of phy lane#1/tx#2. Either this needs to be fixed or needs a FIXME: comment.

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +8 -0
+				C10_PHY_OVRD_LEVEL_MASK,
+				C10_PHY_OVRD_LEVEL(trans->entries[level].snps.pre_cursor),
+				MB_WRITE_COMMITTED);
+		intel_cx0_rmw(i915, encoder->port, lane + 1, PHY_CX0_VDR_OVRD_CONTROL(lane, tx, 1),
+				C10_PHY_OVRD_LEVEL_MASK,
+				C10_PHY_OVRD_LEVEL(trans->entries[level].snps.vswing),
+				MB_WRITE_COMMITTED);
+		intel_cx0_rmw(i915, encoder->port, lane + 1, PHY_CX0_VDR_OVRD_CONTROL(lane, tx, 2),

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port, · line 333

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +10 -0
+				C10_PHY_OVRD_LEVEL_MASK,
+				C10_PHY_OVRD_LEVEL(trans->entries[level].snps.post_cursor),
+				MB_WRITE_COMMITTED);
+	}
+
+	/* Write Override enables in 0xD71 */
+	intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_OVRD,
+			PHY_C10_VDR_OVRD_TX1 | PHY_C10_VDR_OVRD_TX2,
+			PHY_C10_VDR_OVRD_TX1 | PHY_C10_VDR_OVRD_TX2,
+			MB_WRITE_COMMITTED);

Only the used/owned PHY lanes should be programmed.

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port, · line 339

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +6 -0
+	intel_cx0_write(i915, encoder->port, follower_lane, PHY_C10_VDR_CONTROL(1),
+			C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG,
+			MB_WRITE_COMMITTED);
+	intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CONTROL(1),
+			C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_MSGBUS_ACCESS |
+			C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);

I don't think this should change the MASTER_LANE flag, which only controls where the PLL parameters are programmed and is already set up during PLL enabling. Also I don't see a reason to differentiate between "master" and "follower" PHY lanes here. I think the above two should simply set the C10_VCR_CTRL_UPDATE_CFG flag in both PHY lanes, using intel_cx0_rmw().

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +4 -0
+
+	intel_cx0_phy_transaction_end(encoder, wakeref);
+}
+
 /*
  * Basic DP link rates with 38.4 MHz reference clock.
  * Note: The tables below are with SSC. In non-ssc

drivers/gpu/drm/i915/display/intel_cx0_phy.c void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder, · line 1193

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +3 -0
@@ -1085,9 +1185,12 @@ void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
 	u8 lane = lane_reversal ? INTEL_CX0_LANE1 :
 				  INTEL_CX0_LANE0;
 	enum phy phy = intel_port_to_phy(i915, encoder->port);
+	intel_wakeref_t wakeref;
 	int i;
 	u8 cmn, tx0;
 
+	wakeref = intel_cx0_phy_transaction_begin(encoder);
+

This should be in the patch adding intel_c10mpllb_readout_hw_state().

Quoted 27 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +7 -2
 	/*
 	 * According to C10 VDR Register programming Sequence we need
 	 * to do this to read PHY internal registers from MsgBus.
@@ -1106,6 +1209,8 @@ void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
 				   cmn != C10_CMN0_HDMI_VAL))
 		drm_dbg_kms(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",
 			    tx0, cmn, phy_name(phy));
+
+	intel_cx0_phy_transaction_end(encoder, wakeref);
 }
 
 static void intel_c10_pll_program(struct drm_i915_private *i915,
@@ -1243,8 +1348,11 @@ static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
 
 	if (intel_crtc_has_dp_encoder(crtc_state)) {
 		intel_dp = enc_to_intel_dp(encoder);
-		ssc_enabled = intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
-			      DP_MAX_DOWNSPREAD_0_5;
+		ssc_enabled = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
+			      DP_MAX_DOWNSPREAD_0_5);
+
+		if (intel_dp_is_edp(intel_dp) && !intel_panel_use_ssc(i915))
+			ssc_enabled = false;
 
 		if (!intel_panel_use_ssc(i915))
 			ssc_enabled = false;

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_program_port_clock_ctl(struct intel_encoder *encoder, · line 1365

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -2
@@ -1252,11 +1360,11 @@ static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
 		/* TODO: DP2.0 10G and 20G rates enable MPLLA*/
 		val |= ssc_enabled ? XELPDP_SSC_ENABLE_PLLB : 0;
 	}
+
 	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
-		     XELPDP_LANE1_PHY_CLOCK_SELECT |
-		     XELPDP_FORWARD_CLOCK_UNGATE |
+		     XELPDP_LANE1_PHY_CLOCK_SELECT | XELPDP_FORWARD_CLOCK_UNGATE |

Stray w/s change.

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_program_port_clock_ctl(struct intel_encoder *encoder, · line 1367

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1 -1
 		     XELPDP_DDI_CLOCK_SELECT_MASK |
-		     XELPDP_SSC_ENABLE_PLLB, val);
+		     XELPDP_SSC_ENABLE_PLLA | XELPDP_SSC_ENABLE_PLLB, val);

I suppose this change should be in a C20 patchset, as PLLA is not used in C10 PHYs.

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0 -0
 }
 
 static u32 intel_cx0_get_powerdown_update(u8 lane)
@@ -1396,9 +1504,12 @@ static void intel_c10_program_phy_lane(struct drm_i915_private *i915,
 	bool dp_alt_mode = intel_tc_port_in_dp_alt_mode(enc_to_dig_port(encoder));
 	enum port port = encoder->port;

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10_program_phy_lane(struct drm_i915_private *i915, · line 1512

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +6 -3
 
-	intel_cx0_rmw(i915, port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
-		      C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MSGBUS_ACCESS,
-		      MB_WRITE_COMMITTED);
+	intel_cx0_rmw(i915, port, INTEL_CX0_LANE1, PHY_C10_VDR_CONTROL(1),
+		      C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG,
+		      C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+	intel_cx0_rmw(i915, port, INTEL_CX0_LANE0, PHY_C10_VDR_CONTROL(1),
+		      C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG,
+		      C10_VDR_CTRL_MASTER_LANE  | C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);

As above, this shouldn't change the MASTER_LANE flag (now it contradicts the programming during pll enabling and vswing setting for the lane_reversal=true case). Probably the MSGBUS_ACCESS flag doesn't need to be cleared either, at least I can't see bspec requiring it. So just set the C10_VDR_CTRL_UPDATE_CFG flag in the programmed PHY lanes.

drivers/gpu/drm/i915/display/intel_cx0_phy.c void intel_cx0pll_enable(struct intel_encoder *encoder, · line 1677

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +3 -0
 	l0t1 = intel_cx0_read(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2));
 	l0t2 = intel_cx0_read(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2));
@@ -1561,9 +1672,14 @@ void intel_cx0pll_enable(struct intel_encoder *encoder,
 {
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	enum phy phy = intel_port_to_phy(i915, encoder->port);
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_cx0_phy_transaction_begin(encoder);

Should be in the patch adding intel_cx0pll_enable().

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -0
 	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
 	intel_c10pll_enable(encoder, crtc_state);
+
+	intel_cx0_phy_transaction_end(encoder, wakeref);
 }
 
 static void intel_c10pll_disable(struct intel_encoder *encoder)

drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_disable(struct intel_encoder *encoder) · line 1729

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -1
@@ -1608,7 +1724,8 @@ static void intel_c10pll_disable(struct intel_encoder *encoder)
 
 	/* 7. Program PORT_CLOCK_CTL register to disable and gate clocks. */
 	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
-		     XELPDP_DDI_CLOCK_SELECT_MASK |
+		     XELPDP_DDI_CLOCK_SELECT_MASK, 0);
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
 		     XELPDP_FORWARD_CLOCK_UNGATE, 0);

This looks like a fix-up, if required should be part of the patch adding this register programming.

drivers/gpu/drm/i915/display/intel_cx0_phy.c void intel_cx0pll_disable(struct intel_encoder *encoder) · line 1738

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +3 -0
 }
 
@@ -1616,9 +1733,14 @@ void intel_cx0pll_disable(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	enum phy phy = intel_port_to_phy(i915, encoder->port);
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_cx0_phy_transaction_begin(encoder);

Should be where intel_cx0pll_disable() is added.

Quoted 25 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -0
 	drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));
 	intel_c10pll_disable(encoder);
+
+	intel_cx0_phy_transaction_end(encoder, wakeref);
 }
 
 void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
drivers/gpu/drm/i915/display/intel_cx0_phy.h +2 -0
index f8023f240727..952c7deeffaa 100644
@@ -40,5 +40,7 @@ int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
 void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 				 struct intel_crtc_state *new_crtc_state);
 int intel_c10_phy_check_hdmi_link_rate(int clock);
+void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder,
+				     const struct intel_crtc_state *crtc_state);
 
 #endif /* __INTEL_CX0_PHY_H__ */
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0 -0
index 91e2f88f43f7..7a578a30ee45 100644

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 163

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +7 -0
@@ -154,6 +154,14 @@
 #define CX0_P4PG_STATE_DISABLE		0xC
 #define CX0_P2_STATE_RESET		0x2
 
+#define PHY_C10_VDR_OVRD		0xD71
+#define   PHY_C10_VDR_OVRD_TX1		REG_BIT8(0)
+#define   PHY_C10_VDR_OVRD_TX2		REG_BIT8(2)
+#define PHY_C10_VDR_PRE_OVRD_TX1	0xD80
+#define C10_PHY_OVRD_LEVEL_MASK		REG_GENMASK8(5, 0)
+#define C10_PHY_OVRD_LEVEL(val)		REG_FIELD_PREP8(C10_PHY_OVRD_LEVEL_MASK, val)
+#define PHY_CX0_VDR_OVRD_CONTROL(lane, tx, control) (PHY_C10_VDR_PRE_OVRD_TX1 + ((lane) ^ ((tx) - 1)) * 0x10 + (control))

Flag indentation is missing.

Instead of open-coding there should be defines like

CX0_VDR_CONTROL_TX1 0
CX0_VDR_CONTROL_TX2 1

and use these both in lane_to_phy_lane_tx() and above replacing ((tx) - 1) with ((tx) - CX0_VDR_CONTROL_TX1).

(and in similar places like PHY_CX0_TX_CONTROL()).

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 176

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +6 -0
+
 /* PHY_C10_VDR_PLL0 */
 #define PLL_C10_MPLL_SSC_EN             REG_BIT8(0)
 
@@ -161,4 +169,10 @@
 #define PHY_CX0_TX_CONTROL(tx, control) (0x400 + ((tx) - 1) * 0x200 + (control))
 #define CONTROL2_DISABLE_SINGLE_TX      REG_BIT(6)
 
+/* C10 Phy VSWING Masks */
+#define C10_PHY_VSWING_LEVEL_MASK	REG_GENMASK8(2, 0)
+#define C10_PHY_VSWING_LEVEL(val)	REG_FIELD_PREP8(C10_PHY_VSWING_LEVEL_MASK, val)
+#define C10_PHY_VSWING_PREEMPH_MASK	REG_GENMASK8(1, 0)
+#define C10_PHY_VSWING_PREEMPH(val)	REG_FIELD_PREP8(C10_PHY_VSWING_PREEMPH_MASK, val)

The above seem to be unused.

Quoted 100 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1 -0
+
 #endif /* __INTEL_CX0_REG_DEFS_H__ */
drivers/gpu/drm/i915/display/intel_ddi.c +3 -1
index a433dea5b9a3..e8269fcc595e 100644
@@ -4493,7 +4493,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 		encoder->get_config = hsw_ddi_get_config;
 	}
 
-	if (IS_DG2(dev_priv)) {
+	if (DISPLAY_VER(dev_priv) >= 14) {
+		encoder->set_signal_levels = intel_cx0_phy_set_signal_levels;
+	} else if (IS_DG2(dev_priv)) {
 		encoder->set_signal_levels = intel_snps_phy_set_signal_levels;
 	} else if (DISPLAY_VER(dev_priv) >= 12) {
 		if (intel_phy_is_combo(dev_priv, phy))
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c +30 -1
index 006a2e979000..cd4becbae098 100644
@@ -1035,6 +1035,25 @@ static const struct intel_ddi_buf_trans dg2_snps_trans_uhbr = {
 	.num_entries = ARRAY_SIZE(_dg2_snps_trans_uhbr),
 };
 
+static const union intel_ddi_buf_trans_entry _mtl_c10_trans_dp14[] = {
+	{ .snps = { 26, 0, 0  } },      /* preset 0 */
+	{ .snps = { 33, 0, 6  } },      /* preset 1 */
+	{ .snps = { 38, 0, 11 } },      /* preset 2 */
+	{ .snps = { 43, 0, 19 } },      /* preset 3 */
+	{ .snps = { 39, 0, 0  } },      /* preset 4 */
+	{ .snps = { 45, 0, 7  } },      /* preset 5 */
+	{ .snps = { 46, 0, 13 } },      /* preset 6 */
+	{ .snps = { 46, 0, 0  } },      /* preset 7 */
+	{ .snps = { 55, 0, 7  } },      /* preset 8 */
+	{ .snps = { 62, 0, 0  } },      /* preset 9 */
+};
+
+static const struct intel_ddi_buf_trans mtl_cx0c10_trans = {
+	.entries = _mtl_c10_trans_dp14,
+	.num_entries = ARRAY_SIZE(_mtl_c10_trans_dp14),
+	.hdmi_default_entry = ARRAY_SIZE(_mtl_c10_trans_dp14) - 1,
+};
+
 bool is_hobl_buf_trans(const struct intel_ddi_buf_trans *table)
 {
 	return table == &tgl_combo_phy_trans_edp_hbr2_hobl;
@@ -1606,12 +1625,22 @@ dg2_get_snps_buf_trans(struct intel_encoder *encoder,
 		return intel_get_buf_trans(&dg2_snps_trans, n_entries);
 }
 
+static const struct intel_ddi_buf_trans *
+mtl_get_cx0_buf_trans(struct intel_encoder *encoder,
+		      const struct intel_crtc_state *crtc_state,
+		      int *n_entries)
+{
+	return intel_get_buf_trans(&mtl_cx0c10_trans, n_entries);
+}
+
 void intel_ddi_buf_trans_init(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	enum phy phy = intel_port_to_phy(i915, encoder->port);
 
-	if (IS_DG2(i915)) {
+	if (DISPLAY_VER(i915) >= 14) {
+		encoder->get_buf_trans = mtl_get_cx0_buf_trans;
+	} else if (IS_DG2(i915)) {
 		encoder->get_buf_trans = dg2_get_snps_buf_trans;
 	} else if (IS_ALDERLAKE_P(i915)) {
 		if (intel_phy_is_combo(i915, phy))
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h +6 -0
index 2133984a572b..e4a857b9829d 100644
@@ -51,6 +51,11 @@ struct dg2_snps_phy_buf_trans {
 	u8 post_cursor;
 };
 
+struct direct_phy_buf_trans {
+	u8 level;
+	u8 preemph;
+};
+
 union intel_ddi_buf_trans_entry {
 	struct hsw_ddi_buf_trans hsw;
 	struct bxt_ddi_buf_trans bxt;
@@ -58,6 +63,7 @@ union intel_ddi_buf_trans_entry {
 	struct icl_mg_phy_ddi_buf_trans mg;
 	struct tgl_dkl_phy_ddi_buf_trans dkl;
 	struct dg2_snps_phy_buf_trans snps;
+	struct direct_phy_buf_trans direct;
 };
 
 struct intel_ddi_buf_trans {
drivers/gpu/drm/i915/display/intel_display_power_map.c +0 -0
index 6645eb1911d8..5ec2b9a109ae 100644

drivers/gpu/drm/i915/display/intel_display_power_map.c I915_DECL_PW_DOMAINS(xelpdp_pwdoms_dc_off, · line 1430

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display_power_map.c +1 -0
@@ -1427,6 +1427,7 @@ I915_DECL_PW_DOMAINS(xelpdp_pwdoms_dc_off,
 	XELPDP_PW_2_POWER_DOMAINS,
 	POWER_DOMAIN_AUDIO_MMIO,
 	POWER_DOMAIN_MODESET,
+	POWER_DOMAIN_DC_OFF,

It's added to the domain list below.

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display_power_map.c +0 -0
 	POWER_DOMAIN_AUX_A,
 	POWER_DOMAIN_AUX_B,
 	POWER_DOMAIN_DC_OFF,
Signature · 1 line
2.34.1
#27 lore raw

PATCH 7/7 drm/i915/mtl: Add support for PM DEMAND

In reply to Mika Kahola

Display14 introduces a new way to instruct the PUnit with power and bandwidth requirements of DE. Add the functionality to program the registers and handle waits using interrupts. The current wait time for timeouts is programmed for 10 msecs to factor in the worst case scenarios. Changes made to use REG_BIT for a register that we touched(GEN8_DE_MISC_IER _MMIO).

v2:
- Removed repeated definition of dbuf, which has been moved to struct intel_display. (Gustavo)
- s/dev_priv->dbuf/dev_priv->display.dbuf/ (Gustavo)

Bspec: 66451, 64636, 64602, 64603

---
 drivers/gpu/drm/i915/display/intel_bw.c       |   4 +-
 drivers/gpu/drm/i915/display/intel_bw.h       |   2 +
 drivers/gpu/drm/i915/display/intel_display.c  |  14 +
 .../drm/i915/display/intel_display_power.c    |   8 +
 drivers/gpu/drm/i915/i915_drv.h               |   6 +
 drivers/gpu/drm/i915/i915_irq.c               |  22 +-
 drivers/gpu/drm/i915/i915_reg.h               |  33 +-
 drivers/gpu/drm/i915/intel_pm.c               | 286 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_pm.h               |  35 +++
 9 files changed, 405 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_bw.c +2 -2
index 202321ffbe2a..87c20bf52123 100644
@@ -746,8 +746,8 @@ static unsigned int intel_bw_num_active_planes(struct drm_i915_private *dev_priv
 	return num_active_planes;
 }
 
-static unsigned int intel_bw_data_rate(struct drm_i915_private *dev_priv,
-				       const struct intel_bw_state *bw_state)
+unsigned int intel_bw_data_rate(struct drm_i915_private *dev_priv,
+				const struct intel_bw_state *bw_state)
 {
 	unsigned int data_rate = 0;
 	enum pipe pipe;
drivers/gpu/drm/i915/display/intel_bw.h +2 -0
index f20292143745..17fc0b61db04 100644
@@ -62,6 +62,8 @@ int intel_bw_init(struct drm_i915_private *dev_priv);
 int intel_bw_atomic_check(struct intel_atomic_state *state);
 void intel_bw_crtc_update(struct intel_bw_state *bw_state,
 			  const struct intel_crtc_state *crtc_state);
+unsigned int intel_bw_data_rate(struct drm_i915_private *dev_priv,
+				const struct intel_bw_state *bw_state);
 int icl_pcode_restrict_qgv_points(struct drm_i915_private *dev_priv,
 				  u32 points_mask);
 int intel_bw_calc_min_cdclk(struct intel_atomic_state *state,
drivers/gpu/drm/i915/display/intel_display.c +14 -0
index 9fe6e33a66d6..3a9d71c80d5c 100644
@@ -959,6 +959,9 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
 		num_encoders++;
 	}
 
+	if (!encoder)
+		return NULL;
+
 	drm_WARN(encoder->base.dev, num_encoders != 1,
 		 "%d encoders for pipe %c\n",
 		 num_encoders, pipe_name(master_crtc->pipe));
@@ -6767,6 +6770,10 @@ int intel_atomic_check(struct drm_device *dev,
 		ret = intel_modeset_calc_cdclk(state);
 		if (ret)
 			return ret;
+
+		ret = intel_pmdemand_atomic_check(state);
+		if (ret)
+			goto fail;
 	}
 
 	ret = intel_atomic_check_crtcs(state);
@@ -7405,6 +7412,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
 	}
 
 	intel_sagv_pre_plane_update(state);
+	intel_pmdemand_pre_plane_update(state);
 
 	/* Complete the events for pipes that have now been disabled */
 	for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
@@ -7517,6 +7525,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
 		intel_verify_planes(state);
 
 	intel_sagv_post_plane_update(state);
+	intel_pmdemand_post_plane_update(state);
 
 	drm_atomic_helper_commit_hw_done(&state->base);
 
@@ -8248,6 +8257,7 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv)
 	intel_color_init_hooks(dev_priv);
 	intel_init_cdclk_hooks(dev_priv);
 	intel_audio_hooks_init(dev_priv);
+	intel_init_pmdemand(dev_priv);
 
 	intel_dpll_init_clock_hook(dev_priv);
 
@@ -8474,6 +8484,10 @@ int intel_modeset_init_noirq(struct drm_i915_private *i915)
 	if (ret)
 		goto cleanup_vga_client_pw_domain_dmc;
 
+	ret = intel_pmdemand_init(i915);
+	if (ret)
+		goto cleanup_vga_client_pw_domain_dmc;
+
 	init_llist_head(&i915->display.atomic_helper.free_list);
 	INIT_WORK(&i915->display.atomic_helper.free_work,
 		  intel_atomic_helper_free_state_worker);
drivers/gpu/drm/i915/display/intel_display_power.c +8 -0
index e23fecba446c..77927d66cd35 100644
@@ -19,6 +19,7 @@
 #include "intel_mchbar_regs.h"
 #include "intel_pch_refclk.h"
 #include "intel_pcode.h"
+#include "intel_pm.h"
 #include "intel_snps_phy.h"
 #include "skl_watermark.h"
 #include "vlv_sideband.h"
@@ -1082,6 +1083,10 @@ static void gen9_dbuf_enable(struct drm_i915_private *dev_priv)
 	dev_priv->display.dbuf.enabled_slices =
 		intel_enabled_dbuf_slices_mask(dev_priv);
 
+	if (DISPLAY_VER(dev_priv) >= 14)
+		intel_program_dbuf_pmdemand(dev_priv, BIT(DBUF_S1) |
+					    dev_priv->display.dbuf.enabled_slices);
+
 	/*
 	 * Just power up at least 1 slice, we will
 	 * figure out later which slices we have and what we need.
@@ -1093,6 +1098,9 @@ static void gen9_dbuf_enable(struct drm_i915_private *dev_priv)
 static void gen9_dbuf_disable(struct drm_i915_private *dev_priv)
 {
 	gen9_dbuf_slices_update(dev_priv, 0);
+
+	if (DISPLAY_VER(dev_priv) >= 14)
+		intel_program_dbuf_pmdemand(dev_priv, 0);
 }
 
 static void gen12_dbuf_slices_config(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_drv.h +6 -0
index 6254aa977398..df3b6742d980 100644
@@ -250,6 +250,12 @@ struct drm_i915_private {
 	unsigned int hpll_freq;
 	unsigned int czclk_freq;
 
+	struct {
+		wait_queue_head_t waitqueue;
+		struct mutex lock;
+		struct intel_global_obj obj;
+	} pmdemand;
+
 	/**
 	 * wq - Driver workqueue for GEM.
 	 *
drivers/gpu/drm/i915/i915_irq.c +21 -1
index 31271c30a8cf..4de7edc6c751 100644
@@ -1912,6 +1912,11 @@ static u32 gen8_de_pipe_fault_mask(struct drm_i915_private *dev_priv)
 		return GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
 }
 
+static void intel_pmdemand_irq_handler(struct drm_i915_private *dev_priv)
+{
+	wake_up_all(&dev_priv->pmdemand.waitqueue);
+}
+
 static void
 gen8_de_misc_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
 {
@@ -1948,6 +1953,18 @@ gen8_de_misc_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
 		}
 	}
 
+	if (iir & XELPDP_PMDEMAND_RSPTOUT_ERR) {
+		drm_dbg(&dev_priv->drm,
+			"Error waiting for Punit PM Demand Response\n");
+		intel_pmdemand_irq_handler(dev_priv);
+		found = true;
+	}
+
+	if (iir & XELPDP_PMDEMAND_RSP) {
+		intel_pmdemand_irq_handler(dev_priv);
+		found = true;
+	}
+
 	if (!found)
 		drm_err(&dev_priv->drm, "Unexpected DE Misc interrupt\n");
 }
@@ -3314,7 +3331,10 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
 		de_port_masked |= BXT_DE_PORT_GMBUS;
 
-	if (DISPLAY_VER(dev_priv) >= 11) {
+	if (DISPLAY_VER(dev_priv) >= 14)
+		de_misc_masked |= XELPDP_PMDEMAND_RSPTOUT_ERR |
+				  XELPDP_PMDEMAND_RSP;
+	else if (DISPLAY_VER(dev_priv) >= 11) {
 		enum port port;
 
 		if (intel_bios_is_dsi_present(dev_priv, &port))
drivers/gpu/drm/i915/i915_reg.h +31 -2
index 94dd0d3a474b..370b2bcb6fbf 100644
@@ -5398,8 +5398,10 @@
 #define GEN8_DE_MISC_IMR _MMIO(0x44464)
 #define GEN8_DE_MISC_IIR _MMIO(0x44468)
 #define GEN8_DE_MISC_IER _MMIO(0x4446c)
-#define  GEN8_DE_MISC_GSE		(1 << 27)
-#define  GEN8_DE_EDP_PSR		(1 << 19)
+#define  XELPDP_PMDEMAND_RSPTOUT_ERR	REG_BIT(27)
+#define  GEN8_DE_MISC_GSE		REG_BIT(27)
+#define  GEN8_DE_EDP_PSR		REG_BIT(19)
+#define  XELPDP_PMDEMAND_RSP		REG_BIT(3)
 
 #define GEN8_PCU_ISR _MMIO(0x444e0)
 #define GEN8_PCU_IMR _MMIO(0x444e4)
@@ -5462,6 +5464,33 @@
 #define  GEN11_HOTPLUG_CTL_SHORT_DETECT(hpd_pin)	(1 << (_HPD_PIN_TC(hpd_pin) * 4))
 #define  GEN11_HOTPLUG_CTL_NO_DETECT(hpd_pin)		(0 << (_HPD_PIN_TC(hpd_pin) * 4))
 
+#define XELPDP_INITIATE_PMDEMAND_REQUEST(dword)		_MMIO(0x45230 + 4 * (dword))
+#define  XELPDP_PMDEMAND_QCLK_GV_BW_MASK		REG_GENMASK(31, 16)
+#define  XELPDP_PMDEMAND_QCLK_GV_BW(x)			REG_FIELD_PREP(XELPDP_PMDEMAND_QCLK_GV_BW_MASK, x)
+#define  XELPDP_PMDEMAND_VOLTAGE_INDEX_MASK		REG_GENMASK(14, 12)
+#define  XELPDP_PMDEMAND_VOLTAGE_INDEX(x)		REG_FIELD_PREP(XELPDP_PMDEMAND_VOLTAGE_INDEX_MASK, x)
+#define  XELPDP_PMDEMAND_QCLK_GV_INDEX_MASK		REG_GENMASK(11, 8)
+#define  XELPDP_PMDEMAND_QCLK_GV_INDEX(x)		REG_FIELD_PREP(XELPDP_PMDEMAND_QCLK_GV_INDEX_MASK, x)
+#define  XELPDP_PMDEMAND_PIPES_MASK			REG_GENMASK(7, 6)
+#define  XELPDP_PMDEMAND_PIPES(x)			REG_FIELD_PREP(XELPDP_PMDEMAND_PIPES_MASK, x)
+#define  XELPDP_PMDEMAND_DBUFS_MASK			REG_GENMASK(5, 4)
+#define  XELPDP_PMDEMAND_DBUFS(x)			REG_FIELD_PREP(XELPDP_PMDEMAND_DBUFS_MASK, x)
+#define  XELPDP_PMDEMAND_PHYS_MASK			REG_GENMASK(2, 0)
+#define  XELPDP_PMDEMAND_PHYS(x)				REG_FIELD_PREP(XELPDP_PMDEMAND_PHYS_MASK, x)
+
+#define  XELPDP_PMDEMAND_REQ_ENABLE			REG_BIT(31)
+#define  XELPDP_PMDEMAND_CDCLK_FREQ_MASK		REG_GENMASK(30, 20)
+#define  XELPDP_PMDEMAND_CDCLK_FREQ(x)			REG_FIELD_PREP(XELPDP_PMDEMAND_CDCLK_FREQ_MASK, x)
+#define  XELPDP_PMDEMAND_DDICLK_FREQ_MASK		REG_GENMASK(18, 8)
+#define  XELPDP_PMDEMAND_DDICLK_FREQ(x)			REG_FIELD_PREP(XELPDP_PMDEMAND_DDICLK_FREQ_MASK, x)
+#define  XELPDP_PMDEMAND_SCALERS_MASK			REG_GENMASK(6, 4)
+#define  XELPDP_PMDEMAND_SCALERS(x)			REG_FIELD_PREP(XELPDP_PMDEMAND_SCALERS_MASK, x)
+#define  XELPDP_PMDEMAND_PLLS_MASK			REG_GENMASK(2, 0)
+#define  XELPDP_PMDEMAND_PLLS(x)			REG_FIELD_PREP(XELPDP_PMDEMAND_PLLS_MASK, x)
+
+#define GEN12_DCPR_STATUS_1				_MMIO(0x46440)
+#define  XELPDP_PMDEMAND_INFLIGHT_STATUS		REG_BIT(26)
+
 #define ILK_DISPLAY_CHICKEN2	_MMIO(0x42004)
 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
 #define  ILK_ELPIN_409_SELECT	(1 << 25)
drivers/gpu/drm/i915/intel_pm.c +286 -0

298 lines not on this page · raw message

drivers/gpu/drm/i915/intel_pm.h +35 -0
index f774bddcdca6..2663bec408c7 100644
@@ -8,11 +8,46 @@
 
 #include <linux/types.h>
 
+#include "display/intel_global_state.h"
+
 struct drm_i915_private;
 struct intel_crtc_state;
 struct intel_plane_state;
 
 void intel_init_clock_gating(struct drm_i915_private *dev_priv);
+void intel_init_pmdemand(struct drm_i915_private *dev_priv);
 void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv);
 
+struct intel_pmdemand_state {
+	struct intel_global_state base;
+
+	u16 qclk_gv_bw;
+	u8 voltage_index;
+	u8 qclk_gv_index;
+	u8 active_pipes;
+	u8 dbufs;
+	u8 active_phys_plls_mask;
+	u16 cdclk_freq_mhz;
+	u16 ddiclk_freq_mhz;
+	u8 scalers;
+};
+
+int intel_pmdemand_init(struct drm_i915_private *dev_priv);
+
+struct intel_pmdemand_state *
+intel_atomic_get_pmdemand_state(struct intel_atomic_state *state);
+
+#define to_intel_pmdemand_state(x) container_of((x), struct intel_pmdemand_state, base)
+#define intel_atomic_get_old_pmdemand_state(state) \
+	to_intel_pmdemand_state(intel_atomic_get_old_global_obj_state(state, &to_i915(state->base.dev)->pmdemand.obj))
+#define intel_atomic_get_new_pmdemand_state(state) \
+	to_intel_pmdemand_state(intel_atomic_get_new_global_obj_state(state, &to_i915(state->base.dev)->pmdemand.obj))
+
+int intel_pmdemand_init(struct drm_i915_private *dev_priv);
+void intel_program_dbuf_pmdemand(struct drm_i915_private *dev_priv,
+				 u8 dbuf_slices);
+void intel_pmdemand_pre_plane_update(struct intel_atomic_state *state);
+void intel_pmdemand_post_plane_update(struct intel_atomic_state *state);
+int intel_pmdemand_atomic_check(struct intel_atomic_state *state);
+
 #endif /* __INTEL_PM_H__ */
Signature · 1 line
2.34.1
#28 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/mtl: Add Support for C10 chips

In reply to Mika Kahola
== Series Details ==

== Series Details ==

Series: drm/i915/mtl: Add Support for C10 chips
URL : https://patchwork.freedesktop.org/series/115664/
State : warning

== Summary ==

Error: dim checkpatch failed
acf3d3886bcc drm/i915/mtl: Initial DDI port setup
fa367a60b5f5 drm/i915/mtl: Add DP rates
dd49f2562c22 drm/i915/mtl: Create separate reg file for PICA registers
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:17: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #17:
new file mode 100644

-:37: WARNING:LONG_LINE: line length of 117 exceeds 100 columns #37: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:16:
+ _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \

-:38: WARNING:LONG_LINE: line length of 117 exceeds 100 columns #38: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:17:
+ _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \

-:39: WARNING:LONG_LINE: line length of 121 exceeds 100 columns #39: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:18:
+ _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \

-:40: WARNING:LONG_LINE: line length of 133 exceeds 100 columns #40: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:19:
+ _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2) + (lane) * 4)

-:43: WARNING:LONG_LINE: line length of 110 exceeds 100 columns #43: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:22:
+#define XELPDP_PORT_M2P_COMMAND_WRITE_UNCOMMITTED REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x1)

-:44: WARNING:LONG_LINE: line length of 110 exceeds 100 columns #44: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:23:
+#define XELPDP_PORT_M2P_COMMAND_WRITE_COMMITTED REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x2)

-:45: WARNING:LONG_LINE: line length of 110 exceeds 100 columns #45: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:24:
+#define XELPDP_PORT_M2P_COMMAND_READ REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x3)

-:47: WARNING:LONG_LINE: line length of 102 exceeds 100 columns #47: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:26:
+#define XELPDP_PORT_M2P_DATA(val) REG_FIELD_PREP(XELPDP_PORT_M2P_DATA_MASK, val)

-:50: WARNING:LONG_LINE: line length of 105 exceeds 100 columns #50: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:29:
+#define XELPDP_PORT_M2P_ADDRESS(val) REG_FIELD_PREP(XELPDP_PORT_M2P_ADDRESS_MASK, val)

-:52: WARNING:LONG_LINE: line length of 117 exceeds 100 columns #52: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:31:
+ _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \

-:53: WARNING:LONG_LINE: line length of 117 exceeds 100 columns #53: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:32:
+ _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \

-:54: WARNING:LONG_LINE: line length of 121 exceeds 100 columns #54: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:33:
+ _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \

-:55: WARNING:LONG_LINE: line length of 137 exceeds 100 columns #55: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:34:
+ _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2) + (lane) * 4 + 8)

-:61: WARNING:LONG_LINE: line length of 102 exceeds 100 columns #61: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:40:
+#define XELPDP_PORT_P2M_DATA(val) REG_FIELD_PREP(XELPDP_PORT_P2M_DATA_MASK, val)

-:79: WARNING:LONG_LINE: line length of 111 exceeds 100 columns #79: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:58:
+ _XELPDP_PORT_BUF_CTL1_LN0_A, \

-:80: WARNING:LONG_LINE: line length of 111 exceeds 100 columns #80: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:59:
+ _XELPDP_PORT_BUF_CTL1_LN0_B, \

-:81: WARNING:LONG_LINE: line length of 115 exceeds 100 columns #81: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:60:
+ _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \

-:82: WARNING:LONG_LINE: line length of 114 exceeds 100 columns #82: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:61:
+ _XELPDP_PORT_BUF_CTL1_LN0_USBC2))

-:92: WARNING:LONG_LINE: line length of 111 exceeds 100 columns #92: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:71:
+ _XELPDP_PORT_BUF_CTL1_LN0_A, \

-:93: WARNING:LONG_LINE: line length of 111 exceeds 100 columns #93: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:72:
+ _XELPDP_PORT_BUF_CTL1_LN0_B, \

-:94: WARNING:LONG_LINE: line length of 115 exceeds 100 columns #94: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:73:
+ _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \

-:95: WARNING:LONG_LINE: line length of 118 exceeds 100 columns #95: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:74:
+ _XELPDP_PORT_BUF_CTL1_LN0_USBC2) + 4)

-:103: WARNING:LONG_LINE: line length of 114 exceeds 100 columns #103: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:82:
+#define XELPDP_LANE0_POWERDOWN_NEW_STATE(val) REG_FIELD_PREP(XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK, val)

-:105: WARNING:LONG_LINE: line length of 114 exceeds 100 columns #105: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:84:
+#define XELPDP_LANE1_POWERDOWN_NEW_STATE(val) REG_FIELD_PREP(XELPDP_LANE1_POWERDOWN_NEW_STATE_MASK, val)

-:107: WARNING:LONG_LINE: line length of 106 exceeds 100 columns #107: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:86:
+#define XELPDP_POWER_STATE_READY(val) REG_FIELD_PREP(XELPDP_POWER_STATE_READY_MASK, val)

-:110: WARNING:LONG_LINE: line length of 111 exceeds 100 columns #110: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:89:
+ _XELPDP_PORT_BUF_CTL1_LN0_A, \

-:111: WARNING:LONG_LINE: line length of 111 exceeds 100 columns #111: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:90:
+ _XELPDP_PORT_BUF_CTL1_LN0_B, \

-:112: WARNING:LONG_LINE: line length of 115 exceeds 100 columns #112: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:91:
+ _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \

-:113: WARNING:LONG_LINE: line length of 118 exceeds 100 columns #113: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:92:
+ _XELPDP_PORT_BUF_CTL1_LN0_USBC2) + 8)

-:115: WARNING:LONG_LINE: line length of 114 exceeds 100 columns #115: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:94:
+#define XELPDP_PLL_LANE_STAGGERING_DELAY(val) REG_FIELD_PREP(XELPDP_PLL_LANE_STAGGERING_DELAY_MASK, val)

-:117: WARNING:LONG_LINE: line length of 107 exceeds 100 columns #117: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:96:
+#define XELPDP_POWER_STATE_ACTIVE(val) REG_FIELD_PREP(XELPDP_POWER_STATE_ACTIVE_MASK, val)

-:124: WARNING:LONG_LINE: line length of 108 exceeds 100 columns #124: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:103:
+ _XELPDP_PORT_CLOCK_CTL_A, \

-:125: WARNING:LONG_LINE: line length of 108 exceeds 100 columns #125: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:104:
+ _XELPDP_PORT_CLOCK_CTL_B, \

-:126: WARNING:LONG_LINE: line length of 112 exceeds 100 columns #126: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:105:
+ _XELPDP_PORT_CLOCK_CTL_USBC1, \

-:127: WARNING:LONG_LINE: line length of 111 exceeds 100 columns #127: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:106:
+ _XELPDP_PORT_CLOCK_CTL_USBC2))

-:139: WARNING:LONG_LINE: line length of 105 exceeds 100 columns #139: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:118:
+#define XELPDP_DDI_CLOCK_SELECT(val) REG_FIELD_PREP(XELPDP_DDI_CLOCK_SELECT_MASK, val)

total: 0 errors, 37 warnings, 0 checks, 131 lines checked
484ad1495ef9 drm/i915/mtl: Add Support for C10 PHY message bus and pll programming
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:24: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #24:
Move register definitions to a new file i.e. intel_cx0_reg_defs.h (Jani)

-:58: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #58:
new file mode 100644

-:79: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'phy < PHY_C' #79: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:17:
+ if (IS_METEORLAKE(dev_priv) && (phy < PHY_C))

-:114: WARNING:LONG_LINE: line length of 119 exceeds 100 columns #114: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:52:
+ drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for message ACK. Status: 0x%x\n", phy_name(phy), *val);

-:122: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #122: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:60:
+static int __intel_cx0_read(struct drm_i915_private *i915, enum port port,
+ int lane, u16 addr, u32 *val)

-:131: WARNING:LONG_LINE: line length of 146 exceeds 100 columns #131: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:69:
+ drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for previous transaction to complete. Reset the bus and retry.\n", phy_name(phy));

-:151: WARNING:LONG_LINE: line length of 122 exceeds 100 columns #151: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:89:
+ drm_dbg_kms(&i915->drm, "PHY %c Error occurred during read command. Status: 0x%x\n", phy_name(phy), *val);

-:159: WARNING:LONG_LINE: line length of 115 exceeds 100 columns #159: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:97:
+ drm_dbg_kms(&i915->drm, "PHY %c Not a Read response. MSGBUS Status: 0x%x.\n", phy_name(phy), *val);

-:185: WARNING:LONG_LINE: line length of 112 exceeds 100 columns #185: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:123:
+ drm_err_once(&i915->drm, "PHY %c Read %04x failed after %d retries.\n", phy_name(phy), addr, i);

-:193: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #193: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:131:
+static int intel_cx0_wait_cwrite_ack(struct drm_i915_private *i915,
+ enum port port, int lane)

-:206: WARNING:LONG_LINE: line length of 118 exceeds 100 columns #206: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:144:
+ drm_dbg_kms(&i915->drm, "PHY %c Unexpected ACK received. MSGBUS STATUS: 0x%x.\n", phy_name(phy), val);

-:222: WARNING:LONG_LINE: line length of 146 exceeds 100 columns #222: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:160:
+ drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for previous transaction to complete. Reset the bus and retry.\n", phy_name(phy));

-:243: WARNING:LONG_LINE: line length of 104 exceeds 100 columns #243: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:181:
+ drm_dbg_kms(&i915->drm, "PHY %c Error occurred during write command.\n", phy_name(phy));

-:267: WARNING:LONG_LINE: line length of 113 exceeds 100 columns #267: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:205:
+ drm_err_once(&i915->drm, "PHY %c Write %04x failed after %d retries.\n", phy_name(phy), addr, i);

-:672: WARNING:LONG_LINE: line length of 104 exceeds 100 columns #672: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:610:
+ intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CMN(0), cmn0, MB_WRITE_COMMITTED);

-:673: WARNING:LONG_LINE: line length of 110 exceeds 100 columns #673: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:611:
+ intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_TX(0), C10_TX0_VAL, MB_WRITE_COMMITTED);

-:868: WARNING:LONG_LINE: line length of 107 exceeds 100 columns #868: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:806:
+ XELPDP_LANE0_PHY_CURRENT_STATUS | XELPDP_LANE1_PHY_CURRENT_STATUS,

-:869: WARNING:LONG_LINE: line length of 107 exceeds 100 columns #869: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:807:
+ XELPDP_LANE0_PHY_CURRENT_STATUS | XELPDP_LANE1_PHY_CURRENT_STATUS,

-:943: WARNING:LONG_LINE: line length of 102 exceeds 100 columns #943: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:881:
+ intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(1, 2),

-:948: WARNING:LONG_LINE: line length of 102 exceeds 100 columns #948: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:886:
+ intel_cx0_write(i915, port, INTEL_CX0_LANE0, PHY_CX0_TX_CONTROL(2, 2),

-:974: WARNING:LONG_LINE: line length of 102 exceeds 100 columns #974: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:912:
+ C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);

-:1189: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/gpu/drm/i915/display/intel_cx0_phy.h', please use '/*' instead #1189: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.h:1:
+// SPDX-License-Identifier: MIT

-:1189: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #1189: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.h:1:
+// SPDX-License-Identifier: MIT

-:1298: WARNING:LONG_LINE: line length of 102 exceeds 100 columns #1298: FILE: drivers/gpu/drm/i915/display/intel_ddi.c:3521:
+ crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state->c10mpllb_state);

-:1487: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__n' - possible side-effects? #1487: FILE: drivers/gpu/drm/i915/i915_reg_defs.h:33:
+#define REG_BIT8(__n) \
+ ((u8)(BIT(__n) + \
+ BUILD_BUG_ON_ZERO(__is_constexpr(__n) && \
+ ((__n) < 0 || (__n) > 7))))

-:1508: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__high' - possible side-effects? #1508: FILE: drivers/gpu/drm/i915/i915_reg_defs.h:77:
+#define REG_GENMASK8(__high, __low) \
+ ((u8)(GENMASK(__high, __low) + \
+ BUILD_BUG_ON_ZERO(__is_constexpr(__high) && \
+ __is_constexpr(__low) && \
+ ((__low) < 0 || (__high) > 7 || (__low) > (__high)))))

-:1508: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__low' - possible side-effects? #1508: FILE: drivers/gpu/drm/i915/i915_reg_defs.h:77:
+#define REG_GENMASK8(__high, __low) \
+ ((u8)(GENMASK(__high, __low) + \
+ BUILD_BUG_ON_ZERO(__is_constexpr(__high) && \
+ __is_constexpr(__low) && \
+ ((__low) < 0 || (__high) > 7 || (__low) > (__high)))))

-:1531: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__mask' - possible side-effects? #1531: FILE: drivers/gpu/drm/i915/i915_reg_defs.h:115:
+#define REG_FIELD_PREP8(__mask, __val) \
+ ((u8)((((typeof(__mask))(__val) << __bf_shf(__mask)) & (__mask)) + \

+	       BUILD_BUG_ON_ZERO(!__is_constexpr(__mask)) +             \
+	       BUILD_BUG_ON_ZERO((__mask) == 0 || (__mask) > U8_MAX) +          \
+	       BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
+	       BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))

-:1531: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__val' - possible side-effects? #1531: FILE: drivers/gpu/drm/i915/i915_reg_defs.h:115:
+#define REG_FIELD_PREP8(__mask, __val) \
+ ((u8)((((typeof(__mask))(__val) << __bf_shf(__mask)) & (__mask)) + \

+	       BUILD_BUG_ON_ZERO(!__is_constexpr(__mask)) +             \
+	       BUILD_BUG_ON_ZERO((__mask) == 0 || (__mask) > U8_MAX) +          \
+	       BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
+	       BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))

-:1536: WARNING:LONG_LINE: line length of 128 exceeds 100 columns #1536: FILE: drivers/gpu/drm/i915/i915_reg_defs.h:120:
+ BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))

total: 0 errors, 22 warnings, 8 checks, 1438 lines checked
5ab3ed0136b6 drm/i915/mtl: Add C10 phy programming for HDMI
-:21: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #21:
v3: Add missing use_hdmi checks from Clint's HDMI implementation changes (Ankit)

-:165: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #165: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:615:
+ .pll[0]=0x34,
^

-:166: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #166: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:616:
+ .pll[1]=0x00,
^

-:167: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #167: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:617:
+ .pll[2]=0xB0,
^

-:168: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #168: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:618:
+ .pll[3]=0x00,
^

-:169: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #169: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:619:
+ .pll[4]=0x00,
^

-:170: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #170: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:620:
+ .pll[5]=0x00,
^

-:171: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #171: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:621:
+ .pll[6]=0x00,
^

-:172: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #172: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:622:
+ .pll[7]=0x00,
^

-:173: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #173: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:623:
+ .pll[8]=0x20,
^

-:174: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #174: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:624:
+ .pll[9]=0xFF,
^

-:175: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #175: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:625:
+ .pll[10]=0xFF,
^

-:176: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #176: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:626:
+ .pll[11]=0x55,
^

-:177: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #177: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:627:
+ .pll[12]=0xE5,
^

-:178: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #178: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:628:
+ .pll[13]=0x55,
^

-:179: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #179: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:629:
+ .pll[14]=0x55,
^

-:180: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #180: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:630:
+ .pll[15]=0x0D,
^

-:181: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #181: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:631:
+ .pll[16]=0x09,
^

-:182: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #182: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:632:
+ .pll[17]=0x8F,
^

-:183: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #183: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:633:
+ .pll[18]=0x84,
^

-:184: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #184: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:634:
+ .pll[19]=0x23,
^

-:189: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #189: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:639:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xC0, .pll[3]=0x00, .pll[4]=0x00,
^

-:189: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #189: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:639:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xC0, .pll[3]=0x00, .pll[4]=0x00,
^

-:189: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #189: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:639:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xC0, .pll[3]=0x00, .pll[4]=0x00,
^

-:189: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #189: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:639:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xC0, .pll[3]=0x00, .pll[4]=0x00,
^

-:189: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #189: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:639:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xC0, .pll[3]=0x00, .pll[4]=0x00,
^

-:190: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #190: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:640:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:190: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #190: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:640:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:190: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #190: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:640:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:190: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #190: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:640:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:190: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #190: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:640:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:191: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #191: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:641:
+ .pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
^

-:191: ERROR:SPACING: space required after that ',' (ctx:VxV) #191: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:641:
+ .pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
^

-:191: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #191: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:641:
+ .pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
^

-:191: ERROR:SPACING: space required after that ',' (ctx:VxV) #191: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:641:
+ .pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
^

-:191: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #191: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:641:
+ .pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
^

-:191: ERROR:SPACING: space required after that ',' (ctx:VxV) #191: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:641:
+ .pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
^

-:191: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #191: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:641:
+ .pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
^

-:191: ERROR:SPACING: space required after that ',' (ctx:VxV) #191: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:641:
+ .pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
^

-:191: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #191: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:641:
+ .pll[10]=0xFF,.pll[11]=0xCC,.pll[12]=0x9C,.pll[13]=0xCB,.pll[14]=0xCC,
^

-:192: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #192: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:642:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:192: ERROR:SPACING: space required after that ',' (ctx:VxV) #192: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:642:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:192: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #192: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:642:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:192: ERROR:SPACING: space required after that ',' (ctx:VxV) #192: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:642:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:192: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #192: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:642:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:192: ERROR:SPACING: space required after that ',' (ctx:VxV) #192: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:642:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:192: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #192: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:642:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:192: ERROR:SPACING: space required after that ',' (ctx:VxV) #192: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:642:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:192: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #192: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:642:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:197: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #197: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:647:
+ .pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xCC, .pll[3]=0x00, .pll[4]=0x00,
^

-:197: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #197: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:647:
+ .pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xCC, .pll[3]=0x00, .pll[4]=0x00,
^

-:197: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #197: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:647:
+ .pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xCC, .pll[3]=0x00, .pll[4]=0x00,
^

-:197: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #197: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:647:
+ .pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xCC, .pll[3]=0x00, .pll[4]=0x00,
^

-:197: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #197: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:647:
+ .pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xCC, .pll[3]=0x00, .pll[4]=0x00,
^

-:198: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #198: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:648:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:198: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #198: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:648:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:198: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #198: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:648:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:198: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #198: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:648:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:198: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #198: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:648:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:199: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #199: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:649:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:199: ERROR:SPACING: space required after that ',' (ctx:VxV) #199: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:649:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:199: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #199: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:649:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:199: ERROR:SPACING: space required after that ',' (ctx:VxV) #199: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:649:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:199: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #199: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:649:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:199: ERROR:SPACING: space required after that ',' (ctx:VxV) #199: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:649:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:199: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #199: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:649:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:199: ERROR:SPACING: space required after that ',' (ctx:VxV) #199: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:649:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:199: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #199: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:649:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:200: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #200: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:650:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:200: ERROR:SPACING: space required after that ',' (ctx:VxV) #200: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:650:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:200: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #200: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:650:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:200: ERROR:SPACING: space required after that ',' (ctx:VxV) #200: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:650:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:200: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #200: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:650:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:200: ERROR:SPACING: space required after that ',' (ctx:VxV) #200: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:650:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:200: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #200: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:650:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:200: ERROR:SPACING: space required after that ',' (ctx:VxV) #200: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:650:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:200: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #200: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:650:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:205: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #205: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:655:
+ .pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xDC, .pll[3]=0x00, .pll[4]=0x00,
^

-:205: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #205: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:655:
+ .pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xDC, .pll[3]=0x00, .pll[4]=0x00,
^

-:205: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #205: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:655:
+ .pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xDC, .pll[3]=0x00, .pll[4]=0x00,
^

-:205: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #205: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:655:
+ .pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xDC, .pll[3]=0x00, .pll[4]=0x00,
^

-:205: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #205: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:655:
+ .pll[0]=0x04, .pll[1]=0x00, .pll[2]=0xDC, .pll[3]=0x00, .pll[4]=0x00,
^

-:206: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #206: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:656:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:206: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #206: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:656:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:206: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #206: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:656:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:206: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #206: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:656:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:206: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #206: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:656:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:207: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #207: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:657:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:207: ERROR:SPACING: space required after that ',' (ctx:VxV) #207: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:657:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:207: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #207: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:657:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:207: ERROR:SPACING: space required after that ',' (ctx:VxV) #207: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:657:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:207: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #207: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:657:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:207: ERROR:SPACING: space required after that ',' (ctx:VxV) #207: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:657:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:207: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #207: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:657:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:207: ERROR:SPACING: space required after that ',' (ctx:VxV) #207: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:657:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:207: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #207: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:657:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:208: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #208: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:658:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:208: ERROR:SPACING: space required after that ',' (ctx:VxV) #208: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:658:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:208: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #208: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:658:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:208: ERROR:SPACING: space required after that ',' (ctx:VxV) #208: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:658:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:208: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #208: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:658:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:208: ERROR:SPACING: space required after that ',' (ctx:VxV) #208: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:658:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:208: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #208: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:658:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:208: ERROR:SPACING: space required after that ',' (ctx:VxV) #208: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:658:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:208: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #208: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:658:
+ .pll[15]=0x0D,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:213: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #213: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:663:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x62, .pll[3]=0x00, .pll[4]=0x00,
^

-:213: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #213: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:663:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x62, .pll[3]=0x00, .pll[4]=0x00,
^

-:213: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #213: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:663:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x62, .pll[3]=0x00, .pll[4]=0x00,
^

-:213: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #213: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:663:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x62, .pll[3]=0x00, .pll[4]=0x00,
^

-:213: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #213: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:663:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x62, .pll[3]=0x00, .pll[4]=0x00,
^

-:214: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #214: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:664:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:214: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #214: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:664:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:214: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #214: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:664:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:214: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #214: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:664:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:214: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #214: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:664:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:215: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #215: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:665:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
^

-:215: ERROR:SPACING: space required after that ',' (ctx:VxV) #215: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:665:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
^

-:215: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #215: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:665:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
^

-:215: ERROR:SPACING: space required after that ',' (ctx:VxV) #215: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:665:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
^

-:215: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #215: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:665:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
^

-:215: ERROR:SPACING: space required after that ',' (ctx:VxV) #215: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:665:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
^

-:215: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #215: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:665:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
^

-:215: ERROR:SPACING: space required after that ',' (ctx:VxV) #215: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:665:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
^

-:215: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #215: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:665:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0xA0,.pll[13]=0x00,.pll[14]=0x00,
^

-:216: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #216: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:666:
+ .pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:216: ERROR:SPACING: space required after that ',' (ctx:VxV) #216: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:666:
+ .pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:216: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #216: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:666:
+ .pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:216: ERROR:SPACING: space required after that ',' (ctx:VxV) #216: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:666:
+ .pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:216: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #216: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:666:
+ .pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:216: ERROR:SPACING: space required after that ',' (ctx:VxV) #216: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:666:
+ .pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:216: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #216: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:666:
+ .pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:216: ERROR:SPACING: space required after that ',' (ctx:VxV) #216: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:666:
+ .pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:216: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #216: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:666:
+ .pll[15]=0x0C,.pll[16]=0x09,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:221: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #221: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:671:
+ .pll[0]=0xC4, .pll[1]=0x00, .pll[2]=0x76, .pll[3]=0x00, .pll[4]=0x00,
^

-:221: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #221: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:671:
+ .pll[0]=0xC4, .pll[1]=0x00, .pll[2]=0x76, .pll[3]=0x00, .pll[4]=0x00,
^

-:221: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #221: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:671:
+ .pll[0]=0xC4, .pll[1]=0x00, .pll[2]=0x76, .pll[3]=0x00, .pll[4]=0x00,
^

-:221: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #221: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:671:
+ .pll[0]=0xC4, .pll[1]=0x00, .pll[2]=0x76, .pll[3]=0x00, .pll[4]=0x00,
^

-:221: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #221: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:671:
+ .pll[0]=0xC4, .pll[1]=0x00, .pll[2]=0x76, .pll[3]=0x00, .pll[4]=0x00,
^

-:222: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #222: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:672:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:222: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #222: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:672:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:222: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #222: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:672:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:222: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #222: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:672:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:222: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #222: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:672:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:223: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #223: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:673:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:223: ERROR:SPACING: space required after that ',' (ctx:VxV) #223: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:673:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:223: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #223: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:673:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:223: ERROR:SPACING: space required after that ',' (ctx:VxV) #223: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:673:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:223: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #223: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:673:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:223: ERROR:SPACING: space required after that ',' (ctx:VxV) #223: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:673:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:223: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #223: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:673:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:223: ERROR:SPACING: space required after that ',' (ctx:VxV) #223: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:673:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:223: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #223: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:673:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x00,.pll[13]=0x00,.pll[14]=0x00,
^

-:224: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #224: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:674:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:224: ERROR:SPACING: space required after that ',' (ctx:VxV) #224: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:674:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:224: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #224: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:674:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:224: ERROR:SPACING: space required after that ',' (ctx:VxV) #224: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:674:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:224: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #224: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:674:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:224: ERROR:SPACING: space required after that ',' (ctx:VxV) #224: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:674:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:224: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #224: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:674:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:224: ERROR:SPACING: space required after that ',' (ctx:VxV) #224: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:674:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:224: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #224: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:674:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:229: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #229: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:679:
+ .pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x86, .pll[3]=0x00, .pll[4]=0x00,
^

-:229: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #229: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:679:
+ .pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x86, .pll[3]=0x00, .pll[4]=0x00,
^

-:229: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #229: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:679:
+ .pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x86, .pll[3]=0x00, .pll[4]=0x00,
^

-:229: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #229: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:679:
+ .pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x86, .pll[3]=0x00, .pll[4]=0x00,
^

-:229: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #229: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:679:
+ .pll[0]=0xB4, .pll[1]=0x00, .pll[2]=0x86, .pll[3]=0x00, .pll[4]=0x00,
^

-:230: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #230: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:680:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:230: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #230: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:680:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:230: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #230: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:680:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:230: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #230: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:680:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:230: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #230: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:680:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:231: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #231: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:681:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
^

-:231: ERROR:SPACING: space required after that ',' (ctx:VxV) #231: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:681:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
^

-:231: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #231: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:681:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
^

-:231: ERROR:SPACING: space required after that ',' (ctx:VxV) #231: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:681:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
^

-:231: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #231: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:681:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
^

-:231: ERROR:SPACING: space required after that ',' (ctx:VxV) #231: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:681:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
^

-:231: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #231: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:681:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
^

-:231: ERROR:SPACING: space required after that ',' (ctx:VxV) #231: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:681:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
^

-:231: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #231: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:681:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0x55,.pll[13]=0x55,.pll[14]=0x55,
^

-:232: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #232: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:682:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:232: ERROR:SPACING: space required after that ',' (ctx:VxV) #232: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:682:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:232: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #232: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:682:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:232: ERROR:SPACING: space required after that ',' (ctx:VxV) #232: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:682:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:232: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #232: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:682:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:232: ERROR:SPACING: space required after that ',' (ctx:VxV) #232: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:682:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:232: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #232: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:682:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:232: ERROR:SPACING: space required after that ',' (ctx:VxV) #232: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:682:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:232: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #232: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:682:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:237: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #237: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:687:
+ .pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
^

-:237: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #237: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:687:
+ .pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
^

-:237: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #237: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:687:
+ .pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
^

-:237: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #237: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:687:
+ .pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
^

-:237: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #237: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:687:
+ .pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xAE, .pll[3]=0x00, .pll[4]=0x00,
^

-:238: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #238: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:688:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:238: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #238: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:688:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:238: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #238: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:688:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:238: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #238: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:688:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:238: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #238: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:688:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:239: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #239: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:689:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
^

-:239: ERROR:SPACING: space required after that ',' (ctx:VxV) #239: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:689:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
^

-:239: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #239: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:689:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
^

-:239: ERROR:SPACING: space required after that ',' (ctx:VxV) #239: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:689:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
^

-:239: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #239: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:689:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
^

-:239: ERROR:SPACING: space required after that ',' (ctx:VxV) #239: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:689:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
^

-:239: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #239: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:689:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
^

-:239: ERROR:SPACING: space required after that ',' (ctx:VxV) #239: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:689:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
^

-:239: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #239: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:689:
+ .pll[10]=0xFF,.pll[11]=0x00,.pll[12]=0x20,.pll[13]=0x00,.pll[14]=0x00,
^

-:240: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #240: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:690:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:240: ERROR:SPACING: space required after that ',' (ctx:VxV) #240: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:690:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:240: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #240: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:690:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:240: ERROR:SPACING: space required after that ',' (ctx:VxV) #240: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:690:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:240: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #240: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:690:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:240: ERROR:SPACING: space required after that ',' (ctx:VxV) #240: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:690:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:240: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #240: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:690:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:240: ERROR:SPACING: space required after that ',' (ctx:VxV) #240: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:690:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:240: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #240: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:690:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:245: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #245: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:695:
+ .pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xB0, .pll[3]=0x00, .pll[4]=0x00,
^

-:245: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #245: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:695:
+ .pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xB0, .pll[3]=0x00, .pll[4]=0x00,
^

-:245: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #245: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:695:
+ .pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xB0, .pll[3]=0x00, .pll[4]=0x00,
^

-:245: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #245: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:695:
+ .pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xB0, .pll[3]=0x00, .pll[4]=0x00,
^

-:245: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #245: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:695:
+ .pll[0]=0x74, .pll[1]=0x00, .pll[2]=0xB0, .pll[3]=0x00, .pll[4]=0x00,
^

-:246: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #246: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:696:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:246: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #246: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:696:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:246: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #246: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:696:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:246: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #246: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:696:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:246: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #246: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:696:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:247: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #247: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:697:
+ .pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
^

-:247: ERROR:SPACING: space required after that ',' (ctx:VxV) #247: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:697:
+ .pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
^

-:247: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #247: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:697:
+ .pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
^

-:247: ERROR:SPACING: space required after that ',' (ctx:VxV) #247: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:697:
+ .pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
^

-:247: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #247: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:697:
+ .pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
^

-:247: ERROR:SPACING: space required after that ',' (ctx:VxV) #247: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:697:
+ .pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
^

-:247: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #247: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:697:
+ .pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
^

-:247: ERROR:SPACING: space required after that ',' (ctx:VxV) #247: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:697:
+ .pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
^

-:247: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #247: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:697:
+ .pll[10]=0xFF,.pll[11]=0xAA,.pll[12]=0x2A,.pll[13]=0xA9,.pll[14]=0xAA,
^

-:248: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #248: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:698:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:248: ERROR:SPACING: space required after that ',' (ctx:VxV) #248: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:698:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:248: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #248: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:698:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:248: ERROR:SPACING: space required after that ',' (ctx:VxV) #248: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:698:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:248: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #248: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:698:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:248: ERROR:SPACING: space required after that ',' (ctx:VxV) #248: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:698:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:248: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #248: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:698:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:248: ERROR:SPACING: space required after that ',' (ctx:VxV) #248: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:698:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:248: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #248: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:698:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:253: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #253: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:703:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xCE, .pll[3]=0x00, .pll[4]=0x00,
^

-:253: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #253: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:703:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xCE, .pll[3]=0x00, .pll[4]=0x00,
^

-:253: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #253: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:703:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xCE, .pll[3]=0x00, .pll[4]=0x00,
^

-:253: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #253: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:703:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xCE, .pll[3]=0x00, .pll[4]=0x00,
^

-:253: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #253: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:703:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xCE, .pll[3]=0x00, .pll[4]=0x00,
^

-:254: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #254: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:704:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:254: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #254: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:704:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:254: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #254: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:704:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:254: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #254: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:704:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:254: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #254: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:704:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:255: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #255: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:705:
+ .pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
^

-:255: ERROR:SPACING: space required after that ',' (ctx:VxV) #255: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:705:
+ .pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
^

-:255: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #255: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:705:
+ .pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
^

-:255: ERROR:SPACING: space required after that ',' (ctx:VxV) #255: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:705:
+ .pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
^

-:255: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #255: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:705:
+ .pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
^

-:255: ERROR:SPACING: space required after that ',' (ctx:VxV) #255: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:705:
+ .pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
^

-:255: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #255: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:705:
+ .pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
^

-:255: ERROR:SPACING: space required after that ',' (ctx:VxV) #255: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:705:
+ .pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
^

-:255: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #255: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:705:
+ .pll[10]=0xFF,.pll[11]=0x77,.pll[12]=0x57,.pll[13]=0x77,.pll[14]=0x77,
^

-:256: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #256: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:706:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:256: ERROR:SPACING: space required after that ',' (ctx:VxV) #256: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:706:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:256: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #256: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:706:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:256: ERROR:SPACING: space required after that ',' (ctx:VxV) #256: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:706:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:256: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #256: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:706:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:256: ERROR:SPACING: space required after that ',' (ctx:VxV) #256: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:706:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:256: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #256: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:706:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:256: ERROR:SPACING: space required after that ',' (ctx:VxV) #256: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:706:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:256: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #256: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:706:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:261: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #261: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:711:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD0, .pll[3]=0x00, .pll[4]=0x00,
^

-:261: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #261: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:711:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD0, .pll[3]=0x00, .pll[4]=0x00,
^

-:261: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #261: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:711:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD0, .pll[3]=0x00, .pll[4]=0x00,
^

-:261: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #261: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:711:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD0, .pll[3]=0x00, .pll[4]=0x00,
^

-:261: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #261: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:711:
+ .pll[0]=0x34, .pll[1]=0x00, .pll[2]=0xD0, .pll[3]=0x00, .pll[4]=0x00,
^

-:262: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #262: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:712:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:262: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #262: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:712:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:262: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #262: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:712:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:262: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #262: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:712:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:262: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #262: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:712:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:263: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #263: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:713:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
^

-:263: ERROR:SPACING: space required after that ',' (ctx:VxV) #263: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:713:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
^

-:263: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #263: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:713:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
^

-:263: ERROR:SPACING: space required after that ',' (ctx:VxV) #263: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:713:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
^

-:263: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #263: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:713:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
^

-:263: ERROR:SPACING: space required after that ',' (ctx:VxV) #263: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:713:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
^

-:263: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #263: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:713:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
^

-:263: ERROR:SPACING: space required after that ',' (ctx:VxV) #263: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:713:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
^

-:263: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #263: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:713:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xD5,.pll[13]=0x55,.pll[14]=0x55,
^

-:264: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #264: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:714:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:264: ERROR:SPACING: space required after that ',' (ctx:VxV) #264: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:714:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:264: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #264: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:714:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:264: ERROR:SPACING: space required after that ',' (ctx:VxV) #264: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:714:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:264: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #264: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:714:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:264: ERROR:SPACING: space required after that ',' (ctx:VxV) #264: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:714:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:264: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #264: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:714:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:264: ERROR:SPACING: space required after that ',' (ctx:VxV) #264: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:714:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:264: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #264: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:714:
+ .pll[15]=0x0C,.pll[16]=0x08,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:269: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #269: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:719:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x66, .pll[3]=0x00, .pll[4]=0x00,
^

-:269: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #269: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:719:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x66, .pll[3]=0x00, .pll[4]=0x00,
^

-:269: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #269: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:719:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x66, .pll[3]=0x00, .pll[4]=0x00,
^

-:269: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #269: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:719:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x66, .pll[3]=0x00, .pll[4]=0x00,
^

-:269: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #269: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:719:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x66, .pll[3]=0x00, .pll[4]=0x00,
^

-:270: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #270: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:720:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:270: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #270: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:720:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:270: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #270: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:720:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:270: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #270: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:720:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:270: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #270: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:720:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:271: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #271: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:721:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
^

-:271: ERROR:SPACING: space required after that ',' (ctx:VxV) #271: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:721:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
^

-:271: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #271: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:721:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
^

-:271: ERROR:SPACING: space required after that ',' (ctx:VxV) #271: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:721:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
^

-:271: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #271: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:721:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
^

-:271: ERROR:SPACING: space required after that ',' (ctx:VxV) #271: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:721:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
^

-:271: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #271: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:721:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
^

-:271: ERROR:SPACING: space required after that ',' (ctx:VxV) #271: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:721:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
^

-:271: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #271: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:721:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xB5,.pll[13]=0x55,.pll[14]=0x55,
^

-:272: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #272: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:722:
+ .pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:272: ERROR:SPACING: space required after that ',' (ctx:VxV) #272: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:722:
+ .pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:272: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #272: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:722:
+ .pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:272: ERROR:SPACING: space required after that ',' (ctx:VxV) #272: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:722:
+ .pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:272: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #272: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:722:
+ .pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:272: ERROR:SPACING: space required after that ',' (ctx:VxV) #272: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:722:
+ .pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:272: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #272: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:722:
+ .pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:272: ERROR:SPACING: space required after that ',' (ctx:VxV) #272: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:722:
+ .pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:272: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #272: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:722:
+ .pll[15]=0x0B,.pll[16]=0x09,.pll[17]=0xCF,.pll[18]=0x84,.pll[19]=0x23,
^

-:277: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #277: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:727:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x72, .pll[3]=0x00, .pll[4]=0x00,
^

-:277: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #277: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:727:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x72, .pll[3]=0x00, .pll[4]=0x00,
^

-:277: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #277: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:727:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x72, .pll[3]=0x00, .pll[4]=0x00,
^

-:277: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #277: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:727:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x72, .pll[3]=0x00, .pll[4]=0x00,
^

-:277: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #277: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:727:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x72, .pll[3]=0x00, .pll[4]=0x00,
^

-:278: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #278: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:728:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:278: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #278: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:728:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:278: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #278: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:728:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:278: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #278: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:728:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:278: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #278: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:728:
+ .pll[5]=0x00, .pll[6]=0x00, .pll[7]=0x00, .pll[8]=0x20, .pll[9]=0xFF,
^

-:279: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #279: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:729:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
^

-:279: ERROR:SPACING: space required after that ',' (ctx:VxV) #279: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:729:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
^

-:279: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #279: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:729:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
^

-:279: ERROR:SPACING: space required after that ',' (ctx:VxV) #279: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:729:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
^

-:279: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #279: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:729:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
^

-:279: ERROR:SPACING: space required after that ',' (ctx:VxV) #279: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:729:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
^

-:279: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #279: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:729:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
^

-:279: ERROR:SPACING: space required after that ',' (ctx:VxV) #279: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:729:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
^

-:279: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #279: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:729:
+ .pll[10]=0xFF,.pll[11]=0x55,.pll[12]=0xF5,.pll[13]=0x55,.pll[14]=0x55,
^

-:280: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #280: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:730:
+ .pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:280: ERROR:SPACING: space required after that ',' (ctx:VxV) #280: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:730:
+ .pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:280: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #280: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:730:
+ .pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:280: ERROR:SPACING: space required after that ',' (ctx:VxV) #280: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:730:
+ .pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:280: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #280: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:730:
+ .pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:280: ERROR:SPACING: space required after that ',' (ctx:VxV) #280: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:730:
+ .pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:280: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #280: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:730:
+ .pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:280: ERROR:SPACING: space required after that ',' (ctx:VxV) #280: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:730:
+ .pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:280: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #280: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:730:
+ .pll[15]=0x0B,.pll[16]=0x08,.pll[17]=0x8F,.pll[18]=0x84,.pll[19]=0x23,
^

-:285: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #285: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:735:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
^

-:285: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #285: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:735:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,
^

-:285: ERROR:SPACING: spaces required around that '=' (ctx:VxV) #285: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:735:
+ .pll[0]=0xF4, .pll[1]=0x00, .pll[2]=0x7A, .pll[3]=0x00, .pll[4]=0x00,

#30 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/mtl: Add Support for C10 chips

In reply to Mika Kahola
== Series Details ==

== Series Details ==

Series: drm/i915/mtl: Add Support for C10 chips
URL : https://patchwork.freedesktop.org/series/115664/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12921 -> Patchwork_115664v1
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/index.html

Participating hosts (37 -> 36)
------------------------------

Missing (1): fi-kbl-soraka

Known issues
------------

Here are the changes found in Patchwork_115664v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live@migrate:
- bat-dg2-11: [PASS][1] -> [DMESG-WARN][2] ([i915#7699])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/bat-dg2-11/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/bat-dg2-11/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@slpc:
- bat-rpls-2: NOTRUN -> [DMESG-FAIL][3] ([i915#6997] / [i915#7913])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/bat-rpls-2/igt@i915_selftest@[email protected]

* igt@i915_suspend@basic-s2idle-without-i915:
- bat-rpls-2: NOTRUN -> [ABORT][4] ([i915#6687])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/bat-rpls-2/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@reset:
- bat-rpls-2: [ABORT][5] ([i915#4983] / [i915#7913]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/bat-rpls-2/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/bat-rpls-2/igt@i915_selftest@[email protected]

#### Warnings ####

* igt@i915_selftest@live@slpc:
- bat-rpls-1: [DMESG-FAIL][7] ([i915#6367]) -> [DMESG-FAIL][8] ([i915#6367] / [i915#7996])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/bat-rpls-1/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/bat-rpls-1/igt@i915_selftest@[email protected]

[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
[i915#6997]: https://gitlab.freedesktop.org/drm/intel/issues/6997
[i915#7699]: https://gitlab.freedesktop.org/drm/intel/issues/7699
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7996]: https://gitlab.freedesktop.org/drm/intel/issues/7996

Build changes
-------------

* Linux: CI_DRM_12921 -> Patchwork_115664v1

CI-20190529: 20190529
CI_DRM_12921: 3de6040ce9900a94ec626662d5c6a227b37eeb1c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7221: 4b77c6d85024d22ca521d510f8eee574128fe04f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_115664v1: 3de6040ce9900a94ec626662d5c6a227b37eeb1c @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

44fd26d03e78 drm/i915/mtl: Add support for PM DEMAND
0a81d023ecf3 drm/i915/mtl: Add vswing programming for C10 phys 8dc097cb04ea drm/i915/mtl: Add C10 phy programming for HDMI 5c7fcca442fa drm/i915/mtl: Add Support for C10 PHY message bus and pll programming 8c2f753b154f drm/i915/mtl: Create separate reg file for PICA registers d5b7d4eeaded drm/i915/mtl: Add DP rates
be08398ebf6f drm/i915/mtl: Initial DDI port setup

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/index.html

#31 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/mtl: Add Support for C10 chips

In reply to Mika Kahola
== Series Details ==

== Series Details ==

Series: drm/i915/mtl: Add Support for C10 chips
URL : https://patchwork.freedesktop.org/series/115664/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12921_full -> Patchwork_115664v1_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Participating hosts (7 -> 7)
------------------------------

No changes in participating hosts

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_115664v1_full:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@kms_vblank@pipe-b-wait-idle:
- {shard-dg1}: [PASS][1] -> [DMESG-WARN][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-dg1-18/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-dg1-17/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_115664v1_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk: [PASS][3] -> [FAIL][4] ([i915#2842])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-glk5/igt@gem_exec_fair@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-glk2/igt@gem_exec_fair@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- shard-glk: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#4613])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-glk3/igt@[email protected]

* igt@gen9_exec_parse@allowed-single:
- shard-glk: [PASS][6] -> [ABORT][7] ([i915#5566])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-glk1/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-glk4/igt@[email protected]

* igt@kms_ccs@pipe-b-missing-ccs-buffer-y_tiled_gen12_mc_ccs:
- shard-apl: NOTRUN -> [SKIP][8] ([fdo#109271] / [i915#3886]) +2 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-apl6/igt@kms_ccs@pipe-b-missing-ccs-buffer-y_tiled_gen12_mc_ccs.html

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-glk: [PASS][9] -> [FAIL][10] ([i915#2346]) +1 similar issue
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-glk7/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-glk5/igt@[email protected]
- shard-apl: [PASS][11] -> [FAIL][12] ([i915#2346])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-apl1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-apl7/igt@[email protected]

* igt@kms_flip@plain-flip-fb-recreate@a-hdmi-a1:
- shard-glk: [PASS][13] -> [FAIL][14] ([i915#2122])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-glk6/igt@kms_flip@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-glk8/igt@kms_flip@[email protected]

* igt@kms_plane_scaling@plane-downscale-with-modifiers-factor-0-25@pipe-c-dp-1:
- shard-apl: NOTRUN -> [SKIP][15] ([fdo#109271]) +76 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-apl2/igt@kms_plane_scaling@[email protected]

* igt@kms_psr2_sf@plane-move-sf-dmg-area:
- shard-apl: NOTRUN -> [SKIP][16] ([fdo#109271] / [i915#658])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-apl2/igt@[email protected]

* igt@vc4/vc4_perfmon@create-perfmon-exceed:
- shard-glk: NOTRUN -> [SKIP][17] ([fdo#109271]) +20 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-glk3/igt@vc4/[email protected]

#### Possible fixes ####

* igt@gem_ctx_exec@basic-nohangcheck:
- {shard-tglu}: [FAIL][18] ([i915#6268]) -> [PASS][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-tglu-7/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-tglu-2/igt@[email protected]

* igt@gem_exec_fair@basic-deadline:
- shard-apl: [FAIL][20] ([i915#2846]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-apl1/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-apl4/igt@[email protected]

* igt@gem_mmap_offset@clear@smem0:
- {shard-dg1}: [DMESG-WARN][22] ([i915#8304]) -> [PASS][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-dg1-17/igt@gem_mmap_offset@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-dg1-16/igt@gem_mmap_offset@[email protected]

* igt@gen9_exec_parse@allowed-all:
- shard-apl: [ABORT][24] ([i915#5566]) -> [PASS][25]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-apl6/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-apl2/igt@[email protected]

* igt@i915_pm_dc@dc9-dpms:
- {shard-tglu}: [SKIP][26] ([i915#4281]) -> [PASS][27]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-tglu-5/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-tglu-10/igt@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- shard-apl: [DMESG-FAIL][28] ([i915#5334]) -> [PASS][29]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-apl2/igt@i915_selftest@live@gt_heartbeat.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-apl6/igt@i915_selftest@live@gt_heartbeat.html

* igt@kms_cursor_legacy@forked-move@pipe-b:
- {shard-dg1}: [INCOMPLETE][30] ([i915#8011]) -> [PASS][31]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-dg1-14/igt@kms_cursor_legacy@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-dg1-16/igt@kms_cursor_legacy@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend@pipe-a-planes:
- shard-apl: [ABORT][32] ([i915#180]) -> [PASS][33]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-apl2/igt@kms_plane@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-apl6/igt@kms_plane@[email protected]

* {igt@perf@oa-exponents@0-rcs0}:
- shard-glk: [ABORT][34] -> [PASS][35]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12921/shard-glk3/igt@perf@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/shard-glk3/igt@perf@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109307]: https://bugs.freedesktop.org/show_bug.cgi?id=109307
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2846]: https://gitlab.freedesktop.org/drm/intel/issues/2846
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3952]: https://gitlab.freedesktop.org/drm/intel/issues/3952
[i915#4036]: https://gitlab.freedesktop.org/drm/intel/issues/4036
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#426]: https://gitlab.freedesktop.org/drm/intel/issues/426
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4281]: https://gitlab.freedesktop.org/drm/intel/issues/4281
[i915#4391]: https://gitlab.freedesktop.org/drm/intel/issues/4391
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4818]: https://gitlab.freedesktop.org/drm/intel/issues/4818
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
[i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
[i915#5566]: https://gitlab.freedesktop.org/drm/intel/issues/5566
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6227]: https://gitlab.freedesktop.org/drm/intel/issues/6227
[i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
[i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
[i915#8150]: https://gitlab.freedesktop.org/drm/intel/issues/8150
[i915#8211]: https://gitlab.freedesktop.org/drm/intel/issues/8211
[i915#8292]: https://gitlab.freedesktop.org/drm/intel/issues/8292
[i915#8304]: https://gitlab.freedesktop.org/drm/intel/issues/8304
[i915#8308]: https://gitlab.freedesktop.org/drm/intel/issues/8308

Build changes
-------------

* Linux: CI_DRM_12921 -> Patchwork_115664v1

CI-20190529: 20190529
CI_DRM_12921: 3de6040ce9900a94ec626662d5c6a227b37eeb1c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7221: 4b77c6d85024d22ca521d510f8eee574128fe04f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_115664v1: 3de6040ce9900a94ec626662d5c6a227b37eeb1c @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115664v1/index.html