All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support
@ 2023-02-24 10:13 Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 01/22] drm/i915/mtl: Initial DDI port setup Mika Kahola
                   ` (25 more replies)
  0 siblings, 26 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

PHY programming support for PICA C10 and C20 Type-C chips.

v2: Move intel_cx0_reg_defs.h to intel_cx0_phy_regs.h (Jani)
    Move pmdemand as part of intel_display structure
    PLL table updates
v3: Renaming C20 read/write functions (Gustavo)
    Code readibility fixes (Gustavo)
    HDMI PLL table updates
    PICA hotplug handling updates
v4: Initialize parameters for C20 port clock calculation

Signed-off-by: Mika Kahola <mika.kahola@intel.com>

Anusha Srivatsa (1):
  drm/i915/mtl: Pin assignment for TypeC

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

Gustavo Sousa (1):
  drm/i915/mtl: Define mask for DDI AUX interrupts

Imre Deak (1):
  drm/i915/mtl: TypeC HPD live status query

Mika Kahola (15):
  drm/i915/mtl: Add DP rates
  drm/i915/mtl: Create separate reg file for PICA registers
  drm/i915/mtl: Add support for PM DEMAND
  drm/i915/mtl: C20 PLL programming
  drm/i915/mtl: C20 HW readout
  drm/i915/mtl: Dump C20 pll hw state
  drm/i915/mtl: C20 port clock calculation
  drm/i915/mtl: C20 HDMI state calculations
  drm/i915/mtl: Add voltage swing sequence for C20
  drm/i915/mtl: For DP2.0 10G and 20G rates use MPLLA
  drm/i915/mtl: Enabling/disabling sequence Thunderbolt pll
  drm/i915/mtl: Readout Thunderbolt HW state
  drm/i915/mtl: Enable TC ports
  drm/i915/mtl: MTL PICA hotplug detection
  drm/i915/mtl: Power up TCSS

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  | 2796 +++++++++++++++++
 drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   57 +
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  220 ++
 drivers/gpu/drm/i915/display/intel_ddi.c      |   38 +-
 .../drm/i915/display/intel_ddi_buf_trans.c    |   85 +-
 .../drm/i915/display/intel_ddi_buf_trans.h    |    6 +
 drivers/gpu/drm/i915/display/intel_display.c  |   25 +-
 .../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    |   23 +
 drivers/gpu/drm/i915/display/intel_dp.c       |   23 +-
 drivers/gpu/drm/i915/display/intel_dpll.c     |   22 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |    2 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c     |    7 +-
 drivers/gpu/drm/i915/display/intel_hdmi.h     |    1 +
 .../drm/i915/display/intel_modeset_verify.c   |    2 +
 drivers/gpu/drm/i915/display/intel_tc.c       |  177 +-
 drivers/gpu/drm/i915/i915_drv.h               |    6 +
 drivers/gpu/drm/i915/i915_irq.c               |  276 +-
 drivers/gpu/drm/i915/i915_reg.h               |   69 +-
 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 +
 27 files changed, 4205 insertions(+), 29 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

-- 
2.34.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 01/22] drm/i915/mtl: Initial DDI port setup
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 02/22] drm/i915/mtl: Add DP rates Mika Kahola
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

From: Clint Taylor <clinton.a.taylor@intel.com>

Initialize c10 combo phy ports. TODO Type-C ports.

Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>

Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index a1fbdf32bd21..8030968e7008 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7830,7 +7830,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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 02/22] drm/i915/mtl: Add DP rates
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 01/22] drm/i915/mtl: Initial DDI port setup Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers Mika Kahola
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

Add DP rates for Meteorlake.

Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index d25a93258f8b..3849375bd459 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -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))
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 01/22] drm/i915/mtl: Initial DDI port setup Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 02/22] drm/i915/mtl: Add DP rates Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-28  0:16   ` Matt Roper
  2023-02-28 23:26   ` Lucas De Marchi
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 04/22] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming Mika Kahola
                   ` (22 subsequent siblings)
  25 siblings, 2 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

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

v2: Rename file (Jani)

Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 136 ++++++++++++++++++
 1 file changed, 136 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
new file mode 100644
index 000000000000..d6b3709d3762
--- /dev/null
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
@@ -0,0 +1,136 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef __INTEL_CX0_PHY_REGS_H__
+#define __INTEL_CX0_PHY_REGS_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_LN0_USBC3		0x16F640
+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4		0x16F840
+#define _XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)		(_PICK(port, \
+							[PORT_A] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \
+							[PORT_B] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \
+							[PORT_TC1] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \
+							[PORT_TC2] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2, \
+							[PORT_TC3] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC3, \
+							[PORT_TC4] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4) + ((lane) * 4))
+
+#define XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)		_MMIO(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane))
+#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(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane) + 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_LN0_USBC3			0x16F600
+#define _XELPDP_PORT_BUF_CTL1_LN0_USBC4			0x16F800
+#define _XELPDP_PORT_BUF_CTL1(port)			(_PICK(port, \
+							[PORT_A] = _XELPDP_PORT_BUF_CTL1_LN0_A, \
+							[PORT_B] = _XELPDP_PORT_BUF_CTL1_LN0_B, \
+							[PORT_TC1] = _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
+							[PORT_TC2] = _XELPDP_PORT_BUF_CTL1_LN0_USBC2, \
+							[PORT_TC3] = _XELPDP_PORT_BUF_CTL1_LN0_USBC3, \
+							[PORT_TC4] = _XELPDP_PORT_BUF_CTL1_LN0_USBC4))
+
+#define XELPDP_PORT_BUF_CTL1(port)			_MMIO(_XELPDP_PORT_BUF_CTL1(port))
+#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(_XELPDP_PORT_BUF_CTL1(port) + 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(_XELPDP_PORT_BUF_CTL1(port) + 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_USBC3			0x16F660
+#define _XELPDP_PORT_CLOCK_CTL_USBC4			0x16F860
+#define XELPDP_PORT_CLOCK_CTL(port)			_MMIO(_PICK(port, \
+							[PORT_A] = _XELPDP_PORT_CLOCK_CTL_A, \
+							[PORT_B] = _XELPDP_PORT_CLOCK_CTL_B, \
+							[PORT_TC1] = _XELPDP_PORT_CLOCK_CTL_USBC1, \
+							[PORT_TC2] = _XELPDP_PORT_CLOCK_CTL_USBC2, \
+							[PORT_TC3] = _XELPDP_PORT_CLOCK_CTL_USBC3, \
+							[PORT_TC4] = _XELPDP_PORT_CLOCK_CTL_USBC4))
+
+#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__ */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 04/22] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (2 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-03-02 21:42   ` Sripada, Radhakrishna
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 05/22] drm/i915/mtl: Add C10 phy programming for HDMI Mika Kahola
                   ` (21 subsequent siblings)
  25 siblings, 1 reply; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

From: Radhakrishna Sripada <radhakrishna.sripada@intel.com>

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)

Cc: Imre Deak <imre.deak@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 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 |   34 +
 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     |   22 +-
 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, 1314 insertions(+), 5 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

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index b2f91a1f8268..b04395472437 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -294,6 +294,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 \
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
new file mode 100644
index 000000000000..dce55f0ed5e1
--- /dev/null
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -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)
+{
+	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;
+	}
+
+	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;
+	}
+
+	/* 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;
+	}
+
+	/* 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;
+	}
+
+	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)) {
+		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) |
+		       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;
+	}
+
+	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;
+	}
+}
+
+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);
+}
+
+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;
+	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));
+
+	/* 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);
+
+	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_cx0_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, 0, 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, 0, 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);
+	}
+}
+
+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_cx0_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]);
+	}
+}
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.h b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
new file mode 100644
index 000000000000..8cf340509097
--- /dev/null
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
@@ -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__ */
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
index d6b3709d3762..ef629f8b14cf 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
@@ -133,4 +133,38 @@
 #define XELPDP_SSC_ENABLE_PLLA				REG_BIT(1)
 #define XELPDP_SSC_ENABLE_PLLB				REG_BIT(0)
 
+/* 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_PHY_REGS_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index e5979427b38b..d48e1ffdfc71 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -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"
@@ -3505,6 +3506,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)
 {
@@ -4379,7 +4395,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;
diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
index 743b919bb2cf..87c7e082a3b4 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -1613,7 +1613,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).
diff --git a/drivers/gpu/drm/i915/display/intel_display_power_well.c b/drivers/gpu/drm/i915/display/intel_display_power_well.c
index 49042ece9d1c..3f9a31f1bf4a 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power_well.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power_well.c
@@ -967,7 +967,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,
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 748b0cd411fa..5dd11d3da2e4 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -979,6 +979,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.
@@ -1122,6 +1127,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;
 	};
 
 	/*
diff --git a/drivers/gpu/drm/i915/display/intel_dpll.c b/drivers/gpu/drm/i915/display/intel_dpll.c
index 4e9c18be7e1f..cd3da053055d 100644
--- a/drivers/gpu/drm/i915/display/intel_dpll.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll.c
@@ -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,11 @@ 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 (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;
diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
index 22fc908b7e5d..ed372d227aa7 100644
--- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
@@ -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))
diff --git a/drivers/gpu/drm/i915/display/intel_modeset_verify.c b/drivers/gpu/drm/i915/display/intel_modeset_verify.c
index 842d70f0dfd2..ec504470c2f0 100644
--- a/drivers/gpu/drm/i915/display/intel_modeset_verify.c
+++ b/drivers/gpu/drm/i915/display/intel_modeset_verify.c
@@ -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,
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index c1efa655fb68..681a301bb65f 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2099,6 +2099,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
  *
diff --git a/drivers/gpu/drm/i915/i915_reg_defs.h b/drivers/gpu/drm/i915/i915_reg_defs.h
index 983c5aa3045b..940855bfd482 100644
--- a/drivers/gpu/drm/i915/i915_reg_defs.h
+++ b/drivers/gpu/drm/i915/i915_reg_defs.h
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 05/22] drm/i915/mtl: Add C10 phy programming for HDMI
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (3 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 04/22] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 06/22] drm/i915/mtl: Add vswing programming for C10 phys Mika Kahola
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

From: Radhakrishna Sripada <radhakrishna.sripada@intel.com>

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)
    Remove unused table

Cc: Imre Deak <imre.deak@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Signed-off-by: Clint Taylor <Clinton.A.Taylor@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 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 |   2 +
 drivers/gpu/drm/i915/display/intel_hdmi.c     |   5 +-
 4 files changed, 573 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index dce55f0ed5e1..c73d2bc3e1a8 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -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];
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.h b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
index 8cf340509097..f8023f240727 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
@@ -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__ */
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
index ef629f8b14cf..f6002b70ddbe 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
@@ -138,9 +138,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)
 
diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index c7e9e1fbed37..baa9ef7568af 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 06/22] drm/i915/mtl: Add vswing programming for C10 phys
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (4 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 05/22] drm/i915/mtl: Add C10 phy programming for HDMI Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND Mika Kahola
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

From: Radhakrishna Sripada <radhakrishna.sripada@intel.com>

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)

Cc: Imre Deak <imre.deak@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Clint Taylor <Clinton.A.Taylor@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 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    |  36 ++++-
 .../drm/i915/display/intel_ddi_buf_trans.h    |   6 +
 .../i915/display/intel_display_power_map.c    |   1 +
 7 files changed, 192 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index c73d2bc3e1a8..3d61afbe7bdb 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -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_tc.h"
+#include "intel_psr.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 + 1;
+		tx = ln % 2 + 1;
+
+		intel_cx0_rmw(i915, encoder->port, lane, 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, 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, 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_cx0_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,
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.h b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
index f8023f240727..952c7deeffaa 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
@@ -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__ */
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
index f6002b70ddbe..9bf7408fb363 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
@@ -162,6 +162,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)
 
@@ -169,4 +177,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_PHY_REGS_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index d48e1ffdfc71..60c38bc77683 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4457,7 +4457,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))
diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
index 006a2e979000..d5a9aa2de2fa 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
@@ -1035,6 +1035,30 @@ static const struct intel_ddi_buf_trans dg2_snps_trans_uhbr = {
 	.num_entries = ARRAY_SIZE(_dg2_snps_trans_uhbr),
 };
 
+/*
+ * Some platforms don't need a mapping table and only expect us to
+ * to program the vswing + preemphasis levels directly since the
+ * hardware will do its own mapping to tuning values internally.
+ */
+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_cx0_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 +1630,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_cx0_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))
diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h
index 2133984a572b..e4a857b9829d 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h
@@ -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 {
diff --git a/drivers/gpu/drm/i915/display/intel_display_power_map.c b/drivers/gpu/drm/i915/display/intel_display_power_map.c
index 6645eb1911d8..5ec2b9a109ae 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power_map.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power_map.c
@@ -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,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (5 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 06/22] drm/i915/mtl: Add vswing programming for C10 phys Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-03-01 22:50   ` Sripada, Radhakrishna
  2023-03-02  8:49   ` Murthy, Arun R
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 08/22] drm/i915/mtl: C20 PLL programming Mika Kahola
                   ` (18 subsequent siblings)
  25 siblings, 2 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx; +Cc: Lucas De Marchi, Matt Roper

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
Cc: Matt Atwood <matthew.s.atwood@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221014124740.774835-8-mika.kahola@intel.com
---
 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(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c
index 202321ffbe2a..87c20bf52123 100644
--- a/drivers/gpu/drm/i915/display/intel_bw.c
+++ b/drivers/gpu/drm/i915/display/intel_bw.c
@@ -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;
diff --git a/drivers/gpu/drm/i915/display/intel_bw.h b/drivers/gpu/drm/i915/display/intel_bw.h
index f20292143745..17fc0b61db04 100644
--- a/drivers/gpu/drm/i915/display/intel_bw.h
+++ b/drivers/gpu/drm/i915/display/intel_bw.h
@@ -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,
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 8030968e7008..676bf512b9ce 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -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));
@@ -6823,6 +6826,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);
@@ -7439,6 +7446,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) {
@@ -7551,6 +7559,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);
 
@@ -8282,6 +8291,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);
 
@@ -8508,6 +8518,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);
diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
index 87c7e082a3b4..ce2386f12f8b 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -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"
@@ -1081,6 +1082,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.
@@ -1092,6 +1097,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)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6254aa977398..df3b6742d980 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -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.
 	 *
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 417c981e4968..a0d0dd84c429 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1911,6 +1911,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)
 {
@@ -1947,6 +1952,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");
 }
@@ -3313,7 +3330,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))
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 681a301bb65f..d4706ec3cbb7 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -5496,8 +5496,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)
@@ -5560,6 +5562,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)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index ddf004e5bb4b..8bed6406c66e 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -25,6 +25,11 @@
  *
  */
 
+#include <linux/bitops.h>
+
+#include "display/intel_bw.h"
+#include "display/intel_cdclk.h"
+#include "display/intel_cx0_phy.h"
 #include "display/intel_de.h"
 #include "display/intel_display.h"
 #include "display/intel_display_trace.h"
@@ -124,6 +129,287 @@ static void glk_init_clock_gating(struct drm_i915_private *dev_priv)
 		   PWM1_GATING_DIS | PWM2_GATING_DIS);
 }
 
+static struct intel_global_state *intel_pmdemand_duplicate_state(struct intel_global_obj *obj)
+{
+	struct intel_pmdemand_state *pmdmnd_state;
+
+	pmdmnd_state = kmemdup(obj->state, sizeof(*pmdmnd_state), GFP_KERNEL);
+	if (!pmdmnd_state)
+		return NULL;
+
+	return &pmdmnd_state->base;
+}
+
+static void intel_pmdemand_destroy_state(struct intel_global_obj *obj,
+					 struct intel_global_state *state)
+{
+	kfree(state);
+}
+
+static const struct intel_global_state_funcs intel_pmdemand_funcs = {
+	.atomic_duplicate_state = intel_pmdemand_duplicate_state,
+	.atomic_destroy_state = intel_pmdemand_destroy_state,
+};
+
+struct intel_pmdemand_state *
+intel_atomic_get_pmdemand_state(struct intel_atomic_state *state)
+{
+	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
+	struct intel_global_state *pmdemand_state;
+
+	pmdemand_state = intel_atomic_get_global_obj_state(state, &dev_priv->pmdemand.obj);
+	if (IS_ERR(pmdemand_state))
+		return ERR_CAST(pmdemand_state);
+
+	return to_intel_pmdemand_state(pmdemand_state);
+}
+
+int intel_pmdemand_init(struct drm_i915_private *dev_priv)
+{
+	struct intel_pmdemand_state *pmdemand_state;
+
+	pmdemand_state = kzalloc(sizeof(*pmdemand_state), GFP_KERNEL);
+	if (!pmdemand_state)
+		return -ENOMEM;
+
+	intel_atomic_global_obj_init(dev_priv, &dev_priv->pmdemand.obj,
+				     &pmdemand_state->base, &intel_pmdemand_funcs);
+
+	return 0;
+}
+
+void intel_init_pmdemand(struct drm_i915_private *dev_priv)
+{
+	mutex_init(&dev_priv->pmdemand.lock);
+	init_waitqueue_head(&dev_priv->pmdemand.waitqueue);
+}
+
+int intel_pmdemand_atomic_check(struct intel_atomic_state *state)
+{
+	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
+	struct intel_pmdemand_state *new_pmdemand_state = NULL;
+	struct intel_crtc_state *old_crtc_state, *new_crtc_state;
+	struct intel_crtc *crtc;
+	struct intel_encoder *encoder;
+	struct intel_bw_state *new_bw_state;
+	const struct intel_dbuf_state *new_dbuf_state;
+	const struct intel_cdclk_state *new_cdclk_state;
+	int port_clock = 0;
+	unsigned int data_rate;
+	enum phy phy;
+	int i, ret;
+
+	if (DISPLAY_VER(dev_priv) < 14)
+		return 0;
+
+	new_pmdemand_state = intel_atomic_get_pmdemand_state(state);
+	if (IS_ERR(new_pmdemand_state))
+		return PTR_ERR(new_pmdemand_state);
+
+	ret = intel_atomic_lock_global_state(&new_pmdemand_state->base);
+	if (ret)
+		return ret;
+
+	/* Punit figures out the voltage index based on bandwidth*/
+	new_bw_state = intel_atomic_get_bw_state(state);
+	if (IS_ERR(new_bw_state))
+		return PTR_ERR(new_bw_state);
+
+	/* firmware will calculate the qclck_gc_index, requirement is set to 0 */
+	new_pmdemand_state->qclk_gv_index = 0;
+
+	data_rate = intel_bw_data_rate(dev_priv, new_bw_state);
+	/* To MBs then to multiples of 100MBs */
+	data_rate = DIV_ROUND_UP(data_rate, 1000);
+	data_rate = DIV_ROUND_UP(data_rate, 100);
+	new_pmdemand_state->qclk_gv_bw = data_rate;
+
+	new_dbuf_state = intel_atomic_get_dbuf_state(state);
+	if (IS_ERR(new_dbuf_state))
+		return PTR_ERR(new_dbuf_state);
+
+	i = hweight8(new_dbuf_state->active_pipes);
+	new_pmdemand_state->active_pipes = min(i, 3);
+
+	new_cdclk_state = intel_atomic_get_cdclk_state(state);
+	if (IS_ERR(new_cdclk_state))
+		return PTR_ERR(new_cdclk_state);
+
+	new_pmdemand_state->voltage_index = new_cdclk_state->logical.voltage_level;
+	/* KHz to MHz */
+	new_pmdemand_state->cdclk_freq_mhz = DIV_ROUND_UP(new_cdclk_state->logical.cdclk, 1000);
+
+	new_pmdemand_state->active_phys_plls_mask = 0;
+
+	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
+		if (!new_crtc_state->hw.active)
+			continue;
+
+		encoder = intel_get_crtc_new_encoder(state, new_crtc_state);
+		if (!encoder)
+			continue;
+
+		phy = intel_port_to_phy(dev_priv, encoder->port);
+
+		if (intel_is_c10phy(dev_priv, phy))
+			new_pmdemand_state->active_phys_plls_mask |= BIT(phy);
+
+		port_clock = max(port_clock, new_crtc_state->port_clock);
+	}
+
+	/* To MHz */
+	new_pmdemand_state->ddiclk_freq_mhz = DIV_ROUND_UP(port_clock, 1000);
+
+	/*
+	 * Setting scalers to max as it can not be calculated during flips and
+	 * fastsets without taking global states locks.
+	 */
+	new_pmdemand_state->scalers = 7;
+
+	return 0;
+}
+
+static bool intel_pmdemand_check_prev_transaction(struct drm_i915_private *dev_priv)
+{
+	return !((intel_de_read(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1)) & XELPDP_PMDEMAND_REQ_ENABLE) ||
+		(intel_de_read(dev_priv, GEN12_DCPR_STATUS_1) & XELPDP_PMDEMAND_INFLIGHT_STATUS));
+}
+
+static bool intel_pmdemand_req_complete(struct drm_i915_private *dev_priv)
+{
+	return !(intel_de_read(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1)) & XELPDP_PMDEMAND_REQ_ENABLE);
+}
+
+static int intel_pmdemand_wait(struct drm_i915_private *dev_priv)
+{
+	DEFINE_WAIT(wait);
+	int ret;
+	const unsigned int timeout_ms = 10;
+
+	add_wait_queue(&dev_priv->pmdemand.waitqueue, &wait);
+
+	ret = wait_event_timeout(dev_priv->pmdemand.waitqueue,
+				 intel_pmdemand_req_complete(dev_priv),
+				 msecs_to_jiffies_timeout(timeout_ms));
+	if (ret < 0)
+		drm_err(&dev_priv->drm,
+			"timed out waiting for Punit PM Demand Response\n");
+
+	remove_wait_queue(&dev_priv->pmdemand.waitqueue, &wait);
+
+	return ret;
+}
+
+/* Required to be programmed during Display Init Sequences. */
+void intel_program_dbuf_pmdemand(struct drm_i915_private *dev_priv,
+				 u8 dbuf_slices)
+{
+	mutex_lock(&dev_priv->pmdemand.lock);
+	if (drm_WARN_ON(&dev_priv->drm,
+			!intel_pmdemand_check_prev_transaction(dev_priv)))
+		goto unlock;
+
+	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(0),
+		     XELPDP_PMDEMAND_DBUFS_MASK,
+		     XELPDP_PMDEMAND_DBUFS(hweight32(dbuf_slices)));
+	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1), 0,
+		     XELPDP_PMDEMAND_REQ_ENABLE);
+
+	intel_pmdemand_wait(dev_priv);
+unlock:
+	mutex_unlock(&dev_priv->pmdemand.lock);
+}
+
+static void intel_program_pmdemand(struct drm_i915_private *dev_priv,
+				   const struct intel_pmdemand_state *new,
+				   const struct intel_pmdemand_state *old)
+{
+	u32 val, tmp;
+
+#define UPDATE_PMDEMAND_VAL(val, F, f) do {            \
+	val &= (~(XELPDP_PMDEMAND_##F##_MASK));         \
+	val |= (XELPDP_PMDEMAND_##F((u32)(old ? max(old->f, new->f) : new->f))); \
+} while (0)
+
+	mutex_lock(&dev_priv->pmdemand.lock);
+	if (drm_WARN_ON(&dev_priv->drm,
+			!intel_pmdemand_check_prev_transaction(dev_priv)))
+		goto unlock;
+
+	/*
+	 * TODO: Update programming PM Demand for
+	 * PHYS, PLLS, DDI_CLKFREQ, SCALARS
+	 */
+	val = intel_de_read(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(0));
+	UPDATE_PMDEMAND_VAL(val, QCLK_GV_INDEX, qclk_gv_index);
+	UPDATE_PMDEMAND_VAL(val, QCLK_GV_BW, qclk_gv_bw);
+	UPDATE_PMDEMAND_VAL(val, VOLTAGE_INDEX, voltage_index);
+	UPDATE_PMDEMAND_VAL(val, PIPES, active_pipes);
+	UPDATE_PMDEMAND_VAL(val, DBUFS, dbufs);
+	tmp = hweight32(new->active_phys_plls_mask);
+	if (old)
+		tmp = max(tmp, hweight32(old->active_phys_plls_mask));
+	val |= XELPDP_PMDEMAND_PHYS(tmp);
+
+	intel_de_write(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(0), val);
+
+	val = intel_de_read(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1));
+	UPDATE_PMDEMAND_VAL(val, CDCLK_FREQ, cdclk_freq_mhz);
+	UPDATE_PMDEMAND_VAL(val, DDICLK_FREQ, ddiclk_freq_mhz);
+	UPDATE_PMDEMAND_VAL(val, SCALERS, scalers);
+	/*
+	 * Active_PLLs starts with 1 because of CDCLK PLL.
+	 * TODO: Missing to account genlock filter when it gets used.
+	 */
+	val |= XELPDP_PMDEMAND_PLLS(tmp + 1);
+
+	intel_de_write(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1), val);
+
+#undef UPDATE_PM_DEMAND_VAL
+
+	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1), 0, XELPDP_PMDEMAND_REQ_ENABLE);
+
+	intel_pmdemand_wait(dev_priv);
+unlock:
+	mutex_unlock(&dev_priv->pmdemand.lock);
+}
+
+void intel_pmdemand_pre_plane_update(struct intel_atomic_state *state)
+{
+	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
+	const struct intel_pmdemand_state *new_pmdmnd_state =
+		intel_atomic_get_new_pmdemand_state(state);
+	const struct intel_pmdemand_state *old_pmdmnd_state =
+		intel_atomic_get_old_pmdemand_state(state);
+
+	if (DISPLAY_VER(dev_priv) < 14)
+		return;
+
+	if (!new_pmdmnd_state ||
+	    memcmp(new_pmdmnd_state, old_pmdmnd_state, sizeof(*new_pmdmnd_state)) == 0)
+		return;
+
+	intel_program_pmdemand(dev_priv, new_pmdmnd_state, old_pmdmnd_state);
+}
+
+void intel_pmdemand_post_plane_update(struct intel_atomic_state *state)
+{
+	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
+	const struct intel_pmdemand_state *new_pmdmnd_state =
+		intel_atomic_get_new_pmdemand_state(state);
+	const struct intel_pmdemand_state *old_pmdmnd_state =
+		intel_atomic_get_old_pmdemand_state(state);
+
+	if (DISPLAY_VER(dev_priv) < 14)
+		return;
+
+	if (!new_pmdmnd_state ||
+	    memcmp(new_pmdmnd_state, old_pmdmnd_state, sizeof(*new_pmdmnd_state)) == 0)
+		return;
+
+	intel_program_pmdemand(dev_priv, new_pmdmnd_state, NULL);
+}
+
 static void ibx_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	/*
diff --git a/drivers/gpu/drm/i915/intel_pm.h b/drivers/gpu/drm/i915/intel_pm.h
index eab60df0c6bb..db5763ace31a 100644
--- a/drivers/gpu/drm/i915/intel_pm.h
+++ b/drivers/gpu/drm/i915/intel_pm.h
@@ -8,13 +8,48 @@
 
 #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_suspend_hw(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);
 void intel_pm_setup(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__ */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 08/22] drm/i915/mtl: C20 PLL programming
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (6 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 09/22] drm/i915/mtl: C20 HW readout Mika Kahola
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

C20 phy PLL programming sequence for DP, DP2.0, HDMI2.x non-FRL and
HDMI2.x FRL. This enables C20 MPLLA and MPLLB programming sequence. add
4 lane support for c20.

v2: Rename intel_c20_write() to intel_c20_sram_write() (Gustavo)
    Remove unnecessary bit masks (Gustavo)
    Fix comments on C20 pll programming (Gustavo)
    Clear calibration banks for both lanes (Gustavo)

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 266 +++++++++++++++---
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  30 ++
 drivers/gpu/drm/i915/display/intel_ddi.c      |  11 +-
 .../drm/i915/display/intel_display_types.h    |  19 +-
 drivers/gpu/drm/i915/display/intel_dp.c       |  12 +-
 5 files changed, 298 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index 3d61afbe7bdb..730c70f82822 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -15,6 +15,7 @@
 #include "intel_tc.h"
 #include "intel_psr.h"
 #include "intel_uncore.h"
+#include "intel_tc.h"
 
 bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)
 {
@@ -235,6 +236,18 @@ static void intel_cx0_write(struct drm_i915_private *i915, enum port port,
 	}
 }
 
+static void intel_c20_sram_write(struct drm_i915_private *i915, enum port port,
+				 int lane, u16 addr, u16 data)
+{
+	assert_dc_off(i915);
+
+	intel_cx0_write(i915, port, lane, PHY_C20_WR_ADDRESS_H, (addr >> 8), 0);
+	intel_cx0_write(i915, port, lane, PHY_C20_WR_ADDRESS_L, addr & 0xff, 0);
+
+	intel_cx0_write(i915, port, lane, PHY_C20_WR_DATA_H, (data >> 8), 0);
+	intel_cx0_write(i915, port, lane, PHY_C20_WR_DATA_L, data & 0xff, 1);
+}
+
 static void __intel_cx0_rmw(struct drm_i915_private *i915, enum port port,
 			    int lane, u16 addr, u8 clear, u8 set, bool committed)
 {
@@ -1157,7 +1170,7 @@ static int intel_c10mpllb_calc_state(struct intel_crtc_state *crtc_state,
 
 	for (i = 0; tables[i]; i++) {
 		if (crtc_state->port_clock <= tables[i]->clock) {
-			crtc_state->c10mpllb_state = *tables[i];
+			crtc_state->cx0pll_state.c10mpllb_state = *tables[i];
 			return 0;
 		}
 	}
@@ -1217,7 +1230,7 @@ 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;
+	const struct intel_c10mpllb_state *pll_state = &crtc_state->cx0pll_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 :
@@ -1301,6 +1314,205 @@ void intel_c10mpllb_dump_hw_state(struct drm_i915_private *dev_priv,
 			    i + 2, hw_state->pll[i + 2], i + 3, hw_state->pll[i + 3]);
 }
 
+static bool intel_c20_use_mplla(u32 clock)
+{
+	/* 10G and 20G rates use MPLLA */
+	if (clock == 312500 || clock == 625000)
+		return true;
+
+	return false;
+}
+
+static u8 intel_c20_get_dp_rate(u32 clock)
+{
+	switch (clock) {
+	case 162000: /* 1.62 Gbps DP1.4 */
+		return 0;
+	case 270000: /* 2.7 Gbps DP1.4 */
+		return 1;
+	case 540000: /* 5.4 Gbps DP 1.4 */
+		return 2;
+	case 810000: /* 8.1 Gbps DP1.4 */
+		return 3;
+	case 216000: /* 2.16 Gbps eDP */
+		return 4;
+	case 243000: /* 2.43 Gbps eDP */
+		return 5;
+	case 324000: /* 3.24 Gbps eDP */
+		return 6;
+	case 432000: /* 4.32 Gbps eDP */
+		return 7;
+	case 312500: /* 10 Gbps DP2.0 */
+		return 8;
+	case 421875: /* 13.5 Gbps DP2.0 */
+		return 9;
+	case 625000: /* 20 Gbps DP2.0*/
+		return 10;
+	default:
+		MISSING_CASE(clock);
+		return 0;
+	}
+}
+
+static u8 intel_c20_get_hdmi_rate(u32 clock)
+{
+	switch (clock) {
+	case 25175:
+	case 27000:
+	case 74250:
+	case 148500:
+	case 594000:
+		return 0;
+	case 166670: /* 3 Gbps */
+	case 333330: /* 6 Gbps */
+	case 666670: /* 12 Gbps */
+		return 1;
+	case 444440: /* 8 Gbps */
+		return 2;
+	case 555560: /* 10 Gbps */
+		return 3;
+	default:
+		MISSING_CASE(clock);
+		return 0;
+	}
+}
+
+static bool is_dp2(u32 clock)
+{
+	/* DP2.0 clock rates */
+	if (clock == 312500 || clock == 421875 || clock  == 625000)
+		return true;
+
+	return false;
+}
+
+static bool is_hdmi_frl(u32 clock)
+{
+	switch (clock) {
+	case 166670: /* 3 Gbps */
+	case 333330: /* 6 Gbps */
+	case 444440: /* 8 Gbps */
+	case 555560: /* 10 Gbps */
+	case 666670: /* 12 Gbps */
+		return true;
+	default:
+		return false;
+	}
+}
+
+static bool intel_c20_protocol_switch_valid(struct intel_encoder *encoder)
+{
+	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
+
+	/* banks should not be cleared for DPALT/USB4/TBT modes */
+	/* TODO: optimize re-calibration in legacy mode */
+	return intel_tc_port_in_legacy_mode(intel_dig_port);
+}
+
+static void intel_c20_pll_program(struct drm_i915_private *i915,
+				  const struct intel_crtc_state *crtc_state,
+				  struct intel_encoder *encoder)
+{
+	const struct intel_c20pll_state *pll_state = &crtc_state->cx0pll_state.c20pll_state;
+	bool dp = false;
+	int lane_count = crtc_state->lane_count;
+	int lanes = lane_count == 4 ? INTEL_CX0_BOTH_LANES : INTEL_CX0_LANE0;
+	bool cntx;
+	int i;
+
+	if (intel_crtc_has_dp_encoder(crtc_state))
+		dp = true;
+
+	/* 1. Read current context selection */
+	cntx = intel_cx0_read(i915, encoder->port, INTEL_CX0_LANE0, PHY_C20_VDR_CUSTOM_SERDES_RATE) &
+		PHY_C20_CONTEXT_TOGGLE;
+
+	/* 2. If there is a protocol switch from HDMI to DP or vice versa, clear
+	 * the lane #0 MPLLB CAL_DONE_BANK.
+	 * Protocol switch is only applicable for MPLLB
+	 */
+	if (intel_c20_protocol_switch_valid(encoder)) {
+		for (i = 0; i < 4; i++)
+			intel_c20_sram_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, RAWLANEAONX_DIG_TX_MPLLB_CAL_DONE_BANK(i), 0);
+	}
+
+	/* 3. Write SRAM configuration context. If A in use, write configuration to B context */
+	/* 3.1 Tx configuration */
+	for (i = 0; i < 3; i++) {
+		if (cntx)
+			intel_c20_sram_write(i915, encoder->port, INTEL_CX0_LANE0, PHY_C20_A_TX_CNTX_CFG(i), pll_state->tx[i]);
+		else
+			intel_c20_sram_write(i915, encoder->port, INTEL_CX0_LANE0, PHY_C20_B_TX_CNTX_CFG(i), pll_state->tx[i]);
+	}
+
+	/* 3.2 common configuration */
+	for (i = 0; i < 4; i++) {
+		if (cntx)
+			intel_c20_sram_write(i915, encoder->port, INTEL_CX0_LANE0, PHY_C20_A_CMN_CNTX_CFG(i), pll_state->cmn[i]);
+		else
+			intel_c20_sram_write(i915, encoder->port, INTEL_CX0_LANE0, PHY_C20_B_CMN_CNTX_CFG(i), pll_state->cmn[i]);
+	}
+
+	/* 3.3 mpllb or mplla configuration */
+	if (intel_c20_use_mplla(pll_state->clock)) {
+		for (i = 0; i < 10; i++) {
+			if (cntx)
+				intel_c20_sram_write(i915, encoder->port, INTEL_CX0_LANE0,
+						     PHY_C20_A_MPLLA_CNTX_CFG(i),
+						     pll_state->mplla[i]);
+			else
+				intel_c20_sram_write(i915, encoder->port, INTEL_CX0_LANE0,
+						     PHY_C20_B_MPLLA_CNTX_CFG(i),
+						     pll_state->mplla[i]);
+		}
+	} else {
+		for (i = 0; i < 11; i++) {
+			if (cntx)
+				intel_c20_sram_write(i915, encoder->port, INTEL_CX0_LANE0,
+						     PHY_C20_A_MPLLB_CNTX_CFG(i),
+						     pll_state->mpllb[i]);
+			else
+				intel_c20_sram_write(i915, encoder->port, INTEL_CX0_LANE0,
+						     PHY_C20_B_MPLLB_CNTX_CFG(i),
+						     pll_state->mpllb[i]);
+		}
+	}
+
+	/* 4. Program custom width to match the link protocol */
+	if (dp) {
+		intel_cx0_write(i915, encoder->port, lanes, PHY_C20_VDR_CUSTOM_WIDTH,
+				is_dp2(pll_state->clock) ? 2 : 0,
+				MB_WRITE_COMMITTED);
+	} else if (is_hdmi_frl(pll_state->clock)) {
+		intel_cx0_write(i915, encoder->port, lanes, PHY_C20_VDR_CUSTOM_WIDTH,
+				1, MB_WRITE_COMMITTED);
+	} else
+		intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C20_VDR_CUSTOM_WIDTH,
+				0, MB_WRITE_COMMITTED);
+
+	/* 5. For DP or 6. For HDMI */
+	if (dp) {
+		intel_cx0_write(i915, encoder->port, lanes, PHY_C20_VDR_CUSTOM_SERDES_RATE,
+				BIT(6) | (intel_c20_get_dp_rate(pll_state->clock) << 1),
+				MB_WRITE_COMMITTED);
+	} else {
+		intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C20_VDR_CUSTOM_SERDES_RATE,
+				((is_hdmi_frl(pll_state->clock) ? 1 : 0) << 7),
+				MB_WRITE_COMMITTED);
+
+		intel_cx0_write(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C20_VDR_HDMI_RATE,
+				(intel_c20_get_hdmi_rate(pll_state->clock) << 0),
+				MB_WRITE_COMMITTED);
+	}
+
+	/*
+	 * 7. Write Vendor specific registers to toggle context setting to load
+	 * the updated programming toggle context bit
+	 */
+	intel_cx0_write(i915, encoder->port, lanes, PHY_C20_VDR_CUSTOM_SERDES_RATE,
+			cntx ? 0 : 1, MB_WRITE_COMMITTED);
+}
+
 int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
 				   const struct intel_c10mpllb_state *pll_state)
 {
@@ -1344,7 +1556,11 @@ static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
 		val |= XELPDP_LANE1_PHY_CLOCK_SELECT;
 
 	val |= XELPDP_FORWARD_CLOCK_UNGATE;
-	val |= XELPDP_DDI_CLOCK_SELECT(XELPDP_DDI_CLOCK_SELECT_MAXPCLK);
+
+	if (is_hdmi_frl(crtc_state->port_clock))
+		val |= XELPDP_DDI_CLOCK_SELECT(XELPDP_DDI_CLOCK_SELECT_DIV18CLK);
+	else
+		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);
@@ -1599,8 +1815,8 @@ static u32 intel_cx0_get_pclk_pll_ack(u8 lane)
 		       XELPDP_LANE1_PCLK_PLL_ACK;
 }
 
-static void intel_c10pll_enable(struct intel_encoder *encoder,
-				const struct intel_crtc_state *crtc_state)
+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);
@@ -1608,6 +1824,7 @@ static void intel_c10pll_enable(struct intel_encoder *encoder,
 	bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;
 	u8 maxpclk_lane = lane_reversal ? INTEL_CX0_LANE1 :
 					  INTEL_CX0_LANE0;
+	intel_wakeref_t wakeref = intel_cx0_phy_transaction_begin(encoder);
 
 	/*
 	 * 1. Program PORT_CLOCK_CTL REGISTER to configure
@@ -1626,7 +1843,10 @@ static void intel_c10pll_enable(struct intel_encoder *encoder,
 					    CX0_P2_STATE_READY);
 
 	/* 4. Program PHY internal PLL internal registers. */
-	intel_c10_pll_program(i915, crtc_state, encoder);
+	if (intel_is_c10phy(i915, phy))
+		intel_c10_pll_program(i915, crtc_state, encoder);
+	else
+		intel_c20_pll_program(i915, crtc_state, encoder);
 
 	/*
 	 * 5. Program the enabled and disabled owned PHY lane
@@ -1665,31 +1885,21 @@ static void intel_c10pll_enable(struct intel_encoder *encoder,
 	 * 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);
-	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)
+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);
+	bool is_c10 = intel_is_c10phy(i915, phy);
+	intel_wakeref_t wakeref = intel_cx0_phy_transaction_begin(encoder);
 
 	/* 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);
+					    is_c10 ? CX0_P2PG_STATE_DISABLE :
+					    CX0_P4PG_STATE_DISABLE);
 
 	/*
 	 * 2. Follow the Display Voltage Frequency Switching Sequence Before
@@ -1727,18 +1937,6 @@ static void intel_c10pll_disable(struct intel_encoder *encoder)
 		     XELPDP_DDI_CLOCK_SELECT_MASK, 0);
 	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
 		     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);
-	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);
 }
@@ -1748,7 +1946,7 @@ void intel_c10mpllb_state_verify(struct intel_atomic_state *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_c10mpllb_state *mpllb_sw_state = &new_crtc_state->cx0pll_state.c10mpllb_state;
 	struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
 	struct intel_encoder *encoder;
 	struct intel_dp *intel_dp;
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
index 9bf7408fb363..a17da2d7298e 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
@@ -183,4 +183,34 @@
 #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)
 
+/* C20 Registers */
+#define PHY_C20_WR_ADDRESS_L		0xC02
+#define PHY_C20_WR_ADDRESS_H		0xC03
+#define PHY_C20_WR_DATA_L		0xC04
+#define PHY_C20_WR_DATA_H		0xC05
+#define PHY_C20_RD_ADDRESS_L		0xC06
+#define PHY_C20_RD_ADDRESS_H		0xC07
+#define PHY_C20_RD_DATA_L		0xC08
+#define PHY_C20_RD_DATA_H		0xC09
+#define PHY_C20_VDR_CUSTOM_SERDES_RATE	0xD00
+#define PHY_C20_VDR_HDMI_RATE		0xD01
+#define  PHY_C20_CONTEXT_TOGGLE		REG_BIT8(0)
+#define PHY_C20_VDR_CUSTOM_WIDTH	0xD02
+#define PHY_C20_A_TX_CNTX_CFG(idx)	(0xCF2E - (idx))
+#define PHY_C20_B_TX_CNTX_CFG(idx)	(0xCF2A - (idx))
+#define PHY_C20_A_CMN_CNTX_CFG(idx)	(0xCDAA - (idx))
+#define PHY_C20_B_CMN_CNTX_CFG(idx)	(0xCDA5 - (idx))
+#define PHY_C20_A_MPLLA_CNTX_CFG(idx)	(0xCCF0 - (idx))
+#define PHY_C20_B_MPLLA_CNTX_CFG(idx)	(0xCCE5 - (idx))
+#define PHY_C20_A_MPLLB_CNTX_CFG(idx)	(0xCB5A - (idx))
+#define PHY_C20_B_MPLLB_CNTX_CFG(idx)	(0xCB4E - (idx))
+
+#define C20_MPLLB_FRACEN		REG_BIT(13)
+#define C20_MPLLA_FRACEN		REG_BIT(14)
+#define C20_MULTIPLIER_MASK		REG_GENMASK(11, 0)
+#define C20_MPLLB_TX_CLK_DIV_MASK	REG_GENMASK(15, 13)
+#define C20_MPLLA_TX_CLK_DIV_MASK	REG_GENMASK(10, 8)
+
+#define RAWLANEAONX_DIG_TX_MPLLB_CAL_DONE_BANK(idx)	(0x303D + (idx))
+
 #endif /* __INTEL_CX0_PHY_REGS_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 60c38bc77683..13696f08e75e 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3064,6 +3064,11 @@ intel_ddi_update_prepare(struct intel_atomic_state *state,
 
 	intel_tc_port_get_link(enc_to_dig_port(encoder),
 		               required_lanes);
+
+	/* FIXME: Add MTL pll_mgr */
+	if (DISPLAY_VER(i915) >= 14)
+		return;
+
 	if (crtc_state && crtc_state->hw.active) {
 		struct intel_crtc *slave_crtc;
 
@@ -3514,9 +3519,9 @@ static void mtl_ddi_get_config(struct intel_encoder *encoder,
 
 	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_c10mpllb_readout_hw_state(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
+	intel_c10mpllb_dump_hw_state(i915, &crtc_state->cx0pll_state.c10mpllb_state);
+	crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
 
 	intel_ddi_get_config(encoder, crtc_state);
 }
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 5dd11d3da2e4..46b98fd4f92d 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -984,6 +984,23 @@ struct intel_c10mpllb_state {
 	u8 pll[20];
 };
 
+struct intel_c20pll_state {
+	u32 clock; /* in kHz */
+	u16 tx[3];
+	u16 cmn[4];
+	union {
+		u16 mplla[10];
+		u16 mpllb[11];
+	};
+};
+
+struct intel_cx0pll_state {
+	union {
+		struct intel_c10mpllb_state c10mpllb_state;
+		struct intel_c20pll_state c20pll_state;
+	};
+};
+
 struct intel_crtc_state {
 	/*
 	 * uapi (drm) state. This is the software state shown to userspace.
@@ -1127,7 +1144,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;
+		struct intel_cx0pll_state cx0pll_state;
 	};
 
 	/*
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 3849375bd459..0c12f89be417 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -53,6 +53,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_de.h"
 #include "intel_display_types.h"
@@ -422,7 +423,14 @@ static int ehl_max_source_rate(struct intel_dp *intel_dp)
 
 static int mtl_max_source_rate(struct intel_dp *intel_dp)
 {
-	return intel_dp_is_edp(intel_dp) ? 675000 : 810000;
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+	enum phy phy = intel_port_to_phy(i915, dig_port->base.port);
+
+	if (intel_is_c10phy(i915, phy))
+		return intel_dp_is_edp(intel_dp) ? 675000 : 810000;
+
+	return 2000000;
 }
 
 static int vbt_max_link_rate(struct intel_dp *intel_dp)
@@ -451,7 +459,7 @@ 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,
+		810000,	1000000, 1350000, 2000000,
 	};
 	static const int icl_rates[] = {
 		162000, 216000, 270000, 324000, 432000, 540000, 648000, 810000,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 09/22] drm/i915/mtl: C20 HW readout
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (7 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 08/22] drm/i915/mtl: C20 PLL programming Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 10/22] drm/i915/mtl: Dump C20 pll hw state Mika Kahola
                   ` (16 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

Create a table for C20 DP1.4, DP2.0 and HDMI2.1 rates.
The PLL settings are based on table, not for algorithmic alternative.
For DP 1.4 only MPLLB is in use.

Once register settings are done, we read back C20 HW state.

BSpec: 64568

v2: Update rbr, hbr1, hbr2, and hbr3 pll configurations 4 and 5
    based on changes in BSpec consolidated table
v3: Rename intel_c20_read() to intel_c20_sram_read() (Gustavo)
    Use context and correct MPLLA reg bit to select if MPLLA is in
    use or not (Gustavo)

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c | 553 ++++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_cx0_phy.h |   8 +-
 drivers/gpu/drm/i915/display/intel_ddi.c     |   9 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c    |   6 +-
 drivers/gpu/drm/i915/display/intel_hdmi.h    |   1 +
 5 files changed, 569 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index 730c70f82822..bfb264ea154a 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -11,6 +11,7 @@
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_dp.h"
+#include "intel_hdmi.h"
 #include "intel_panel.h"
 #include "intel_tc.h"
 #include "intel_psr.h"
@@ -248,6 +249,23 @@ static void intel_c20_sram_write(struct drm_i915_private *i915, enum port port,
 	intel_cx0_write(i915, port, lane, PHY_C20_WR_DATA_L, data & 0xff, 1);
 }
 
+static u16 intel_c20_sram_read(struct drm_i915_private *i915, enum port port,
+			        int lane, u16 addr)
+{
+	u16 val;
+
+	assert_dc_off(i915);
+
+	intel_cx0_write(i915, port, lane, PHY_C20_RD_ADDRESS_H, (addr >> 8), 1);
+	intel_cx0_write(i915, port, lane, PHY_C20_RD_ADDRESS_L, addr & 0xff, 0);
+
+	val = intel_cx0_read(i915, port, lane, PHY_C20_RD_DATA_H);
+	val <<= 8;
+	val |= intel_cx0_read(i915, port, lane, PHY_C20_RD_DATA_L);
+
+	return val;
+}
+
 static void __intel_cx0_rmw(struct drm_i915_private *i915, enum port port,
 			    int lane, u16 addr, u8 clear, u8 set, bool committed)
 {
@@ -598,6 +616,192 @@ static const struct intel_c10mpllb_state * const mtl_c10_edp_tables[] = {
 	NULL,
 };
 
+/* C20 basic DP 1.4 tables */
+static const struct intel_c20pll_state mtl_c20_dp_rbr = {
+	.clock = 162000,
+	.tx = {	0xbe88, /* tx cfg0 */
+		0x5800, /* tx cfg1 */
+		0x0000, /* tx cfg2 */
+		},
+	.cmn = {0x0500, /* cmn cfg0*/
+		0x0005, /* cmn cfg1 */
+		0x0000, /* cmn cfg2 */
+		0x0000, /* cmn cfg3 */
+		},
+	.mpllb = { 0x50a8,	/* mpllb cfg0 */
+		0x2120,		/* mpllb cfg1 */
+		0xcd9a,		/* mpllb cfg2 */
+		0xbfc1,		/* mpllb cfg3 */
+		0x5ab8,         /* mpllb cfg4 */
+		0x4c34,         /* mpllb cfg5 */
+		0x2000,		/* mpllb cfg6 */
+		0x0001,		/* mpllb cfg7 */
+		0x6000,		/* mpllb cfg8 */
+		0x0000,		/* mpllb cfg9 */
+		0x0000,		/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_dp_hbr1 = {
+	.clock = 270000,
+	.tx = {	0xbe88, /* tx cfg0 */
+		0x4800, /* tx cfg1 */
+		0x0000, /* tx cfg2 */
+		},
+	.cmn = {0x0500, /* cmn cfg0*/
+		0x0005, /* cmn cfg1 */
+		0x0000, /* cmn cfg2 */
+		0x0000, /* cmn cfg3 */
+		},
+	.mpllb = { 0x308c,	/* mpllb cfg0 */
+		0x2110,		/* mpllb cfg1 */
+		0xcc9c,		/* mpllb cfg2 */
+		0xbfc1,		/* mpllb cfg3 */
+		0x489a,         /* mpllb cfg4 */
+		0x3f81,         /* mpllb cfg5 */
+		0x2000,		/* mpllb cfg6 */
+		0x0001,		/* mpllb cfg7 */
+		0x5000,		/* mpllb cfg8 */
+		0x0000,		/* mpllb cfg9 */
+		0x0000,		/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_dp_hbr2 = {
+	.clock = 540000,
+	.tx = {	0xbe88, /* tx cfg0 */
+		0x4800, /* tx cfg1 */
+		0x0000, /* tx cfg2 */
+		},
+	.cmn = {0x0500, /* cmn cfg0*/
+		0x0005, /* cmn cfg1 */
+		0x0000, /* cmn cfg2 */
+		0x0000, /* cmn cfg3 */
+		},
+	.mpllb = { 0x108c,	/* mpllb cfg0 */
+		0x2108,		/* mpllb cfg1 */
+		0xcc9c,		/* mpllb cfg2 */
+		0xbfc1,		/* mpllb cfg3 */
+		0x489a,         /* mpllb cfg4 */
+		0x3f81,         /* mpllb cfg5 */
+		0x2000,		/* mpllb cfg6 */
+		0x0001,		/* mpllb cfg7 */
+		0x5000,		/* mpllb cfg8 */
+		0x0000,		/* mpllb cfg9 */
+		0x0000,		/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_dp_hbr3 = {
+	.clock = 810000,
+	.tx = {	0xbe88, /* tx cfg0 */
+		0x4800, /* tx cfg1 */
+		0x0000, /* tx cfg2 */
+		},
+	.cmn = {0x0500, /* cmn cfg0*/
+		0x0005, /* cmn cfg1 */
+		0x0000, /* cmn cfg2 */
+		0x0000, /* cmn cfg3 */
+		},
+	.mpllb = { 0x10d2,	/* mpllb cfg0 */
+		0x2108,		/* mpllb cfg1 */
+		0x8d98,		/* mpllb cfg2 */
+		0xbfc1,		/* mpllb cfg3 */
+		0x7166,         /* mpllb cfg4 */
+		0x5f42,         /* mpllb cfg5 */
+		0x2000,		/* mpllb cfg6 */
+		0x0001,		/* mpllb cfg7 */
+		0x7800,		/* mpllb cfg8 */
+		0x0000,		/* mpllb cfg9 */
+		0x0000,		/* mpllb cfg10 */
+		},
+};
+
+/* C20 basic DP 2.0 tables */
+static const struct intel_c20pll_state mtl_c20_dp_uhbr10 = {
+	.clock = 312500,
+	.tx = {	0xbe21, /* tx cfg0 */
+		0x4800, /* tx cfg1 */
+		0x0000, /* tx cfg2 */
+		},
+	.cmn = {0x0500, /* cmn cfg0*/
+		0x0005, /* cmn cfg1 */
+		0x0000, /* cmn cfg2 */
+		0x0000, /* cmn cfg3 */
+		},
+	.mplla = { 0x3104,	/* mplla cfg0 */
+		0xd105,		/* mplla cfg1 */
+		0xc025,		/* mplla cfg2 */
+		0xc025,		/* mplla cfg3 */
+		0xa6ab,		/* mplla cfg4 */
+		0x8c00,		/* mplla cfg5 */
+		0x4000,		/* mplla cfg6 */
+		0x0003,		/* mplla cfg7 */
+		0x3555,		/* mplla cfg8 */
+		0x0001,		/* mplla cfg9 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_dp_uhbr13_5 = {
+	.clock = 421875,
+	.tx = {	0xbea0, /* tx cfg0 */
+		0x4800, /* tx cfg1 */
+		0x0000, /* tx cfg2 */
+		},
+	.cmn = {0x0500, /* cmn cfg0*/
+		0x0005, /* cmn cfg1 */
+		0x0000, /* cmn cfg2 */
+		0x0000, /* cmn cfg3 */
+		},
+	.mpllb = { 0x015f,	/* mpllb cfg0 */
+		0x2205,		/* mpllb cfg1 */
+		0x1b17,		/* mpllb cfg2 */
+		0xffc1,		/* mpllb cfg3 */
+		0xe100,		/* mpllb cfg4 */
+		0xbd00,		/* mpllb cfg5 */
+		0x2000,		/* mpllb cfg6 */
+		0x0001,		/* mpllb cfg7 */
+		0x4800,		/* mpllb cfg8 */
+		0x0000,		/* mpllb cfg9 */
+		0x0000,		/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_dp_uhbr20 = {
+	.clock = 625000,
+	.tx = {	0xbe20, /* tx cfg0 */
+		0x4800, /* tx cfg1 */
+		0x0000, /* tx cfg2 */
+		},
+	.cmn = {0x0500, /* cmn cfg0*/
+		0x0005, /* cmn cfg1 */
+		0x0000, /* cmn cfg2 */
+		0x0000, /* cmn cfg3 */
+		},
+	.mplla = { 0x3104,	/* mplla cfg0 */
+		0xd105,		/* mplla cfg1 */
+		0xc025,		/* mplla cfg2 */
+		0xc025,		/* mplla cfg3 */
+		0xa6ab,		/* mplla cfg4 */
+		0x8c00,		/* mplla cfg5 */
+		0x4000,		/* mplla cfg6 */
+		0x0003,		/* mplla cfg7 */
+		0x3555,		/* mplla cfg8 */
+		0x0001,		/* mplla cfg9 */
+		},
+};
+
+static const struct intel_c20pll_state * const mtl_c20_dp_tables[] = {
+        &mtl_c20_dp_rbr,
+        &mtl_c20_dp_hbr1,
+        &mtl_c20_dp_hbr2,
+        &mtl_c20_dp_hbr3,
+	&mtl_c20_dp_uhbr10,
+	&mtl_c20_dp_uhbr13_5,
+	&mtl_c20_dp_uhbr20,
+        NULL,
+};
+
 /*
  * HDMI link rates with 38.4 MHz reference clock.
  */
@@ -1117,7 +1321,271 @@ static const struct intel_c10mpllb_state * const mtl_c10_hdmi_tables[] = {
 	NULL,
 };
 
-int intel_c10_phy_check_hdmi_link_rate(int clock)
+static const struct intel_c20pll_state mtl_c20_hdmi_25_175 = {
+	.clock = 25175,
+	.tx = {  0xbe88, /* tx cfg0 */
+		 0x9800, /* tx cfg1 */
+		 0x0000, /* tx cfg2 */
+	      },
+	.cmn = { 0x0500, /* cmn cfg0*/
+		 0x0005, /* cmn cfg1 */
+		 0x0000, /* cmn cfg2 */
+		 0x0000, /* cmn cfg3 */
+	       },
+	.mpllb = { 0xa0d2,	/* mpllb cfg0 */
+		   0x7d80,	/* mpllb cfg1 */
+		   0x0906,	/* mpllb cfg2 */
+		   0xbe40,	/* mpllb cfg3 */
+		   0x0000,	/* mpllb cfg4 */
+		   0x0000,	/* mpllb cfg5 */
+		   0x0200,	/* mpllb cfg6 */
+		   0x0001,	/* mpllb cfg7 */
+		   0x0000,	/* mpllb cfg8 */
+		   0x0000,	/* mpllb cfg9 */
+		   0x0001,	/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_hdmi_27_0 = {
+	.clock = 27000,
+	.tx = {  0xbe88, /* tx cfg0 */
+		 0x9800, /* tx cfg1 */
+		 0x0000, /* tx cfg2 */
+	      },
+	.cmn = { 0x0500, /* cmn cfg0*/
+		 0x0005, /* cmn cfg1 */
+		 0x0000, /* cmn cfg2 */
+		 0x0000, /* cmn cfg3 */
+	       },
+	.mpllb = { 0xa0e0,	/* mpllb cfg0 */
+		   0x7d80,	/* mpllb cfg1 */
+		   0x0906,	/* mpllb cfg2 */
+		   0xbe40,	/* mpllb cfg3 */
+		   0x0000,	/* mpllb cfg4 */
+		   0x0000,	/* mpllb cfg5 */
+		   0x2200,	/* mpllb cfg6 */
+		   0x0001,	/* mpllb cfg7 */
+		   0x8000,	/* mpllb cfg8 */
+		   0x0000,	/* mpllb cfg9 */
+		   0x0001,	/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_hdmi_74_25 = {
+	.clock = 74250,
+	.tx = {  0xbe88, /* tx cfg0 */
+		 0x9800, /* tx cfg1 */
+		 0x0000, /* tx cfg2 */
+	      },
+	.cmn = { 0x0500, /* cmn cfg0*/
+		 0x0005, /* cmn cfg1 */
+		 0x0000, /* cmn cfg2 */
+		 0x0000, /* cmn cfg3 */
+	       },
+	.mpllb = { 0x609a,	/* mpllb cfg0 */
+		   0x7d40,	/* mpllb cfg1 */
+		   0xca06,	/* mpllb cfg2 */
+		   0xbe40,	/* mpllb cfg3 */
+		   0x0000,	/* mpllb cfg4 */
+		   0x0000,	/* mpllb cfg5 */
+		   0x2200,	/* mpllb cfg6 */
+		   0x0001,	/* mpllb cfg7 */
+		   0x5800,	/* mpllb cfg8 */
+		   0x0000,	/* mpllb cfg9 */
+		   0x0001,	/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_hdmi_148_5 = {
+	.clock = 148500,
+	.tx = {  0xbe88, /* tx cfg0 */
+		 0x9800, /* tx cfg1 */
+		 0x0000, /* tx cfg2 */
+	      },
+	.cmn = { 0x0500, /* cmn cfg0*/
+		 0x0005, /* cmn cfg1 */
+		 0x0000, /* cmn cfg2 */
+		 0x0000, /* cmn cfg3 */
+	       },
+	.mpllb = { 0x409a,	/* mpllb cfg0 */
+		   0x7d20,	/* mpllb cfg1 */
+		   0xca06,	/* mpllb cfg2 */
+		   0xbe40,	/* mpllb cfg3 */
+		   0x0000,	/* mpllb cfg4 */
+		   0x0000,	/* mpllb cfg5 */
+		   0x2200,	/* mpllb cfg6 */
+		   0x0001,	/* mpllb cfg7 */
+		   0x5800,	/* mpllb cfg8 */
+		   0x0000,	/* mpllb cfg9 */
+		   0x0001,	/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_hdmi_594 = {
+	.clock = 594000,
+	.tx = {  0xbe88, /* tx cfg0 */
+		 0x9800, /* tx cfg1 */
+		 0x0000, /* tx cfg2 */
+	      },
+	.cmn = { 0x0500, /* cmn cfg0*/
+		 0x0005, /* cmn cfg1 */
+		 0x0000, /* cmn cfg2 */
+		 0x0000, /* cmn cfg3 */
+	       },
+	.mpllb = { 0x009a,	/* mpllb cfg0 */
+		   0x7d08,	/* mpllb cfg1 */
+		   0xca06,	/* mpllb cfg2 */
+		   0xbe40,	/* mpllb cfg3 */
+		   0x0000,	/* mpllb cfg4 */
+		   0x0000,	/* mpllb cfg5 */
+		   0x2200,	/* mpllb cfg6 */
+		   0x0001,	/* mpllb cfg7 */
+		   0x5800,	/* mpllb cfg8 */
+		   0x0000,	/* mpllb cfg9 */
+		   0x0001,	/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_hdmi_300 = {
+	.clock = 166670,
+	.tx = {  0xbe88, /* tx cfg0 */
+		 0x9800, /* tx cfg1 */
+		 0x0000, /* tx cfg2 */
+	      },
+	.cmn = { 0x0500, /* cmn cfg0*/
+		 0x0005, /* cmn cfg1 */
+		 0x0000, /* cmn cfg2 */
+		 0x0000, /* cmn cfg3 */
+	       },
+	.mpllb = { 0x209c,	/* mpllb cfg0 */
+		   0x7d10,	/* mpllb cfg1 */
+		   0xca06,	/* mpllb cfg2 */
+		   0xbe40,	/* mpllb cfg3 */
+		   0x0000,	/* mpllb cfg4 */
+		   0x0000,	/* mpllb cfg5 */
+		   0x2200,	/* mpllb cfg6 */
+		   0x0001,	/* mpllb cfg7 */
+		   0x2000,	/* mpllb cfg8 */
+		   0x0000,	/* mpllb cfg9 */
+		   0x0004,	/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_hdmi_600 = {
+	.clock = 333330,
+	.tx = {  0xbe88, /* tx cfg0 */
+		 0x9800, /* tx cfg1 */
+		 0x0000, /* tx cfg2 */
+	      },
+	.cmn = { 0x0500, /* cmn cfg0*/
+		 0x0005, /* cmn cfg1 */
+		 0x0000, /* cmn cfg2 */
+		 0x0000, /* cmn cfg3 */
+	       },
+	.mpllb = { 0x009c,	/* mpllb cfg0 */
+		   0x7d08,	/* mpllb cfg1 */
+		   0xca06,	/* mpllb cfg2 */
+		   0xbe40,	/* mpllb cfg3 */
+		   0x0000,	/* mpllb cfg4 */
+		   0x0000,	/* mpllb cfg5 */
+		   0x2200,	/* mpllb cfg6 */
+		   0x0001,	/* mpllb cfg7 */
+		   0x2000,	/* mpllb cfg8 */
+		   0x0000,	/* mpllb cfg9 */
+		   0x0004,	/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_hdmi_800 = {
+	.clock = 444440,
+	.tx = {  0xbe88, /* tx cfg0 */
+		 0x9800, /* tx cfg1 */
+		 0x0000, /* tx cfg2 */
+	      },
+	.cmn = { 0x0500, /* cmn cfg0*/
+		 0x0005, /* cmn cfg1 */
+		 0x0000, /* cmn cfg2 */
+		 0x0000, /* cmn cfg3 */
+	       },
+	.mpllb = { 0x00d0,	/* mpllb cfg0 */
+		   0x7d08,	/* mpllb cfg1 */
+		   0x4a06,	/* mpllb cfg2 */
+		   0xbe40,	/* mpllb cfg3 */
+		   0x0000,	/* mpllb cfg4 */
+		   0x0000,	/* mpllb cfg5 */
+		   0x2200,	/* mpllb cfg6 */
+		   0x0003,	/* mpllb cfg7 */
+		   0x2aaa,	/* mpllb cfg8 */
+		   0x0002,	/* mpllb cfg9 */
+		   0x0004,	/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_hdmi_1000 = {
+	.clock = 555560,
+	.tx = {  0xbe88, /* tx cfg0 */
+		 0x9800, /* tx cfg1 */
+		 0x0000, /* tx cfg2 */
+	      },
+	.cmn = { 0x0500, /* cmn cfg0*/
+		 0x0005, /* cmn cfg1 */
+		 0x0000, /* cmn cfg2 */
+		 0x0000, /* cmn cfg3 */
+	       },
+	.mpllb = { 0x1104,	/* mpllb cfg0 */
+		   0x7d08,	/* mpllb cfg1 */
+		   0x0a06,	/* mpllb cfg2 */
+		   0xbe40,	/* mpllb cfg3 */
+		   0x0000,	/* mpllb cfg4 */
+		   0x0000,	/* mpllb cfg5 */
+		   0x2200,	/* mpllb cfg6 */
+		   0x0003,	/* mpllb cfg7 */
+		   0x3555,	/* mpllb cfg8 */
+		   0x0001,	/* mpllb cfg9 */
+		   0x0004,	/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state mtl_c20_hdmi_1200 = {
+	.clock = 666670,
+	.tx = {  0xbe88, /* tx cfg0 */
+		 0x9800, /* tx cfg1 */
+		 0x0000, /* tx cfg2 */
+	      },
+	.cmn = { 0x0500, /* cmn cfg0*/
+		 0x0005, /* cmn cfg1 */
+		 0x0000, /* cmn cfg2 */
+		 0x0000, /* cmn cfg3 */
+	       },
+	.mpllb = { 0x0138,	/* mpllb cfg0 */
+		   0x7d08,	/* mpllb cfg1 */
+		   0x5486,	/* mpllb cfg2 */
+		   0xfe40,	/* mpllb cfg3 */
+		   0x0000,	/* mpllb cfg4 */
+		   0x0000,	/* mpllb cfg5 */
+		   0x2200,	/* mpllb cfg6 */
+		   0x0001,	/* mpllb cfg7 */
+		   0x4000,	/* mpllb cfg8 */
+		   0x0000,	/* mpllb cfg9 */
+		   0x0004,	/* mpllb cfg10 */
+		},
+};
+
+static const struct intel_c20pll_state * const mtl_c20_hdmi_tables[] = {
+	&mtl_c20_hdmi_25_175,
+	&mtl_c20_hdmi_27_0,
+	&mtl_c20_hdmi_74_25,
+	&mtl_c20_hdmi_148_5,
+	&mtl_c20_hdmi_594,
+	&mtl_c20_hdmi_300,
+	&mtl_c20_hdmi_600,
+	&mtl_c20_hdmi_800,
+	&mtl_c20_hdmi_1000,
+	&mtl_c20_hdmi_1200,
+	NULL,
+};
+
+static int intel_c10_phy_check_hdmi_link_rate(int clock)
 {
 	const struct intel_c10mpllb_state * const *tables = mtl_c10_hdmi_tables;
 	int i;
@@ -1130,6 +1598,17 @@ int intel_c10_phy_check_hdmi_link_rate(int clock)
 	return MODE_CLOCK_RANGE;
 }
 
+int intel_cx0_phy_check_hdmi_link_rate(struct intel_hdmi *hdmi, int clock)
+{
+	struct intel_digital_port *dig_port = hdmi_to_dig_port(hdmi);
+	struct drm_i915_private *i915 = intel_hdmi_to_i915(hdmi);
+	enum phy phy = intel_port_to_phy(i915, dig_port->base.port);
+
+	if (intel_is_c10phy(i915, phy))
+		return intel_c10_phy_check_hdmi_link_rate(clock);
+	return intel_c20_phy_check_hdmi_link_rate(clock);
+}
+
 static const struct intel_c10mpllb_state * const *
 intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
 			   struct intel_encoder *encoder)
@@ -1314,6 +1793,19 @@ void intel_c10mpllb_dump_hw_state(struct drm_i915_private *dev_priv,
 			    i + 2, hw_state->pll[i + 2], i + 3, hw_state->pll[i + 3]);
 }
 
+int intel_c20_phy_check_hdmi_link_rate(int clock)
+{
+        const struct intel_c20pll_state * const *tables = mtl_c20_hdmi_tables;
+        int i;
+
+        for (i = 0; tables[i]; i++) {
+                if (clock == tables[i]->clock)
+                        return MODE_OK;
+        }
+
+        return MODE_CLOCK_RANGE;
+}
+
 static bool intel_c20_use_mplla(u32 clock)
 {
 	/* 10G and 20G rates use MPLLA */
@@ -1323,6 +1815,65 @@ static bool intel_c20_use_mplla(u32 clock)
 	return false;
 }
 
+void intel_c20pll_readout_hw_state(struct intel_encoder *encoder,
+				   struct intel_c20pll_state *pll_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	bool cntx;
+	u32 val;
+	int i;
+
+        /* 1. Read current context selection */
+        cntx = intel_cx0_read(i915, encoder->port, INTEL_CX0_LANE0, PHY_C20_VDR_CUSTOM_SERDES_RATE) & PHY_C20_CONTEXT_TOGGLE;
+
+	/* Read Tx configuration */
+	for (i = 0; i < ARRAY_SIZE(pll_state->tx); i++) {
+		if (cntx)
+			pll_state->tx[i] = intel_c20_sram_read(i915, encoder->port, INTEL_CX0_LANE0,
+							       PHY_C20_B_TX_CNTX_CFG(i));
+		else
+			pll_state->tx[i] = intel_c20_sram_read(i915, encoder->port, INTEL_CX0_LANE0,
+							       PHY_C20_A_TX_CNTX_CFG(i));
+	}
+
+	/* Read common configuration */
+	for (i = 0; i < ARRAY_SIZE(pll_state->cmn); i++) {
+		if (cntx)
+			pll_state->cmn[i] = intel_c20_sram_read(i915, encoder->port, INTEL_CX0_LANE0,
+							        PHY_C20_B_CMN_CNTX_CFG(i));
+		else
+			pll_state->cmn[i] = intel_c20_sram_read(i915, encoder->port, INTEL_CX0_LANE0,
+							        PHY_C20_A_CMN_CNTX_CFG(i));
+	}
+
+	if (cntx)
+		val = intel_c20_sram_read(i915, encoder->port, INTEL_CX0_LANE0, PHY_C20_B_MPLLA_CNTX_CFG(6));
+	else
+		val = intel_c20_sram_read(i915, encoder->port, INTEL_CX0_LANE0, PHY_C20_A_MPLLA_CNTX_CFG(6));
+
+	if (val & C20_MPLLA_FRACEN) {
+		/* MPLLA configuration */
+		for (i = 0; i < ARRAY_SIZE(pll_state->mplla); i++) {
+			if (cntx)
+				pll_state->mplla[i] = intel_c20_sram_read(i915, encoder->port, INTEL_CX0_LANE0,
+								          PHY_C20_B_MPLLA_CNTX_CFG(i));
+			else
+				pll_state->mplla[i] = intel_c20_sram_read(i915, encoder->port, INTEL_CX0_LANE0,
+								          PHY_C20_A_MPLLA_CNTX_CFG(i));
+		}
+	} else {
+		/* MPLLB configuration */
+		for (i = 0; i < ARRAY_SIZE(pll_state->mpllb); i++) {
+			if (cntx)
+				pll_state->mpllb[i] = intel_c20_sram_read(i915, encoder->port, INTEL_CX0_LANE0,
+								          PHY_C20_B_MPLLB_CNTX_CFG(i));
+			else
+				pll_state->mpllb[i] = intel_c20_sram_read(i915, encoder->port, INTEL_CX0_LANE0,
+								          PHY_C20_A_MPLLB_CNTX_CFG(i));
+		}
+	}
+}
+
 static u8 intel_c20_get_dp_rate(u32 clock)
 {
 	switch (clock) {
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.h b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
index 952c7deeffaa..cf603080ce3d 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
@@ -33,14 +33,20 @@ 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_c20pll_readout_hw_state(struct intel_encoder *encoder,
+                                   struct intel_c20pll_state *pll_state);
 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);
-int intel_c10_phy_check_hdmi_link_rate(int clock);
+int intel_cx0_phy_check_hdmi_link_rate(struct intel_hdmi *hdmi, int clock);
 void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder,
 				     const struct intel_crtc_state *crtc_state);
 
+int intel_c20_phy_check_hdmi_link_rate(int clock);
+void intel_cx0_phy_ddi_vswing_sequence(struct intel_encoder *encoder,
+				       const struct intel_crtc_state *crtc_state,
+				       u32 level);
 #endif /* __INTEL_CX0_PHY_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 13696f08e75e..8e653061adb9 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3517,10 +3517,13 @@ static void mtl_ddi_get_config(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));
+	if (intel_is_c10phy(i915, phy)) {
+		intel_c10mpllb_readout_hw_state(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
+		intel_c10mpllb_dump_hw_state(i915, &crtc_state->cx0pll_state.c10mpllb_state);
+	} else {
+		intel_c20pll_readout_hw_state(encoder, &crtc_state->cx0pll_state.c20pll_state);
+	}
 
-	intel_c10mpllb_readout_hw_state(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
-	intel_c10mpllb_dump_hw_state(i915, &crtc_state->cx0pll_state.c10mpllb_state);
 	crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
 
 	intel_ddi_get_config(encoder, crtc_state);
diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index baa9ef7568af..43d06d22bd48 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -59,7 +59,7 @@
 #include "intel_panel.h"
 #include "intel_snps_phy.h"
 
-static struct drm_i915_private *intel_hdmi_to_i915(struct intel_hdmi *intel_hdmi)
+inline struct drm_i915_private *intel_hdmi_to_i915(struct intel_hdmi *intel_hdmi)
 {
 	return to_i915(hdmi_to_dig_port(intel_hdmi)->base.base.dev);
 }
@@ -1866,8 +1866,8 @@ 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_METEORLAKE(dev_priv))
-		return intel_c10_phy_check_hdmi_link_rate(clock);
+	if (DISPLAY_VER(dev_priv) >= 14)
+		return intel_cx0_phy_check_hdmi_link_rate(hdmi, clock);
 	else if (IS_DG2(dev_priv))
 		return intel_snps_phy_check_hdmi_link_rate(clock);
 
diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.h b/drivers/gpu/drm/i915/display/intel_hdmi.h
index 774dda2376ed..492bd3921385 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.h
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.h
@@ -54,5 +54,6 @@ int intel_hdmi_dsc_get_num_slices(const struct intel_crtc_state *crtc_state,
 				  int src_max_slices, int src_max_slice_width,
 				  int hdmi_max_slices, int hdmi_throughput);
 int intel_hdmi_dsc_get_slice_height(int vactive);
+struct drm_i915_private *intel_hdmi_to_i915(struct intel_hdmi *intel_hdmi);
 
 #endif /* __INTEL_HDMI_H__ */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 10/22] drm/i915/mtl: Dump C20 pll hw state
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (8 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 09/22] drm/i915/mtl: C20 HW readout Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 11/22] drm/i915/mtl: C20 port clock calculation Mika Kahola
                   ` (15 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

As we already do with C10 chip, let's dump the pll
hw state for C20 as well.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c | 20 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_cx0_phy.h |  2 ++
 drivers/gpu/drm/i915/display/intel_ddi.c     |  1 +
 3 files changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index bfb264ea154a..bc6913a7444a 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -1874,6 +1874,26 @@ void intel_c20pll_readout_hw_state(struct intel_encoder *encoder,
 	}
 }
 
+void intel_c20pll_dump_hw_state(struct drm_i915_private *i915,
+				const struct intel_c20pll_state *hw_state)
+{
+	int i;
+
+	drm_dbg_kms(&i915->drm, "c20pll_hw_state:\n");
+	drm_dbg_kms(&i915->drm, "tx[0] = 0x%.4x, tx[1] = 0x%.4x, tx[2] = 0x%.4x\n",
+		    hw_state->tx[0], hw_state->tx[1], hw_state->tx[2]);
+	drm_dbg_kms(&i915->drm, "cmn[0] = 0x%.4x, cmn[1] = 0x%.4x, cmn[2] = 0x%.4x, cmn[3] = 0x%.4x\n",
+		    hw_state->cmn[0], hw_state->cmn[1], hw_state->cmn[2], hw_state->cmn[3]);
+
+	if (intel_c20_use_mplla(hw_state->clock)) {
+		for (i = 0; i < ARRAY_SIZE(hw_state->mplla); i++)
+			drm_dbg_kms(&i915->drm, "mplla[%d] = 0x%.4x\n", i, hw_state->mplla[i]);
+	} else {
+		for (i = 0; i < ARRAY_SIZE(hw_state->mpllb); i++)
+			drm_dbg_kms(&i915->drm, "mpllb[%d] = 0x%.4x\n", i, hw_state->mpllb[i]);
+	}
+}
+
 static u8 intel_c20_get_dp_rate(u32 clock)
 {
 	switch (clock) {
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.h b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
index cf603080ce3d..0b46b2ad48a9 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
@@ -37,6 +37,8 @@ void intel_c20pll_readout_hw_state(struct intel_encoder *encoder,
                                    struct intel_c20pll_state *pll_state);
 void intel_c10mpllb_dump_hw_state(struct drm_i915_private *dev_priv,
 				  const struct intel_c10mpllb_state *hw_state);
+void intel_c20pll_dump_hw_state(struct drm_i915_private *i915,
+				const struct intel_c20pll_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,
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 8e653061adb9..4e8f3632b3bc 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3522,6 +3522,7 @@ static void mtl_ddi_get_config(struct intel_encoder *encoder,
 		intel_c10mpllb_dump_hw_state(i915, &crtc_state->cx0pll_state.c10mpllb_state);
 	} else {
 		intel_c20pll_readout_hw_state(encoder, &crtc_state->cx0pll_state.c20pll_state);
+		intel_c20pll_dump_hw_state(i915, &crtc_state->cx0pll_state.c20pll_state);
 	}
 
 	crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 11/22] drm/i915/mtl: C20 port clock calculation
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (9 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 10/22] drm/i915/mtl: Dump C20 pll hw state Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 12/22] drm/i915/mtl: C20 HDMI state calculations Mika Kahola
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

Calculate port clock with C20 phy.

v2: Initialize parameters

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c | 64 +++++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_cx0_phy.h |  2 +
 drivers/gpu/drm/i915/display/intel_ddi.c     |  4 +-
 3 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index bc6913a7444a..60db8d1b7589 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -1626,6 +1626,18 @@ intel_c10_mpllb_tables_get(struct intel_crtc_state *crtc_state,
 	return NULL;
 }
 
+static const struct intel_c20pll_state * const *
+intel_c20_pll_tables_get(struct intel_crtc_state *crtc_state,
+			 struct intel_encoder *encoder)
+{
+	if (intel_crtc_has_dp_encoder(crtc_state)) {
+		return mtl_c20_dp_tables;
+	}
+
+	MISSING_CASE(encoder->type);
+	return NULL;
+}
+
 static int intel_c10mpllb_calc_state(struct intel_crtc_state *crtc_state,
 				     struct intel_encoder *encoder)
 {
@@ -1657,15 +1669,36 @@ static int intel_c10mpllb_calc_state(struct intel_crtc_state *crtc_state,
 	return -EINVAL;
 }
 
+static int intel_c20pll_calc_state(struct intel_crtc_state *crtc_state,
+				   struct intel_encoder *encoder)
+{
+	const struct intel_c20pll_state * const *tables;
+	int i;
+
+	tables = intel_c20_pll_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->cx0pll_state.c20pll_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);
+	if (intel_is_c10phy(i915, phy))
+		return intel_c10mpllb_calc_state(crtc_state, encoder);
+	else
+		return intel_c20pll_calc_state(crtc_state, encoder);
 }
 
 void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,
@@ -2111,6 +2144,31 @@ int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,
 	return tmpclk;
 }
 
+int intel_c20pll_calc_port_clock(struct intel_encoder *encoder,
+				 const struct intel_c20pll_state *pll_state)
+{
+	unsigned int frac_quot = 0, frac_rem = 0, frac_den = 1;
+	unsigned int multiplier = 0, tx_clk_div = 0, refclk = 38400;
+
+	if (pll_state->mpllb[6] & C20_MPLLB_FRACEN) {
+		frac_quot = pll_state->mpllb[8];
+		frac_rem =  pll_state->mpllb[9];
+		frac_den =  pll_state->mpllb[7];
+		multiplier = REG_FIELD_GET(C20_MULTIPLIER_MASK, pll_state->mpllb[0]);
+		tx_clk_div = REG_FIELD_GET(C20_MPLLB_TX_CLK_DIV_MASK, pll_state->mpllb[0]);
+	} else if (pll_state->mplla[6] & C20_MPLLA_FRACEN) {
+		frac_quot = pll_state->mplla[8];
+		frac_rem =  pll_state->mplla[9];
+		frac_den =  pll_state->mplla[7];
+		multiplier = REG_FIELD_GET(C20_MULTIPLIER_MASK, pll_state->mplla[0]);
+		tx_clk_div = REG_FIELD_GET(C20_MPLLA_TX_CLK_DIV_MASK, pll_state->mplla[1]);
+       }
+
+	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)
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.h b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
index 0b46b2ad48a9..0a8e76fd101e 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
@@ -43,6 +43,8 @@ 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_c20pll_calc_port_clock(struct intel_encoder *encoder,
+				 const struct intel_c20pll_state *pll_state);
 int intel_cx0_phy_check_hdmi_link_rate(struct intel_hdmi *hdmi, int clock);
 void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder,
 				     const struct intel_crtc_state *crtc_state);
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 4e8f3632b3bc..5ec856e3c3bf 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3520,13 +3520,13 @@ static void mtl_ddi_get_config(struct intel_encoder *encoder,
 	if (intel_is_c10phy(i915, phy)) {
 		intel_c10mpllb_readout_hw_state(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
 		intel_c10mpllb_dump_hw_state(i915, &crtc_state->cx0pll_state.c10mpllb_state);
+		crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
 	} else {
 		intel_c20pll_readout_hw_state(encoder, &crtc_state->cx0pll_state.c20pll_state);
 		intel_c20pll_dump_hw_state(i915, &crtc_state->cx0pll_state.c20pll_state);
+		crtc_state->port_clock = intel_c20pll_calc_port_clock(encoder, &crtc_state->cx0pll_state.c20pll_state);
 	}
 
-	crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
-
 	intel_ddi_get_config(encoder, crtc_state);
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 12/22] drm/i915/mtl: C20 HDMI state calculations
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (10 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 11/22] drm/i915/mtl: C20 port clock calculation Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 13/22] drm/i915/mtl: Add voltage swing sequence for C20 Mika Kahola
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

Add C20 HDMI state calculations and put HDMI table definitions
in use.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index 60db8d1b7589..434ca994be4c 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -1632,6 +1632,8 @@ intel_c20_pll_tables_get(struct intel_crtc_state *crtc_state,
 {
 	if (intel_crtc_has_dp_encoder(crtc_state)) {
 		return mtl_c20_dp_tables;
+	} else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
+		return mtl_c20_hdmi_tables;
 	}
 
 	MISSING_CASE(encoder->type);
@@ -1672,9 +1674,19 @@ static int intel_c10mpllb_calc_state(struct intel_crtc_state *crtc_state,
 static int intel_c20pll_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);
 	const struct intel_c20pll_state * const *tables;
 	int i;
 
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
+		if (intel_c20_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_c20_pll_tables_get(crtc_state, encoder);
 	if (!tables)
 		return -EINVAL;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 13/22] drm/i915/mtl: Add voltage swing sequence for C20
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (11 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 12/22] drm/i915/mtl: C20 HDMI state calculations Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 14/22] drm/i915/mtl: For DP2.0 10G and 20G rates use MPLLA Mika Kahola
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

DP1.4 and DP20 voltage swing sequence for C20 phy.

Bspec: 65449, 67636, 67610

v2: DP2.0 Tx Eq tables has been updated in BSpec.
    Update also the driver code as per BSpec 65449

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
---
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  4 ++
 .../drm/i915/display/intel_ddi_buf_trans.c    | 51 ++++++++++++++++++-
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
index a17da2d7298e..257b4cd6c80c 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
@@ -211,6 +211,10 @@
 #define C20_MPLLB_TX_CLK_DIV_MASK	REG_GENMASK(15, 13)
 #define C20_MPLLA_TX_CLK_DIV_MASK	REG_GENMASK(10, 8)
 
+/* C20 Phy VSwing Masks */
+#define C20_PHY_VSWING_PREEMPH_MASK	REG_GENMASK8(5, 0)
+#define C20_PHY_VSWING_PREEMPH(val)	REG_FIELD_PREP8(C20_PHY_VSWING_PREEMPH_MASK, val)
+
 #define RAWLANEAONX_DIG_TX_MPLLB_CAL_DONE_BANK(idx)	(0x303D + (idx))
 
 #endif /* __INTEL_CX0_PHY_REGS_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
index d5a9aa2de2fa..883084422f1f 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
@@ -9,6 +9,7 @@
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_dp.h"
+#include "intel_cx0_phy.h"
 
 /* HDMI/DVI modes ignore everything but the last 2 items. So we share
  * them for both DP and FDI transports, allowing those ports to
@@ -1059,6 +1060,46 @@ static const struct intel_ddi_buf_trans mtl_cx0_trans = {
 	.hdmi_default_entry = ARRAY_SIZE(_mtl_c10_trans_dp14) - 1,
 };
 
+/* HDMI2.0 */
+static const union intel_ddi_buf_trans_entry _mtl_c20_trans_hdmi[] = {
+	{ .snps = { 48, 0, 0 } },       /* preset 0 */
+	{ .snps = { 38, 4, 6 } },       /* preset 1 */
+	{ .snps = { 36, 4, 8 } },       /* preset 2 */
+	{ .snps = { 34, 4, 10 } },      /* preset 3 */
+	{ .snps = { 32, 4, 12 } },      /* preset 4 */
+};
+
+static const struct intel_ddi_buf_trans mtl_c20_trans_hdmi = {
+	.entries = _mtl_c20_trans_hdmi,
+	.num_entries = ARRAY_SIZE(_mtl_c20_trans_hdmi),
+	.hdmi_default_entry = 0,
+};
+
+/* DP2.0 */
+static const union intel_ddi_buf_trans_entry _mtl_c20_trans_uhbr[] = {
+	{ .snps = { 48, 0, 0 } },       /* preset 0 */
+	{ .snps = { 43, 0, 5 } },       /* preset 1 */
+	{ .snps = { 40, 0, 8 } },       /* preset 2 */
+	{ .snps = { 37, 0, 11 } },      /* preset 3 */
+	{ .snps = { 33, 0, 15 } },      /* preset 4 */
+	{ .snps = { 46, 2, 0 } },       /* preset 5 */
+	{ .snps = { 42, 2, 4 } },       /* preset 6 */
+	{ .snps = { 38, 2, 8 } },       /* preset 7 */
+	{ .snps = { 35, 2, 11 } },      /* preset 8 */
+	{ .snps = { 33, 2, 13 } },      /* preset 9 */
+	{ .snps = { 44, 4, 0 } },       /* preset 10 */
+	{ .snps = { 40, 4, 4 } },       /* preset 11 */
+	{ .snps = { 37, 4, 7 } },       /* preset 12 */
+	{ .snps = { 33, 4, 11 } },      /* preset 13 */
+	{ .snps = { 40, 8, 0 } },	/* preset 14 */
+	{ .snps = { 28, 2, 2 } },	/* preset 15 */
+};
+
+static const struct intel_ddi_buf_trans mtl_c20_trans_uhbr = {
+	.entries = _mtl_c20_trans_uhbr,
+	.num_entries = ARRAY_SIZE(_mtl_c20_trans_uhbr),
+};
+
 bool is_hobl_buf_trans(const struct intel_ddi_buf_trans *table)
 {
 	return table == &tgl_combo_phy_trans_edp_hbr2_hobl;
@@ -1635,7 +1676,15 @@ 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_cx0_trans, n_entries);
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	enum phy phy = intel_port_to_phy(i915, encoder->port);
+
+	if (intel_crtc_has_dp_encoder(crtc_state) && crtc_state->port_clock > 1000000)
+		return intel_get_buf_trans(&mtl_c20_trans_uhbr, n_entries);
+	else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI) && !(intel_is_c10phy(i915, phy)))
+		return intel_get_buf_trans(&mtl_c20_trans_hdmi, n_entries);
+	else
+		return intel_get_buf_trans(&mtl_cx0_trans, n_entries);
 }
 
 void intel_ddi_buf_trans_init(struct intel_encoder *encoder)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 14/22] drm/i915/mtl: For DP2.0 10G and 20G rates use MPLLA
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (12 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 13/22] drm/i915/mtl: Add voltage swing sequence for C20 Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 15/22] drm/i915/mtl: Enabling/disabling sequence Thunderbolt pll Mika Kahola
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

Use MPLLA for DP2.0 rates 20G and 20G, when ssc is enabled.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index 434ca994be4c..7df32f114042 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -2214,8 +2214,12 @@ static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
 		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;
+		/* DP2.0 10G and 20G rates enable MPLLA*/
+		if (crtc_state->port_clock == 1000000 || crtc_state->port_clock == 2000000) {
+			val |= ssc_enabled ? XELPDP_SSC_ENABLE_PLLA : 0;
+		} else {
+			val |= ssc_enabled ? XELPDP_SSC_ENABLE_PLLB : 0;
+		}
 	}
 
 	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 15/22] drm/i915/mtl: Enabling/disabling sequence Thunderbolt pll
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (13 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 14/22] drm/i915/mtl: For DP2.0 10G and 20G rates use MPLLA Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 16/22] drm/i915/mtl: Readout Thunderbolt HW state Mika Kahola
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

Enabling and disabling sequence for Thunderbolt PLL.

v2: Use __intel_de_wait_for_register() instead of
    __intel_wait_for_register() (Jani)
    Use '0' instead of ~XELPDP_TBT_CLOCK_ACK (Gustavo)

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c | 136 ++++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_cx0_phy.h |   7 +-
 drivers/gpu/drm/i915/display/intel_ddi.c     |   4 +-
 3 files changed, 138 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index 7df32f114042..e41fce75d5b2 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -15,7 +15,6 @@
 #include "intel_panel.h"
 #include "intel_tc.h"
 #include "intel_psr.h"
-#include "intel_uncore.h"
 #include "intel_tc.h"
 
 bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)
@@ -2460,8 +2459,8 @@ static u32 intel_cx0_get_pclk_pll_ack(u8 lane)
 		       XELPDP_LANE1_PCLK_PLL_ACK;
 }
 
-void intel_cx0pll_enable(struct intel_encoder *encoder,
-			 const struct intel_crtc_state *crtc_state)
+static 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);
@@ -2534,7 +2533,86 @@ void intel_cx0pll_enable(struct intel_encoder *encoder,
 	intel_cx0_phy_transaction_end(encoder, wakeref);
 }
 
-void intel_cx0pll_disable(struct intel_encoder *encoder)
+static int intel_mtl_tbt_clock_select(struct drm_i915_private *i915, int clock)
+{
+	switch (clock) {
+	case 162000:
+		return XELPDP_DDI_CLOCK_SELECT_TBT_162;
+	case 270000:
+		return XELPDP_DDI_CLOCK_SELECT_TBT_270;
+	case 540000:
+		return XELPDP_DDI_CLOCK_SELECT_TBT_540;
+	case 810000:
+		return XELPDP_DDI_CLOCK_SELECT_TBT_810;
+	default:
+		MISSING_CASE(clock);
+		return XELPDP_DDI_CLOCK_SELECT_TBT_162;
+       }
+}
+
+static void intel_mtl_tbt_pll_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);
+	u32 val = 0;
+
+	/*
+	 * 1. Program PORT_CLOCK_CTL REGISTER to configure
+	 * clock muxes, gating and SSC
+	 */
+	val |= XELPDP_DDI_CLOCK_SELECT(intel_mtl_tbt_clock_select(i915, crtc_state->port_clock));
+	val |= XELPDP_FORWARD_CLOCK_UNGATE;
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+		     XELPDP_DDI_CLOCK_SELECT_MASK | XELPDP_FORWARD_CLOCK_UNGATE, val);
+
+	/* 2. Read back PORT_CLOCK_CTL REGISTER */
+	val = intel_de_read(i915, XELPDP_PORT_CLOCK_CTL(encoder->port));
+
+	/*
+	 * 3. Follow the Display Voltage Frequency Switching - Sequence
+	 * Before Frequency Change. We handle this step in bxt_set_cdclk().
+	 */
+
+	/*
+	 * 4. Set PORT_CLOCK_CTL register TBT CLOCK Request to "1" to enable PLL.
+	 */
+	val |= XELPDP_TBT_CLOCK_REQUEST;
+	intel_de_write(i915, XELPDP_PORT_CLOCK_CTL(encoder->port), val);
+
+	/* 5. Poll on PORT_CLOCK_CTL TBT CLOCK Ack == "1". */
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+				         XELPDP_TBT_CLOCK_ACK,
+				         XELPDP_TBT_CLOCK_ACK,
+				         100, 0, NULL))
+		drm_warn(&i915->drm, "[ENCODER:%d:%s][%c] PHY PLL not locked after 100us.\n",
+			 encoder->base.base.id, encoder->base.name, phy_name(phy));
+
+	/*
+	 * 6. Follow the Display Voltage Frequency Switching Sequence After
+	 * 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);
+}
+
+void intel_mtl_pll_enable(struct intel_encoder *encoder,
+			  const struct intel_crtc_state *crtc_state)
+{
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+
+	if (intel_tc_port_in_tbt_alt_mode(dig_port))
+		intel_mtl_tbt_pll_enable(encoder, crtc_state);
+	else
+		intel_cx0pll_enable(encoder, crtc_state);
+}
+
+static 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);
@@ -2586,6 +2664,56 @@ void intel_cx0pll_disable(struct intel_encoder *encoder)
 	intel_cx0_phy_transaction_end(encoder, wakeref);
 }
 
+static void intel_mtl_tbt_pll_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. Follow the Display Voltage Frequency Switching Sequence Before
+	 * Frequency Change. We handle this step in bxt_set_cdclk().
+	 */
+
+	/*
+	 * 2. Set PORT_CLOCK_CTL register TBT CLOCK Request to "0" to disable PLL.
+	 */
+	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+		     XELPDP_TBT_CLOCK_REQUEST, 0);
+
+	/* 3. Poll on PORT_CLOCK_CTL TBT CLOCK Ack == "0". */
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+				         XELPDP_TBT_CLOCK_ACK,
+				         0,
+				         10, 0, NULL))
+		drm_warn(&i915->drm, "[ENCODER:%d:%s][%c] PHY PLL not unlocked after 10us.\n",
+			 encoder->base.base.id, encoder->base.name, phy_name(phy));
+
+	/*
+	 * 4. Follow the Display Voltage Frequency Switching Sequence After
+	 * Frequency Change. We handle this step in bxt_set_cdclk().
+	 */
+
+	/*
+	 * 5. Program PORT CLOCK CTRL 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);
+
+	/* 6. Program DDI_CLK_VALFREQ to 0. */
+	intel_de_write(i915, DDI_CLK_VALFREQ(encoder->port), 0);
+}
+
+void intel_mtl_pll_disable(struct intel_encoder *encoder)
+{
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+
+	if (intel_tc_port_in_tbt_alt_mode(dig_port))
+		intel_mtl_tbt_pll_disable(encoder);
+	else
+		intel_cx0pll_disable(encoder);
+}
+
 void intel_c10mpllb_state_verify(struct intel_atomic_state *state,
 				 struct intel_crtc_state *new_crtc_state)
 {
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.h b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
index 0a8e76fd101e..f8a86da4a3f7 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
@@ -26,9 +26,9 @@ enum phy;
 #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_mtl_pll_enable(struct intel_encoder *encoder,
+			  const struct intel_crtc_state *crtc_state);
+void intel_mtl_pll_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,
@@ -53,4 +53,5 @@ int intel_c20_phy_check_hdmi_link_rate(int clock);
 void intel_cx0_phy_ddi_vswing_sequence(struct intel_encoder *encoder,
 				       const struct intel_crtc_state *crtc_state,
 				       u32 level);
+int intel_mtl_tbt_readout_hw_state(struct intel_encoder *encoder);
 #endif /* __INTEL_CX0_PHY_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 5ec856e3c3bf..5e940d2a39d2 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4405,8 +4405,8 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	encoder->pipe_mask = ~0;
 
 	if (DISPLAY_VER(dev_priv) >= 14) {
-		encoder->enable_clock = intel_cx0pll_enable;
-		encoder->disable_clock = intel_cx0pll_disable;
+		encoder->enable_clock = intel_mtl_pll_enable;
+		encoder->disable_clock = intel_mtl_pll_disable;
 		encoder->get_config = mtl_ddi_get_config;
 	} else if (IS_DG2(dev_priv)) {
 		encoder->enable_clock = intel_mpllb_enable;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 16/22] drm/i915/mtl: Readout Thunderbolt HW state
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (14 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 15/22] drm/i915/mtl: Enabling/disabling sequence Thunderbolt pll Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 17/22] drm/i915/mtl: Enable TC ports Mika Kahola
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

Readout hw state for Thunderbolt.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c | 27 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_cx0_phy.h |  2 +-
 drivers/gpu/drm/i915/display/intel_ddi.c     |  5 +++-
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index e41fce75d5b2..90440dcb6d86 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -2533,6 +2533,33 @@ static void intel_cx0pll_enable(struct intel_encoder *encoder,
 	intel_cx0_phy_transaction_end(encoder, wakeref);
 }
 
+int intel_mtl_tbt_calc_port_clock(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u32 clock;
+	u32 val = intel_de_read(i915, XELPDP_PORT_CLOCK_CTL(encoder->port));
+
+	clock = REG_FIELD_GET(XELPDP_DDI_CLOCK_SELECT_MASK, val);
+
+	drm_WARN_ON(&i915->drm, !(val & XELPDP_FORWARD_CLOCK_UNGATE));
+	drm_WARN_ON(&i915->drm, !(val & XELPDP_TBT_CLOCK_REQUEST));
+	drm_WARN_ON(&i915->drm, !(val & XELPDP_TBT_CLOCK_ACK));
+
+	switch (clock) {
+	case XELPDP_DDI_CLOCK_SELECT_TBT_162:
+		return 162000;
+	case XELPDP_DDI_CLOCK_SELECT_TBT_270:
+		return 270000;
+	case XELPDP_DDI_CLOCK_SELECT_TBT_540:
+		return 540000;
+	case XELPDP_DDI_CLOCK_SELECT_TBT_810:
+		return 810000;
+	default:
+		MISSING_CASE(clock);
+		return 162000;
+       }
+}
+
 static int intel_mtl_tbt_clock_select(struct drm_i915_private *i915, int clock)
 {
 	switch (clock) {
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.h b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
index f8a86da4a3f7..9e115ec619ea 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.h
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
@@ -53,5 +53,5 @@ int intel_c20_phy_check_hdmi_link_rate(int clock);
 void intel_cx0_phy_ddi_vswing_sequence(struct intel_encoder *encoder,
 				       const struct intel_crtc_state *crtc_state,
 				       u32 level);
-int intel_mtl_tbt_readout_hw_state(struct intel_encoder *encoder);
+int intel_mtl_tbt_calc_port_clock(struct intel_encoder *encoder);
 #endif /* __INTEL_CX0_PHY_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 5e940d2a39d2..84a6648c53d9 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3516,8 +3516,11 @@ static void mtl_ddi_get_config(struct intel_encoder *encoder,
 {
 	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);
 
-	if (intel_is_c10phy(i915, phy)) {
+	if (intel_tc_port_in_tbt_alt_mode(dig_port)) {
+		crtc_state->port_clock = intel_mtl_tbt_calc_port_clock(encoder);
+	} else if (intel_is_c10phy(i915, phy)) {
 		intel_c10mpllb_readout_hw_state(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
 		intel_c10mpllb_dump_hw_state(i915, &crtc_state->cx0pll_state.c10mpllb_state);
 		crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state->cx0pll_state.c10mpllb_state);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 17/22] drm/i915/mtl: Enable TC ports
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (15 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 16/22] drm/i915/mtl: Readout Thunderbolt HW state Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 18/22] drm/i915/mtl: MTL PICA hotplug detection Mika Kahola
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

Finally, we can enable TC ports for Meteorlake.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 676bf512b9ce..cb008cf222da 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7840,9 +7840,12 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 		return;
 
 	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);
+		intel_ddi_init(dev_priv, PORT_TC1);
+		intel_ddi_init(dev_priv, PORT_TC2);
+		intel_ddi_init(dev_priv, PORT_TC3);
+		intel_ddi_init(dev_priv, PORT_TC4);
 	} else if (IS_DG2(dev_priv)) {
 		intel_ddi_init(dev_priv, PORT_A);
 		intel_ddi_init(dev_priv, PORT_B);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 18/22] drm/i915/mtl: MTL PICA hotplug detection
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (16 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 17/22] drm/i915/mtl: Enable TC ports Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 19/22] drm/i915/mtl: Define mask for DDI AUX interrupts Mika Kahola
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

PICA is used for DP alt mode and TBT modes. Hotplug interruption is routed
from PICA chip to south display engine and from there to north display
engine. This patch adds functionality to enable hotplug detection for
all Type-C ports (4 ports available).

Differently from HPD in south display, PICA provides a dedicated HPD
control register for each supported port, so we loop over ports
ourselves instead of using intel_hpd_hotplug_enables() or
intel_get_hpd_pins().

BSpec: 49305, 55726, 65107, 65300

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Madhumitha Tolakanahalli Pradeep <madhumitha.tolakanahalli.pradeep@intel.com>
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c | 249 +++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  31 +++-
 2 files changed, 273 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index a0d0dd84c429..374c760ad4be 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -161,6 +161,13 @@ static const u32 hpd_gen11[HPD_NUM_PINS] = {
 	[HPD_PORT_TC6] = GEN11_TC_HOTPLUG(HPD_PORT_TC6) | GEN11_TBT_HOTPLUG(HPD_PORT_TC6),
 };
 
+static const u32 hpd_xelpdp[HPD_NUM_PINS] = {
+	[HPD_PORT_TC1] = XELPDP_TBT_HOTPLUG(HPD_PORT_TC1) | XELPDP_DP_ALT_HOTPLUG(HPD_PORT_TC1),
+	[HPD_PORT_TC2] = XELPDP_TBT_HOTPLUG(HPD_PORT_TC2) | XELPDP_DP_ALT_HOTPLUG(HPD_PORT_TC2),
+	[HPD_PORT_TC3] = XELPDP_TBT_HOTPLUG(HPD_PORT_TC3) | XELPDP_DP_ALT_HOTPLUG(HPD_PORT_TC3),
+	[HPD_PORT_TC4] = XELPDP_TBT_HOTPLUG(HPD_PORT_TC4) | XELPDP_DP_ALT_HOTPLUG(HPD_PORT_TC4),
+};
+
 static const u32 hpd_icp[HPD_NUM_PINS] = {
 	[HPD_PORT_A] = SDE_DDI_HOTPLUG_ICP(HPD_PORT_A),
 	[HPD_PORT_B] = SDE_DDI_HOTPLUG_ICP(HPD_PORT_B),
@@ -181,6 +188,16 @@ static const u32 hpd_sde_dg1[HPD_NUM_PINS] = {
 	[HPD_PORT_TC1] = SDE_TC_HOTPLUG_DG2(HPD_PORT_TC1),
 };
 
+static const u32 hpd_mtp[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = SDE_DDI_HOTPLUG_ICP(HPD_PORT_A),
+	[HPD_PORT_B] = SDE_DDI_HOTPLUG_ICP(HPD_PORT_B),
+	[HPD_PORT_TC1] = SDE_TC_HOTPLUG_ICP(HPD_PORT_TC1),
+	[HPD_PORT_TC2] = SDE_TC_HOTPLUG_ICP(HPD_PORT_TC2),
+	[HPD_PORT_TC3] = SDE_TC_HOTPLUG_ICP(HPD_PORT_TC3),
+	[HPD_PORT_TC4] = SDE_TC_HOTPLUG_ICP(HPD_PORT_TC4),
+};
+
+
 static void intel_hpd_init_pins(struct drm_i915_private *dev_priv)
 {
 	struct intel_hotplug *hpd = &dev_priv->display.hotplug;
@@ -194,7 +211,9 @@ static void intel_hpd_init_pins(struct drm_i915_private *dev_priv)
 		return;
 	}
 
-	if (DISPLAY_VER(dev_priv) >= 11)
+	if (DISPLAY_VER(dev_priv) >= 14)
+		hpd->hpd = hpd_xelpdp;
+	else if (DISPLAY_VER(dev_priv) >= 11)
 		hpd->hpd = hpd_gen11;
 	else if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
 		hpd->hpd = hpd_bxt;
@@ -211,6 +230,8 @@ static void intel_hpd_init_pins(struct drm_i915_private *dev_priv)
 
 	if (INTEL_PCH_TYPE(dev_priv) >= PCH_DG1)
 		hpd->pch_hpd = hpd_sde_dg1;
+	else if (INTEL_PCH_TYPE(dev_priv) >= PCH_MTP)
+		hpd->pch_hpd = hpd_mtp;
 	else if (INTEL_PCH_TYPE(dev_priv) >= PCH_ICP)
 		hpd->pch_hpd = hpd_icp;
 	else if (HAS_PCH_CNP(dev_priv) || HAS_PCH_SPT(dev_priv))
@@ -1556,6 +1577,44 @@ static void cpt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 		cpt_serr_int_handler(dev_priv);
 }
 
+static void xelpdp_pica_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
+{
+	enum hpd_pin pin;
+	u32 hotplug_trigger = iir & (XELPDP_DP_ALT_HOTPLUG_MASK | XELPDP_TBT_HOTPLUG_MASK);
+	u32 trigger_aux = iir & XELPDP_AUX_TC_MASK;
+	u32 pin_mask = 0, long_mask = 0;
+
+	for (pin = HPD_PORT_TC1; pin <= HPD_PORT_TC4; pin++) {
+		u32 val;
+
+		if (!(dev_priv->display.hotplug.hpd[pin] & hotplug_trigger))
+			continue;
+
+		pin_mask |= BIT(pin);
+
+		val = intel_uncore_read(&dev_priv->uncore, XELPDP_PORT_HOTPLUG_CTL(pin));
+		intel_uncore_write(&dev_priv->uncore, XELPDP_PORT_HOTPLUG_CTL(pin), val);
+
+		if (val & (XELPDP_DP_ALT_HPD_LONG_DETECT | XELPDP_TBT_HPD_LONG_DETECT))
+			long_mask |= BIT(pin);
+	}
+
+	if (pin_mask) {
+		drm_dbg(&dev_priv->drm,
+			"pica hotplug event received, stat 0x%08x, pins 0x%08x, long 0x%08x\n",
+			hotplug_trigger, pin_mask, long_mask);
+
+		intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
+	}
+
+	if (trigger_aux)
+		dp_aux_irq_handler(dev_priv);
+
+	if (!pin_mask && !trigger_aux)
+		drm_err(&dev_priv->drm,
+			"Unexpected DE HPD/AUX interrupt 0x%08x\n", iir);
+}
+
 static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 {
 	u32 ddi_hotplug_trigger = pch_iir & SDE_DDI_HOTPLUG_MASK_ICP;
@@ -2043,6 +2102,34 @@ u32 gen8_de_pipe_underrun_mask(struct drm_i915_private *dev_priv)
 	return mask;
 }
 
+static void gen8_read_and_ack_pch_irqs(struct drm_i915_private *i915, u32 *pch_iir, u32 *pica_iir)
+{
+	u32 pica_ier = 0;
+
+	*pica_iir = 0;
+	*pch_iir = intel_de_read(i915, SDEIIR);
+	if (!*pch_iir)
+		return;
+
+	/**
+	 * PICA IER must be disabled/re-enabled around clearing PICA IIR and
+	 * SDEIIR, to avoid losing PICA IRQs and to ensure that such IRQs set
+	 * their flags both in the PICA and SDE IIR.
+	 */
+	if (*pch_iir & SDE_PICAINTERRUPT) {
+		drm_WARN_ON(&i915->drm, INTEL_PCH_TYPE(i915) < PCH_MTP);
+
+		pica_ier = intel_de_rmw(i915, PICAINTERRUPT_IER, ~0, 0);
+		*pica_iir = intel_de_read(i915, PICAINTERRUPT_IIR);
+		intel_de_write(i915, PICAINTERRUPT_IIR, *pica_iir);
+	}
+
+	intel_de_write(i915, SDEIIR, *pch_iir);
+
+	if (pica_ier)
+		intel_de_write(i915, PICAINTERRUPT_IER, pica_ier);
+}
+
 static irqreturn_t
 gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 {
@@ -2167,16 +2254,20 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 
 	if (HAS_PCH_SPLIT(dev_priv) && !HAS_PCH_NOP(dev_priv) &&
 	    master_ctl & GEN8_DE_PCH_IRQ) {
+		u32 pica_iir;
+
 		/*
 		 * FIXME(BDW): Assume for now that the new interrupt handling
 		 * scheme also closed the SDE interrupt handling race we've seen
 		 * on older pch-split platforms. But this needs testing.
 		 */
-		iir = intel_uncore_read(&dev_priv->uncore, SDEIIR);
+		gen8_read_and_ack_pch_irqs(dev_priv, &iir, &pica_iir);
 		if (iir) {
-			intel_uncore_write(&dev_priv->uncore, SDEIIR, iir);
 			ret = IRQ_HANDLED;
 
+			if (pica_iir)
+				xelpdp_pica_irq_handler(dev_priv, pica_iir);
+
 			if (INTEL_PCH_TYPE(dev_priv) >= PCH_ICP)
 				icp_irq_handler(dev_priv, iir);
 			else if (INTEL_PCH_TYPE(dev_priv) >= PCH_SPT)
@@ -2754,7 +2845,11 @@ static void gen11_display_irq_reset(struct drm_i915_private *dev_priv)
 
 	GEN3_IRQ_RESET(uncore, GEN8_DE_PORT_);
 	GEN3_IRQ_RESET(uncore, GEN8_DE_MISC_);
-	GEN3_IRQ_RESET(uncore, GEN11_DE_HPD_);
+
+	if (DISPLAY_VER(dev_priv) >= 14)
+		GEN3_IRQ_RESET(uncore, PICAINTERRUPT_);
+	else
+		GEN3_IRQ_RESET(uncore, GEN11_DE_HPD_);
 
 	if (INTEL_PCH_TYPE(dev_priv) >= PCH_ICP)
 		GEN3_IRQ_RESET(uncore, SDE);
@@ -3045,6 +3140,127 @@ static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
 		icp_hpd_irq_setup(dev_priv);
 }
 
+static u32 mtp_ddi_hotplug_enables(struct intel_encoder *encoder)
+{
+	switch (encoder->hpd_pin) {
+	case HPD_PORT_A:
+	case HPD_PORT_B:
+		return SHOTPLUG_CTL_DDI_HPD_ENABLE(encoder->hpd_pin);
+	default:
+		return 0;
+	}
+}
+
+static u32 mtp_tc_hotplug_enables(struct intel_encoder *encoder)
+{
+	switch (encoder->hpd_pin) {
+	case HPD_PORT_TC1:
+	case HPD_PORT_TC2:
+	case HPD_PORT_TC3:
+	case HPD_PORT_TC4:
+		return ICP_TC_HPD_ENABLE(encoder->hpd_pin);
+	default:
+		return 0;
+	}
+}
+
+static void mtp_ddi_hpd_detection_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug;
+
+	hotplug = intel_uncore_read(&dev_priv->uncore, SHOTPLUG_CTL_DDI);
+	hotplug &= ~(SHOTPLUG_CTL_DDI_HPD_ENABLE(HPD_PORT_A) |
+		     SHOTPLUG_CTL_DDI_HPD_ENABLE(HPD_PORT_B));
+	hotplug |= intel_hpd_hotplug_enables(dev_priv, mtp_ddi_hotplug_enables);
+	intel_uncore_write(&dev_priv->uncore, SHOTPLUG_CTL_DDI, hotplug);
+}
+
+static void mtp_tc_hpd_detection_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug;
+
+	hotplug = intel_uncore_read(&dev_priv->uncore, SHOTPLUG_CTL_TC);
+	hotplug &= ~(ICP_TC_HPD_ENABLE(HPD_PORT_TC1) |
+		     ICP_TC_HPD_ENABLE(HPD_PORT_TC2) |
+		     ICP_TC_HPD_ENABLE(HPD_PORT_TC3) |
+		     ICP_TC_HPD_ENABLE(HPD_PORT_TC4));
+	hotplug |= intel_hpd_hotplug_enables(dev_priv, mtp_tc_hotplug_enables);
+	intel_uncore_write(&dev_priv->uncore, SHOTPLUG_CTL_TC, hotplug);
+}
+
+static void mtp_hpd_invert(struct drm_i915_private *i915)
+{
+	u32 val = (INVERT_DDIA_HPD |
+		   INVERT_DDIB_HPD |
+		   INVERT_DDIC_HPD |
+		   INVERT_TC1_HPD |
+		   INVERT_TC2_HPD |
+		   INVERT_TC3_HPD |
+		   INVERT_TC4_HPD |
+		   INVERT_DDID_HPD_MTP |
+		   INVERT_DDIE_HPD);
+	intel_uncore_rmw(&i915->uncore, SOUTH_CHICKEN1, 0, val);
+}
+
+static void mtp_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->display.hotplug.pch_hpd);
+	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->display.hotplug.pch_hpd);
+
+	intel_uncore_write(&dev_priv->uncore, SHPD_FILTER_CNT, SHPD_FILTER_CNT_500_ADJ);
+
+	mtp_hpd_invert(dev_priv);
+	ibx_display_interrupt_update(dev_priv, hotplug_irqs, enabled_irqs);
+
+	mtp_ddi_hpd_detection_setup(dev_priv);
+	mtp_tc_hpd_detection_setup(dev_priv);
+}
+
+static void xelpdp_pica_hpd_detection_setup(struct drm_i915_private *dev_priv)
+{
+	struct intel_encoder *encoder;
+	enum hpd_pin pin;
+	u32 available_pins = 0;
+
+	BUILD_BUG_ON(BITS_PER_TYPE(available_pins) < HPD_NUM_PINS);
+
+	for_each_intel_encoder(&dev_priv->drm, encoder)
+		available_pins |= BIT(encoder->hpd_pin);
+
+	for (pin = HPD_PORT_TC1; pin <= HPD_PORT_TC4; pin++) {
+		u32 mask = (available_pins & BIT(pin)) ? ~(u32)0 : 0;
+		u32 val = XELPDP_TBT_HOTPLUG_ENABLE |
+			  XELPDP_DP_ALT_HOTPLUG_ENABLE;
+
+		intel_uncore_rmw(&dev_priv->uncore,
+				 XELPDP_PORT_HOTPLUG_CTL(pin),
+				 ~mask & val, mask & val);
+	}
+}
+
+static void xelpdp_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+	u32 val;
+
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->display.hotplug.hpd);
+	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->display.hotplug.hpd);
+
+	val = intel_uncore_read(&dev_priv->uncore, PICAINTERRUPT_IMR);
+	val &= ~hotplug_irqs;
+	val |= ~enabled_irqs & hotplug_irqs;
+	intel_uncore_write(&dev_priv->uncore, PICAINTERRUPT_IMR, val);
+	intel_uncore_posting_read(&dev_priv->uncore, PICAINTERRUPT_IMR);
+
+	xelpdp_pica_hpd_detection_setup(dev_priv);
+
+	if (INTEL_PCH_TYPE(dev_priv) >= PCH_MTP) {
+		mtp_hpd_irq_setup(dev_priv);
+	}
+}
+
 static u32 spt_hotplug_enables(struct intel_encoder *encoder)
 {
 	switch (encoder->hpd_pin) {
@@ -3380,7 +3596,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	GEN3_IRQ_INIT(uncore, GEN8_DE_PORT_, ~de_port_masked, de_port_enables);
 	GEN3_IRQ_INIT(uncore, GEN8_DE_MISC_, ~de_misc_masked, de_misc_masked);
 
-	if (DISPLAY_VER(dev_priv) >= 11) {
+	if (IS_DISPLAY_VER(dev_priv, 11, 13)) {
 		u32 de_hpd_masked = 0;
 		u32 de_hpd_enables = GEN11_DE_TC_HOTPLUG_MASK |
 				     GEN11_DE_TBT_HOTPLUG_MASK;
@@ -3390,6 +3606,20 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	}
 }
 
+static void mtp_irq_postinstall(struct drm_i915_private *dev_priv)
+{
+	struct intel_uncore *uncore = &dev_priv->uncore;
+	u32 sde_mask = SDE_GMBUS_ICP | SDE_PICAINTERRUPT;
+	u32 de_hpd_mask = XELPDP_AUX_TC_MASK;
+	u32 de_hpd_enables = de_hpd_mask | XELPDP_DP_ALT_HOTPLUG_MASK |
+			     XELPDP_TBT_HOTPLUG_MASK;
+
+	GEN3_IRQ_INIT(uncore, PICAINTERRUPT_, ~de_hpd_mask,
+		      de_hpd_enables);
+
+	GEN3_IRQ_INIT(uncore, SDE, ~sde_mask, 0xffffffff);
+}
+
 static void icp_irq_postinstall(struct drm_i915_private *dev_priv)
 {
 	struct intel_uncore *uncore = &dev_priv->uncore;
@@ -3451,7 +3681,11 @@ static void dg1_irq_postinstall(struct drm_i915_private *dev_priv)
 	GEN3_IRQ_INIT(uncore, GEN11_GU_MISC_, ~gu_misc_masked, gu_misc_masked);
 
 	if (HAS_DISPLAY(dev_priv)) {
-		icp_irq_postinstall(dev_priv);
+		if (DISPLAY_VER(dev_priv) >= 14)
+			mtp_irq_postinstall(dev_priv);
+		else
+			icp_irq_postinstall(dev_priv);
+
 		gen8_de_irq_postinstall(dev_priv);
 		intel_uncore_write(&dev_priv->uncore, GEN11_DISPLAY_INT_CTL,
 				   GEN11_DISPLAY_IRQ_ENABLE);
@@ -3937,6 +4171,7 @@ static const struct intel_hotplug_funcs platform##_hpd_funcs = { \
 }
 
 HPD_FUNCS(i915);
+HPD_FUNCS(xelpdp);
 HPD_FUNCS(dg1);
 HPD_FUNCS(gen11);
 HPD_FUNCS(bxt);
@@ -3997,6 +4232,8 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 			dev_priv->display.funcs.hotplug = &icp_hpd_funcs;
 		else if (HAS_PCH_DG1(dev_priv))
 			dev_priv->display.funcs.hotplug = &dg1_hpd_funcs;
+		else if (DISPLAY_VER(dev_priv) >= 14)
+			dev_priv->display.funcs.hotplug = &xelpdp_hpd_funcs;
 		else if (DISPLAY_VER(dev_priv) >= 11)
 			dev_priv->display.funcs.hotplug = &gen11_hpd_funcs;
 		else if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index d4706ec3cbb7..9ca9826bb96f 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -5562,6 +5562,28 @@
 #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 PICAINTERRUPT_ISR		_MMIO(0x16FE50)
+#define PICAINTERRUPT_IMR		_MMIO(0x16FE54)
+#define PICAINTERRUPT_IIR		_MMIO(0x16FE58)
+#define PICAINTERRUPT_IER		_MMIO(0x16FE5C)
+
+#define  XELPDP_DP_ALT_HOTPLUG(hpd_pin)		REG_BIT(16 + _HPD_PIN_TC(hpd_pin))
+#define  XELPDP_DP_ALT_HOTPLUG_MASK		REG_GENMASK(19, 16)
+
+#define  XELPDP_AUX_TC(hpd_pin)			REG_BIT(8 + _HPD_PIN_TC(hpd_pin))
+#define  XELPDP_AUX_TC_MASK			REG_GENMASK(11, 8)
+
+#define  XELPDP_TBT_HOTPLUG(hpd_pin)		REG_BIT(_HPD_PIN_TC(hpd_pin))
+#define  XELPDP_TBT_HOTPLUG_MASK		REG_GENMASK(3, 0)
+
+#define XELPDP_PORT_HOTPLUG_CTL(hpd_pin)	_MMIO(0x16F270 + (_HPD_PIN_TC(hpd_pin) * 0x200))
+#define  XELPDP_TBT_HOTPLUG_ENABLE		REG_BIT(6)
+#define  XELPDP_TBT_HPD_LONG_DETECT		REG_BIT(5)
+#define  XELPDP_TBT_HPD_SHORT_DETECT		REG_BIT(4)
+#define  XELPDP_DP_ALT_HOTPLUG_ENABLE		REG_BIT(2)
+#define  XELPDP_DP_ALT_HPD_LONG_DETECT		REG_BIT(1)
+#define  XELPDP_DP_ALT_HPD_SHORT_DETECT		REG_BIT(0)
+
 #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)
@@ -5898,7 +5920,8 @@
 				 SDE_FDI_RXB_CPT | \
 				 SDE_FDI_RXA_CPT)
 
-/* south display engine interrupt: ICP/TGP */
+/* south display engine interrupt: ICP/TGP/MTP */
+#define SDE_PICAINTERRUPT		REG_BIT(31)
 #define SDE_GMBUS_ICP			(1 << 23)
 #define SDE_TC_HOTPLUG_ICP(hpd_pin)	REG_BIT(24 + _HPD_PIN_TC(hpd_pin))
 #define SDE_TC_HOTPLUG_DG2(hpd_pin)	REG_BIT(25 + _HPD_PIN_TC(hpd_pin)) /* sigh */
@@ -6252,6 +6275,12 @@
 #define SOUTH_CHICKEN1		_MMIO(0xc2000)
 #define  FDIA_PHASE_SYNC_SHIFT_OVR	19
 #define  FDIA_PHASE_SYNC_SHIFT_EN	18
+#define  INVERT_DDIE_HPD			REG_BIT(28)
+#define  INVERT_DDID_HPD_MTP			REG_BIT(27)
+#define  INVERT_TC4_HPD				REG_BIT(26)
+#define  INVERT_TC3_HPD				REG_BIT(25)
+#define  INVERT_TC2_HPD				REG_BIT(24)
+#define  INVERT_TC1_HPD				REG_BIT(23)
 #define  INVERT_DDID_HPD			(1 << 18)
 #define  INVERT_DDIC_HPD			(1 << 17)
 #define  INVERT_DDIB_HPD			(1 << 16)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 19/22] drm/i915/mtl: Define mask for DDI AUX interrupts
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (17 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 18/22] drm/i915/mtl: MTL PICA hotplug detection Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 20/22] drm/i915/mtl: Power up TCSS Mika Kahola
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

From: Gustavo Sousa <gustavo.sousa@intel.com>

Xe_LPD+ defines interrupt bits for only DDI ports in the DE Port
Interrupt registers. The bits for Type-C ports are defined in the PICA
interrupt registers.

BSpec: 50064
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 374c760ad4be..3d05819c9917 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1922,7 +1922,10 @@ static u32 gen8_de_port_aux_mask(struct drm_i915_private *dev_priv)
 {
 	u32 mask;
 
-	if (DISPLAY_VER(dev_priv) >= 13)
+	if (DISPLAY_VER(dev_priv) >= 14)
+		return TGL_DE_PORT_AUX_DDIA |
+			TGL_DE_PORT_AUX_DDIB;
+	else if (DISPLAY_VER(dev_priv) >= 13)
 		return TGL_DE_PORT_AUX_DDIA |
 			TGL_DE_PORT_AUX_DDIB |
 			TGL_DE_PORT_AUX_DDIC |
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 20/22] drm/i915/mtl: Power up TCSS
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (18 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 19/22] drm/i915/mtl: Define mask for DDI AUX interrupts Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 21/22] drm/i915/mtl: TypeC HPD live status query Mika Kahola
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

Add register writes to enable powering up Type-C subsystem i.e. TCSS.
For MeteorLake we need to request TCSS to power up and check the TCSS
power state after 500 us.

In addition, for PICA we need to set/clear the Type-C PHY ownnership
bit when Type-C device is connected/disconnected.

v2: Call tcss power request with correct parameter.
v3: Use de variant for register wait (Jani)

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c |   2 +-
 drivers/gpu/drm/i915/display/intel_tc.c      | 117 ++++++++++++++++++-
 2 files changed, 114 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index cb008cf222da..a7eeb059fbf2 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -1977,7 +1977,7 @@ bool intel_phy_is_tc(struct drm_i915_private *dev_priv, enum phy phy)
 	if (IS_DG2(dev_priv))
 		/* DG2's "TC1" output uses a SNPS PHY */
 		return false;
-	else if (IS_ALDERLAKE_P(dev_priv))
+	else if (IS_ALDERLAKE_P(dev_priv) || IS_METEORLAKE(dev_priv))
 		return phy >= PHY_F && phy <= PHY_I;
 	else if (IS_TIGERLAKE(dev_priv))
 		return phy >= PHY_D && phy <= PHY_I;
diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
index f45328712bff..89dfc19de1b8 100644
--- a/drivers/gpu/drm/i915/display/intel_tc.c
+++ b/drivers/gpu/drm/i915/display/intel_tc.c
@@ -5,6 +5,7 @@
 
 #include "i915_drv.h"
 #include "i915_reg.h"
+#include "intel_cx0_phy_regs.h"
 #include "intel_de.h"
 #include "intel_display.h"
 #include "intel_display_power_map.h"
@@ -300,7 +301,7 @@ static u32 tc_port_live_status_mask(struct intel_digital_port *dig_port)
 {
 	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
 
-	if (IS_ALDERLAKE_P(i915))
+	if (DISPLAY_VER(i915) >= 13)
 		return adl_tc_port_live_status_mask(dig_port);
 
 	return icl_tc_port_live_status_mask(dig_port);
@@ -354,11 +355,69 @@ static bool adl_tc_phy_status_complete(struct intel_digital_port *dig_port)
 	return val & TCSS_DDI_STATUS_READY;
 }
 
+static bool xelpdp_wait_phy_status_complete(struct intel_digital_port *dig_port)
+{
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+	enum tc_port tc_port = intel_port_to_tc(i915, dig_port->base.port);
+
+	if (intel_de_wait_for_register(i915,
+				       TCSS_DDI_STATUS(tc_port),
+				       TCSS_DDI_STATUS_READY,
+				       TCSS_DDI_STATUS_READY,
+				       1)) {
+		drm_dbg_kms(&i915->drm,
+			    "Port %s: PHY in TCCOLD, assuming not complete\n",
+			    dig_port->tc_port_name);
+		return false;
+	}
+
+	return true;
+}
+
+static bool xelpdp_wait_for_tcss_power(struct intel_digital_port *dig_port,
+				       bool enabled)
+{
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+
+	if (intel_de_wait_for_register(i915,
+				       XELPDP_PORT_BUF_CTL1(dig_port->base.port),
+				       XELPDP_TCSS_POWER_STATE,
+				       enabled ? XELPDP_TCSS_POWER_STATE : 0,
+				       5)) {
+		drm_dbg_kms(&i915->drm,
+			    "Port %s: TCSS power state not as expected\n",
+			    dig_port->tc_port_name);
+		return false;
+	}
+
+	return true;
+}
+
+static bool xelpdp_tc_power_request(struct intel_digital_port *dig_port, bool request)
+{
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+	struct intel_uncore *uncore = &i915->uncore;
+	enum port port = dig_port->base.port;
+	u32 val;
+
+	val = intel_uncore_read(uncore, XELPDP_PORT_BUF_CTL1(port));
+	if (request)
+		val |= XELPDP_TCSS_POWER_REQUEST;
+	else
+		val &= ~XELPDP_TCSS_POWER_REQUEST;
+	intel_uncore_write(uncore, XELPDP_PORT_BUF_CTL1(port), val);
+
+	return xelpdp_wait_phy_status_complete(dig_port) &&
+	       xelpdp_wait_for_tcss_power(dig_port, request);
+}
+
 static bool tc_phy_status_complete(struct intel_digital_port *dig_port)
 {
 	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
 
-	if (IS_ALDERLAKE_P(i915))
+	if (DISPLAY_VER(i915) >= 14)
+		return xelpdp_wait_phy_status_complete(dig_port);
+	else if (IS_ALDERLAKE_P(i915))
 		return adl_tc_phy_status_complete(dig_port);
 
 	return icl_tc_phy_status_complete(dig_port);
@@ -400,11 +459,31 @@ static bool adl_tc_phy_take_ownership(struct intel_digital_port *dig_port,
 	return true;
 }
 
+static bool xelpdp_tc_phy_take_ownership(struct intel_digital_port *dig_port,
+					 bool take)
+{
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+	struct intel_uncore *uncore = &i915->uncore;
+	enum port port = dig_port->base.port;
+	u32 val;
+
+	val = intel_uncore_read(uncore, XELPDP_PORT_BUF_CTL1(port));
+	if (take)
+		val |= XELPDP_TC_PHY_OWNERSHIP;
+	else
+		val &= ~XELPDP_TC_PHY_OWNERSHIP;
+	intel_uncore_write(uncore, XELPDP_PORT_BUF_CTL1(port), val);
+
+	return true;
+}
+
 static bool tc_phy_take_ownership(struct intel_digital_port *dig_port, bool take)
 {
 	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
 
-	if (IS_ALDERLAKE_P(i915))
+	if (DISPLAY_VER(i915) >= 14)
+		return xelpdp_tc_phy_take_ownership(dig_port, take);
+	else if (IS_ALDERLAKE_P(i915))
 		return adl_tc_phy_take_ownership(dig_port, take);
 
 	return icl_tc_phy_take_ownership(dig_port, take);
@@ -436,11 +515,23 @@ static bool adl_tc_phy_is_owned(struct intel_digital_port *dig_port)
 	return val & DDI_BUF_CTL_TC_PHY_OWNERSHIP;
 }
 
+static bool xelpdp_tc_phy_is_owned(struct intel_digital_port *dig_port)
+{
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+	struct intel_uncore *uncore = &i915->uncore;
+	enum port port = dig_port->base.port;
+
+	return intel_uncore_read(uncore, XELPDP_PORT_BUF_CTL1(port)) &
+	       XELPDP_TC_PHY_OWNERSHIP;
+}
+
 static bool tc_phy_is_owned(struct intel_digital_port *dig_port)
 {
 	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
 
-	if (IS_ALDERLAKE_P(i915))
+	if (DISPLAY_VER(i915) >= 14)
+		return xelpdp_tc_phy_is_owned(dig_port);
+	else if (IS_ALDERLAKE_P(i915))
 		return adl_tc_phy_is_owned(dig_port);
 
 	return icl_tc_phy_is_owned(dig_port);
@@ -464,6 +555,11 @@ static void icl_tc_phy_connect(struct intel_digital_port *dig_port,
 	u32 live_status_mask;
 	int max_lanes;
 
+	if (DISPLAY_VER(i915) >= 14) {
+		if (!xelpdp_tc_power_request(dig_port, true))
+			goto out_release_phy;
+	}
+
 	if (!tc_phy_status_complete(dig_port)) {
 		drm_dbg_kms(&i915->drm, "Port %s: PHY not ready\n",
 			    dig_port->tc_port_name);
@@ -514,6 +610,10 @@ static void icl_tc_phy_connect(struct intel_digital_port *dig_port,
 
 out_release_phy:
 	tc_phy_take_ownership(dig_port, false);
+
+	if (DISPLAY_VER(i915) >= 14)
+		xelpdp_tc_power_request(dig_port, false);
+
 out_set_tbt_alt_mode:
 	dig_port->tc_mode = TC_PORT_TBT_ALT;
 }
@@ -524,6 +624,8 @@ static void icl_tc_phy_connect(struct intel_digital_port *dig_port,
  */
 static void icl_tc_phy_disconnect(struct intel_digital_port *dig_port)
 {
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+
 	switch (dig_port->tc_mode) {
 	case TC_PORT_LEGACY:
 	case TC_PORT_DP_ALT:
@@ -537,6 +639,9 @@ static void icl_tc_phy_disconnect(struct intel_digital_port *dig_port)
 	default:
 		MISSING_CASE(dig_port->tc_mode);
 	}
+
+	if (DISPLAY_VER(i915) >= 14)
+		xelpdp_tc_power_request(dig_port, false);
 }
 
 static bool icl_tc_phy_is_connected(struct intel_digital_port *dig_port)
@@ -886,6 +991,10 @@ tc_has_modular_fia(struct drm_i915_private *i915, struct intel_digital_port *dig
 	if (!INTEL_INFO(i915)->display.has_modular_fia)
 		return false;
 
+	/* for MTL, FIA is always modular */
+	if (DISPLAY_VER(i915) >= 14)
+		return true;
+
 	mutex_lock(&dig_port->tc_lock);
 	wakeref = tc_cold_block(dig_port, &domain);
 	val = intel_de_read(i915, PORT_TX_DFLEXDPSP(FIA1));
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 21/22] drm/i915/mtl: TypeC HPD live status query
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (19 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 20/22] drm/i915/mtl: Power up TCSS Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 22/22] drm/i915/mtl: Pin assignment for TypeC Mika Kahola
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx

From: Imre Deak <imre.deak@intel.com>

The HPD live status for MTL has to be read from different set of
registers. MTL deserves a new function for this purpose
and cannot reuse the existing  HPD live status detection

Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_tc.c | 30 +++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
index 89dfc19de1b8..5756daac91d9 100644
--- a/drivers/gpu/drm/i915/display/intel_tc.c
+++ b/drivers/gpu/drm/i915/display/intel_tc.c
@@ -297,10 +297,40 @@ static u32 adl_tc_port_live_status_mask(struct intel_digital_port *dig_port)
 	return mask;
 }
 
+static u32 xelpdp_tc_port_live_status_mask(struct intel_digital_port *dig_port)
+{
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+	enum tc_port tc_port = intel_port_to_tc(i915, dig_port->base.port);
+	u32 isr_bit = i915->display.hotplug.pch_hpd[dig_port->base.hpd_pin];
+	struct intel_uncore *uncore = &i915->uncore;
+	u32 val, mask = 0;
+	enum hpd_pin pin;
+
+	val = intel_uncore_read(uncore, PICAINTERRUPT_ISR);
+	pin = HPD_PORT_TC1 + tc_port - TC_PORT_1;
+	if (val & XELPDP_DP_ALT_HOTPLUG(pin))
+		mask |= BIT(TC_PORT_DP_ALT);
+	if (val & XELPDP_TBT_HOTPLUG(pin))
+		mask |= BIT(TC_PORT_TBT_ALT);
+
+	if (dig_port->tc_legacy_port &&
+	    intel_uncore_read(uncore, SDEISR) & isr_bit)
+		mask |= BIT(TC_PORT_LEGACY);
+
+	/* The sink can be connected only in a single mode. */
+	if (!drm_WARN_ON(&i915->drm, hweight32(mask) > 1))
+		tc_port_fixup_legacy_flag(dig_port, mask);
+
+	return mask;
+}
+
 static u32 tc_port_live_status_mask(struct intel_digital_port *dig_port)
 {
 	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
 
+	if (DISPLAY_VER(i915) >= 14)
+		return xelpdp_tc_port_live_status_mask(dig_port);
+
 	if (DISPLAY_VER(i915) >= 13)
 		return adl_tc_port_live_status_mask(dig_port);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] [PATCH v4 22/22] drm/i915/mtl: Pin assignment for TypeC
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (20 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 21/22] drm/i915/mtl: TypeC HPD live status query Mika Kahola
@ 2023-02-24 10:13 ` Mika Kahola
  2023-02-24 13:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/mtl: Add C10 and C20 phy support (rev6) Patchwork
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Mika Kahola @ 2023-02-24 10:13 UTC (permalink / raw)
  To: intel-gfx; +Cc: Matt Roper

From: Anusha Srivatsa <anusha.srivatsa@intel.com>

Unlike previous platforms that used PORT_TX_DFLEXDPSP
for max_lane calculation, MTL uses only PORT_TX_DFLEXPA1
from which the max_lanes has to be calculated.

Bspec: 50235, 65380

Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Jose Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/i915/display/intel_tc.c | 30 +++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
index 5756daac91d9..694d74088980 100644
--- a/drivers/gpu/drm/i915/display/intel_tc.c
+++ b/drivers/gpu/drm/i915/display/intel_tc.c
@@ -15,6 +15,10 @@
 #include "intel_mg_phy_regs.h"
 #include "intel_tc.h"
 
+#define DP_PIN_ASSIGNMENT_C	0x3
+#define DP_PIN_ASSIGNMENT_D	0x4
+#define DP_PIN_ASSIGNMENT_E	0x5
+
 static const char *tc_port_mode_name(enum tc_port_mode mode)
 {
 	static const char * const names[] = {
@@ -147,6 +151,29 @@ u32 intel_tc_port_get_pin_assignment_mask(struct intel_digital_port *dig_port)
 	       DP_PIN_ASSIGNMENT_SHIFT(dig_port->tc_phy_fia_idx);
 }
 
+static int mtl_tc_port_get_pin_assignment_mask(struct intel_digital_port *dig_port)
+{
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+	intel_wakeref_t wakeref;
+	u32 pin_mask;
+
+	assert_tc_cold_blocked(dig_port);
+
+	with_intel_display_power(i915, POWER_DOMAIN_DISPLAY_CORE, wakeref)
+		pin_mask = intel_tc_port_get_pin_assignment_mask(dig_port);
+
+	switch(pin_mask) {
+	default:
+		MISSING_CASE(pin_mask);
+		fallthrough;
+	case DP_PIN_ASSIGNMENT_D:
+		return 2;
+	case DP_PIN_ASSIGNMENT_C:
+	case DP_PIN_ASSIGNMENT_E:
+		return 4;
+	}
+}
+
 int intel_tc_port_fia_max_lane_count(struct intel_digital_port *dig_port)
 {
 	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
@@ -156,6 +183,9 @@ int intel_tc_port_fia_max_lane_count(struct intel_digital_port *dig_port)
 	if (dig_port->tc_mode != TC_PORT_DP_ALT)
 		return 4;
 
+	if (DISPLAY_VER(i915) >= 14)
+		return mtl_tc_port_get_pin_assignment_mask(dig_port);
+
 	assert_tc_cold_blocked(dig_port);
 
 	lane_mask = 0;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/mtl: Add C10 and C20 phy support (rev6)
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (21 preceding siblings ...)
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 22/22] drm/i915/mtl: Pin assignment for TypeC Mika Kahola
@ 2023-02-24 13:46 ` Patchwork
  2023-02-24 13:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 37+ messages in thread
From: Patchwork @ 2023-02-24 13:46 UTC (permalink / raw)
  To: Mika Kahola; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/mtl: Add C10 and C20 phy support (rev6)
URL   : https://patchwork.freedesktop.org/series/109714/
State : warning

== Summary ==

Error: dim checkpatch failed
c3e73104d4c0 drm/i915/mtl: Initial DDI port setup
361905cc8fa2 drm/i915/mtl: Add DP rates
3ba7e64de82a 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'
-:15: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#15: 
new file mode 100644

-:35: WARNING:LONG_LINE: line length of 103 exceeds 100 columns
#35: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:16:
+							[PORT_A] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \

-:36: WARNING:LONG_LINE: line length of 103 exceeds 100 columns
#36: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:17:
+							[PORT_B] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \

-:37: WARNING:LONG_LINE: line length of 109 exceeds 100 columns
#37: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:18:
+							[PORT_TC1] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \

-:38: WARNING:LONG_LINE: line length of 109 exceeds 100 columns
#38: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:19:
+							[PORT_TC2] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2, \

-:39: WARNING:LONG_LINE: line length of 109 exceeds 100 columns
#39: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:20:
+							[PORT_TC3] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC3, \

-:40: WARNING:LONG_LINE: line length of 123 exceeds 100 columns
#40: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:21:
+							[PORT_TC4] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4) + ((lane) * 4))

-:42: WARNING:LONG_LINE: line length of 102 exceeds 100 columns
#42: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:23:
+#define XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)		_MMIO(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane))

-:45: WARNING:LONG_LINE: line length of 110 exceeds 100 columns
#45: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:26:
+#define  XELPDP_PORT_M2P_COMMAND_WRITE_UNCOMMITTED	REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x1)

-:46: WARNING:LONG_LINE: line length of 110 exceeds 100 columns
#46: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:27:
+#define  XELPDP_PORT_M2P_COMMAND_WRITE_COMMITTED	REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x2)

-:47: WARNING:LONG_LINE: line length of 110 exceeds 100 columns
#47: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:28:
+#define  XELPDP_PORT_M2P_COMMAND_READ			REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x3)

-:49: WARNING:LONG_LINE: line length of 102 exceeds 100 columns
#49: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:30:
+#define  XELPDP_PORT_M2P_DATA(val)			REG_FIELD_PREP(XELPDP_PORT_M2P_DATA_MASK, val)

-:52: WARNING:LONG_LINE: line length of 105 exceeds 100 columns
#52: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:33:
+#define  XELPDP_PORT_M2P_ADDRESS(val)			REG_FIELD_PREP(XELPDP_PORT_M2P_ADDRESS_MASK, val)

-:54: WARNING:LONG_LINE: line length of 106 exceeds 100 columns
#54: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:35:
+#define XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane)	_MMIO(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane) + 8)

-:60: WARNING:LONG_LINE: line length of 102 exceeds 100 columns
#60: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:41:
+#define  XELPDP_PORT_P2M_DATA(val)			REG_FIELD_PREP(XELPDP_PORT_P2M_DATA_MASK, val)

-:82: WARNING:LONG_LINE: line length of 103 exceeds 100 columns
#82: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:63:
+							[PORT_TC1] = _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \

-:83: WARNING:LONG_LINE: line length of 103 exceeds 100 columns
#83: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:64:
+							[PORT_TC2] = _XELPDP_PORT_BUF_CTL1_LN0_USBC2, \

-:84: WARNING:LONG_LINE: line length of 103 exceeds 100 columns
#84: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:65:
+							[PORT_TC3] = _XELPDP_PORT_BUF_CTL1_LN0_USBC3, \

-:85: WARNING:LONG_LINE: line length of 102 exceeds 100 columns
#85: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:66:
+							[PORT_TC4] = _XELPDP_PORT_BUF_CTL1_LN0_USBC4))

-:105: WARNING:LONG_LINE: line length of 114 exceeds 100 columns
#105: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:86:
+#define  XELPDP_LANE0_POWERDOWN_NEW_STATE(val)		REG_FIELD_PREP(XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK, val)

-:107: WARNING:LONG_LINE: line length of 114 exceeds 100 columns
#107: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:88:
+#define  XELPDP_LANE1_POWERDOWN_NEW_STATE(val)		REG_FIELD_PREP(XELPDP_LANE1_POWERDOWN_NEW_STATE_MASK, val)

-:109: WARNING:LONG_LINE: line length of 106 exceeds 100 columns
#109: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:90:
+#define  XELPDP_POWER_STATE_READY(val)			REG_FIELD_PREP(XELPDP_POWER_STATE_READY_MASK, val)

-:113: WARNING:LONG_LINE: line length of 114 exceeds 100 columns
#113: 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)

-:115: WARNING:LONG_LINE: line length of 107 exceeds 100 columns
#115: 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)

-:142: WARNING:LONG_LINE: line length of 105 exceeds 100 columns
#142: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:123:
+#define XELPDP_DDI_CLOCK_SELECT(val)			REG_FIELD_PREP(XELPDP_DDI_CLOCK_SELECT_MASK, val)

total: 0 errors, 25 warnings, 0 checks, 136 lines checked
564ab30caf89 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)

-:56: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#56: 
new file mode 100644

-:77: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'phy < PHY_C'
#77: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:17:
+	if (IS_METEORLAKE(dev_priv) && (phy < PHY_C))

-:88: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#88: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:28:
+	intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane-1),
 	                                                          ^

-:92: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#92: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:32:
+	if (intel_de_wait_for_clear(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane-1),
 	                                                                       ^

-:99: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#99: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:39:
+	intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane-1), ~0);
 	                                                             ^

-:107: ERROR:CODE_INDENT: code indent should use tabs where possible
#107: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:47:
+^I^I^I^I         XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane-1),$

-:107: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#107: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:47:
+	if (__intel_de_wait_for_register(i915,
+				         XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane-1),

-:107: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#107: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:47:
+				         XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane-1),
 				                                                 ^

-:108: ERROR:CODE_INDENT: code indent should use tabs where possible
#108: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:48:
+^I^I^I^I         XELPDP_PORT_P2M_RESPONSE_READY,$

-:109: ERROR:CODE_INDENT: code indent should use tabs where possible
#109: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:49:
+^I^I^I^I         XELPDP_PORT_P2M_RESPONSE_READY,$

-:110: ERROR:CODE_INDENT: code indent should use tabs where possible
#110: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:50:
+^I^I^I^I         XELPDP_MSGBUS_TIMEOUT_FAST_US,$

-:111: ERROR:CODE_INDENT: code indent should use tabs where possible
#111: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:51:
+^I^I^I^I         XELPDP_MSGBUS_TIMEOUT_SLOW, val)) {$

-:112: WARNING:LONG_LINE: line length of 119 exceeds 100 columns
#112: 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);

-:120: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#120: 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)

-:126: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#126: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:66:
+	if (intel_de_wait_for_clear(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane-1),
 	                                                                       ^

-:129: WARNING:LONG_LINE: line length of 146 exceeds 100 columns
#129: 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));

-:135: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#135: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:75:
+	intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane-1),
 	                                                          ^

-:149: WARNING:LONG_LINE: line length of 122 exceeds 100 columns
#149: 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);

-:157: WARNING:LONG_LINE: line length of 115 exceeds 100 columns
#157: 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);

-:163: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#163: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:103:
+	intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane-1), ~0);
 	                                                             ^

-:183: WARNING:LONG_LINE: line length of 112 exceeds 100 columns
#183: 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);

-:191: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#191: 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)

-:204: WARNING:LONG_LINE: line length of 118 exceeds 100 columns
#204: 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);

-:217: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#217: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:157:
+	if (intel_de_wait_for_clear(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane-1),
 	                                                                       ^

-:220: WARNING:LONG_LINE: line length of 146 exceeds 100 columns
#220: 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));

-:226: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#226: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:166:
+	intel_de_write(i915, XELPDP_PORT_M2P_MSGBUS_CTL(port, lane-1),
 	                                                          ^

-:239: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#239: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:179:
+	} else if ((intel_de_read(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane-1)) &
 	                                                                        ^

-:241: WARNING:LONG_LINE: line length of 104 exceeds 100 columns
#241: 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));

-:246: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#246: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:186:
+	intel_de_write(i915, XELPDP_PORT_P2M_MSGBUS_STATUS(port, lane-1), ~0);
 	                                                             ^

-:265: WARNING:LONG_LINE: line length of 113 exceeds 100 columns
#265: 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);

-:670: WARNING:LONG_LINE: line length of 104 exceeds 100 columns
#670: 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);

-:671: WARNING:LONG_LINE: line length of 110 exceeds 100 columns
#671: 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);

-:806: ERROR:CODE_INDENT: code indent should use tabs where possible
#806: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:746:
+^I^I^I^I         intel_cx0_get_powerdown_update(lane), 0,$

-:806: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#806: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:746:
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
+				         intel_cx0_get_powerdown_update(lane), 0,

-:807: ERROR:CODE_INDENT: code indent should use tabs where possible
#807: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:747:
+^I^I^I^I         XELPDP_PORT_POWERDOWN_UPDATE_TIMEOUT_US, 0, NULL))$

-:855: ERROR:CODE_INDENT: code indent should use tabs where possible
#855: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:795:
+^I^I^I^I         XELPDP_PORT_BUF_SOC_PHY_READY,$

-:855: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#855: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:795:
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL1(port),
+				         XELPDP_PORT_BUF_SOC_PHY_READY,

-:856: ERROR:CODE_INDENT: code indent should use tabs where possible
#856: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:796:
+^I^I^I^I         XELPDP_PORT_BUF_SOC_PHY_READY,$

-:857: ERROR:CODE_INDENT: code indent should use tabs where possible
#857: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:797:
+^I^I^I^I         XELPDP_PORT_BUF_SOC_READY_TIMEOUT_US, 0, NULL))$

-:866: WARNING:LONG_LINE: line length of 107 exceeds 100 columns
#866: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:806:
+				         XELPDP_LANE0_PHY_CURRENT_STATUS | XELPDP_LANE1_PHY_CURRENT_STATUS,

-:866: ERROR:CODE_INDENT: code indent should use tabs where possible
#866: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:806:
+^I^I^I^I         XELPDP_LANE0_PHY_CURRENT_STATUS | XELPDP_LANE1_PHY_CURRENT_STATUS,$

-:866: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#866: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:806:
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_BUF_CTL2(port),
+				         XELPDP_LANE0_PHY_CURRENT_STATUS | XELPDP_LANE1_PHY_CURRENT_STATUS,

-:867: WARNING:LONG_LINE: line length of 107 exceeds 100 columns
#867: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:807:
+				         XELPDP_LANE0_PHY_CURRENT_STATUS | XELPDP_LANE1_PHY_CURRENT_STATUS,

-:867: ERROR:CODE_INDENT: code indent should use tabs where possible
#867: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:807:
+^I^I^I^I         XELPDP_LANE0_PHY_CURRENT_STATUS | XELPDP_LANE1_PHY_CURRENT_STATUS,$

-:868: ERROR:CODE_INDENT: code indent should use tabs where possible
#868: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:808:
+^I^I^I^I         XELPDP_PORT_RESET_START_TIMEOUT_US, 0, NULL))$

-:877: ERROR:CODE_INDENT: code indent should use tabs where possible
#877: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:817:
+^I^I^I^I         intel_cx0_get_pclk_refclk_ack(INTEL_CX0_BOTH_LANES),$

-:877: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#877: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:817:
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(port),
+				         intel_cx0_get_pclk_refclk_ack(INTEL_CX0_BOTH_LANES),

-:878: ERROR:CODE_INDENT: code indent should use tabs where possible
#878: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:818:
+^I^I^I^I         intel_cx0_get_pclk_refclk_ack(lane),$

-:879: ERROR:CODE_INDENT: code indent should use tabs where possible
#879: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:819:
+^I^I^I^I         XELPDP_REFCLK_ENABLE_TIMEOUT_US, 0, NULL))$

-:949: ERROR:CODE_INDENT: code indent should use tabs where possible
#949: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:889:
+                        }$

-:949: WARNING:LEADING_SPACE: please, no spaces at the start of a line
#949: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:889:
+                        }$

-:972: WARNING:LONG_LINE: line length of 102 exceeds 100 columns
#972: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:912:
+			      C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);

-:1054: ERROR:CODE_INDENT: code indent should use tabs where possible
#1054: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:994:
+^I^I^I^I         intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES),$

-:1054: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#1054: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:994:
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+				         intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES),

-:1055: ERROR:CODE_INDENT: code indent should use tabs where possible
#1055: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:995:
+^I^I^I^I         intel_cx0_get_pclk_pll_ack(maxpclk_lane),$

-:1056: ERROR:CODE_INDENT: code indent should use tabs where possible
#1056: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:996:
+^I^I^I^I         XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US, 0, NULL))$

-:1105: ERROR:CODE_INDENT: code indent should use tabs where possible
#1105: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:1045:
+^I^I^I^I         intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES) |$

-:1105: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#1105: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:1045:
+	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
+				         intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES) |

-:1106: ERROR:CODE_INDENT: code indent should use tabs where possible
#1106: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:1046:
+^I^I^I^I         intel_cx0_get_pclk_refclk_ack(INTEL_CX0_BOTH_LANES), 0,$

-:1107: ERROR:CODE_INDENT: code indent should use tabs where possible
#1107: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:1047:
+^I^I^I^I         XELPDP_PCLK_PLL_DISABLE_TIMEOUT_US, 0, NULL))$

-:1187: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/gpu/drm/i915/display/intel_cx0_phy.h', please use '/*' instead
#1187: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.h:1:
+// SPDX-License-Identifier: MIT

-:1187: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
#1187: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.h:1:
+// SPDX-License-Identifier: MIT

-:1299: WARNING:LONG_LINE: line length of 102 exceeds 100 columns
#1299: FILE: drivers/gpu/drm/i915/display/intel_ddi.c:3519:
+	crtc_state->port_clock = intel_c10mpllb_calc_port_clock(encoder, &crtc_state->c10mpllb_state);

-:1490: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__n' - possible side-effects?
#1490: 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))))

-:1511: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__high' - possible side-effects?
#1511: 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)))))

-:1511: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__low' - possible side-effects?
#1511: 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)))))

-:1534: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__mask' - possible side-effects?
#1534: 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))))

-:1534: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__val' - possible side-effects?
#1534: 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))))

-:1539: WARNING:LONG_LINE: line length of 128 exceeds 100 columns
#1539: 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: 23 errors, 21 warnings, 26 checks, 1443 lines checked
d348b388d1a3 drm/i915/mtl: Add C10 phy programming for HDMI
-:22: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#22: 
v3: Add missing use_hdmi checks from Clint's HDMI implementation changes (Ankit)

-:167: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#167: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:615:
+	.pll[0]=0x34,
 	       ^

-:168: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#168: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:616:
+	.pll[1]=0x00,
 	       ^

-:169: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#169: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:617:
+	.pll[2]=0xB0,
 	       ^

-:170: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#170: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:618:
+	.pll[3]=0x00,
 	       ^

-:171: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#171: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:619:
+	.pll[4]=0x00,
 	       ^

-:172: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#172: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:620:
+	.pll[5]=0x00,
 	       ^

-:173: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#173: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:621:
+	.pll[6]=0x00,
 	       ^

-:174: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#174: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:622:
+	.pll[7]=0x00,
 	       ^

-:175: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#175: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:623:
+	.pll[8]=0x20,
 	       ^

-:176: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#176: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:624:
+	.pll[9]=0xFF,
 	       ^

-:177: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#177: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:625:
+	.pll[10]=0xFF,
 	        ^

-:178: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#178: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:626:
+	.pll[11]=0x55,
 	        ^

-:179: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#179: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:627:
+	.pll[12]=0xE5,
 	        ^

-:180: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#180: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:628:
+	.pll[13]=0x55,
 	        ^

-:181: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#181: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:629:
+	.pll[14]=0x55,
 	        ^

-:182: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#182: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:630:
+	.pll[15]=0x0D,
 	        ^

-:183: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#183: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:631:
+	.pll[16]=0x09,
 	        ^

-:184: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#184: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:632:
+	.pll[17]=0x8F,
 	        ^

-:185: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#185: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:633:
+	.pll[18]=0x84,
 	        ^

-:186: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#186: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy.c:634:
+	.pll[19]=0x23,
 	        ^

-:191: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#191: 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,
 	       ^

-:191: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#191: 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,
 	                     ^

-:191: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#191: 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,
 	                                   ^

-:191: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#191: 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,
 	                                                 ^

-:191: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#191: 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,
 	                                                               ^

-:192: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#192: 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,
 	       ^

-:192: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#192: 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,
 	                     ^

-:192: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#192: 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,
 	                                   ^

-:192: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#192: 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,
 	                                                 ^

-:192: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#192: 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,
 	                                                               ^

-:193: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#193: 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,
 	        ^

-:193: ERROR:SPACING: space required after that ',' (ctx:VxV)
#193: 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,
 	             ^

-:193: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#193: 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,
 	                      ^

-:193: ERROR:SPACING: space required after that ',' (ctx:VxV)
#193: 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,
 	                           ^

-:193: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#193: 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,
 	                                    ^

-:193: ERROR:SPACING: space required after that ',' (ctx:VxV)
#193: 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,
 	                                         ^

-:193: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#193: 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,
 	                                                  ^

-:193: ERROR:SPACING: space required after that ',' (ctx:VxV)
#193: 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,
 	                                                       ^

-:193: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#193: 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,
 	                                                                ^

-:194: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#194: 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,
 	        ^

-:194: ERROR:SPACING: space required after that ',' (ctx:VxV)
#194: 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,
 	             ^

-:194: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#194: 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,
 	                      ^

-:194: ERROR:SPACING: space required after that ',' (ctx:VxV)
#194: 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,
 	                           ^

-:194: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#194: 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,
 	                                    ^

-:194: ERROR:SPACING: space required after that ',' (ctx:VxV)
#194: 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,
 	                                         ^

-:194: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#194: 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,
 	                                                  ^

-:194: ERROR:SPACING: space required after that ',' (ctx:VxV)
#194: 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,
 	                                                       ^

-:194: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#194: 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,
 	                                                                ^

-:199: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#199: 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,
 	       ^

-:199: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#199: 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,
 	                     ^

-:199: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#199: 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,
 	                                   ^

-:199: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#199: 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,
 	                                                 ^

-:199: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#199: 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,
 	                                                               ^

-:200: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#200: 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,
 	       ^

-:200: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#200: 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,
 	                     ^

-:200: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#200: 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,
 	                                   ^

-:200: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#200: 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,
 	                                                 ^

-:200: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#200: 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,
 	                                                               ^

-:201: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#201: 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,
 	        ^

-:201: ERROR:SPACING: space required after that ',' (ctx:VxV)
#201: 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,
 	             ^

-:201: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#201: 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,
 	                      ^

-:201: ERROR:SPACING: space required after that ',' (ctx:VxV)
#201: 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,
 	                           ^

-:201: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#201: 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,
 	                                    ^

-:201: ERROR:SPACING: space required after that ',' (ctx:VxV)
#201: 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,
 	                                         ^

-:201: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#201: 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,
 	                                                  ^

-:201: ERROR:SPACING: space required after that ',' (ctx:VxV)
#201: 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,
 	                                                       ^

-:201: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#201: 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,
 	                                                                ^

-:202: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#202: 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,
 	        ^

-:202: ERROR:SPACING: space required after that ',' (ctx:VxV)
#202: 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,
 	             ^

-:202: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#202: 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,
 	                      ^

-:202: ERROR:SPACING: space required after that ',' (ctx:VxV)
#202: 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,
 	                           ^

-:202: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#202: 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,
 	                                    ^

-:202: ERROR:SPACING: space required after that ',' (ctx:VxV)
#202: 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,
 	                                         ^

-:202: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#202: 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,
 	                                                  ^

-:202: ERROR:SPACING: space required after that ',' (ctx:VxV)
#202: 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,
 	                                                       ^

-:202: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#202: 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,
 	                                                                ^

-:207: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#207: 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,
 	       ^

-:207: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#207: 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,
 	                     ^

-:207: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#207: 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,
 	                                   ^

-:207: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#207: 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,
 	                                                 ^

-:207: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#207: 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,
 	                                                               ^

-:208: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#208: 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,
 	       ^

-:208: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#208: 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,
 	                     ^

-:208: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#208: 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,
 	                                   ^

-:208: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#208: 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,
 	                                                 ^

-:208: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#208: 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,
 	                                                               ^

-:209: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#209: 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,
 	        ^

-:209: ERROR:SPACING: space required after that ',' (ctx:VxV)
#209: 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,
 	             ^

-:209: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#209: 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,
 	                      ^

-:209: ERROR:SPACING: space required after that ',' (ctx:VxV)
#209: 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,
 	                           ^

-:209: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#209: 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,
 	                                    ^

-:209: ERROR:SPACING: space required after that ',' (ctx:VxV)
#209: 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,
 	                                         ^

-:209: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#209: 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,
 	                                                  ^

-:209: ERROR:SPACING: space required after that ',' (ctx:VxV)
#209: 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,
 	                                                       ^

-:209: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#209: 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,
 	                                                                ^

-:210: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#210: 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,
 	        ^

-:210: ERROR:SPACING: space required after that ',' (ctx:VxV)
#210: 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,
 	             ^

-:210: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#210: 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,
 	                      ^

-:210: ERROR:SPACING: space required after that ',' (ctx:VxV)
#210: 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,
 	                           ^

-:210: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#210: 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,
 	                                    ^

-:210: ERROR:SPACING: space required after that ',' (ctx:VxV)
#210: 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,
 	                                         ^

-:210: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#210: 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,
 	                                                  ^

-:210: ERROR:SPACING: space required after that ',' (ctx:VxV)
#210: 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,
 	                                                       ^

-:210: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#210: 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,
 	                                                                ^

-:215: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#215: 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,
 	       ^

-:215: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#215: 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,
 	                     ^

-:215: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#215: 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,
 	                                   ^

-:215: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#215: 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,
 	                                                 ^

-:215: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#215: 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,
 	                                                               ^

-:216: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#216: 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,
 	       ^

-:216: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#216: 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,
 	                     ^

-:216: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#216: 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,
 	                                   ^

-:216: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#216: 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,
 	                                                 ^

-:216: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#216: 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,
 	                                                               ^

-:217: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#217: 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,
 	        ^

-:217: ERROR:SPACING: space required after that ',' (ctx:VxV)
#217: 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,
 	             ^

-:217: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#217: 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,
 	                      ^

-:217: ERROR:SPACING: space required after that ',' (ctx:VxV)
#217: 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,
 	                           ^

-:217: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#217: 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,
 	                                    ^

-:217: ERROR:SPACING: space required after that ',' (ctx:VxV)
#217: 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,
 	                                         ^

-:217: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#217: 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,
 	                                                  ^

-:217: ERROR:SPACING: space required after that ',' (ctx:VxV)
#217: 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,
 	                                                       ^

-:217: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#217: 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,
 	                                                                ^

-:218: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#218: 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,
 	        ^

-:218: ERROR:SPACING: space required after that ',' (ctx:VxV)
#218: 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,
 	             ^

-:218: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#218: 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,
 	                      ^

-:218: ERROR:SPACING: space required after that ',' (ctx:VxV)
#218: 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,
 	                           ^

-:218: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#218: 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,
 	                                    ^

-:218: ERROR:SPACING: space required after that ',' (ctx:VxV)
#218: 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,
 	                                         ^

-:218: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#218: 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,
 	                                                  ^

-:218: ERROR:SPACING: space required after that ',' (ctx:VxV)
#218: 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,
 	                                                       ^

-:218: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#218: 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,
 	                                                                ^

-:223: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#223: 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,
 	       ^

-:223: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#223: 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,
 	                     ^

-:223: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#223: 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,
 	                                   ^

-:223: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#223: 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,
 	                                                 ^

-:223: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#223: 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,
 	                                                               ^

-:224: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#224: 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,
 	       ^

-:224: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#224: 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,
 	                     ^

-:224: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#224: 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,
 	                                   ^

-:224: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#224: 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,
 	                                                 ^

-:224: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#224: 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,
 	                                                               ^

-:225: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#225: 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,
 	        ^

-:225: ERROR:SPACING: space required after that ',' (ctx:VxV)
#225: 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,
 	             ^

-:225: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#225: 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,
 	                      ^

-:225: ERROR:SPACING: space required after that ',' (ctx:VxV)
#225: 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,
 	                           ^

-:225: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#225: 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,
 	                                    ^

-:225: ERROR:SPACING: space required after that ',' (ctx:VxV)
#225: 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,
 	                                         ^

-:225: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#225: 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,
 	                                                  ^

-:225: ERROR:SPACING: space required after that ',' (ctx:VxV)
#225: 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,
 	                                                       ^

-:225: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#225: 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,
 	                                                                ^

-:226: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#226: 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,
 	        ^

-:226: ERROR:SPACING: space required after that ',' (ctx:VxV)
#226: 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,
 	             ^

-:226: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#226: 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,
 	                      ^

-:226: ERROR:SPACING: space required after that ',' (ctx:VxV)
#226: 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,
 	                           ^

-:226: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#226: 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,
 	                                    ^

-:226: ERROR:SPACING: space required after that ',' (ctx:VxV)
#226: 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,
 	                                         ^

-:226: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#226: 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,
 	                                                  ^

-:226: ERROR:SPACING: space required after that ',' (ctx:VxV)
#226: 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,
 	                                                       ^

-:226: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#226: 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,
 	                                                                ^

-:231: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#231: 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,
 	       ^

-:231: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#231: 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,
 	                     ^

-:231: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#231: 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,
 	                                   ^

-:231: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#231: 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,
 	                                                 ^

-:231: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#231: 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,
 	                                                               ^

-:232: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#232: 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,
 	       ^

-:232: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#232: 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,
 	                     ^

-:232: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#232: 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,
 	                                   ^

-:232: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#232: 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,
 	                                                 ^

-:232: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#232: 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,
 	                                                               ^

-:233: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#233: 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,
 	        ^

-:233: ERROR:SPACING: space required after that ',' (ctx:VxV)
#233: 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,
 	             ^

-:233: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#233: 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,
 	                      ^

-:233: ERROR:SPACING: space required after that ',' (ctx:VxV)
#233: 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,
 	                           ^

-:233: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#233: 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,
 	                                    ^

-:233: ERROR:SPACING: space required after that ',' (ctx:VxV)
#233: 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,
 	                                         ^

-:233: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#233: 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,
 	                                                  ^

-:233: ERROR:SPACING: space required after that ',' (ctx:VxV)
#233: 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,
 	                                                       ^

-:233: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#233: 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,
 	                                                                ^

-:234: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#234: 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,
 	        ^

-:234: ERROR:SPACING: space required after that ',' (ctx:VxV)
#234: 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,
 	             ^

-:234: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#234: 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,
 	                      ^

-:234: ERROR:SPACING: space required after that ',' (ctx:VxV)
#234: 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,
 	                           ^

-:234: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#234: 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,
 	                                    ^

-:234: ERROR:SPACING: space required after that ',' (ctx:VxV)
#234: 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,
 	                                         ^

-:234: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#234: 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,
 	                                                  ^

-:234: ERROR:SPACING: space required after that ',' (ctx:VxV)
#234: 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,
 	                                                       ^

-:234: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#234: 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,
 	                                                                ^

-:239: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#239: 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,
 	       ^

-:239: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#239: 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,
 	                     ^

-:239: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#239: 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,
 	                                   ^

-:239: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#239: 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,
 	                                                 ^

-:239: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#239: 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,
 	                                                               ^

-:240: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#240: 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,
 	       ^

-:240: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#240: 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,
 	                     ^

-:240: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#240: 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,
 	                                   ^

-:240: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#240: 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,
 	                                                 ^

-:240: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#240: 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,
 	                                                               ^

-:241: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#241: 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,
 	        ^

-:241: ERROR:SPACING: space required after that ',' (ctx:VxV)
#241: 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,
 	             ^

-:241: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#241: 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,
 	                      ^

-:241: ERROR:SPACING: space required after that ',' (ctx:VxV)
#241: 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,
 	                           ^

-:241: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#241: 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,
 	                                    ^

-:241: ERROR:SPACING: space required after that ',' (ctx:VxV)
#241: 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,
 	                                         ^

-:241: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#241: 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,
 	                                                  ^

-:241: ERROR:SPACING: space required after that ',' (ctx:VxV)
#241: 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,
 	                                                       ^

-:241: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#241: 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,
 	                                                                ^

-:242: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#242: 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,
 	        ^

-:242: ERROR:SPACING: space required after that ',' (ctx:VxV)
#242: 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,
 	             ^

-:242: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#242: 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,
 	                      ^

-:242: ERROR:SPACING: space required after that ',' (ctx:VxV)
#242: 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,
 	                           ^

-:242: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#242: 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,
 	                                    ^

-:242: ERROR:SPACING: space required after that ',' (ctx:VxV)
#242: 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,
 	                                         ^

-:242: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#242: 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,
 	                                                  ^

-:242: ERROR:SPACING: space required after that ',' (ctx:VxV)
#242: 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,
 	                                                       ^

-:242: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#242: 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,
 	                                                                ^

-:247: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#247: 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,
 	       ^

-:247: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#247: 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,
 	                     ^

-:247: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#247: 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,
 	                                   ^

-:247: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#247: 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,
 	                                                 ^

-:247: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#247: 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,
 	                                                               ^

-:248: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#248: 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,
 	       ^

-:248: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#248: 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,
 	                     ^

-:248: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#248: 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,
 	                                   ^

-:248: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#248: 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,
 	                                                 ^

-:248: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#248: 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,
 	                                                               ^

-:249: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#249: 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,
 	        ^

-:249: ERROR:SPACING: space required after that ',' (ctx:VxV)
#249: 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,
 	             ^

-:249: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#249: 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,
 	                      ^

-:249: ERROR:SPACING: space required after that ',' (ctx:VxV)
#249: 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,
 	                           ^

-:249: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#249: 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,
 	                                    ^

-:249: ERROR:SPACING: space required after that ',' (ctx:VxV)
#249: 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,
 	                                         ^

-:249: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#249: 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,
 	                                                  ^

-:249: ERROR:SPACING: space required after that ',' (ctx:VxV)
#249: 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,
 	                                                       ^

-:249: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#249: 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,
 	                                                                ^

-:250: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#250: 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,
 	        ^

-:250: ERROR:SPACING: space required after that ',' (ctx:VxV)
#250: 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,
 	             ^

-:250: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#250: 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,
 	                      ^

-:250: ERROR:SPACING: space required after that ',' (ctx:VxV)
#250: 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,
 	                           ^

-:250: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#250: 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,
 	                                    ^

-:250: ERROR:SPACING: space required after that ',' (ctx:VxV)
#250: 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,
 	                                         ^

-:250: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#250: 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,
 	                                                  ^

-:250: ERROR:SPACING: space required after that ',' (ctx:VxV)
#250: 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,
 	                                                       ^

-:250: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#250: 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,
 	                                                                ^

-:255: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#255: 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,
 	       ^

-:255: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#255: 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,
 	                     ^

-:255: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#255: 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,
 	                                   ^

-:255: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#255: 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,
 	                                                 ^

-:255: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#255: 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,
 	                                                               ^

-:256: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#256: 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,
 	       ^

-:256: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#256: 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,
 	                     ^

-:256: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#256: 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,
 	                                   ^

-:256: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#256: 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,
 	                                                 ^

-:256: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#256: 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,
 	                                                               ^

-:257: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#257: 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,
 	        ^

-:257: ERROR:SPACING: space required after that ',' (ctx:VxV)
#257: 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,
 	             ^

-:257: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#257: 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,
 	                      ^

-:257: ERROR:SPACING: space required after that ',' (ctx:VxV)
#257: 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,
 	                           ^

-:257: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#257: 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,
 	                                    ^

-:257: ERROR:SPACING: space required after that ',' (ctx:VxV)
#257: 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,
 	                                         ^

-:257: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#257: 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,
 	                                                  ^

-:257: ERROR:SPACING: space required after that ',' (ctx:VxV)
#257: 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,
 	                                                       ^

-:257: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#257: 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,
 	                                                                ^

-:258: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#258: 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,
 	        ^

-:258: ERROR:SPACING: space required after that ',' (ctx:VxV)
#258: 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,
 	             ^

-:258: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#258: 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,
 	                      ^

-:258: ERROR:SPACING: space required after that ',' (ctx:VxV)
#258: 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,
 	                           ^

-:258: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#258: 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,
 	                                    ^

-:258: ERROR:SPACING: space required after that ',' (ctx:VxV)
#258: 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,
 	                                         ^

-:258: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#258: 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,
 	                                                  ^

-:258: ERROR:SPACING: space required after that ',' (ctx:VxV)
#258: 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,
 	                                                       ^

-:258: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#258: 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,
 	                                                                ^

-:263: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#263: 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,
 	       ^

-:263: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#263: 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,
 	                     ^

-:263: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#263: 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,
 	                                   ^

-:263: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#263: 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,
 	                                                 ^

-:263: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#263: 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,
 	                                                               ^

-:264: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#264: 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,
 	       ^

-:264: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#264: 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,
 	                     ^

-:264: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#264: 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,
 	                                   ^

-:264: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#264: 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,
 	                                                 ^

-:264: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#264: 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,
 	                                                               ^

-:265: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#265: 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,
 	        ^

-:265: ERROR:SPACING: space required after that ',' (ctx:VxV)
#265: 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,
 	             ^

-:265: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#265: 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,
 	                      ^

-:265: ERROR:SPACING: space required after that ',' (ctx:VxV)
#265: 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,
 	                           ^

-:265: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#265: 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,
 	                                    ^

-:265: ERROR:SPACING: space required after that ',' (ctx:VxV)
#265: 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,
 	                                         ^

-:265: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#265: 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,
 	                                                  ^

-:265: ERROR:SPACING: space required after that ',' (ctx:VxV)
#265: 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,
 	                                                       ^

-:265: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#265: 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,
 	                                                                ^

-:266: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#266: 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,
 	        ^

-:266: ERROR:SPACING: space required after that ',' (ctx:VxV)
#266: 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,
 	             ^

-:266: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#266: 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,
 	                      ^

-:266: ERROR:SPACING: space required after that ',' (ctx:VxV)
#266: 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,
 	                           ^

-:266: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#266: 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,
 	                                    ^

-:266: ERROR:SPACING: space required after that ',' (ctx:VxV)
#266: 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,
 	                                         ^

-:266: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#266: 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,
 	                                                  ^

-:266: ERROR:SPACING: space required after that ',' (ctx:VxV)
#266: 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,
 	                                                       ^

-:266: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#266: 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,
 	                                                                ^

-:271: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#271: 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,
 	       ^

-:271: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#271: 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,
 	                     ^

-:271: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#271: 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,
 	                                   ^

-:271: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#271: 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,
 	                                                 ^

-:271: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#271: 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,
 	                                                               ^

-:272: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#272: 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,
 	       ^

-:272: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#272: 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,
 	                     ^

-:272: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#272: 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,
 	                                   ^

-:272: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#272: 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,
 	                                                 ^

-:272: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#272: 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,
 	                                                               ^

-:273: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#273: 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,
 	        ^

-:273: ERROR:SPACING: space required after that ',' (ctx:VxV)
#273: 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,
 	             ^

-:273: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#273: 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,
 	                      ^

-:273: ERROR:SPACING: space required after that ',' (ctx:VxV)
#273: 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,
 	                           ^

-:273: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#273: 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,
 	                                    ^

-:273: ERROR:SPACING: space required after that ',' (ctx:VxV)
#273: 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,
 	                                         ^

-:273: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#273: 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,
 	                                                  ^

-:273: ERROR:SPACING: space required after that ',' (ctx:VxV)
#273: 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,
 	                                                       ^

-:273: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#273: 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,
 	                                                                ^

-:274: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#274: 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,
 	        ^

-:274: ERROR:SPACING: space required after that ',' (ctx:VxV)
#274: 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,
 	             ^

-:274: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#274: 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,
 	                      ^

-:274: ERROR:SPACING: space required after that ',' (ctx:VxV)
#274: 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,
 	                           ^

-:274: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#274: 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,
 	                                    ^

-:274: ERROR:SPACING: space required after that ',' (ctx:VxV)
#274: 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,
 	                                         ^

-:274: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#274: 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,
 	                                                  ^

-:274: ERROR:SPACING: space required after that ',' (ctx:VxV)
#274: 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,
 	                                                       ^

-:274: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#274: 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,
 	                                                                ^

-:279: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
#279: 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,



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/mtl: Add C10 and C20 phy support (rev6)
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (22 preceding siblings ...)
  2023-02-24 13:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/mtl: Add C10 and C20 phy support (rev6) Patchwork
@ 2023-02-24 13:59 ` Patchwork
  2023-02-24 18:03 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
  2023-03-15 12:26 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/mtl: Add C10 and C20 phy support (rev7) Patchwork
  25 siblings, 0 replies; 37+ messages in thread
From: Patchwork @ 2023-02-24 13:59 UTC (permalink / raw)
  To: Mika Kahola; +Cc: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 8049 bytes --]

== Series Details ==

Series: drm/i915/mtl: Add C10 and C20 phy support (rev6)
URL   : https://patchwork.freedesktop.org/series/109714/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12775 -> Patchwork_109714v6
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/index.html

Participating hosts (37 -> 36)
------------------------------

  Additional (1): fi-kbl-x1275 
  Missing    (2): fi-snb-2520m fi-pnv-d510 

Known issues
------------

  Here are the changes found in Patchwork_109714v6 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_suspend@basic-s3@smem:
    - bat-rpls-1:         [PASS][1] -> [ABORT][2] ([i915#6687] / [i915#7978])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/bat-rpls-1/igt@gem_exec_suspend@basic-s3@smem.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-rpls-1/igt@gem_exec_suspend@basic-s3@smem.html

  * igt@gem_huc_copy@huc-copy:
    - fi-kbl-x1275:       NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#2190])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/fi-kbl-x1275/igt@gem_huc_copy@huc-copy.html

  * igt@gem_lmem_swapping@random-engines:
    - bat-adlp-6:         NOTRUN -> [SKIP][4] ([i915#4613]) +3 similar issues
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-adlp-6/igt@gem_lmem_swapping@random-engines.html

  * igt@gem_lmem_swapping@verify-random:
    - fi-kbl-x1275:       NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#4613]) +3 similar issues
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/fi-kbl-x1275/igt@gem_lmem_swapping@verify-random.html

  * igt@i915_pm_rps@basic-api:
    - bat-adlp-6:         NOTRUN -> [SKIP][6] ([i915#6621])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-adlp-6/igt@i915_pm_rps@basic-api.html

  * igt@i915_selftest@live@execlists:
    - fi-bsw-nick:        [PASS][7] -> [ABORT][8] ([i915#7911] / [i915#7913])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/fi-bsw-nick/igt@i915_selftest@live@execlists.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/fi-bsw-nick/igt@i915_selftest@live@execlists.html

  * igt@kms_chamelium_hpd@common-hpd-after-suspend:
    - bat-adlp-6:         NOTRUN -> [SKIP][9] ([i915#7828])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-adlp-6/igt@kms_chamelium_hpd@common-hpd-after-suspend.html

  * igt@kms_pipe_crc_basic@read-crc:
    - fi-kbl-x1275:       NOTRUN -> [SKIP][10] ([fdo#109271]) +45 similar issues
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/fi-kbl-x1275/igt@kms_pipe_crc_basic@read-crc.html

  * igt@prime_vgem@basic-fence-read:
    - bat-adlp-6:         NOTRUN -> [SKIP][11] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-adlp-6/igt@prime_vgem@basic-fence-read.html

  * igt@prime_vgem@basic-userptr:
    - bat-adlp-6:         NOTRUN -> [SKIP][12] ([fdo#109295] / [i915#3301] / [i915#3708])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-adlp-6/igt@prime_vgem@basic-userptr.html

  
#### Possible fixes ####

  * igt@i915_pm_rpm@basic-rte:
    - bat-adlp-6:         [ABORT][13] ([i915#7977]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/bat-adlp-6/igt@i915_pm_rpm@basic-rte.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-adlp-6/igt@i915_pm_rpm@basic-rte.html

  * igt@i915_selftest@live@gt_pm:
    - bat-adln-1:         [DMESG-FAIL][15] ([i915#4258]) -> [PASS][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/bat-adln-1/igt@i915_selftest@live@gt_pm.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-adln-1/igt@i915_selftest@live@gt_pm.html

  * igt@i915_selftest@live@migrate:
    - bat-dg2-11:         [DMESG-WARN][17] ([i915#7699]) -> [PASS][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/bat-dg2-11/igt@i915_selftest@live@migrate.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-dg2-11/igt@i915_selftest@live@migrate.html

  * igt@i915_selftest@live@slpc:
    - bat-rpls-1:         [DMESG-FAIL][19] ([i915#6367] / [i915#7996]) -> [PASS][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/bat-rpls-1/igt@i915_selftest@live@slpc.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-rpls-1/igt@i915_selftest@live@slpc.html

  
#### Warnings ####

  * igt@i915_selftest@live@slpc:
    - bat-rpls-2:         [DMESG-FAIL][21] ([i915#6367]) -> [DMESG-FAIL][22] ([i915#6367] / [i915#7996])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/bat-rpls-2/igt@i915_selftest@live@slpc.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/bat-rpls-2/igt@i915_selftest@live@slpc.html

  
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
  [i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
  [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
  [i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
  [i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
  [i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
  [i915#7699]: https://gitlab.freedesktop.org/drm/intel/issues/7699
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7911]: https://gitlab.freedesktop.org/drm/intel/issues/7911
  [i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
  [i915#7977]: https://gitlab.freedesktop.org/drm/intel/issues/7977
  [i915#7978]: https://gitlab.freedesktop.org/drm/intel/issues/7978
  [i915#7996]: https://gitlab.freedesktop.org/drm/intel/issues/7996


Build changes
-------------

  * Linux: CI_DRM_12775 -> Patchwork_109714v6

  CI-20190529: 20190529
  CI_DRM_12775: 4411ea4d524cff0bd08d9db1cdbf0ee127c3d831 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_7173: deab4e0bdf5a9366b67d0a44f478f3da3c9a943b @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_109714v6: 4411ea4d524cff0bd08d9db1cdbf0ee127c3d831 @ git://anongit.freedesktop.org/gfx-ci/linux


### Linux commits

2bfa25959578 drm/i915/mtl: Pin assignment for TypeC
d883890f770f drm/i915/mtl: TypeC HPD live status query
34a5a7deffb3 drm/i915/mtl: Power up TCSS
09eed583af68 drm/i915/mtl: Define mask for DDI AUX interrupts
968c63b790bf drm/i915/mtl: MTL PICA hotplug detection
1bd79fe6a618 drm/i915/mtl: Enable TC ports
4808edb660d7 drm/i915/mtl: Readout Thunderbolt HW state
d894e53b3829 drm/i915/mtl: Enabling/disabling sequence Thunderbolt pll
4251e0a82f87 drm/i915/mtl: For DP2.0 10G and 20G rates use MPLLA
a304df94c897 drm/i915/mtl: Add voltage swing sequence for C20
dfbd8df31421 drm/i915/mtl: C20 HDMI state calculations
4bea41064c0e drm/i915/mtl: C20 port clock calculation
72835bad2689 drm/i915/mtl: Dump C20 pll hw state
860dadb9ae04 drm/i915/mtl: C20 HW readout
7979b6c919d9 drm/i915/mtl: C20 PLL programming
2469f0cd188e drm/i915/mtl: Add support for PM DEMAND
14ff7241e91f drm/i915/mtl: Add vswing programming for C10 phys
8078e700152d drm/i915/mtl: Add C10 phy programming for HDMI
63a494aff1d4 drm/i915/mtl: Add Support for C10 PHY message bus and pll programming
de5ae055eb84 drm/i915/mtl: Create separate reg file for PICA registers
a81875bee6ff drm/i915/mtl: Add DP rates
1fb939e3f332 drm/i915/mtl: Initial DDI port setup

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/index.html

[-- Attachment #2: Type: text/html, Size: 9666 bytes --]

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/mtl: Add C10 and C20 phy support (rev6)
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (23 preceding siblings ...)
  2023-02-24 13:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
@ 2023-02-24 18:03 ` Patchwork
  2023-03-15 12:26 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/mtl: Add C10 and C20 phy support (rev7) Patchwork
  25 siblings, 0 replies; 37+ messages in thread
From: Patchwork @ 2023-02-24 18:03 UTC (permalink / raw)
  To: Mika Kahola; +Cc: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 40309 bytes --]

== Series Details ==

Series: drm/i915/mtl: Add C10 and C20 phy support (rev6)
URL   : https://patchwork.freedesktop.org/series/109714/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12775_full -> Patchwork_109714v6_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  

Participating hosts (10 -> 10)
------------------------------

  No changes in participating hosts

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_109714v6_full:

### IGT changes ###

#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@gem_barrier_race@remote-request@rcs0}:
    - {shard-dg1}:        NOTRUN -> [ABORT][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-dg1-13/igt@gem_barrier_race@remote-request@rcs0.html

  
Known issues
------------

  Here are the changes found in Patchwork_109714v6_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@debugfs_test@basic-hwmon:
    - shard-tglu-10:      NOTRUN -> [SKIP][2] ([i915#7456])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@debugfs_test@basic-hwmon.html

  * igt@feature_discovery@display-2x:
    - shard-tglu-9:       NOTRUN -> [SKIP][3] ([i915#1839])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@feature_discovery@display-2x.html

  * igt@gem_ccs@block-multicopy-compressed:
    - shard-tglu-10:      NOTRUN -> [SKIP][4] ([i915#5325])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gem_ccs@block-multicopy-compressed.html

  * igt@gem_ccs@ctrl-surf-copy:
    - shard-tglu-10:      NOTRUN -> [SKIP][5] ([i915#3555] / [i915#5325])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gem_ccs@ctrl-surf-copy.html

  * igt@gem_close_race@multigpu-basic-process:
    - shard-tglu-10:      NOTRUN -> [SKIP][6] ([i915#7697])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gem_close_race@multigpu-basic-process.html

  * igt@gem_create@create-ext-cpu-access-big:
    - shard-tglu-9:       NOTRUN -> [SKIP][7] ([i915#6335])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@gem_create@create-ext-cpu-access-big.html

  * igt@gem_exec_capture@capture-invisible@smem0:
    - shard-glk:          NOTRUN -> [SKIP][8] ([fdo#109271] / [i915#6334])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-glk9/igt@gem_exec_capture@capture-invisible@smem0.html

  * igt@gem_exec_fair@basic-none-rrul@rcs0:
    - shard-tglu-10:      NOTRUN -> [FAIL][9] ([i915#2842])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gem_exec_fair@basic-none-rrul@rcs0.html

  * igt@gem_exec_fair@basic-none-solo@rcs0:
    - shard-tglu-9:       NOTRUN -> [FAIL][10] ([i915#2842])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@gem_exec_fair@basic-none-solo@rcs0.html

  * igt@gem_exec_params@rsvd2-dirt:
    - shard-tglu-10:      NOTRUN -> [SKIP][11] ([fdo#109283])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gem_exec_params@rsvd2-dirt.html

  * igt@gem_lmem_evict@dontneed-evict-race:
    - shard-tglu-10:      NOTRUN -> [SKIP][12] ([i915#7582])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gem_lmem_evict@dontneed-evict-race.html

  * igt@gem_lmem_swapping@heavy-multi:
    - shard-tglu-10:      NOTRUN -> [SKIP][13] ([i915#4613]) +2 similar issues
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gem_lmem_swapping@heavy-multi.html

  * igt@gem_lmem_swapping@parallel-random-verify:
    - shard-tglu-9:       NOTRUN -> [SKIP][14] ([i915#4613]) +1 similar issue
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@gem_lmem_swapping@parallel-random-verify.html

  * igt@gem_lmem_swapping@random-engines:
    - shard-glk:          NOTRUN -> [SKIP][15] ([fdo#109271] / [i915#4613]) +1 similar issue
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-glk9/igt@gem_lmem_swapping@random-engines.html

  * igt@gem_pxp@reject-modify-context-protection-off-1:
    - shard-tglu-10:      NOTRUN -> [SKIP][16] ([i915#4270]) +2 similar issues
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gem_pxp@reject-modify-context-protection-off-1.html

  * igt@gem_softpin@evict-snoop:
    - shard-tglu-10:      NOTRUN -> [SKIP][17] ([fdo#109312])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gem_softpin@evict-snoop.html

  * igt@gem_userptr_blits@dmabuf-unsync:
    - shard-tglu-9:       NOTRUN -> [SKIP][18] ([i915#3297])
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@gem_userptr_blits@dmabuf-unsync.html

  * igt@gem_userptr_blits@vma-merge:
    - shard-tglu-10:      NOTRUN -> [FAIL][19] ([i915#3318])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gem_userptr_blits@vma-merge.html

  * igt@gen7_exec_parse@batch-without-end:
    - shard-tglu-9:       NOTRUN -> [SKIP][20] ([fdo#109289]) +3 similar issues
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@gen7_exec_parse@batch-without-end.html

  * igt@gen7_exec_parse@bitmasks:
    - shard-tglu-10:      NOTRUN -> [SKIP][21] ([fdo#109289]) +1 similar issue
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gen7_exec_parse@bitmasks.html

  * igt@gen9_exec_parse@allowed-single:
    - shard-apl:          [PASS][22] -> [ABORT][23] ([i915#5566])
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-apl7/igt@gen9_exec_parse@allowed-single.html
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-apl3/igt@gen9_exec_parse@allowed-single.html

  * igt@gen9_exec_parse@batch-zero-length:
    - shard-tglu-10:      NOTRUN -> [SKIP][24] ([i915#2527] / [i915#2856]) +2 similar issues
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@gen9_exec_parse@batch-zero-length.html

  * igt@gen9_exec_parse@bb-start-param:
    - shard-tglu-9:       NOTRUN -> [SKIP][25] ([i915#2527] / [i915#2856])
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@gen9_exec_parse@bb-start-param.html

  * igt@i915_pm_backlight@bad-brightness:
    - shard-tglu-10:      NOTRUN -> [SKIP][26] ([i915#7561])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@i915_pm_backlight@bad-brightness.html

  * igt@i915_pm_dc@dc6-dpms:
    - shard-tglu-9:       NOTRUN -> [FAIL][27] ([i915#3989] / [i915#454])
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@i915_pm_dc@dc6-dpms.html

  * igt@i915_pm_dc@dc6-psr:
    - shard-tglu-9:       NOTRUN -> [SKIP][28] ([i915#658])
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@i915_pm_dc@dc6-psr.html

  * igt@i915_pm_rpm@modeset-lpsp-stress-no-wait:
    - shard-tglu-9:       NOTRUN -> [SKIP][29] ([i915#1397])
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@i915_pm_rpm@modeset-lpsp-stress-no-wait.html

  * igt@i915_pm_rpm@modeset-pc8-residency-stress:
    - shard-tglu-10:      NOTRUN -> [SKIP][30] ([fdo#109506])
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@i915_pm_rpm@modeset-pc8-residency-stress.html

  * igt@i915_query@hwconfig_table:
    - shard-tglu-9:       NOTRUN -> [SKIP][31] ([i915#6245])
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@i915_query@hwconfig_table.html

  * igt@kms_big_fb@4-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip:
    - shard-tglu-10:      NOTRUN -> [SKIP][32] ([i915#5286]) +4 similar issues
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_big_fb@4-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip.html

  * igt@kms_big_fb@y-tiled-8bpp-rotate-90:
    - shard-tglu-10:      NOTRUN -> [SKIP][33] ([fdo#111614])
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_big_fb@y-tiled-8bpp-rotate-90.html

  * igt@kms_big_fb@yf-tiled-8bpp-rotate-180:
    - shard-tglu-9:       NOTRUN -> [SKIP][34] ([fdo#111615] / [i915#1845] / [i915#7651]) +5 similar issues
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_big_fb@yf-tiled-8bpp-rotate-180.html

  * igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip:
    - shard-tglu-10:      NOTRUN -> [SKIP][35] ([fdo#111615]) +3 similar issues
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip.html

  * igt@kms_big_joiner@2x-modeset:
    - shard-tglu-10:      NOTRUN -> [SKIP][36] ([i915#2705])
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_big_joiner@2x-modeset.html

  * igt@kms_ccs@pipe-a-crc-primary-basic-y_tiled_gen12_mc_ccs:
    - shard-tglu-10:      NOTRUN -> [SKIP][37] ([i915#3689] / [i915#3886]) +1 similar issue
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_ccs@pipe-a-crc-primary-basic-y_tiled_gen12_mc_ccs.html

  * igt@kms_ccs@pipe-b-bad-rotation-90-4_tiled_dg2_rc_ccs:
    - shard-tglu-10:      NOTRUN -> [SKIP][38] ([i915#3689] / [i915#6095]) +4 similar issues
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_ccs@pipe-b-bad-rotation-90-4_tiled_dg2_rc_ccs.html

  * igt@kms_ccs@pipe-b-random-ccs-data-y_tiled_gen12_rc_ccs_cc:
    - shard-glk:          NOTRUN -> [SKIP][39] ([fdo#109271] / [i915#3886])
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-glk9/igt@kms_ccs@pipe-b-random-ccs-data-y_tiled_gen12_rc_ccs_cc.html

  * igt@kms_ccs@pipe-c-bad-rotation-90-4_tiled_dg2_mc_ccs:
    - shard-tglu-10:      NOTRUN -> [SKIP][40] ([i915#6095]) +3 similar issues
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_ccs@pipe-c-bad-rotation-90-4_tiled_dg2_mc_ccs.html

  * igt@kms_ccs@pipe-c-ccs-on-another-bo-yf_tiled_ccs:
    - shard-tglu-10:      NOTRUN -> [SKIP][41] ([fdo#111615] / [i915#3689]) +5 similar issues
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_ccs@pipe-c-ccs-on-another-bo-yf_tiled_ccs.html

  * igt@kms_ccs@pipe-d-bad-pixel-format-4_tiled_dg2_rc_ccs_cc:
    - shard-tglu-10:      NOTRUN -> [SKIP][42] ([i915#3689]) +5 similar issues
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_ccs@pipe-d-bad-pixel-format-4_tiled_dg2_rc_ccs_cc.html

  * igt@kms_chamelium_color@ctm-limited-range:
    - shard-tglu-9:       NOTRUN -> [SKIP][43] ([fdo#111827]) +1 similar issue
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_chamelium_color@ctm-limited-range.html

  * igt@kms_chamelium_color@gamma:
    - shard-tglu-10:      NOTRUN -> [SKIP][44] ([fdo#111827]) +2 similar issues
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_chamelium_color@gamma.html

  * igt@kms_chamelium_hpd@dp-hpd-fast:
    - shard-tglu-10:      NOTRUN -> [SKIP][45] ([i915#7828]) +3 similar issues
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_chamelium_hpd@dp-hpd-fast.html

  * igt@kms_chamelium_hpd@vga-hpd-fast:
    - shard-tglu-9:       NOTRUN -> [SKIP][46] ([i915#7828]) +4 similar issues
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_chamelium_hpd@vga-hpd-fast.html

  * igt@kms_color@ctm-max:
    - shard-tglu-9:       NOTRUN -> [SKIP][47] ([i915#3546])
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_color@ctm-max.html

  * igt@kms_content_protection@atomic-dpms:
    - shard-tglu-10:      NOTRUN -> [SKIP][48] ([i915#6944] / [i915#7116] / [i915#7118])
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_content_protection@atomic-dpms.html

  * igt@kms_cursor_crc@cursor-sliding-max-size:
    - shard-tglu-10:      NOTRUN -> [SKIP][49] ([i915#3555]) +7 similar issues
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_cursor_crc@cursor-sliding-max-size.html

  * igt@kms_cursor_crc@cursor-suspend:
    - shard-tglu-9:       NOTRUN -> [SKIP][50] ([i915#1845] / [i915#7651]) +44 similar issues
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_cursor_crc@cursor-suspend.html

  * igt@kms_cursor_legacy@cursora-vs-flipb-atomic-transitions-varying-size:
    - shard-tglu-10:      NOTRUN -> [SKIP][51] ([fdo#109274]) +3 similar issues
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_cursor_legacy@cursora-vs-flipb-atomic-transitions-varying-size.html

  * igt@kms_cursor_legacy@short-busy-flip-before-cursor-atomic-transitions:
    - shard-tglu-10:      NOTRUN -> [SKIP][52] ([i915#4103])
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_cursor_legacy@short-busy-flip-before-cursor-atomic-transitions.html

  * igt@kms_fence_pin_leak:
    - shard-tglu-9:       NOTRUN -> [SKIP][53] ([fdo#109274] / [i915#1845])
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_fence_pin_leak.html

  * igt@kms_flip@2x-absolute-wf_vblank:
    - shard-tglu-9:       NOTRUN -> [SKIP][54] ([fdo#109274] / [i915#3637] / [i915#3966])
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_flip@2x-absolute-wf_vblank.html

  * igt@kms_flip@2x-flip-vs-panning:
    - shard-tglu-9:       NOTRUN -> [SKIP][55] ([fdo#109274] / [i915#3637]) +1 similar issue
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_flip@2x-flip-vs-panning.html

  * igt@kms_flip@2x-nonexisting-fb:
    - shard-tglu-10:      NOTRUN -> [SKIP][56] ([fdo#109274] / [i915#3637]) +3 similar issues
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_flip@2x-nonexisting-fb.html

  * igt@kms_flip@flip-vs-panning-vs-hang:
    - shard-tglu-9:       NOTRUN -> [SKIP][57] ([i915#3637]) +4 similar issues
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_flip@flip-vs-panning-vs-hang.html

  * igt@kms_flip_scaled_crc@flip-32bpp-yftileccs-to-64bpp-yftile-upscaling:
    - shard-tglu-9:       NOTRUN -> [SKIP][58] ([i915#3555]) +8 similar issues
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_flip_scaled_crc@flip-32bpp-yftileccs-to-64bpp-yftile-upscaling.html

  * igt@kms_flip_scaled_crc@flip-64bpp-4tile-to-32bpp-4tiledg2rcccs-downscaling@pipe-a-valid-mode:
    - shard-tglu-10:      NOTRUN -> [SKIP][59] ([i915#2587] / [i915#2672])
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_flip_scaled_crc@flip-64bpp-4tile-to-32bpp-4tiledg2rcccs-downscaling@pipe-a-valid-mode.html

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-spr-indfb-draw-pwrite:
    - shard-tglu-9:       NOTRUN -> [SKIP][60] ([i915#1849]) +39 similar issues
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-spr-indfb-draw-pwrite.html

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-spr-indfb-fullscreen:
    - shard-tglu-10:      NOTRUN -> [SKIP][61] ([fdo#109280]) +25 similar issues
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-spr-indfb-fullscreen.html

  * igt@kms_frontbuffer_tracking@fbcpsr-tiling-linear:
    - shard-tglu-10:      NOTRUN -> [SKIP][62] ([fdo#110189]) +20 similar issues
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_frontbuffer_tracking@fbcpsr-tiling-linear.html

  * igt@kms_plane@plane-panning-bottom-right-suspend@pipe-b-planes:
    - shard-tglu-9:       NOTRUN -> [SKIP][63] ([i915#1849] / [i915#3558]) +1 similar issue
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_plane@plane-panning-bottom-right-suspend@pipe-b-planes.html

  * igt@kms_plane_scaling@plane-scaler-with-clipping-clamping-rotation@pipe-a-vga-1:
    - shard-snb:          NOTRUN -> [SKIP][64] ([fdo#109271]) +20 similar issues
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-snb2/igt@kms_plane_scaling@plane-scaler-with-clipping-clamping-rotation@pipe-a-vga-1.html

  * igt@kms_plane_scaling@plane-upscale-with-rotation-20x20@pipe-c-hdmi-a-1:
    - shard-tglu-10:      NOTRUN -> [SKIP][65] ([i915#5176]) +7 similar issues
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_plane_scaling@plane-upscale-with-rotation-20x20@pipe-c-hdmi-a-1.html

  * igt@kms_prime@basic-modeset-hybrid:
    - shard-tglu-9:       NOTRUN -> [SKIP][66] ([i915#6524])
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_prime@basic-modeset-hybrid.html

  * igt@kms_psr2_sf@cursor-plane-move-continuous-sf:
    - shard-tglu-10:      NOTRUN -> [SKIP][67] ([i915#658]) +1 similar issue
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_psr2_sf@cursor-plane-move-continuous-sf.html

  * igt@kms_psr2_sf@cursor-plane-update-sf:
    - shard-tglu-10:      NOTRUN -> [SKIP][68] ([fdo#111068] / [i915#658])
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@kms_psr2_sf@cursor-plane-update-sf.html

  * igt@kms_psr2_sf@overlay-plane-move-continuous-sf:
    - shard-glk:          NOTRUN -> [SKIP][69] ([fdo#109271] / [i915#658])
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-glk9/igt@kms_psr2_sf@overlay-plane-move-continuous-sf.html

  * igt@kms_psr2_sf@plane-move-sf-dmg-area:
    - shard-tglu-9:       NOTRUN -> [SKIP][70] ([fdo#111068] / [i915#658])
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_psr2_sf@plane-move-sf-dmg-area.html

  * igt@kms_psr2_su@frontbuffer-xrgb8888:
    - shard-tglu-9:       NOTRUN -> [SKIP][71] ([fdo#109642] / [fdo#111068] / [i915#658])
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_psr2_su@frontbuffer-xrgb8888.html

  * igt@kms_psr@primary_mmap_gtt:
    - shard-tglu-9:       NOTRUN -> [SKIP][72] ([fdo#110189]) +1 similar issue
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_psr@primary_mmap_gtt.html

  * igt@kms_scaling_modes@scaling-mode-center:
    - shard-tglu-9:       NOTRUN -> [SKIP][73] ([i915#1845]) +13 similar issues
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@kms_scaling_modes@scaling-mode-center.html

  * igt@prime_udl:
    - shard-tglu-9:       NOTRUN -> [SKIP][74] ([fdo#109291])
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@prime_udl.html

  * igt@v3d/v3d_create_bo@create-bo-4096:
    - shard-tglu-9:       NOTRUN -> [SKIP][75] ([fdo#109315] / [i915#2575]) +1 similar issue
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@v3d/v3d_create_bo@create-bo-4096.html

  * igt@v3d/v3d_perfmon@create-perfmon-invalid-counters:
    - shard-tglu-10:      NOTRUN -> [SKIP][76] ([fdo#109315] / [i915#2575]) +2 similar issues
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@v3d/v3d_perfmon@create-perfmon-invalid-counters.html

  * igt@vc4/vc4_lookup_fail@bad-color-write:
    - shard-glk:          NOTRUN -> [SKIP][77] ([fdo#109271]) +48 similar issues
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-glk9/igt@vc4/vc4_lookup_fail@bad-color-write.html

  * igt@vc4/vc4_purgeable_bo@access-purged-bo-mem:
    - shard-tglu-10:      NOTRUN -> [SKIP][78] ([i915#2575]) +6 similar issues
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-10/igt@vc4/vc4_purgeable_bo@access-purged-bo-mem.html

  * igt@vc4/vc4_wait_bo@bad-bo:
    - shard-tglu-9:       NOTRUN -> [SKIP][79] ([i915#2575]) +3 similar issues
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-9/igt@vc4/vc4_wait_bo@bad-bo.html

  
#### Possible fixes ####

  * igt@drm_read@empty-block:
    - {shard-rkl}:        [SKIP][80] ([i915#4098]) -> [PASS][81]
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-3/igt@drm_read@empty-block.html
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-6/igt@drm_read@empty-block.html

  * igt@fbdev@eof:
    - {shard-rkl}:        [SKIP][82] ([i915#2582]) -> [PASS][83] +1 similar issue
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-3/igt@fbdev@eof.html
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-6/igt@fbdev@eof.html

  * igt@gem_ctx_persistence@engines-hang@bcs0:
    - {shard-rkl}:        [SKIP][84] ([i915#6252]) -> [PASS][85]
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-5/igt@gem_ctx_persistence@engines-hang@bcs0.html
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-6/igt@gem_ctx_persistence@engines-hang@bcs0.html

  * igt@gem_exec_fair@basic-none-solo@rcs0:
    - shard-apl:          [FAIL][86] ([i915#2842]) -> [PASS][87]
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-apl1/igt@gem_exec_fair@basic-none-solo@rcs0.html
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-apl4/igt@gem_exec_fair@basic-none-solo@rcs0.html

  * igt@gem_exec_fair@basic-pace@rcs0:
    - {shard-rkl}:        [FAIL][88] ([i915#2842]) -> [PASS][89] +2 similar issues
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-6/igt@gem_exec_fair@basic-pace@rcs0.html
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-5/igt@gem_exec_fair@basic-pace@rcs0.html

  * igt@gem_exec_reloc@basic-wc-read-noreloc:
    - {shard-rkl}:        [SKIP][90] ([i915#3281]) -> [PASS][91] +3 similar issues
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-6/igt@gem_exec_reloc@basic-wc-read-noreloc.html
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-5/igt@gem_exec_reloc@basic-wc-read-noreloc.html

  * igt@gem_partial_pwrite_pread@writes-after-reads-uncached:
    - {shard-rkl}:        [SKIP][92] ([i915#3282]) -> [PASS][93]
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-3/igt@gem_partial_pwrite_pread@writes-after-reads-uncached.html
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-5/igt@gem_partial_pwrite_pread@writes-after-reads-uncached.html

  * igt@gen9_exec_parse@bb-start-far:
    - {shard-rkl}:        [SKIP][94] ([i915#2527]) -> [PASS][95] +3 similar issues
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-6/igt@gen9_exec_parse@bb-start-far.html
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-5/igt@gen9_exec_parse@bb-start-far.html

  * igt@i915_pm_dc@dc5-dpms:
    - {shard-rkl}:        [FAIL][96] ([i915#7330]) -> [PASS][97]
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-5/igt@i915_pm_dc@dc5-dpms.html
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-2/igt@i915_pm_dc@dc5-dpms.html

  * igt@i915_pm_dc@dc6-psr:
    - {shard-rkl}:        [SKIP][98] ([i915#658]) -> [PASS][99]
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-1/igt@i915_pm_dc@dc6-psr.html
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-6/igt@i915_pm_dc@dc6-psr.html

  * igt@i915_pm_rpm@modeset-lpsp-stress-no-wait:
    - {shard-rkl}:        [SKIP][100] ([i915#1397]) -> [PASS][101] +1 similar issue
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-1/igt@i915_pm_rpm@modeset-lpsp-stress-no-wait.html
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-6/igt@i915_pm_rpm@modeset-lpsp-stress-no-wait.html

  * igt@i915_selftest@live@gt_heartbeat:
    - shard-apl:          [DMESG-FAIL][102] ([i915#5334]) -> [PASS][103]
   [102]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-apl4/igt@i915_selftest@live@gt_heartbeat.html
   [103]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-apl7/igt@i915_selftest@live@gt_heartbeat.html

  * igt@kms_big_fb@x-tiled-32bpp-rotate-0:
    - {shard-rkl}:        [SKIP][104] ([i915#1845] / [i915#4098]) -> [PASS][105] +26 similar issues
   [104]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-5/igt@kms_big_fb@x-tiled-32bpp-rotate-0.html
   [105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-6/igt@kms_big_fb@x-tiled-32bpp-rotate-0.html

  * igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-0-hflip:
    - {shard-tglu}:       [SKIP][106] ([i915#1845] / [i915#7651]) -> [PASS][107] +9 similar issues
   [106]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-tglu-6/igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-0-hflip.html
   [107]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-1/igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-0-hflip.html

  * igt@kms_cursor_legacy@basic-flip-after-cursor-varying-size:
    - {shard-tglu}:       [SKIP][108] ([i915#1845]) -> [PASS][109] +1 similar issue
   [108]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-tglu-6/igt@kms_cursor_legacy@basic-flip-after-cursor-varying-size.html
   [109]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-1/igt@kms_cursor_legacy@basic-flip-after-cursor-varying-size.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:
    - shard-apl:          [FAIL][110] ([i915#2346]) -> [PASS][111]
   [110]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-apl3/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
   [111]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-apl6/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
    - shard-glk:          [FAIL][112] ([i915#2346]) -> [PASS][113]
   [112]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-glk6/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
   [113]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-glk1/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html

  * igt@kms_fbcon_fbt@fbc-suspend:
    - shard-apl:          [FAIL][114] ([i915#4767]) -> [PASS][115]
   [114]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-apl1/igt@kms_fbcon_fbt@fbc-suspend.html
   [115]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-apl4/igt@kms_fbcon_fbt@fbc-suspend.html

  * igt@kms_frontbuffer_tracking@fbc-1p-pri-indfb-multidraw:
    - {shard-tglu}:       [SKIP][116] ([i915#1849]) -> [PASS][117] +3 similar issues
   [116]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-tglu-6/igt@kms_frontbuffer_tracking@fbc-1p-pri-indfb-multidraw.html
   [117]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-1/igt@kms_frontbuffer_tracking@fbc-1p-pri-indfb-multidraw.html

  * igt@kms_frontbuffer_tracking@fbc-badstride:
    - {shard-rkl}:        [SKIP][118] ([i915#1849] / [i915#4098]) -> [PASS][119] +18 similar issues
   [118]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-3/igt@kms_frontbuffer_tracking@fbc-badstride.html
   [119]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-6/igt@kms_frontbuffer_tracking@fbc-badstride.html

  * igt@kms_psr@cursor_render:
    - {shard-rkl}:        [SKIP][120] ([i915#1072]) -> [PASS][121] +1 similar issue
   [120]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-5/igt@kms_psr@cursor_render.html
   [121]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-6/igt@kms_psr@cursor_render.html

  * igt@kms_universal_plane@cursor-fb-leak-pipe-d:
    - {shard-tglu}:       [SKIP][122] ([fdo#109274]) -> [PASS][123]
   [122]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-tglu-6/igt@kms_universal_plane@cursor-fb-leak-pipe-d.html
   [123]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-tglu-1/igt@kms_universal_plane@cursor-fb-leak-pipe-d.html

  * igt@perf@gen12-oa-tlb-invalidate:
    - {shard-rkl}:        [SKIP][124] ([fdo#109289]) -> [PASS][125]
   [124]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-5/igt@perf@gen12-oa-tlb-invalidate.html
   [125]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-1/igt@perf@gen12-oa-tlb-invalidate.html

  * igt@prime_vgem@coherency-gtt:
    - {shard-rkl}:        [SKIP][126] ([fdo#109295] / [fdo#111656] / [i915#3708]) -> [PASS][127]
   [126]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12775/shard-rkl-6/igt@prime_vgem@coherency-gtt.html
   [127]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109714v6/shard-rkl-5/igt@prime_vgem@coherency-gtt.html

  
  {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#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
  [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
  [fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
  [fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
  [fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
  [fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
  [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
  [fdo#110542]: https://bugs.freedesktop.org/show_bug.cgi?id=110542
  [fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
  [fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
  [fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
  [fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
  [fdo#111644]: https://bugs.freedesktop.org/show_bug.cgi?id=111644
  [fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
  [fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
  [fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
  [i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
  [i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
  [i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
  [i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
  [i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
  [i915#1902]: https://gitlab.freedesktop.org/drm/intel/issues/1902
  [i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
  [i915#2434]: https://gitlab.freedesktop.org/drm/intel/issues/2434
  [i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
  [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
  [i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
  [i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
  [i915#2658]: https://gitlab.freedesktop.org/drm/intel/issues/2658
  [i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
  [i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
  [i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
  [i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
  [i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
  [i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
  [i915#315]: https://gitlab.freedesktop.org/drm/intel/issues/315
  [i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
  [i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
  [i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
  [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#3323]: https://gitlab.freedesktop.org/drm/intel/issues/3323
  [i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
  [i915#3361]: https://gitlab.freedesktop.org/drm/intel/issues/3361
  [i915#3371]: https://gitlab.freedesktop.org/drm/intel/issues/3371
  [i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
  [i915#3528]: https://gitlab.freedesktop.org/drm/intel/issues/3528
  [i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
  [i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
  [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
  [i915#3558]: https://gitlab.freedesktop.org/drm/intel/issues/3558
  [i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
  [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#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
  [i915#3804]: https://gitlab.freedesktop.org/drm/intel/issues/3804
  [i915#3840]: https://gitlab.freedesktop.org/drm/intel/issues/3840
  [i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
  [i915#3936]: https://gitlab.freedesktop.org/drm/intel/issues/3936
  [i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
  [i915#3966]: https://gitlab.freedesktop.org/drm/intel/issues/3966
  [i915#3989]: https://gitlab.freedesktop.org/drm/intel/issues/3989
  [i915#404]: https://gitlab.freedesktop.org/drm/intel/issues/404
  [i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
  [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
  [i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
  [i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
  [i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
  [i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
  [i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
  [i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
  [i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
  [i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
  [i915#4281]: https://gitlab.freedesktop.org/drm/intel/issues/4281
  [i915#433]: https://gitlab.freedesktop.org/drm/intel/issues/433
  [i915#4349]: https://gitlab.freedesktop.org/drm/intel/issues/4349
  [i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
  [i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
  [i915#4565]: https://gitlab.freedesktop.org/drm/intel/issues/4565
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#4767]: https://gitlab.freedesktop.org/drm/intel/issues/4767
  [i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
  [i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
  [i915#4881]: https://gitlab.freedesktop.org/drm/intel/issues/4881
  [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#5288]: https://gitlab.freedesktop.org/drm/intel/issues/5288
  [i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
  [i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
  [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
  [i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
  [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#6245]: https://gitlab.freedesktop.org/drm/intel/issues/6245
  [i915#6247]: https://gitlab.freedesktop.org/drm/intel/issues/6247
  [i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
  [i915#6252]: https://gitlab.freedesktop.org/drm/intel/issues/6252
  [i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
  [i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
  [i915#6333]: https://gitlab.freedesktop.org/drm/intel/issues/6333
  [i915#6334]: https://gitlab.freedesktop.org/drm/intel/issues/6334
  [i915#6335]: https://gitlab.freedesktop.org/drm/intel/issues/6335
  [i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
  [i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
  [i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
  [i915#6590]: https://gitlab.freedesktop.org/drm/intel/issues/6590
  [i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
  [i915#6944]: https://gitlab.freedesktop.org/drm/intel/issues/6944
  [i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
  [i915#7037]: https://gitlab.freedesktop.org/drm/intel/issues/7037
  [i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
  [i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
  [i915#7330]: https://gitlab.freedesktop.org/drm/intel/issues/7330
  [i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
  [i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
  [i915#7582]: https://gitlab.freedesktop.org/drm/intel/issues/7582
  [i915#7651]: https://gitlab.freedesktop.org/drm/intel/issues/7651
  [i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
  [i915#7701]: https://gitlab.freedesktop.org/drm/intel/issues/7701
  [i915#7707]: https://gitlab.freedesktop.org/drm/intel/issues/7707
  [i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
  [i915#7742]: https://gitlab.freedesktop.org/drm/intel/issues/7742
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7949]: https://gitlab.freedesktop.org/drm/intel/issues/7949
  [i915#7957]: https://gitlab.freedesktop.org/drm/intel/issues/7957
  [i915#7984]: https://gitlab.freedesktop.org/drm/intel/issues/7984
  [i915#8126]: https://gitlab.freedesktop.org/drm/intel/issues/8126
  [i915#8151]: https://gitlab.freedesktop.org/drm/intel/issues/8151
  [i915#8152]: https://gitlab.freedesktop.org/drm/intel/issues/8152
  [i915#8154]: https://gitlab.freedesktop.org/drm/intel/issues/8154
  [i915#8211]: https://gitlab.freedesktop.org/drm/intel/issues/8211


Build changes
-------------

  * Linux: CI_DRM_12775 -> Patchwork_109714v6

  CI-20190529: 20190529
  CI_DRM_12775: 4411ea4d524cff0bd08d9db1cdbf0ee127c3d831 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_7173: deab4e0bdf5a9366b67d0a44f478f3da3c9a943b @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_109714v6: 4411ea4d524cff0bd08d9db1cdbf0ee127c3d831 @ 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_109714v6/index.html

[-- Attachment #2: Type: text/html, Size: 42730 bytes --]

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers Mika Kahola
@ 2023-02-28  0:16   ` Matt Roper
  2023-02-28 13:25     ` Kahola, Mika
  2023-02-28 23:26   ` Lucas De Marchi
  1 sibling, 1 reply; 37+ messages in thread
From: Matt Roper @ 2023-02-28  0:16 UTC (permalink / raw)
  To: Mika Kahola; +Cc: intel-gfx

On Fri, Feb 24, 2023 at 12:13:37PM +0200, Mika Kahola wrote:
> Create a separate file to store registers for PICA chips
> C10 and C20.
> 
> v2: Rename file (Jani)
> 
> Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 136 ++++++++++++++++++
>  1 file changed, 136 insertions(+)
>  create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> new file mode 100644
> index 000000000000..d6b3709d3762
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> @@ -0,0 +1,136 @@
> +/* SPDX-License-Identifier: MIT
> + *
> + * Copyright © 2022 Intel Corporation
> + */
> +
> +#ifndef __INTEL_CX0_PHY_REGS_H__
> +#define __INTEL_CX0_PHY_REGS_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_LN0_USBC3		0x16F640
> +#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4		0x16F840
> +#define _XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)		(_PICK(port, \
> +							[PORT_A] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \
> +							[PORT_B] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \
> +							[PORT_TC1] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \
> +							[PORT_TC2] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2, \
> +							[PORT_TC3] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC3, \
> +							[PORT_TC4] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4) + ((lane) * 4))
> +
> +#define XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)		_MMIO(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane))
> +#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(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane) + 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

Drive-by comment:  is this constant correct?  On bspec 65450 it looks
like there's a table of different values (anywhere from 2 to 1380) that
get used depending on the old/new state combination.


Matt

> +#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_LN0_USBC3			0x16F600
> +#define _XELPDP_PORT_BUF_CTL1_LN0_USBC4			0x16F800
> +#define _XELPDP_PORT_BUF_CTL1(port)			(_PICK(port, \
> +							[PORT_A] = _XELPDP_PORT_BUF_CTL1_LN0_A, \
> +							[PORT_B] = _XELPDP_PORT_BUF_CTL1_LN0_B, \
> +							[PORT_TC1] = _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
> +							[PORT_TC2] = _XELPDP_PORT_BUF_CTL1_LN0_USBC2, \
> +							[PORT_TC3] = _XELPDP_PORT_BUF_CTL1_LN0_USBC3, \
> +							[PORT_TC4] = _XELPDP_PORT_BUF_CTL1_LN0_USBC4))
> +
> +#define XELPDP_PORT_BUF_CTL1(port)			_MMIO(_XELPDP_PORT_BUF_CTL1(port))
> +#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(_XELPDP_PORT_BUF_CTL1(port) + 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(_XELPDP_PORT_BUF_CTL1(port) + 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_USBC3			0x16F660
> +#define _XELPDP_PORT_CLOCK_CTL_USBC4			0x16F860
> +#define XELPDP_PORT_CLOCK_CTL(port)			_MMIO(_PICK(port, \
> +							[PORT_A] = _XELPDP_PORT_CLOCK_CTL_A, \
> +							[PORT_B] = _XELPDP_PORT_CLOCK_CTL_B, \
> +							[PORT_TC1] = _XELPDP_PORT_CLOCK_CTL_USBC1, \
> +							[PORT_TC2] = _XELPDP_PORT_CLOCK_CTL_USBC2, \
> +							[PORT_TC3] = _XELPDP_PORT_CLOCK_CTL_USBC3, \
> +							[PORT_TC4] = _XELPDP_PORT_CLOCK_CTL_USBC4))
> +
> +#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__ */
> -- 
> 2.34.1
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers
  2023-02-28  0:16   ` Matt Roper
@ 2023-02-28 13:25     ` Kahola, Mika
  0 siblings, 0 replies; 37+ messages in thread
From: Kahola, Mika @ 2023-02-28 13:25 UTC (permalink / raw)
  To: Roper, Matthew D; +Cc: intel-gfx

> -----Original Message-----
> From: Roper, Matthew D <matthew.d.roper@intel.com>
> Sent: Tuesday, February 28, 2023 2:17 AM
> To: Kahola, Mika <mika.kahola@intel.com>
> Cc: intel-gfx@lists.freedesktop.org; Sripada, Radhakrishna
> <radhakrishna.sripada@intel.com>; Sousa, Gustavo <gustavo.sousa@intel.com>
> Subject: Re: [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file
> for PICA registers
> 
> On Fri, Feb 24, 2023 at 12:13:37PM +0200, Mika Kahola wrote:
> > Create a separate file to store registers for PICA chips
> > C10 and C20.
> >
> > v2: Rename file (Jani)
> >
> > Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 136
> > ++++++++++++++++++
> >  1 file changed, 136 insertions(+)
> >  create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> > b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> > new file mode 100644
> > index 000000000000..d6b3709d3762
> > --- /dev/null
> > +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> > @@ -0,0 +1,136 @@
> > +/* SPDX-License-Identifier: MIT
> > + *
> > + * Copyright © 2022 Intel Corporation  */
> > +
> > +#ifndef __INTEL_CX0_PHY_REGS_H__
> > +#define __INTEL_CX0_PHY_REGS_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_LN0_USBC3
> 	0x16F640
> > +#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4
> 	0x16F840
> > +#define _XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)
> 	(_PICK(port, \
> > +							[PORT_A] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \
> > +							[PORT_B] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \
> > +							[PORT_TC1] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \
> > +							[PORT_TC2] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2, \
> > +							[PORT_TC3] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC3, \
> > +							[PORT_TC4] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4) + ((lane)
> > +* 4))
> > +
> > +#define XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)
> 	_MMIO(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane))
> > +#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(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane) + 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
> 
> Drive-by comment:  is this constant correct?  On bspec 65450 it looks like there's
> a table of different values (anywhere from 2 to 1380) that get used depending
> on the old/new state combination.

Your're right that there is a table for this. I think this needs to be sorted out and use the correct value for timeout in intel_cx0_powerdown_change_sequence()

Thanks for spotting this!

-Mika-
> 
> 
> Matt
> 
> > +#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_LN0_USBC3
> 	0x16F600
> > +#define _XELPDP_PORT_BUF_CTL1_LN0_USBC4
> 	0x16F800
> > +#define _XELPDP_PORT_BUF_CTL1(port)			(_PICK(port, \
> > +							[PORT_A] =
> _XELPDP_PORT_BUF_CTL1_LN0_A, \
> > +							[PORT_B] =
> _XELPDP_PORT_BUF_CTL1_LN0_B, \
> > +							[PORT_TC1] =
> _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
> > +							[PORT_TC2] =
> _XELPDP_PORT_BUF_CTL1_LN0_USBC2, \
> > +							[PORT_TC3] =
> _XELPDP_PORT_BUF_CTL1_LN0_USBC3, \
> > +							[PORT_TC4] =
> _XELPDP_PORT_BUF_CTL1_LN0_USBC4))
> > +
> > +#define XELPDP_PORT_BUF_CTL1(port)
> 	_MMIO(_XELPDP_PORT_BUF_CTL1(port))
> > +#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(_XELPDP_PORT_BUF_CTL1(port) + 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(_XELPDP_PORT_BUF_CTL1(port) + 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_USBC3			0x16F660
> > +#define _XELPDP_PORT_CLOCK_CTL_USBC4			0x16F860
> > +#define XELPDP_PORT_CLOCK_CTL(port)
> 	_MMIO(_PICK(port, \
> > +							[PORT_A] =
> _XELPDP_PORT_CLOCK_CTL_A, \
> > +							[PORT_B] =
> _XELPDP_PORT_CLOCK_CTL_B, \
> > +							[PORT_TC1] =
> _XELPDP_PORT_CLOCK_CTL_USBC1, \
> > +							[PORT_TC2] =
> _XELPDP_PORT_CLOCK_CTL_USBC2, \
> > +							[PORT_TC3] =
> _XELPDP_PORT_CLOCK_CTL_USBC3, \
> > +							[PORT_TC4] =
> _XELPDP_PORT_CLOCK_CTL_USBC4))
> > +
> > +#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__ */
> > --
> > 2.34.1
> >
> 
> --
> Matt Roper
> Graphics Software Engineer
> Linux GPU Platform Enablement
> Intel Corporation

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers Mika Kahola
  2023-02-28  0:16   ` Matt Roper
@ 2023-02-28 23:26   ` Lucas De Marchi
  2023-03-07 13:24     ` Kahola, Mika
  1 sibling, 1 reply; 37+ messages in thread
From: Lucas De Marchi @ 2023-02-28 23:26 UTC (permalink / raw)
  To: Mika Kahola; +Cc: intel-gfx

On Fri, Feb 24, 2023 at 12:13:37PM +0200, Mika Kahola wrote:
>Create a separate file to store registers for PICA chips
>C10 and C20.
>
>v2: Rename file (Jani)
>
>Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
>Signed-off-by: Mika Kahola <mika.kahola@intel.com>
>---
> .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 136 ++++++++++++++++++
> 1 file changed, 136 insertions(+)
> create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
>
>diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
>new file mode 100644
>index 000000000000..d6b3709d3762
>--- /dev/null
>+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
>@@ -0,0 +1,136 @@
>+/* SPDX-License-Identifier: MIT
>+ *
>+ * Copyright © 2022 Intel Corporation
>+ */
>+
>+#ifndef __INTEL_CX0_PHY_REGS_H__
>+#define __INTEL_CX0_PHY_REGS_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_LN0_USBC3		0x16F640
>+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4		0x16F840
>+#define _XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)		(_PICK(port, \
>+							[PORT_A] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \
>+							[PORT_B] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \
>+							[PORT_TC1] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \
>+							[PORT_TC2] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2, \
>+							[PORT_TC3] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC3, \
>+							[PORT_TC4] = _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4) + ((lane) * 4))
>+

stray newline

>+#define XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)		_MMIO(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane))


one of the reasons _PICK_EVEN_2RANGES() was added. We usually have 2
ranges for the ports due to the combo vs tc distinction.

#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))


>+#define  XELPDP_PORT_M2P_TRANSACTION_PENDING		REG_BIT(31)

           ^ wrong amount of spaces. See the example on top of i915_reg.h

here and everywhere in this file

>+#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(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane) + 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_LN0_USBC3			0x16F600
>+#define _XELPDP_PORT_BUF_CTL1_LN0_USBC4			0x16F800
>+#define _XELPDP_PORT_BUF_CTL1(port)			(_PICK(port, \
>+							[PORT_A] = _XELPDP_PORT_BUF_CTL1_LN0_A, \
>+							[PORT_B] = _XELPDP_PORT_BUF_CTL1_LN0_B, \
>+							[PORT_TC1] = _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
>+							[PORT_TC2] = _XELPDP_PORT_BUF_CTL1_LN0_USBC2, \
>+							[PORT_TC3] = _XELPDP_PORT_BUF_CTL1_LN0_USBC3, \
>+							[PORT_TC4] = _XELPDP_PORT_BUF_CTL1_LN0_USBC4))

same thing here, please use the new macro

>+
>+#define XELPDP_PORT_BUF_CTL1(port)			_MMIO(_XELPDP_PORT_BUF_CTL1(port))
>+#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(_XELPDP_PORT_BUF_CTL1(port) + 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(_XELPDP_PORT_BUF_CTL1(port) + 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_USBC3			0x16F660
>+#define _XELPDP_PORT_CLOCK_CTL_USBC4			0x16F860
>+#define XELPDP_PORT_CLOCK_CTL(port)			_MMIO(_PICK(port, \
>+							[PORT_A] = _XELPDP_PORT_CLOCK_CTL_A, \
>+							[PORT_B] = _XELPDP_PORT_CLOCK_CTL_B, \
>+							[PORT_TC1] = _XELPDP_PORT_CLOCK_CTL_USBC1, \
>+							[PORT_TC2] = _XELPDP_PORT_CLOCK_CTL_USBC2, \
>+							[PORT_TC3] = _XELPDP_PORT_CLOCK_CTL_USBC3, \
>+							[PORT_TC4] = _XELPDP_PORT_CLOCK_CTL_USBC4))

and here

Lucas De Marchi

>+
>+#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__ */
>-- 
>2.34.1
>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND Mika Kahola
@ 2023-03-01 22:50   ` Sripada, Radhakrishna
  2023-03-02  8:49   ` Murthy, Arun R
  1 sibling, 0 replies; 37+ messages in thread
From: Sripada, Radhakrishna @ 2023-03-01 22:50 UTC (permalink / raw)
  To: Kahola, Mika, intel-gfx; +Cc: De Marchi, Lucas, Roper, Matthew D

Hi Mika,

> -----Original Message-----
> From: Kahola, Mika <mika.kahola@intel.com>
> Sent: Friday, February 24, 2023 2:14 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: Kahola, Mika <mika.kahola@intel.com>; Atwood, Matthew S
> <matthew.s.atwood@intel.com>; Roper, Matthew D
> <matthew.d.roper@intel.com>; De Marchi, Lucas <lucas.demarchi@intel.com>;
> Sousa, Gustavo <gustavo.sousa@intel.com>; Souza, Jose
> <jose.souza@intel.com>; Sripada, Radhakrishna
> <radhakrishna.sripada@intel.com>
> Subject: [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND
> 
> 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
> Cc: Matt Atwood <matthew.s.atwood@intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> Link:
> https://patchwork.freedesktop.org/patch/msgid/20221014124740.774835-8-
> mika.kahola@intel.com
> ---
>  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(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_bw.c
> b/drivers/gpu/drm/i915/display/intel_bw.c
> index 202321ffbe2a..87c20bf52123 100644
> --- a/drivers/gpu/drm/i915/display/intel_bw.c
> +++ b/drivers/gpu/drm/i915/display/intel_bw.c
> @@ -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;
> diff --git a/drivers/gpu/drm/i915/display/intel_bw.h
> b/drivers/gpu/drm/i915/display/intel_bw.h
> index f20292143745..17fc0b61db04 100644
> --- a/drivers/gpu/drm/i915/display/intel_bw.h
> +++ b/drivers/gpu/drm/i915/display/intel_bw.h
> @@ -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,
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 8030968e7008..676bf512b9ce 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -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));
> @@ -6823,6 +6826,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);
> @@ -7439,6 +7446,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) {
> @@ -7551,6 +7559,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);
> 
> @@ -8282,6 +8291,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);
> 
> @@ -8508,6 +8518,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);
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> b/drivers/gpu/drm/i915/display/intel_display_power.c
> index 87c7e082a3b4..ce2386f12f8b 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -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"
> @@ -1081,6 +1082,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.
> @@ -1092,6 +1097,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)
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 6254aa977398..df3b6742d980 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -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;
> +
With all the display related structures moving to structure intel_display
do we still have to keep this in drm_i915_private?

>  	/**
>  	 * wq - Driver workqueue for GEM.
>  	 *
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 417c981e4968..a0d0dd84c429 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1911,6 +1911,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)
>  {
> @@ -1947,6 +1952,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");
>  }
> @@ -3313,7 +3330,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))
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 681a301bb65f..d4706ec3cbb7 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -5496,8 +5496,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)
> @@ -5560,6 +5562,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)
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index ddf004e5bb4b..8bed6406c66e 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -25,6 +25,11 @@
>   *
>   */
> 

Bulk of the watermarks and dbuf related code moved away from intel_pm.c. Jani has a series
to cleanup intel_pm.c. With the changed code and the direction I wonder if intel_pm.c is the right
place to house pmdemand changes.

-Radhakrishna(RK) Sripada
> +#include <linux/bitops.h>
> +
> +#include "display/intel_bw.h"
> +#include "display/intel_cdclk.h"
> +#include "display/intel_cx0_phy.h"
>  #include "display/intel_de.h"
>  #include "display/intel_display.h"
>  #include "display/intel_display_trace.h"
> @@ -124,6 +129,287 @@ static void glk_init_clock_gating(struct
> drm_i915_private *dev_priv)
>  		   PWM1_GATING_DIS | PWM2_GATING_DIS);
>  }
> 
> +static struct intel_global_state *intel_pmdemand_duplicate_state(struct
> intel_global_obj *obj)
> +{
> +	struct intel_pmdemand_state *pmdmnd_state;
> +
> +	pmdmnd_state = kmemdup(obj->state, sizeof(*pmdmnd_state),
> GFP_KERNEL);
> +	if (!pmdmnd_state)
> +		return NULL;
> +
> +	return &pmdmnd_state->base;
> +}
> +
> +static void intel_pmdemand_destroy_state(struct intel_global_obj *obj,
> +					 struct intel_global_state *state)
> +{
> +	kfree(state);
> +}
> +
> +static const struct intel_global_state_funcs intel_pmdemand_funcs = {
> +	.atomic_duplicate_state = intel_pmdemand_duplicate_state,
> +	.atomic_destroy_state = intel_pmdemand_destroy_state,
> +};
> +
> +struct intel_pmdemand_state *
> +intel_atomic_get_pmdemand_state(struct intel_atomic_state *state)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> +	struct intel_global_state *pmdemand_state;
> +
> +	pmdemand_state = intel_atomic_get_global_obj_state(state,
> &dev_priv->pmdemand.obj);
> +	if (IS_ERR(pmdemand_state))
> +		return ERR_CAST(pmdemand_state);
> +
> +	return to_intel_pmdemand_state(pmdemand_state);
> +}
> +
> +int intel_pmdemand_init(struct drm_i915_private *dev_priv)
> +{
> +	struct intel_pmdemand_state *pmdemand_state;
> +
> +	pmdemand_state = kzalloc(sizeof(*pmdemand_state), GFP_KERNEL);
> +	if (!pmdemand_state)
> +		return -ENOMEM;
> +
> +	intel_atomic_global_obj_init(dev_priv, &dev_priv->pmdemand.obj,
> +				     &pmdemand_state->base,
> &intel_pmdemand_funcs);
> +
> +	return 0;
> +}
> +
> +void intel_init_pmdemand(struct drm_i915_private *dev_priv)
> +{
> +	mutex_init(&dev_priv->pmdemand.lock);
> +	init_waitqueue_head(&dev_priv->pmdemand.waitqueue);
> +}
> +
> +int intel_pmdemand_atomic_check(struct intel_atomic_state *state)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> +	struct intel_pmdemand_state *new_pmdemand_state = NULL;
> +	struct intel_crtc_state *old_crtc_state, *new_crtc_state;
> +	struct intel_crtc *crtc;
> +	struct intel_encoder *encoder;
> +	struct intel_bw_state *new_bw_state;
> +	const struct intel_dbuf_state *new_dbuf_state;
> +	const struct intel_cdclk_state *new_cdclk_state;
> +	int port_clock = 0;
> +	unsigned int data_rate;
> +	enum phy phy;
> +	int i, ret;
> +
> +	if (DISPLAY_VER(dev_priv) < 14)
> +		return 0;
> +
> +	new_pmdemand_state = intel_atomic_get_pmdemand_state(state);
> +	if (IS_ERR(new_pmdemand_state))
> +		return PTR_ERR(new_pmdemand_state);
> +
> +	ret = intel_atomic_lock_global_state(&new_pmdemand_state->base);
> +	if (ret)
> +		return ret;
> +
> +	/* Punit figures out the voltage index based on bandwidth*/
> +	new_bw_state = intel_atomic_get_bw_state(state);
> +	if (IS_ERR(new_bw_state))
> +		return PTR_ERR(new_bw_state);
> +
> +	/* firmware will calculate the qclck_gc_index, requirement is set to 0 */
> +	new_pmdemand_state->qclk_gv_index = 0;
> +
> +	data_rate = intel_bw_data_rate(dev_priv, new_bw_state);
> +	/* To MBs then to multiples of 100MBs */
> +	data_rate = DIV_ROUND_UP(data_rate, 1000);
> +	data_rate = DIV_ROUND_UP(data_rate, 100);
> +	new_pmdemand_state->qclk_gv_bw = data_rate;
> +
> +	new_dbuf_state = intel_atomic_get_dbuf_state(state);
> +	if (IS_ERR(new_dbuf_state))
> +		return PTR_ERR(new_dbuf_state);
> +
> +	i = hweight8(new_dbuf_state->active_pipes);
> +	new_pmdemand_state->active_pipes = min(i, 3);
> +
> +	new_cdclk_state = intel_atomic_get_cdclk_state(state);
> +	if (IS_ERR(new_cdclk_state))
> +		return PTR_ERR(new_cdclk_state);
> +
> +	new_pmdemand_state->voltage_index = new_cdclk_state-
> >logical.voltage_level;
> +	/* KHz to MHz */
> +	new_pmdemand_state->cdclk_freq_mhz =
> DIV_ROUND_UP(new_cdclk_state->logical.cdclk, 1000);
> +
> +	new_pmdemand_state->active_phys_plls_mask = 0;
> +
> +	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> new_crtc_state, i) {
> +		if (!new_crtc_state->hw.active)
> +			continue;
> +
> +		encoder = intel_get_crtc_new_encoder(state, new_crtc_state);
> +		if (!encoder)
> +			continue;
> +
> +		phy = intel_port_to_phy(dev_priv, encoder->port);
> +
> +		if (intel_is_c10phy(dev_priv, phy))
> +			new_pmdemand_state->active_phys_plls_mask |=
> BIT(phy);
> +
> +		port_clock = max(port_clock, new_crtc_state->port_clock);
> +	}
> +
> +	/* To MHz */
> +	new_pmdemand_state->ddiclk_freq_mhz =
> DIV_ROUND_UP(port_clock, 1000);
> +
> +	/*
> +	 * Setting scalers to max as it can not be calculated during flips and
> +	 * fastsets without taking global states locks.
> +	 */
> +	new_pmdemand_state->scalers = 7;
> +
> +	return 0;
> +}
> +
> +static bool intel_pmdemand_check_prev_transaction(struct drm_i915_private
> *dev_priv)
> +{
> +	return !((intel_de_read(dev_priv,
> XELPDP_INITIATE_PMDEMAND_REQUEST(1)) &
> XELPDP_PMDEMAND_REQ_ENABLE) ||
> +		(intel_de_read(dev_priv, GEN12_DCPR_STATUS_1) &
> XELPDP_PMDEMAND_INFLIGHT_STATUS));
> +}
> +
> +static bool intel_pmdemand_req_complete(struct drm_i915_private *dev_priv)
> +{
> +	return !(intel_de_read(dev_priv,
> XELPDP_INITIATE_PMDEMAND_REQUEST(1)) &
> XELPDP_PMDEMAND_REQ_ENABLE);
> +}
> +
> +static int intel_pmdemand_wait(struct drm_i915_private *dev_priv)
> +{
> +	DEFINE_WAIT(wait);
> +	int ret;
> +	const unsigned int timeout_ms = 10;
> +
> +	add_wait_queue(&dev_priv->pmdemand.waitqueue, &wait);
> +
> +	ret = wait_event_timeout(dev_priv->pmdemand.waitqueue,
> +				 intel_pmdemand_req_complete(dev_priv),
> +				 msecs_to_jiffies_timeout(timeout_ms));
> +	if (ret < 0)
> +		drm_err(&dev_priv->drm,
> +			"timed out waiting for Punit PM Demand Response\n");
> +
> +	remove_wait_queue(&dev_priv->pmdemand.waitqueue, &wait);
> +
> +	return ret;
> +}
> +
> +/* Required to be programmed during Display Init Sequences. */
> +void intel_program_dbuf_pmdemand(struct drm_i915_private *dev_priv,
> +				 u8 dbuf_slices)
> +{
> +	mutex_lock(&dev_priv->pmdemand.lock);
> +	if (drm_WARN_ON(&dev_priv->drm,
> +			!intel_pmdemand_check_prev_transaction(dev_priv)))
> +		goto unlock;
> +
> +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(0),
> +		     XELPDP_PMDEMAND_DBUFS_MASK,
> +		     XELPDP_PMDEMAND_DBUFS(hweight32(dbuf_slices)));
> +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1), 0,
> +		     XELPDP_PMDEMAND_REQ_ENABLE);
> +
> +	intel_pmdemand_wait(dev_priv);
> +unlock:
> +	mutex_unlock(&dev_priv->pmdemand.lock);
> +}
> +
> +static void intel_program_pmdemand(struct drm_i915_private *dev_priv,
> +				   const struct intel_pmdemand_state *new,
> +				   const struct intel_pmdemand_state *old)
> +{
> +	u32 val, tmp;
> +
> +#define UPDATE_PMDEMAND_VAL(val, F, f) do {            \
> +	val &= (~(XELPDP_PMDEMAND_##F##_MASK));         \
> +	val |= (XELPDP_PMDEMAND_##F((u32)(old ? max(old->f, new->f) : new-
> >f))); \
> +} while (0)
> +
> +	mutex_lock(&dev_priv->pmdemand.lock);
> +	if (drm_WARN_ON(&dev_priv->drm,
> +			!intel_pmdemand_check_prev_transaction(dev_priv)))
> +		goto unlock;
> +
> +	/*
> +	 * TODO: Update programming PM Demand for
> +	 * PHYS, PLLS, DDI_CLKFREQ, SCALARS
> +	 */
> +	val = intel_de_read(dev_priv,
> XELPDP_INITIATE_PMDEMAND_REQUEST(0));
> +	UPDATE_PMDEMAND_VAL(val, QCLK_GV_INDEX, qclk_gv_index);
> +	UPDATE_PMDEMAND_VAL(val, QCLK_GV_BW, qclk_gv_bw);
> +	UPDATE_PMDEMAND_VAL(val, VOLTAGE_INDEX, voltage_index);
> +	UPDATE_PMDEMAND_VAL(val, PIPES, active_pipes);
> +	UPDATE_PMDEMAND_VAL(val, DBUFS, dbufs);
> +	tmp = hweight32(new->active_phys_plls_mask);
> +	if (old)
> +		tmp = max(tmp, hweight32(old->active_phys_plls_mask));
> +	val |= XELPDP_PMDEMAND_PHYS(tmp);
> +
> +	intel_de_write(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(0),
> val);
> +
> +	val = intel_de_read(dev_priv,
> XELPDP_INITIATE_PMDEMAND_REQUEST(1));
> +	UPDATE_PMDEMAND_VAL(val, CDCLK_FREQ, cdclk_freq_mhz);
> +	UPDATE_PMDEMAND_VAL(val, DDICLK_FREQ, ddiclk_freq_mhz);
> +	UPDATE_PMDEMAND_VAL(val, SCALERS, scalers);
> +	/*
> +	 * Active_PLLs starts with 1 because of CDCLK PLL.
> +	 * TODO: Missing to account genlock filter when it gets used.
> +	 */
> +	val |= XELPDP_PMDEMAND_PLLS(tmp + 1);
> +
> +	intel_de_write(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1),
> val);
> +
> +#undef UPDATE_PM_DEMAND_VAL
> +
> +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1), 0,
> XELPDP_PMDEMAND_REQ_ENABLE);
> +
> +	intel_pmdemand_wait(dev_priv);
> +unlock:
> +	mutex_unlock(&dev_priv->pmdemand.lock);
> +}
> +
> +void intel_pmdemand_pre_plane_update(struct intel_atomic_state *state)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> +	const struct intel_pmdemand_state *new_pmdmnd_state =
> +		intel_atomic_get_new_pmdemand_state(state);
> +	const struct intel_pmdemand_state *old_pmdmnd_state =
> +		intel_atomic_get_old_pmdemand_state(state);
> +
> +	if (DISPLAY_VER(dev_priv) < 14)
> +		return;
> +
> +	if (!new_pmdmnd_state ||
> +	    memcmp(new_pmdmnd_state, old_pmdmnd_state,
> sizeof(*new_pmdmnd_state)) == 0)
> +		return;
> +
> +	intel_program_pmdemand(dev_priv, new_pmdmnd_state,
> old_pmdmnd_state);
> +}
> +
> +void intel_pmdemand_post_plane_update(struct intel_atomic_state *state)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> +	const struct intel_pmdemand_state *new_pmdmnd_state =
> +		intel_atomic_get_new_pmdemand_state(state);
> +	const struct intel_pmdemand_state *old_pmdmnd_state =
> +		intel_atomic_get_old_pmdemand_state(state);
> +
> +	if (DISPLAY_VER(dev_priv) < 14)
> +		return;
> +
> +	if (!new_pmdmnd_state ||
> +	    memcmp(new_pmdmnd_state, old_pmdmnd_state,
> sizeof(*new_pmdmnd_state)) == 0)
> +		return;
> +
> +	intel_program_pmdemand(dev_priv, new_pmdmnd_state, NULL);
> +}
> +
>  static void ibx_init_clock_gating(struct drm_i915_private *dev_priv)
>  {
>  	/*
> diff --git a/drivers/gpu/drm/i915/intel_pm.h b/drivers/gpu/drm/i915/intel_pm.h
> index eab60df0c6bb..db5763ace31a 100644
> --- a/drivers/gpu/drm/i915/intel_pm.h
> +++ b/drivers/gpu/drm/i915/intel_pm.h
> @@ -8,13 +8,48 @@
> 
>  #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_suspend_hw(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);
>  void intel_pm_setup(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(stat
> e, &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(sta
> te, &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__ */
> --
> 2.34.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND Mika Kahola
  2023-03-01 22:50   ` Sripada, Radhakrishna
@ 2023-03-02  8:49   ` Murthy, Arun R
  2023-03-02  9:40     ` Kahola, Mika
  1 sibling, 1 reply; 37+ messages in thread
From: Murthy, Arun R @ 2023-03-02  8:49 UTC (permalink / raw)
  To: Kahola, Mika, intel-gfx; +Cc: Roper, Matthew D, De Marchi, Lucas

> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Mika
> Kahola
> Sent: Friday, February 24, 2023 3:44 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: De Marchi, Lucas <lucas.demarchi@intel.com>; Roper, Matthew D
> <matthew.d.roper@intel.com>
> Subject: [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM
> DEMAND
> 
> 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
> Cc: Matt Atwood <matthew.s.atwood@intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> Link:
> https://patchwork.freedesktop.org/patch/msgid/20221014124740.774835-8-
> mika.kahola@intel.com
> ---
>  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(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_bw.c
> b/drivers/gpu/drm/i915/display/intel_bw.c
> index 202321ffbe2a..87c20bf52123 100644
> --- a/drivers/gpu/drm/i915/display/intel_bw.c
> +++ b/drivers/gpu/drm/i915/display/intel_bw.c
> @@ -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;
> diff --git a/drivers/gpu/drm/i915/display/intel_bw.h
> b/drivers/gpu/drm/i915/display/intel_bw.h
> index f20292143745..17fc0b61db04 100644
> --- a/drivers/gpu/drm/i915/display/intel_bw.h
> +++ b/drivers/gpu/drm/i915/display/intel_bw.h
> @@ -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, diff --git
> a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 8030968e7008..676bf512b9ce 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -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)); @@ -
> 6823,6 +6826,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); @@ -7439,6 +7446,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) {
> @@ -7551,6 +7559,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);
> 
> @@ -8282,6 +8291,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);
> 
> @@ -8508,6 +8518,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);
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> b/drivers/gpu/drm/i915/display/intel_display_power.c
> index 87c7e082a3b4..ce2386f12f8b 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -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"
> @@ -1081,6 +1082,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)
Other places where pmdemand functions are called, this check is not added, instead this check is being done inside the pmdemand function. So it would be good to main it the same way here as well. Just call the program_dbuf_pmdemant function and inside this have a check for DISPLAY_VER 14 and return if not.

> +		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.
> @@ -1092,6 +1097,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) diff
> --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 6254aa977398..df3b6742d980 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -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.
>  	 *
> diff --git a/drivers/gpu/drm/i915/i915_irq.c
> b/drivers/gpu/drm/i915/i915_irq.c index 417c981e4968..a0d0dd84c429
> 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1911,6 +1911,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)  {
> @@ -1947,6 +1952,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");  } @@ -3313,7 +3330,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)) diff --git
> a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 681a301bb65f..d4706ec3cbb7 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -5496,8 +5496,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)
> @@ -5560,6 +5562,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)
> diff --git a/drivers/gpu/drm/i915/intel_pm.c
> b/drivers/gpu/drm/i915/intel_pm.c index ddf004e5bb4b..8bed6406c66e
> 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -25,6 +25,11 @@
>   *
>   */
> 
> +#include <linux/bitops.h>
> +
> +#include "display/intel_bw.h"
> +#include "display/intel_cdclk.h"
> +#include "display/intel_cx0_phy.h"
>  #include "display/intel_de.h"
>  #include "display/intel_display.h"
>  #include "display/intel_display_trace.h"
> @@ -124,6 +129,287 @@ static void glk_init_clock_gating(struct
> drm_i915_private *dev_priv)
>  		   PWM1_GATING_DIS | PWM2_GATING_DIS);  }
> 
> +static struct intel_global_state *intel_pmdemand_duplicate_state(struct
> +intel_global_obj *obj) {
> +	struct intel_pmdemand_state *pmdmnd_state;
> +
> +	pmdmnd_state = kmemdup(obj->state, sizeof(*pmdmnd_state),
> GFP_KERNEL);
> +	if (!pmdmnd_state)
> +		return NULL;
> +
> +	return &pmdmnd_state->base;
> +}
> +
> +static void intel_pmdemand_destroy_state(struct intel_global_obj *obj,
> +					 struct intel_global_state *state) {
> +	kfree(state);
> +}
> +
> +static const struct intel_global_state_funcs intel_pmdemand_funcs = {
> +	.atomic_duplicate_state = intel_pmdemand_duplicate_state,
> +	.atomic_destroy_state = intel_pmdemand_destroy_state, };
> +
> +struct intel_pmdemand_state *
> +intel_atomic_get_pmdemand_state(struct intel_atomic_state *state) {
> +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> +	struct intel_global_state *pmdemand_state;
> +
> +	pmdemand_state = intel_atomic_get_global_obj_state(state,
> &dev_priv->pmdemand.obj);
> +	if (IS_ERR(pmdemand_state))
> +		return ERR_CAST(pmdemand_state);
> +
> +	return to_intel_pmdemand_state(pmdemand_state);
> +}
> +
> +int intel_pmdemand_init(struct drm_i915_private *dev_priv) {
> +	struct intel_pmdemand_state *pmdemand_state;
> +
> +	pmdemand_state = kzalloc(sizeof(*pmdemand_state), GFP_KERNEL);
> +	if (!pmdemand_state)
> +		return -ENOMEM;
> +
> +	intel_atomic_global_obj_init(dev_priv, &dev_priv->pmdemand.obj,
> +				     &pmdemand_state->base,
> &intel_pmdemand_funcs);
> +
> +	return 0;
> +}
> +
> +void intel_init_pmdemand(struct drm_i915_private *dev_priv) {
> +	mutex_init(&dev_priv->pmdemand.lock);
> +	init_waitqueue_head(&dev_priv->pmdemand.waitqueue);
> +}
> +
> +int intel_pmdemand_atomic_check(struct intel_atomic_state *state) {
> +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> +	struct intel_pmdemand_state *new_pmdemand_state = NULL;
> +	struct intel_crtc_state *old_crtc_state, *new_crtc_state;
> +	struct intel_crtc *crtc;
> +	struct intel_encoder *encoder;
> +	struct intel_bw_state *new_bw_state;
> +	const struct intel_dbuf_state *new_dbuf_state;
> +	const struct intel_cdclk_state *new_cdclk_state;
> +	int port_clock = 0;
> +	unsigned int data_rate;
> +	enum phy phy;
> +	int i, ret;
> +
> +	if (DISPLAY_VER(dev_priv) < 14)
> +		return 0;
> +
> +	new_pmdemand_state = intel_atomic_get_pmdemand_state(state);
> +	if (IS_ERR(new_pmdemand_state))
> +		return PTR_ERR(new_pmdemand_state);
> +
> +	ret = intel_atomic_lock_global_state(&new_pmdemand_state-
> >base);
> +	if (ret)
> +		return ret;
> +
> +	/* Punit figures out the voltage index based on bandwidth*/
> +	new_bw_state = intel_atomic_get_bw_state(state);
> +	if (IS_ERR(new_bw_state))
> +		return PTR_ERR(new_bw_state);
> +
> +	/* firmware will calculate the qclck_gc_index, requirement is set to 0
> */
> +	new_pmdemand_state->qclk_gv_index = 0;
> +
> +	data_rate = intel_bw_data_rate(dev_priv, new_bw_state);
> +	/* To MBs then to multiples of 100MBs */
> +	data_rate = DIV_ROUND_UP(data_rate, 1000);
> +	data_rate = DIV_ROUND_UP(data_rate, 100);
> +	new_pmdemand_state->qclk_gv_bw = data_rate;
> +
> +	new_dbuf_state = intel_atomic_get_dbuf_state(state);
> +	if (IS_ERR(new_dbuf_state))
> +		return PTR_ERR(new_dbuf_state);
> +
> +	i = hweight8(new_dbuf_state->active_pipes);
> +	new_pmdemand_state->active_pipes = min(i, 3);
> +
> +	new_cdclk_state = intel_atomic_get_cdclk_state(state);
> +	if (IS_ERR(new_cdclk_state))
> +		return PTR_ERR(new_cdclk_state);
> +
> +	new_pmdemand_state->voltage_index = new_cdclk_state-
> >logical.voltage_level;
> +	/* KHz to MHz */
> +	new_pmdemand_state->cdclk_freq_mhz =
> +DIV_ROUND_UP(new_cdclk_state->logical.cdclk, 1000);
> +
> +	new_pmdemand_state->active_phys_plls_mask = 0;
> +
> +	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> new_crtc_state, i) {
> +		if (!new_crtc_state->hw.active)
> +			continue;
> +
> +		encoder = intel_get_crtc_new_encoder(state,
> new_crtc_state);
> +		if (!encoder)
> +			continue;
> +
> +		phy = intel_port_to_phy(dev_priv, encoder->port);
> +
> +		if (intel_is_c10phy(dev_priv, phy))
> +			new_pmdemand_state->active_phys_plls_mask |=
> BIT(phy);
Is this not required for C20 phy?

Thanks and Regards,
Arun R Murthy
--------------------
> +
> +		port_clock = max(port_clock, new_crtc_state->port_clock);
> +	}
> +
> +	/* To MHz */
> +	new_pmdemand_state->ddiclk_freq_mhz =
> DIV_ROUND_UP(port_clock, 1000);
> +
> +	/*
> +	 * Setting scalers to max as it can not be calculated during flips and
> +	 * fastsets without taking global states locks.
> +	 */
> +	new_pmdemand_state->scalers = 7;
> +
> +	return 0;
> +}
> +
> +static bool intel_pmdemand_check_prev_transaction(struct
> +drm_i915_private *dev_priv) {
> +	return !((intel_de_read(dev_priv,
> XELPDP_INITIATE_PMDEMAND_REQUEST(1)) &
> XELPDP_PMDEMAND_REQ_ENABLE) ||
> +		(intel_de_read(dev_priv, GEN12_DCPR_STATUS_1) &
> +XELPDP_PMDEMAND_INFLIGHT_STATUS));
> +}
> +
> +static bool intel_pmdemand_req_complete(struct drm_i915_private
> +*dev_priv) {
> +	return !(intel_de_read(dev_priv,
> XELPDP_INITIATE_PMDEMAND_REQUEST(1))
> +& XELPDP_PMDEMAND_REQ_ENABLE); }
> +
> +static int intel_pmdemand_wait(struct drm_i915_private *dev_priv) {
> +	DEFINE_WAIT(wait);
> +	int ret;
> +	const unsigned int timeout_ms = 10;
> +
> +	add_wait_queue(&dev_priv->pmdemand.waitqueue, &wait);
> +
> +	ret = wait_event_timeout(dev_priv->pmdemand.waitqueue,
> +				 intel_pmdemand_req_complete(dev_priv),
> +				 msecs_to_jiffies_timeout(timeout_ms));
> +	if (ret < 0)
> +		drm_err(&dev_priv->drm,
> +			"timed out waiting for Punit PM Demand
> Response\n");
> +
> +	remove_wait_queue(&dev_priv->pmdemand.waitqueue, &wait);
> +
> +	return ret;
> +}
> +
> +/* Required to be programmed during Display Init Sequences. */ void
> +intel_program_dbuf_pmdemand(struct drm_i915_private *dev_priv,
> +				 u8 dbuf_slices)
> +{
> +	mutex_lock(&dev_priv->pmdemand.lock);
> +	if (drm_WARN_ON(&dev_priv->drm,
> +
> 	!intel_pmdemand_check_prev_transaction(dev_priv)))
> +		goto unlock;
> +
> +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(0),
> +		     XELPDP_PMDEMAND_DBUFS_MASK,
> +		     XELPDP_PMDEMAND_DBUFS(hweight32(dbuf_slices)));
> +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1),
> 0,
> +		     XELPDP_PMDEMAND_REQ_ENABLE);
> +
> +	intel_pmdemand_wait(dev_priv);
> +unlock:
> +	mutex_unlock(&dev_priv->pmdemand.lock);
> +}
> +
> +static void intel_program_pmdemand(struct drm_i915_private *dev_priv,
> +				   const struct intel_pmdemand_state *new,
> +				   const struct intel_pmdemand_state *old) {
> +	u32 val, tmp;
> +
> +#define UPDATE_PMDEMAND_VAL(val, F, f) do {            \
> +	val &= (~(XELPDP_PMDEMAND_##F##_MASK));         \
> +	val |= (XELPDP_PMDEMAND_##F((u32)(old ? max(old->f, new->f) :
> +new->f))); \ } while (0)
> +
> +	mutex_lock(&dev_priv->pmdemand.lock);
> +	if (drm_WARN_ON(&dev_priv->drm,
> +
> 	!intel_pmdemand_check_prev_transaction(dev_priv)))
> +		goto unlock;
> +
> +	/*
> +	 * TODO: Update programming PM Demand for
> +	 * PHYS, PLLS, DDI_CLKFREQ, SCALARS
> +	 */
Why this TODO, I see the updates being done below.

> +	val = intel_de_read(dev_priv,
> XELPDP_INITIATE_PMDEMAND_REQUEST(0));
> +	UPDATE_PMDEMAND_VAL(val, QCLK_GV_INDEX, qclk_gv_index);
> +	UPDATE_PMDEMAND_VAL(val, QCLK_GV_BW, qclk_gv_bw);
> +	UPDATE_PMDEMAND_VAL(val, VOLTAGE_INDEX, voltage_index);
> +	UPDATE_PMDEMAND_VAL(val, PIPES, active_pipes);
> +	UPDATE_PMDEMAND_VAL(val, DBUFS, dbufs);
> +	tmp = hweight32(new->active_phys_plls_mask);
> +	if (old)
> +		tmp = max(tmp, hweight32(old->active_phys_plls_mask));
> +	val |= XELPDP_PMDEMAND_PHYS(tmp);
> +
> +	intel_de_write(dev_priv,
> XELPDP_INITIATE_PMDEMAND_REQUEST(0), val);
> +
> +	val = intel_de_read(dev_priv,
> XELPDP_INITIATE_PMDEMAND_REQUEST(1));
> +	UPDATE_PMDEMAND_VAL(val, CDCLK_FREQ, cdclk_freq_mhz);
> +	UPDATE_PMDEMAND_VAL(val, DDICLK_FREQ, ddiclk_freq_mhz);
> +	UPDATE_PMDEMAND_VAL(val, SCALERS, scalers);
> +	/*
> +	 * Active_PLLs starts with 1 because of CDCLK PLL.
> +	 * TODO: Missing to account genlock filter when it gets used.
> +	 */
> +	val |= XELPDP_PMDEMAND_PLLS(tmp + 1);
> +
> +	intel_de_write(dev_priv,
> XELPDP_INITIATE_PMDEMAND_REQUEST(1), val);
> +
> +#undef UPDATE_PM_DEMAND_VAL
> +
> +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1),
> 0,
> +XELPDP_PMDEMAND_REQ_ENABLE);
> +
> +	intel_pmdemand_wait(dev_priv);
> +unlock:
> +	mutex_unlock(&dev_priv->pmdemand.lock);
> +}
> +
> +void intel_pmdemand_pre_plane_update(struct intel_atomic_state *state)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> +	const struct intel_pmdemand_state *new_pmdmnd_state =
> +		intel_atomic_get_new_pmdemand_state(state);
> +	const struct intel_pmdemand_state *old_pmdmnd_state =
> +		intel_atomic_get_old_pmdemand_state(state);
> +
> +	if (DISPLAY_VER(dev_priv) < 14)
> +		return;
> +
> +	if (!new_pmdmnd_state ||
> +	    memcmp(new_pmdmnd_state, old_pmdmnd_state,
> sizeof(*new_pmdmnd_state)) == 0)
> +		return;
> +
> +	intel_program_pmdemand(dev_priv, new_pmdmnd_state,
> old_pmdmnd_state);
> +}
> +
> +void intel_pmdemand_post_plane_update(struct intel_atomic_state *state)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> +	const struct intel_pmdemand_state *new_pmdmnd_state =
> +		intel_atomic_get_new_pmdemand_state(state);
> +	const struct intel_pmdemand_state *old_pmdmnd_state =
> +		intel_atomic_get_old_pmdemand_state(state);
> +
> +	if (DISPLAY_VER(dev_priv) < 14)
> +		return;
> +
> +	if (!new_pmdmnd_state ||
> +	    memcmp(new_pmdmnd_state, old_pmdmnd_state,
> sizeof(*new_pmdmnd_state)) == 0)
> +		return;
> +
> +	intel_program_pmdemand(dev_priv, new_pmdmnd_state, NULL); }
> +
>  static void ibx_init_clock_gating(struct drm_i915_private *dev_priv)  {
>  	/*
> diff --git a/drivers/gpu/drm/i915/intel_pm.h
> b/drivers/gpu/drm/i915/intel_pm.h index eab60df0c6bb..db5763ace31a
> 100644
> --- a/drivers/gpu/drm/i915/intel_pm.h
> +++ b/drivers/gpu/drm/i915/intel_pm.h
> @@ -8,13 +8,48 @@
> 
>  #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_suspend_hw(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);  void
> intel_pm_setup(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(st
> ate,
> +&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(s
> tate,
> +&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__ */
> --
> 2.34.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND
  2023-03-02  8:49   ` Murthy, Arun R
@ 2023-03-02  9:40     ` Kahola, Mika
  2023-03-02 18:07       ` Sripada, Radhakrishna
  0 siblings, 1 reply; 37+ messages in thread
From: Kahola, Mika @ 2023-03-02  9:40 UTC (permalink / raw)
  To: Murthy, Arun R, intel-gfx; +Cc: Roper, Matthew D, De Marchi, Lucas

> -----Original Message-----
> From: Murthy, Arun R <arun.r.murthy@intel.com>
> Sent: Thursday, March 2, 2023 10:50 AM
> To: Kahola, Mika <mika.kahola@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: De Marchi, Lucas <lucas.demarchi@intel.com>; Roper, Matthew D
> <matthew.d.roper@intel.com>
> Subject: RE: [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM
> DEMAND
> 
> > -----Original Message-----
> > From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of
> > Mika Kahola
> > Sent: Friday, February 24, 2023 3:44 PM
> > To: intel-gfx@lists.freedesktop.org
> > Cc: De Marchi, Lucas <lucas.demarchi@intel.com>; Roper, Matthew D
> > <matthew.d.roper@intel.com>
> > Subject: [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM
> > DEMAND
> >
> > 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
> > Cc: Matt Atwood <matthew.s.atwood@intel.com>
> > Cc: Matt Roper <matthew.d.roper@intel.com>
> > Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> > Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> > Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> > Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> > Link:
> > https://patchwork.freedesktop.org/patch/msgid/20221014124740.774835-8-
> > mika.kahola@intel.com
> > ---
> >  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(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_bw.c
> > b/drivers/gpu/drm/i915/display/intel_bw.c
> > index 202321ffbe2a..87c20bf52123 100644
> > --- a/drivers/gpu/drm/i915/display/intel_bw.c
> > +++ b/drivers/gpu/drm/i915/display/intel_bw.c
> > @@ -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;
> > diff --git a/drivers/gpu/drm/i915/display/intel_bw.h
> > b/drivers/gpu/drm/i915/display/intel_bw.h
> > index f20292143745..17fc0b61db04 100644
> > --- a/drivers/gpu/drm/i915/display/intel_bw.h
> > +++ b/drivers/gpu/drm/i915/display/intel_bw.h
> > @@ -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, diff
> > --git a/drivers/gpu/drm/i915/display/intel_display.c
> > b/drivers/gpu/drm/i915/display/intel_display.c
> > index 8030968e7008..676bf512b9ce 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -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)); @@ -
> > 6823,6 +6826,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); @@ -7439,6 +7446,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) {
> > @@ -7551,6 +7559,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);
> >
> > @@ -8282,6 +8291,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);
> >
> > @@ -8508,6 +8518,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);
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> > b/drivers/gpu/drm/i915/display/intel_display_power.c
> > index 87c7e082a3b4..ce2386f12f8b 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> > @@ -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"
> > @@ -1081,6 +1082,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)
> Other places where pmdemand functions are called, this check is not added,
> instead this check is being done inside the pmdemand function. So it would be
> good to main it the same way here as well. Just call the
> program_dbuf_pmdemant function and inside this have a check for
> DISPLAY_VER 14 and return if not.

Ok. I will move this check into intel_program_dbuf_pmdemand() function.

> 
> > +		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.
> > @@ -1092,6 +1097,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) diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > b/drivers/gpu/drm/i915/i915_drv.h index 6254aa977398..df3b6742d980
> > 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -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.
> >  	 *
> > diff --git a/drivers/gpu/drm/i915/i915_irq.c
> > b/drivers/gpu/drm/i915/i915_irq.c index 417c981e4968..a0d0dd84c429
> > 100644
> > --- a/drivers/gpu/drm/i915/i915_irq.c
> > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > @@ -1911,6 +1911,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)
> > { @@ -1947,6 +1952,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");  }
> @@
> > -3313,7 +3330,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)) diff --git
> > a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > index 681a301bb65f..d4706ec3cbb7 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -5496,8 +5496,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)
> > @@ -5560,6 +5562,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)
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c
> > b/drivers/gpu/drm/i915/intel_pm.c index ddf004e5bb4b..8bed6406c66e
> > 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -25,6 +25,11 @@
> >   *
> >   */
> >
> > +#include <linux/bitops.h>
> > +
> > +#include "display/intel_bw.h"
> > +#include "display/intel_cdclk.h"
> > +#include "display/intel_cx0_phy.h"
> >  #include "display/intel_de.h"
> >  #include "display/intel_display.h"
> >  #include "display/intel_display_trace.h"
> > @@ -124,6 +129,287 @@ static void glk_init_clock_gating(struct
> > drm_i915_private *dev_priv)
> >  		   PWM1_GATING_DIS | PWM2_GATING_DIS);  }
> >
> > +static struct intel_global_state
> > +*intel_pmdemand_duplicate_state(struct
> > +intel_global_obj *obj) {
> > +	struct intel_pmdemand_state *pmdmnd_state;
> > +
> > +	pmdmnd_state = kmemdup(obj->state, sizeof(*pmdmnd_state),
> > GFP_KERNEL);
> > +	if (!pmdmnd_state)
> > +		return NULL;
> > +
> > +	return &pmdmnd_state->base;
> > +}
> > +
> > +static void intel_pmdemand_destroy_state(struct intel_global_obj *obj,
> > +					 struct intel_global_state *state) {
> > +	kfree(state);
> > +}
> > +
> > +static const struct intel_global_state_funcs intel_pmdemand_funcs = {
> > +	.atomic_duplicate_state = intel_pmdemand_duplicate_state,
> > +	.atomic_destroy_state = intel_pmdemand_destroy_state, };
> > +
> > +struct intel_pmdemand_state *
> > +intel_atomic_get_pmdemand_state(struct intel_atomic_state *state) {
> > +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> > +	struct intel_global_state *pmdemand_state;
> > +
> > +	pmdemand_state = intel_atomic_get_global_obj_state(state,
> > &dev_priv->pmdemand.obj);
> > +	if (IS_ERR(pmdemand_state))
> > +		return ERR_CAST(pmdemand_state);
> > +
> > +	return to_intel_pmdemand_state(pmdemand_state);
> > +}
> > +
> > +int intel_pmdemand_init(struct drm_i915_private *dev_priv) {
> > +	struct intel_pmdemand_state *pmdemand_state;
> > +
> > +	pmdemand_state = kzalloc(sizeof(*pmdemand_state), GFP_KERNEL);
> > +	if (!pmdemand_state)
> > +		return -ENOMEM;
> > +
> > +	intel_atomic_global_obj_init(dev_priv, &dev_priv->pmdemand.obj,
> > +				     &pmdemand_state->base,
> > &intel_pmdemand_funcs);
> > +
> > +	return 0;
> > +}
> > +
> > +void intel_init_pmdemand(struct drm_i915_private *dev_priv) {
> > +	mutex_init(&dev_priv->pmdemand.lock);
> > +	init_waitqueue_head(&dev_priv->pmdemand.waitqueue);
> > +}
> > +
> > +int intel_pmdemand_atomic_check(struct intel_atomic_state *state) {
> > +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> > +	struct intel_pmdemand_state *new_pmdemand_state = NULL;
> > +	struct intel_crtc_state *old_crtc_state, *new_crtc_state;
> > +	struct intel_crtc *crtc;
> > +	struct intel_encoder *encoder;
> > +	struct intel_bw_state *new_bw_state;
> > +	const struct intel_dbuf_state *new_dbuf_state;
> > +	const struct intel_cdclk_state *new_cdclk_state;
> > +	int port_clock = 0;
> > +	unsigned int data_rate;
> > +	enum phy phy;
> > +	int i, ret;
> > +
> > +	if (DISPLAY_VER(dev_priv) < 14)
> > +		return 0;
> > +
> > +	new_pmdemand_state = intel_atomic_get_pmdemand_state(state);
> > +	if (IS_ERR(new_pmdemand_state))
> > +		return PTR_ERR(new_pmdemand_state);
> > +
> > +	ret = intel_atomic_lock_global_state(&new_pmdemand_state-
> > >base);
> > +	if (ret)
> > +		return ret;
> > +
> > +	/* Punit figures out the voltage index based on bandwidth*/
> > +	new_bw_state = intel_atomic_get_bw_state(state);
> > +	if (IS_ERR(new_bw_state))
> > +		return PTR_ERR(new_bw_state);
> > +
> > +	/* firmware will calculate the qclck_gc_index, requirement is set to
> > +0
> > */
> > +	new_pmdemand_state->qclk_gv_index = 0;
> > +
> > +	data_rate = intel_bw_data_rate(dev_priv, new_bw_state);
> > +	/* To MBs then to multiples of 100MBs */
> > +	data_rate = DIV_ROUND_UP(data_rate, 1000);
> > +	data_rate = DIV_ROUND_UP(data_rate, 100);
> > +	new_pmdemand_state->qclk_gv_bw = data_rate;
> > +
> > +	new_dbuf_state = intel_atomic_get_dbuf_state(state);
> > +	if (IS_ERR(new_dbuf_state))
> > +		return PTR_ERR(new_dbuf_state);
> > +
> > +	i = hweight8(new_dbuf_state->active_pipes);
> > +	new_pmdemand_state->active_pipes = min(i, 3);
> > +
> > +	new_cdclk_state = intel_atomic_get_cdclk_state(state);
> > +	if (IS_ERR(new_cdclk_state))
> > +		return PTR_ERR(new_cdclk_state);
> > +
> > +	new_pmdemand_state->voltage_index = new_cdclk_state-
> > >logical.voltage_level;
> > +	/* KHz to MHz */
> > +	new_pmdemand_state->cdclk_freq_mhz =
> > +DIV_ROUND_UP(new_cdclk_state->logical.cdclk, 1000);
> > +
> > +	new_pmdemand_state->active_phys_plls_mask = 0;
> > +
> > +	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> > new_crtc_state, i) {
> > +		if (!new_crtc_state->hw.active)
> > +			continue;
> > +
> > +		encoder = intel_get_crtc_new_encoder(state,
> > new_crtc_state);
> > +		if (!encoder)
> > +			continue;
> > +
> > +		phy = intel_port_to_phy(dev_priv, encoder->port);
> > +
> > +		if (intel_is_c10phy(dev_priv, phy))
> > +			new_pmdemand_state->active_phys_plls_mask |=
> > BIT(phy);
> Is this not required for C20 phy?
I think this would be required for C20 as well. I will check this but I think this intel_is_c10phy() check could be removed.

Thanks for the review & comments!

-Mika-

> 
> Thanks and Regards,
> Arun R Murthy
> --------------------
> > +
> > +		port_clock = max(port_clock, new_crtc_state->port_clock);
> > +	}
> > +
> > +	/* To MHz */
> > +	new_pmdemand_state->ddiclk_freq_mhz =
> > DIV_ROUND_UP(port_clock, 1000);
> > +
> > +	/*
> > +	 * Setting scalers to max as it can not be calculated during flips and
> > +	 * fastsets without taking global states locks.
> > +	 */
> > +	new_pmdemand_state->scalers = 7;
> > +
> > +	return 0;
> > +}
> > +
> > +static bool intel_pmdemand_check_prev_transaction(struct
> > +drm_i915_private *dev_priv) {
> > +	return !((intel_de_read(dev_priv,
> > XELPDP_INITIATE_PMDEMAND_REQUEST(1)) &
> > XELPDP_PMDEMAND_REQ_ENABLE) ||
> > +		(intel_de_read(dev_priv, GEN12_DCPR_STATUS_1) &
> > +XELPDP_PMDEMAND_INFLIGHT_STATUS));
> > +}
> > +
> > +static bool intel_pmdemand_req_complete(struct drm_i915_private
> > +*dev_priv) {
> > +	return !(intel_de_read(dev_priv,
> > XELPDP_INITIATE_PMDEMAND_REQUEST(1))
> > +& XELPDP_PMDEMAND_REQ_ENABLE); }
> > +
> > +static int intel_pmdemand_wait(struct drm_i915_private *dev_priv) {
> > +	DEFINE_WAIT(wait);
> > +	int ret;
> > +	const unsigned int timeout_ms = 10;
> > +
> > +	add_wait_queue(&dev_priv->pmdemand.waitqueue, &wait);
> > +
> > +	ret = wait_event_timeout(dev_priv->pmdemand.waitqueue,
> > +				 intel_pmdemand_req_complete(dev_priv),
> > +				 msecs_to_jiffies_timeout(timeout_ms));
> > +	if (ret < 0)
> > +		drm_err(&dev_priv->drm,
> > +			"timed out waiting for Punit PM Demand
> > Response\n");
> > +
> > +	remove_wait_queue(&dev_priv->pmdemand.waitqueue, &wait);
> > +
> > +	return ret;
> > +}
> > +
> > +/* Required to be programmed during Display Init Sequences. */ void
> > +intel_program_dbuf_pmdemand(struct drm_i915_private *dev_priv,
> > +				 u8 dbuf_slices)
> > +{
> > +	mutex_lock(&dev_priv->pmdemand.lock);
> > +	if (drm_WARN_ON(&dev_priv->drm,
> > +
> > 	!intel_pmdemand_check_prev_transaction(dev_priv)))
> > +		goto unlock;
> > +
> > +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(0),
> > +		     XELPDP_PMDEMAND_DBUFS_MASK,
> > +		     XELPDP_PMDEMAND_DBUFS(hweight32(dbuf_slices)));
> > +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1),
> > 0,
> > +		     XELPDP_PMDEMAND_REQ_ENABLE);
> > +
> > +	intel_pmdemand_wait(dev_priv);
> > +unlock:
> > +	mutex_unlock(&dev_priv->pmdemand.lock);
> > +}
> > +
> > +static void intel_program_pmdemand(struct drm_i915_private *dev_priv,
> > +				   const struct intel_pmdemand_state *new,
> > +				   const struct intel_pmdemand_state *old) {
> > +	u32 val, tmp;
> > +
> > +#define UPDATE_PMDEMAND_VAL(val, F, f) do {            \
> > +	val &= (~(XELPDP_PMDEMAND_##F##_MASK));         \
> > +	val |= (XELPDP_PMDEMAND_##F((u32)(old ? max(old->f, new->f) :
> > +new->f))); \ } while (0)
> > +
> > +	mutex_lock(&dev_priv->pmdemand.lock);
> > +	if (drm_WARN_ON(&dev_priv->drm,
> > +
> > 	!intel_pmdemand_check_prev_transaction(dev_priv)))
> > +		goto unlock;
> > +
> > +	/*
> > +	 * TODO: Update programming PM Demand for
> > +	 * PHYS, PLLS, DDI_CLKFREQ, SCALARS
> > +	 */
> Why this TODO, I see the updates being done below.
> 
> > +	val = intel_de_read(dev_priv,
> > XELPDP_INITIATE_PMDEMAND_REQUEST(0));
> > +	UPDATE_PMDEMAND_VAL(val, QCLK_GV_INDEX, qclk_gv_index);
> > +	UPDATE_PMDEMAND_VAL(val, QCLK_GV_BW, qclk_gv_bw);
> > +	UPDATE_PMDEMAND_VAL(val, VOLTAGE_INDEX, voltage_index);
> > +	UPDATE_PMDEMAND_VAL(val, PIPES, active_pipes);
> > +	UPDATE_PMDEMAND_VAL(val, DBUFS, dbufs);
> > +	tmp = hweight32(new->active_phys_plls_mask);
> > +	if (old)
> > +		tmp = max(tmp, hweight32(old->active_phys_plls_mask));
> > +	val |= XELPDP_PMDEMAND_PHYS(tmp);
> > +
> > +	intel_de_write(dev_priv,
> > XELPDP_INITIATE_PMDEMAND_REQUEST(0), val);
> > +
> > +	val = intel_de_read(dev_priv,
> > XELPDP_INITIATE_PMDEMAND_REQUEST(1));
> > +	UPDATE_PMDEMAND_VAL(val, CDCLK_FREQ, cdclk_freq_mhz);
> > +	UPDATE_PMDEMAND_VAL(val, DDICLK_FREQ, ddiclk_freq_mhz);
> > +	UPDATE_PMDEMAND_VAL(val, SCALERS, scalers);
> > +	/*
> > +	 * Active_PLLs starts with 1 because of CDCLK PLL.
> > +	 * TODO: Missing to account genlock filter when it gets used.
> > +	 */
> > +	val |= XELPDP_PMDEMAND_PLLS(tmp + 1);
> > +
> > +	intel_de_write(dev_priv,
> > XELPDP_INITIATE_PMDEMAND_REQUEST(1), val);
> > +
> > +#undef UPDATE_PM_DEMAND_VAL
> > +
> > +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1),
> > 0,
> > +XELPDP_PMDEMAND_REQ_ENABLE);
> > +
> > +	intel_pmdemand_wait(dev_priv);
> > +unlock:
> > +	mutex_unlock(&dev_priv->pmdemand.lock);
> > +}
> > +
> > +void intel_pmdemand_pre_plane_update(struct intel_atomic_state
> > +*state) {
> > +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> > +	const struct intel_pmdemand_state *new_pmdmnd_state =
> > +		intel_atomic_get_new_pmdemand_state(state);
> > +	const struct intel_pmdemand_state *old_pmdmnd_state =
> > +		intel_atomic_get_old_pmdemand_state(state);
> > +
> > +	if (DISPLAY_VER(dev_priv) < 14)
> > +		return;
> > +
> > +	if (!new_pmdmnd_state ||
> > +	    memcmp(new_pmdmnd_state, old_pmdmnd_state,
> > sizeof(*new_pmdmnd_state)) == 0)
> > +		return;
> > +
> > +	intel_program_pmdemand(dev_priv, new_pmdmnd_state,
> > old_pmdmnd_state);
> > +}
> > +
> > +void intel_pmdemand_post_plane_update(struct intel_atomic_state
> > +*state) {
> > +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> > +	const struct intel_pmdemand_state *new_pmdmnd_state =
> > +		intel_atomic_get_new_pmdemand_state(state);
> > +	const struct intel_pmdemand_state *old_pmdmnd_state =
> > +		intel_atomic_get_old_pmdemand_state(state);
> > +
> > +	if (DISPLAY_VER(dev_priv) < 14)
> > +		return;
> > +
> > +	if (!new_pmdmnd_state ||
> > +	    memcmp(new_pmdmnd_state, old_pmdmnd_state,
> > sizeof(*new_pmdmnd_state)) == 0)
> > +		return;
> > +
> > +	intel_program_pmdemand(dev_priv, new_pmdmnd_state, NULL); }
> > +
> >  static void ibx_init_clock_gating(struct drm_i915_private *dev_priv)  {
> >  	/*
> > diff --git a/drivers/gpu/drm/i915/intel_pm.h
> > b/drivers/gpu/drm/i915/intel_pm.h index eab60df0c6bb..db5763ace31a
> > 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.h
> > +++ b/drivers/gpu/drm/i915/intel_pm.h
> > @@ -8,13 +8,48 @@
> >
> >  #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_suspend_hw(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);  void intel_pm_setup(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(st
> > ate,
> > +&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(s
> > tate,
> > +&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__ */
> > --
> > 2.34.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND
  2023-03-02  9:40     ` Kahola, Mika
@ 2023-03-02 18:07       ` Sripada, Radhakrishna
  0 siblings, 0 replies; 37+ messages in thread
From: Sripada, Radhakrishna @ 2023-03-02 18:07 UTC (permalink / raw)
  To: Kahola, Mika, Murthy, Arun R, intel-gfx
  Cc: De Marchi, Lucas, Roper, Matthew D



> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Kahola,
> Mika
> Sent: Thursday, March 2, 2023 1:40 AM
> To: Murthy, Arun R <arun.r.murthy@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: Roper, Matthew D <matthew.d.roper@intel.com>; De Marchi, Lucas
> <lucas.demarchi@intel.com>
> Subject: Re: [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM
> DEMAND
> 
> > -----Original Message-----
> > From: Murthy, Arun R <arun.r.murthy@intel.com>
> > Sent: Thursday, March 2, 2023 10:50 AM
> > To: Kahola, Mika <mika.kahola@intel.com>; intel-gfx@lists.freedesktop.org
> > Cc: De Marchi, Lucas <lucas.demarchi@intel.com>; Roper, Matthew D
> > <matthew.d.roper@intel.com>
> > Subject: RE: [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM
> > DEMAND
> >
> > > -----Original Message-----
> > > From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of
> > > Mika Kahola
> > > Sent: Friday, February 24, 2023 3:44 PM
> > > To: intel-gfx@lists.freedesktop.org
> > > Cc: De Marchi, Lucas <lucas.demarchi@intel.com>; Roper, Matthew D
> > > <matthew.d.roper@intel.com>
> > > Subject: [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM
> > > DEMAND
> > >
> > > 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
> > > Cc: Matt Atwood <matthew.s.atwood@intel.com>
> > > Cc: Matt Roper <matthew.d.roper@intel.com>
> > > Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> > > Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> > > Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> > > Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> > > Link:
> > > https://patchwork.freedesktop.org/patch/msgid/20221014124740.774835-
> 8-
> > > mika.kahola@intel.com
> > > ---
> > >  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(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/display/intel_bw.c
> > > b/drivers/gpu/drm/i915/display/intel_bw.c
> > > index 202321ffbe2a..87c20bf52123 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_bw.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_bw.c
> > > @@ -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;
> > > diff --git a/drivers/gpu/drm/i915/display/intel_bw.h
> > > b/drivers/gpu/drm/i915/display/intel_bw.h
> > > index f20292143745..17fc0b61db04 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_bw.h
> > > +++ b/drivers/gpu/drm/i915/display/intel_bw.h
> > > @@ -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, diff
> > > --git a/drivers/gpu/drm/i915/display/intel_display.c
> > > b/drivers/gpu/drm/i915/display/intel_display.c
> > > index 8030968e7008..676bf512b9ce 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > > @@ -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)); @@ -
> > > 6823,6 +6826,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); @@ -7439,6 +7446,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) {
> > > @@ -7551,6 +7559,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);
> > >
> > > @@ -8282,6 +8291,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);
> > >
> > > @@ -8508,6 +8518,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);
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> > > b/drivers/gpu/drm/i915/display/intel_display_power.c
> > > index 87c7e082a3b4..ce2386f12f8b 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> > > @@ -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"
> > > @@ -1081,6 +1082,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)
> > Other places where pmdemand functions are called, this check is not added,
> > instead this check is being done inside the pmdemand function. So it would be
> > good to main it the same way here as well. Just call the
> > program_dbuf_pmdemant function and inside this have a check for
> > DISPLAY_VER 14 and return if not.
> 
> Ok. I will move this check into intel_program_dbuf_pmdemand() function.
> 
> >
> > > +		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.
> > > @@ -1092,6 +1097,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) diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > > b/drivers/gpu/drm/i915/i915_drv.h index 6254aa977398..df3b6742d980
> > > 100644
> > > --- a/drivers/gpu/drm/i915/i915_drv.h
> > > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > > @@ -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.
> > >  	 *
> > > diff --git a/drivers/gpu/drm/i915/i915_irq.c
> > > b/drivers/gpu/drm/i915/i915_irq.c index 417c981e4968..a0d0dd84c429
> > > 100644
> > > --- a/drivers/gpu/drm/i915/i915_irq.c
> > > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > > @@ -1911,6 +1911,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)
> > > { @@ -1947,6 +1952,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");  }
> > @@
> > > -3313,7 +3330,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)) diff --git
> > > a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > > index 681a301bb65f..d4706ec3cbb7 100644
> > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > @@ -5496,8 +5496,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)
> > > @@ -5560,6 +5562,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)
> > > diff --git a/drivers/gpu/drm/i915/intel_pm.c
> > > b/drivers/gpu/drm/i915/intel_pm.c index ddf004e5bb4b..8bed6406c66e
> > > 100644
> > > --- a/drivers/gpu/drm/i915/intel_pm.c
> > > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > > @@ -25,6 +25,11 @@
> > >   *
> > >   */
> > >
> > > +#include <linux/bitops.h>
> > > +
> > > +#include "display/intel_bw.h"
> > > +#include "display/intel_cdclk.h"
> > > +#include "display/intel_cx0_phy.h"
> > >  #include "display/intel_de.h"
> > >  #include "display/intel_display.h"
> > >  #include "display/intel_display_trace.h"
> > > @@ -124,6 +129,287 @@ static void glk_init_clock_gating(struct
> > > drm_i915_private *dev_priv)
> > >  		   PWM1_GATING_DIS | PWM2_GATING_DIS);  }
> > >
> > > +static struct intel_global_state
> > > +*intel_pmdemand_duplicate_state(struct
> > > +intel_global_obj *obj) {
> > > +	struct intel_pmdemand_state *pmdmnd_state;
> > > +
> > > +	pmdmnd_state = kmemdup(obj->state, sizeof(*pmdmnd_state),
> > > GFP_KERNEL);
> > > +	if (!pmdmnd_state)
> > > +		return NULL;
> > > +
> > > +	return &pmdmnd_state->base;
> > > +}
> > > +
> > > +static void intel_pmdemand_destroy_state(struct intel_global_obj *obj,
> > > +					 struct intel_global_state *state) {
> > > +	kfree(state);
> > > +}
> > > +
> > > +static const struct intel_global_state_funcs intel_pmdemand_funcs = {
> > > +	.atomic_duplicate_state = intel_pmdemand_duplicate_state,
> > > +	.atomic_destroy_state = intel_pmdemand_destroy_state, };
> > > +
> > > +struct intel_pmdemand_state *
> > > +intel_atomic_get_pmdemand_state(struct intel_atomic_state *state) {
> > > +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> > > +	struct intel_global_state *pmdemand_state;
> > > +
> > > +	pmdemand_state = intel_atomic_get_global_obj_state(state,
> > > &dev_priv->pmdemand.obj);
> > > +	if (IS_ERR(pmdemand_state))
> > > +		return ERR_CAST(pmdemand_state);
> > > +
> > > +	return to_intel_pmdemand_state(pmdemand_state);
> > > +}
> > > +
> > > +int intel_pmdemand_init(struct drm_i915_private *dev_priv) {
> > > +	struct intel_pmdemand_state *pmdemand_state;
> > > +
> > > +	pmdemand_state = kzalloc(sizeof(*pmdemand_state), GFP_KERNEL);
> > > +	if (!pmdemand_state)
> > > +		return -ENOMEM;
> > > +
> > > +	intel_atomic_global_obj_init(dev_priv, &dev_priv->pmdemand.obj,
> > > +				     &pmdemand_state->base,
> > > &intel_pmdemand_funcs);
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +void intel_init_pmdemand(struct drm_i915_private *dev_priv) {
> > > +	mutex_init(&dev_priv->pmdemand.lock);
> > > +	init_waitqueue_head(&dev_priv->pmdemand.waitqueue);
> > > +}
> > > +
> > > +int intel_pmdemand_atomic_check(struct intel_atomic_state *state) {
> > > +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> > > +	struct intel_pmdemand_state *new_pmdemand_state = NULL;
> > > +	struct intel_crtc_state *old_crtc_state, *new_crtc_state;
> > > +	struct intel_crtc *crtc;
> > > +	struct intel_encoder *encoder;
> > > +	struct intel_bw_state *new_bw_state;
> > > +	const struct intel_dbuf_state *new_dbuf_state;
> > > +	const struct intel_cdclk_state *new_cdclk_state;
> > > +	int port_clock = 0;
> > > +	unsigned int data_rate;
> > > +	enum phy phy;
> > > +	int i, ret;
> > > +
> > > +	if (DISPLAY_VER(dev_priv) < 14)
> > > +		return 0;
> > > +
> > > +	new_pmdemand_state = intel_atomic_get_pmdemand_state(state);
> > > +	if (IS_ERR(new_pmdemand_state))
> > > +		return PTR_ERR(new_pmdemand_state);
> > > +
> > > +	ret = intel_atomic_lock_global_state(&new_pmdemand_state-
> > > >base);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	/* Punit figures out the voltage index based on bandwidth*/
> > > +	new_bw_state = intel_atomic_get_bw_state(state);
> > > +	if (IS_ERR(new_bw_state))
> > > +		return PTR_ERR(new_bw_state);
> > > +
> > > +	/* firmware will calculate the qclck_gc_index, requirement is set to
> > > +0
> > > */
> > > +	new_pmdemand_state->qclk_gv_index = 0;
> > > +
> > > +	data_rate = intel_bw_data_rate(dev_priv, new_bw_state);
> > > +	/* To MBs then to multiples of 100MBs */
> > > +	data_rate = DIV_ROUND_UP(data_rate, 1000);
> > > +	data_rate = DIV_ROUND_UP(data_rate, 100);
> > > +	new_pmdemand_state->qclk_gv_bw = data_rate;
> > > +
> > > +	new_dbuf_state = intel_atomic_get_dbuf_state(state);
> > > +	if (IS_ERR(new_dbuf_state))
> > > +		return PTR_ERR(new_dbuf_state);
> > > +
> > > +	i = hweight8(new_dbuf_state->active_pipes);
> > > +	new_pmdemand_state->active_pipes = min(i, 3);
> > > +
> > > +	new_cdclk_state = intel_atomic_get_cdclk_state(state);
> > > +	if (IS_ERR(new_cdclk_state))
> > > +		return PTR_ERR(new_cdclk_state);
> > > +
> > > +	new_pmdemand_state->voltage_index = new_cdclk_state-
> > > >logical.voltage_level;
> > > +	/* KHz to MHz */
> > > +	new_pmdemand_state->cdclk_freq_mhz =
> > > +DIV_ROUND_UP(new_cdclk_state->logical.cdclk, 1000);
> > > +
> > > +	new_pmdemand_state->active_phys_plls_mask = 0;
> > > +
> > > +	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> > > new_crtc_state, i) {
> > > +		if (!new_crtc_state->hw.active)
> > > +			continue;
> > > +
> > > +		encoder = intel_get_crtc_new_encoder(state,
> > > new_crtc_state);
> > > +		if (!encoder)
> > > +			continue;
> > > +
> > > +		phy = intel_port_to_phy(dev_priv, encoder->port);
> > > +
> > > +		if (intel_is_c10phy(dev_priv, phy))
> > > +			new_pmdemand_state->active_phys_plls_mask |=
> > > BIT(phy);
> > Is this not required for C20 phy?
> I think this would be required for C20 as well. I will check this but I think this
> intel_is_c10phy() check could be removed.

Bspec: 64995 Mentions that while programming active phy's and pll's type-c/tbt phy/pll's
should not be counted. 

-Radhakrishna(RK) Sripada
> 
> Thanks for the review & comments!
> 
> -Mika-
> 
> >
> > Thanks and Regards,
> > Arun R Murthy
> > --------------------
> > > +
> > > +		port_clock = max(port_clock, new_crtc_state->port_clock);
> > > +	}
> > > +
> > > +	/* To MHz */
> > > +	new_pmdemand_state->ddiclk_freq_mhz =
> > > DIV_ROUND_UP(port_clock, 1000);
> > > +
> > > +	/*
> > > +	 * Setting scalers to max as it can not be calculated during flips and
> > > +	 * fastsets without taking global states locks.
> > > +	 */
> > > +	new_pmdemand_state->scalers = 7;
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static bool intel_pmdemand_check_prev_transaction(struct
> > > +drm_i915_private *dev_priv) {
> > > +	return !((intel_de_read(dev_priv,
> > > XELPDP_INITIATE_PMDEMAND_REQUEST(1)) &
> > > XELPDP_PMDEMAND_REQ_ENABLE) ||
> > > +		(intel_de_read(dev_priv, GEN12_DCPR_STATUS_1) &
> > > +XELPDP_PMDEMAND_INFLIGHT_STATUS));
> > > +}
> > > +
> > > +static bool intel_pmdemand_req_complete(struct drm_i915_private
> > > +*dev_priv) {
> > > +	return !(intel_de_read(dev_priv,
> > > XELPDP_INITIATE_PMDEMAND_REQUEST(1))
> > > +& XELPDP_PMDEMAND_REQ_ENABLE); }
> > > +
> > > +static int intel_pmdemand_wait(struct drm_i915_private *dev_priv) {
> > > +	DEFINE_WAIT(wait);
> > > +	int ret;
> > > +	const unsigned int timeout_ms = 10;
> > > +
> > > +	add_wait_queue(&dev_priv->pmdemand.waitqueue, &wait);
> > > +
> > > +	ret = wait_event_timeout(dev_priv->pmdemand.waitqueue,
> > > +				 intel_pmdemand_req_complete(dev_priv),
> > > +				 msecs_to_jiffies_timeout(timeout_ms));
> > > +	if (ret < 0)
> > > +		drm_err(&dev_priv->drm,
> > > +			"timed out waiting for Punit PM Demand
> > > Response\n");
> > > +
> > > +	remove_wait_queue(&dev_priv->pmdemand.waitqueue, &wait);
> > > +
> > > +	return ret;
> > > +}
> > > +
> > > +/* Required to be programmed during Display Init Sequences. */ void
> > > +intel_program_dbuf_pmdemand(struct drm_i915_private *dev_priv,
> > > +				 u8 dbuf_slices)
> > > +{
> > > +	mutex_lock(&dev_priv->pmdemand.lock);
> > > +	if (drm_WARN_ON(&dev_priv->drm,
> > > +
> > > 	!intel_pmdemand_check_prev_transaction(dev_priv)))
> > > +		goto unlock;
> > > +
> > > +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(0),
> > > +		     XELPDP_PMDEMAND_DBUFS_MASK,
> > > +		     XELPDP_PMDEMAND_DBUFS(hweight32(dbuf_slices)));
> > > +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1),
> > > 0,
> > > +		     XELPDP_PMDEMAND_REQ_ENABLE);
> > > +
> > > +	intel_pmdemand_wait(dev_priv);
> > > +unlock:
> > > +	mutex_unlock(&dev_priv->pmdemand.lock);
> > > +}
> > > +
> > > +static void intel_program_pmdemand(struct drm_i915_private *dev_priv,
> > > +				   const struct intel_pmdemand_state *new,
> > > +				   const struct intel_pmdemand_state *old) {
> > > +	u32 val, tmp;
> > > +
> > > +#define UPDATE_PMDEMAND_VAL(val, F, f) do {            \
> > > +	val &= (~(XELPDP_PMDEMAND_##F##_MASK));         \
> > > +	val |= (XELPDP_PMDEMAND_##F((u32)(old ? max(old->f, new->f) :
> > > +new->f))); \ } while (0)
> > > +
> > > +	mutex_lock(&dev_priv->pmdemand.lock);
> > > +	if (drm_WARN_ON(&dev_priv->drm,
> > > +
> > > 	!intel_pmdemand_check_prev_transaction(dev_priv)))
> > > +		goto unlock;
> > > +
> > > +	/*
> > > +	 * TODO: Update programming PM Demand for
> > > +	 * PHYS, PLLS, DDI_CLKFREQ, SCALARS
> > > +	 */
> > Why this TODO, I see the updates being done below.
> >
> > > +	val = intel_de_read(dev_priv,
> > > XELPDP_INITIATE_PMDEMAND_REQUEST(0));
> > > +	UPDATE_PMDEMAND_VAL(val, QCLK_GV_INDEX, qclk_gv_index);
> > > +	UPDATE_PMDEMAND_VAL(val, QCLK_GV_BW, qclk_gv_bw);
> > > +	UPDATE_PMDEMAND_VAL(val, VOLTAGE_INDEX, voltage_index);
> > > +	UPDATE_PMDEMAND_VAL(val, PIPES, active_pipes);
> > > +	UPDATE_PMDEMAND_VAL(val, DBUFS, dbufs);
> > > +	tmp = hweight32(new->active_phys_plls_mask);
> > > +	if (old)
> > > +		tmp = max(tmp, hweight32(old->active_phys_plls_mask));
> > > +	val |= XELPDP_PMDEMAND_PHYS(tmp);
> > > +
> > > +	intel_de_write(dev_priv,
> > > XELPDP_INITIATE_PMDEMAND_REQUEST(0), val);
> > > +
> > > +	val = intel_de_read(dev_priv,
> > > XELPDP_INITIATE_PMDEMAND_REQUEST(1));
> > > +	UPDATE_PMDEMAND_VAL(val, CDCLK_FREQ, cdclk_freq_mhz);
> > > +	UPDATE_PMDEMAND_VAL(val, DDICLK_FREQ, ddiclk_freq_mhz);
> > > +	UPDATE_PMDEMAND_VAL(val, SCALERS, scalers);
> > > +	/*
> > > +	 * Active_PLLs starts with 1 because of CDCLK PLL.
> > > +	 * TODO: Missing to account genlock filter when it gets used.
> > > +	 */
> > > +	val |= XELPDP_PMDEMAND_PLLS(tmp + 1);
> > > +
> > > +	intel_de_write(dev_priv,
> > > XELPDP_INITIATE_PMDEMAND_REQUEST(1), val);
> > > +
> > > +#undef UPDATE_PM_DEMAND_VAL
> > > +
> > > +	intel_de_rmw(dev_priv, XELPDP_INITIATE_PMDEMAND_REQUEST(1),
> > > 0,
> > > +XELPDP_PMDEMAND_REQ_ENABLE);
> > > +
> > > +	intel_pmdemand_wait(dev_priv);
> > > +unlock:
> > > +	mutex_unlock(&dev_priv->pmdemand.lock);
> > > +}
> > > +
> > > +void intel_pmdemand_pre_plane_update(struct intel_atomic_state
> > > +*state) {
> > > +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> > > +	const struct intel_pmdemand_state *new_pmdmnd_state =
> > > +		intel_atomic_get_new_pmdemand_state(state);
> > > +	const struct intel_pmdemand_state *old_pmdmnd_state =
> > > +		intel_atomic_get_old_pmdemand_state(state);
> > > +
> > > +	if (DISPLAY_VER(dev_priv) < 14)
> > > +		return;
> > > +
> > > +	if (!new_pmdmnd_state ||
> > > +	    memcmp(new_pmdmnd_state, old_pmdmnd_state,
> > > sizeof(*new_pmdmnd_state)) == 0)
> > > +		return;
> > > +
> > > +	intel_program_pmdemand(dev_priv, new_pmdmnd_state,
> > > old_pmdmnd_state);
> > > +}
> > > +
> > > +void intel_pmdemand_post_plane_update(struct intel_atomic_state
> > > +*state) {
> > > +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> > > +	const struct intel_pmdemand_state *new_pmdmnd_state =
> > > +		intel_atomic_get_new_pmdemand_state(state);
> > > +	const struct intel_pmdemand_state *old_pmdmnd_state =
> > > +		intel_atomic_get_old_pmdemand_state(state);
> > > +
> > > +	if (DISPLAY_VER(dev_priv) < 14)
> > > +		return;
> > > +
> > > +	if (!new_pmdmnd_state ||
> > > +	    memcmp(new_pmdmnd_state, old_pmdmnd_state,
> > > sizeof(*new_pmdmnd_state)) == 0)
> > > +		return;
> > > +
> > > +	intel_program_pmdemand(dev_priv, new_pmdmnd_state, NULL); }
> > > +
> > >  static void ibx_init_clock_gating(struct drm_i915_private *dev_priv)  {
> > >  	/*
> > > diff --git a/drivers/gpu/drm/i915/intel_pm.h
> > > b/drivers/gpu/drm/i915/intel_pm.h index eab60df0c6bb..db5763ace31a
> > > 100644
> > > --- a/drivers/gpu/drm/i915/intel_pm.h
> > > +++ b/drivers/gpu/drm/i915/intel_pm.h
> > > @@ -8,13 +8,48 @@
> > >
> > >  #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_suspend_hw(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);  void intel_pm_setup(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(st
> > > ate,
> > > +&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(s
> > > tate,
> > > +&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__ */
> > > --
> > > 2.34.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Intel-gfx] [PATCH v4 04/22] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming
  2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 04/22] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming Mika Kahola
@ 2023-03-02 21:42   ` Sripada, Radhakrishna
  0 siblings, 0 replies; 37+ messages in thread
From: Sripada, Radhakrishna @ 2023-03-02 21:42 UTC (permalink / raw)
  To: Kahola, Mika, intel-gfx

Hi Mika,

> -----Original Message-----
> From: Kahola, Mika <mika.kahola@intel.com>
> Sent: Friday, February 24, 2023 2:14 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: Sripada, Radhakrishna <radhakrishna.sripada@intel.com>; Deak, Imre
> <imre.deak@intel.com>; Shankar, Uma <uma.shankar@intel.com>; Kahola,
> Mika <mika.kahola@intel.com>
> Subject: [PATCH v4 04/22] drm/i915/mtl: Add Support for C10 PHY message bus
> and pll programming
> 
> From: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> 
> 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)
> 
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Uma Shankar <uma.shankar@intel.com>
> Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  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 |   34 +
>  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     |   22 +-
>  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, 1314 insertions(+), 5 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
> 
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index b2f91a1f8268..b04395472437 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -294,6 +294,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 \
> diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
> b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
> new file mode 100644
> index 000000000000..dce55f0ed5e1
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
> @@ -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)
> +{
> +	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;
> +	}
> +
> +	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;
> +	}
> +
> +	/* 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;
> +	}
> +
> +	/* 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;
> +	}
> +
> +	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)) {
> +		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)
> |
> +		       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;
> +	}
> +
> +	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;
> +	}
> +}
> +
> +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);
> +}
> +
> +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;
> +	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));
> +
> +	/* 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);
> +
> +	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_cx0_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, 0,
> 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, 0,
> 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);
> +	}
> +}
> +
> +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_cx0_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]);
> +	}
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.h
> b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
> new file mode 100644
> index 000000000000..8cf340509097
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.h
> @@ -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__ */
> diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> index d6b3709d3762..ef629f8b14cf 100644
> --- a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> @@ -133,4 +133,38 @@
>  #define XELPDP_SSC_ENABLE_PLLA				REG_BIT(1)
>  #define XELPDP_SSC_ENABLE_PLLB				REG_BIT(0)
> 
> +/* 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_PHY_REGS_H__ */
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index e5979427b38b..d48e1ffdfc71 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -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"
> @@ -3505,6 +3506,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)
>  {
> @@ -4379,7 +4395,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;
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> b/drivers/gpu/drm/i915/display/intel_display_power.c
> index 743b919bb2cf..87c7e082a3b4 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -1613,7 +1613,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).
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power_well.c
> b/drivers/gpu/drm/i915/display/intel_display_power_well.c
> index 49042ece9d1c..3f9a31f1bf4a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power_well.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power_well.c
> @@ -967,7 +967,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,
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h
> b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 748b0cd411fa..5dd11d3da2e4 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -979,6 +979,11 @@ struct intel_link_m_n {
>  	u32 link_n;
>  };
> 
> +struct intel_c10mpllb_state {
In order to use a homogeneous name across C10 and C20 phy's,
Can we rename this as intel_c10pll_state? So that it matches intel_c20pll_state
In the C20 patches?

- Radhakrishna(RK) Sripada

> +	u32 clock; /* in KHz */
> +	u8 pll[20];
> +};
> +
>  struct intel_crtc_state {
>  	/*
>  	 * uapi (drm) state. This is the software state shown to userspace.
> @@ -1122,6 +1127,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;
>  	};
> 
>  	/*
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll.c
> b/drivers/gpu/drm/i915/display/intel_dpll.c
> index 4e9c18be7e1f..cd3da053055d 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpll.c
> @@ -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,11 @@ 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 (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;
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> index 22fc908b7e5d..ed372d227aa7 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> @@ -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))
> diff --git a/drivers/gpu/drm/i915/display/intel_modeset_verify.c
> b/drivers/gpu/drm/i915/display/intel_modeset_verify.c
> index 842d70f0dfd2..ec504470c2f0 100644
> --- a/drivers/gpu/drm/i915/display/intel_modeset_verify.c
> +++ b/drivers/gpu/drm/i915/display/intel_modeset_verify.c
> @@ -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,
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index c1efa655fb68..681a301bb65f 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -2099,6 +2099,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
>   *
> diff --git a/drivers/gpu/drm/i915/i915_reg_defs.h
> b/drivers/gpu/drm/i915/i915_reg_defs.h
> index 983c5aa3045b..940855bfd482 100644
> --- a/drivers/gpu/drm/i915/i915_reg_defs.h
> +++ b/drivers/gpu/drm/i915/i915_reg_defs.h
> @@ -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;
> --
> 2.34.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers
  2023-02-28 23:26   ` Lucas De Marchi
@ 2023-03-07 13:24     ` Kahola, Mika
  2023-03-08  6:52       ` Kahola, Mika
  0 siblings, 1 reply; 37+ messages in thread
From: Kahola, Mika @ 2023-03-07 13:24 UTC (permalink / raw)
  To: De Marchi, Lucas; +Cc: intel-gfx

> -----Original Message-----
> From: De Marchi, Lucas <lucas.demarchi@intel.com>
> Sent: Wednesday, March 1, 2023 1:27 AM
> To: Kahola, Mika <mika.kahola@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file
> for PICA registers
> 
> On Fri, Feb 24, 2023 at 12:13:37PM +0200, Mika Kahola wrote:
> >Create a separate file to store registers for PICA chips
> >C10 and C20.
> >
> >v2: Rename file (Jani)
> >
> >Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> >Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> >---
> > .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 136 ++++++++++++++++++
> > 1 file changed, 136 insertions(+)
> > create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> >
> >diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> >b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> >new file mode 100644
> >index 000000000000..d6b3709d3762
> >--- /dev/null
> >+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> >@@ -0,0 +1,136 @@
> >+/* SPDX-License-Identifier: MIT
> >+ *
> >+ * Copyright © 2022 Intel Corporation
> >+ */
> >+
> >+#ifndef __INTEL_CX0_PHY_REGS_H__
> >+#define __INTEL_CX0_PHY_REGS_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_LN0_USBC3
> 	0x16F640
> >+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4
> 	0x16F840
> >+#define _XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)
> 	(_PICK(port, \
> >+							[PORT_A] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \
> >+							[PORT_B] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \
> >+							[PORT_TC1] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \
> >+							[PORT_TC2] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2, \
> >+							[PORT_TC3] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC3, \
> >+							[PORT_TC4] =
> _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4) + ((lane) *
> >+4))
> >+
> 
> stray newline
> 
> >+#define XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)
> 	_MMIO(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane))
> 
> 
> one of the reasons _PICK_EVEN_2RANGES() was added. We usually have 2
> ranges for the ports due to the combo vs tc distinction.
> 
> #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))
> 
Btw, are we missing something from upstream? It seems that this is not compiling properly with upstream kernel?

Thanks for the review and comments! I'm working on the rest of these fixes.

-Mika-
> 
> >+#define  XELPDP_PORT_M2P_TRANSACTION_PENDING
> 	REG_BIT(31)
> 
>            ^ wrong amount of spaces. See the example on top of i915_reg.h
> 
> here and everywhere in this file
> 
> >+#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(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane) + 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_LN0_USBC3
> 	0x16F600
> >+#define _XELPDP_PORT_BUF_CTL1_LN0_USBC4
> 	0x16F800
> >+#define _XELPDP_PORT_BUF_CTL1(port)			(_PICK(port, \
> >+							[PORT_A] =
> _XELPDP_PORT_BUF_CTL1_LN0_A, \
> >+							[PORT_B] =
> _XELPDP_PORT_BUF_CTL1_LN0_B, \
> >+							[PORT_TC1] =
> _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
> >+							[PORT_TC2] =
> _XELPDP_PORT_BUF_CTL1_LN0_USBC2, \
> >+							[PORT_TC3] =
> _XELPDP_PORT_BUF_CTL1_LN0_USBC3, \
> >+							[PORT_TC4] =
> _XELPDP_PORT_BUF_CTL1_LN0_USBC4))
> 
> same thing here, please use the new macro
> 
> >+
> >+#define XELPDP_PORT_BUF_CTL1(port)
> 	_MMIO(_XELPDP_PORT_BUF_CTL1(port))
> >+#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(_XELPDP_PORT_BUF_CTL1(port) + 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(_XELPDP_PORT_BUF_CTL1(port) + 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_USBC3			0x16F660
> >+#define _XELPDP_PORT_CLOCK_CTL_USBC4			0x16F860
> >+#define XELPDP_PORT_CLOCK_CTL(port)
> 	_MMIO(_PICK(port, \
> >+							[PORT_A] =
> _XELPDP_PORT_CLOCK_CTL_A, \
> >+							[PORT_B] =
> _XELPDP_PORT_CLOCK_CTL_B, \
> >+							[PORT_TC1] =
> _XELPDP_PORT_CLOCK_CTL_USBC1, \
> >+							[PORT_TC2] =
> _XELPDP_PORT_CLOCK_CTL_USBC2, \
> >+							[PORT_TC3] =
> _XELPDP_PORT_CLOCK_CTL_USBC3, \
> >+							[PORT_TC4] =
> _XELPDP_PORT_CLOCK_CTL_USBC4))
> 
> and here
> 
> Lucas De Marchi
> 
> >+
> >+#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__ */
> >--
> >2.34.1
> >

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers
  2023-03-07 13:24     ` Kahola, Mika
@ 2023-03-08  6:52       ` Kahola, Mika
  0 siblings, 0 replies; 37+ messages in thread
From: Kahola, Mika @ 2023-03-08  6:52 UTC (permalink / raw)
  To: Kahola, Mika, De Marchi, Lucas; +Cc: intel-gfx

> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Kahola,
> Mika
> Sent: Tuesday, March 7, 2023 3:24 PM
> To: De Marchi, Lucas <lucas.demarchi@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file
> for PICA registers
> 
> > -----Original Message-----
> > From: De Marchi, Lucas <lucas.demarchi@intel.com>
> > Sent: Wednesday, March 1, 2023 1:27 AM
> > To: Kahola, Mika <mika.kahola@intel.com>
> > Cc: intel-gfx@lists.freedesktop.org
> > Subject: Re: [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create
> > separate reg file for PICA registers
> >
> > On Fri, Feb 24, 2023 at 12:13:37PM +0200, Mika Kahola wrote:
> > >Create a separate file to store registers for PICA chips
> > >C10 and C20.
> > >
> > >v2: Rename file (Jani)
> > >
> > >Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> > >Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > >---
> > > .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 136
> > >++++++++++++++++++
> > > 1 file changed, 136 insertions(+)
> > > create mode 100644 drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> > >
> > >diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> > >b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> > >new file mode 100644
> > >index 000000000000..d6b3709d3762
> > >--- /dev/null
> > >+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> > >@@ -0,0 +1,136 @@
> > >+/* SPDX-License-Identifier: MIT
> > >+ *
> > >+ * Copyright © 2022 Intel Corporation  */
> > >+
> > >+#ifndef __INTEL_CX0_PHY_REGS_H__
> > >+#define __INTEL_CX0_PHY_REGS_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_LN0_USBC3
> > 	0x16F640
> > >+#define _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4
> > 	0x16F840
> > >+#define _XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)
> > 	(_PICK(port, \
> > >+							[PORT_A] =
> > _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \
> > >+							[PORT_B] =
> > _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \
> > >+							[PORT_TC1] =
> > _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \
> > >+							[PORT_TC2] =
> > _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2, \
> > >+							[PORT_TC3] =
> > _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC3, \
> > >+							[PORT_TC4] =
> > _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC4) + ((lane) *
> > >+4))
> > >+
> >
> > stray newline
> >
> > >+#define XELPDP_PORT_M2P_MSGBUS_CTL(port, lane)
> > 	_MMIO(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane))
> >
> >
> > one of the reasons _PICK_EVEN_2RANGES() was added. We usually have 2
> > ranges for the ports due to the combo vs tc distinction.
> >
> > #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))
> >
> Btw, are we missing something from upstream? It seems that this is not
> compiling properly with upstream kernel?

Never mind this comment. I sorted this one out.

> 
> Thanks for the review and comments! I'm working on the rest of these fixes.
> 
> -Mika-
> >
> > >+#define  XELPDP_PORT_M2P_TRANSACTION_PENDING
> > 	REG_BIT(31)
> >
> >            ^ wrong amount of spaces. See the example on top of
> > i915_reg.h
> >
> > here and everywhere in this file
> >
> > >+#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(_XELPDP_PORT_M2P_MSGBUS_CTL(port, lane) + 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_LN0_USBC3
> > 	0x16F600
> > >+#define _XELPDP_PORT_BUF_CTL1_LN0_USBC4
> > 	0x16F800
> > >+#define _XELPDP_PORT_BUF_CTL1(port)			(_PICK(port, \
> > >+							[PORT_A] =
> > _XELPDP_PORT_BUF_CTL1_LN0_A, \
> > >+							[PORT_B] =
> > _XELPDP_PORT_BUF_CTL1_LN0_B, \
> > >+							[PORT_TC1] =
> > _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \
> > >+							[PORT_TC2] =
> > _XELPDP_PORT_BUF_CTL1_LN0_USBC2, \
> > >+							[PORT_TC3] =
> > _XELPDP_PORT_BUF_CTL1_LN0_USBC3, \
> > >+							[PORT_TC4] =
> > _XELPDP_PORT_BUF_CTL1_LN0_USBC4))
> >
> > same thing here, please use the new macro
> >
> > >+
> > >+#define XELPDP_PORT_BUF_CTL1(port)
> > 	_MMIO(_XELPDP_PORT_BUF_CTL1(port))
> > >+#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(_XELPDP_PORT_BUF_CTL1(port) + 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(_XELPDP_PORT_BUF_CTL1(port) + 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_USBC3			0x16F660
> > >+#define _XELPDP_PORT_CLOCK_CTL_USBC4			0x16F860
> > >+#define XELPDP_PORT_CLOCK_CTL(port)
> > 	_MMIO(_PICK(port, \
> > >+							[PORT_A] =
> > _XELPDP_PORT_CLOCK_CTL_A, \
> > >+							[PORT_B] =
> > _XELPDP_PORT_CLOCK_CTL_B, \
> > >+							[PORT_TC1] =
> > _XELPDP_PORT_CLOCK_CTL_USBC1, \
> > >+							[PORT_TC2] =
> > _XELPDP_PORT_CLOCK_CTL_USBC2, \
> > >+							[PORT_TC3] =
> > _XELPDP_PORT_CLOCK_CTL_USBC3, \
> > >+							[PORT_TC4] =
> > _XELPDP_PORT_CLOCK_CTL_USBC4))
> >
> > and here
> >
> > Lucas De Marchi
> >
> > >+
> > >+#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__ */
> > >--
> > >2.34.1
> > >

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/mtl: Add C10 and C20 phy support (rev7)
  2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
                   ` (24 preceding siblings ...)
  2023-02-24 18:03 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
@ 2023-03-15 12:26 ` Patchwork
  25 siblings, 0 replies; 37+ messages in thread
From: Patchwork @ 2023-03-15 12:26 UTC (permalink / raw)
  To: Kahola, Mika; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/mtl: Add C10 and C20 phy support (rev7)
URL   : https://patchwork.freedesktop.org/series/109714/
State : failure

== Summary ==

Error: patch https://patchwork.freedesktop.org/api/1.0/series/109714/revisions/7/mbox/ not applied
Applying: drm/i915/mtl: Initial DDI port setup
Applying: drm/i915/mtl: Add DP rates
Applying: drm/i915/mtl: Create separate reg file for PICA registers
Applying: drm/i915/mtl: Add Support for C10 PHY message bus and pll programming
Applying: drm/i915/mtl: Add C10 phy programming for HDMI
Applying: drm/i915/mtl: Add vswing programming for C10 phys
Applying: drm/i915/mtl: Add support for PM DEMAND
Using index info to reconstruct a base tree...
M	drivers/gpu/drm/i915/display/intel_display.c
M	drivers/gpu/drm/i915/display/intel_display_power.c
M	drivers/gpu/drm/i915/i915_irq.c
M	drivers/gpu/drm/i915/i915_reg.h
M	drivers/gpu/drm/i915/intel_pm.c
M	drivers/gpu/drm/i915/intel_pm.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/intel_pm.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/intel_pm.h
Auto-merging drivers/gpu/drm/i915/intel_pm.c
Auto-merging drivers/gpu/drm/i915/i915_reg.h
Auto-merging drivers/gpu/drm/i915/i915_irq.c
Auto-merging drivers/gpu/drm/i915/display/intel_display_power.c
Auto-merging drivers/gpu/drm/i915/display/intel_display.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0007 drm/i915/mtl: Add support for PM DEMAND
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".



^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2023-03-15 12:26 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 10:13 [Intel-gfx] [PATCH v4 00/22] drm/i915/mtl: Add C10 and C20 phy support Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 01/22] drm/i915/mtl: Initial DDI port setup Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 02/22] drm/i915/mtl: Add DP rates Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 03/22] drm/i915/mtl: Create separate reg file for PICA registers Mika Kahola
2023-02-28  0:16   ` Matt Roper
2023-02-28 13:25     ` Kahola, Mika
2023-02-28 23:26   ` Lucas De Marchi
2023-03-07 13:24     ` Kahola, Mika
2023-03-08  6:52       ` Kahola, Mika
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 04/22] drm/i915/mtl: Add Support for C10 PHY message bus and pll programming Mika Kahola
2023-03-02 21:42   ` Sripada, Radhakrishna
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 05/22] drm/i915/mtl: Add C10 phy programming for HDMI Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 06/22] drm/i915/mtl: Add vswing programming for C10 phys Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 07/22] drm/i915/mtl: Add support for PM DEMAND Mika Kahola
2023-03-01 22:50   ` Sripada, Radhakrishna
2023-03-02  8:49   ` Murthy, Arun R
2023-03-02  9:40     ` Kahola, Mika
2023-03-02 18:07       ` Sripada, Radhakrishna
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 08/22] drm/i915/mtl: C20 PLL programming Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 09/22] drm/i915/mtl: C20 HW readout Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 10/22] drm/i915/mtl: Dump C20 pll hw state Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 11/22] drm/i915/mtl: C20 port clock calculation Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 12/22] drm/i915/mtl: C20 HDMI state calculations Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 13/22] drm/i915/mtl: Add voltage swing sequence for C20 Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 14/22] drm/i915/mtl: For DP2.0 10G and 20G rates use MPLLA Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 15/22] drm/i915/mtl: Enabling/disabling sequence Thunderbolt pll Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 16/22] drm/i915/mtl: Readout Thunderbolt HW state Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 17/22] drm/i915/mtl: Enable TC ports Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 18/22] drm/i915/mtl: MTL PICA hotplug detection Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 19/22] drm/i915/mtl: Define mask for DDI AUX interrupts Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 20/22] drm/i915/mtl: Power up TCSS Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 21/22] drm/i915/mtl: TypeC HPD live status query Mika Kahola
2023-02-24 10:13 ` [Intel-gfx] [PATCH v4 22/22] drm/i915/mtl: Pin assignment for TypeC Mika Kahola
2023-02-24 13:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/mtl: Add C10 and C20 phy support (rev6) Patchwork
2023-02-24 13:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-02-24 18:03 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-03-15 12:26 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/mtl: Add C10 and C20 phy support (rev7) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.