Skip to content

Commit 3a6f155

Browse files
committed
drm/i915/ltphy: Define the LT Phy state compare function
Define function to compare the state and if mismatch is detected dump both the states. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com> Link: https://patch.msgid.link/20251101032513.4171255-22-suraj.kandpal@intel.com
1 parent a54bdcb commit 3a6f155

3 files changed

Lines changed: 68 additions & 1 deletion

File tree

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

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
#include "intel_hdmi.h"
101101
#include "intel_hotplug.h"
102102
#include "intel_link_bw.h"
103+
#include "intel_lt_phy.h"
103104
#include "intel_lvds.h"
104105
#include "intel_lvds_regs.h"
105106
#include "intel_modeset_setup.h"
@@ -5000,6 +5001,24 @@ static bool allow_vblank_delay_fastset(const struct intel_crtc_state *old_crtc_s
50005001
!intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_DSI);
50015002
}
50025003

5004+
static void
5005+
pipe_config_lt_phy_pll_mismatch(struct drm_printer *p, bool fastset,
5006+
const struct intel_crtc *crtc,
5007+
const char *name,
5008+
const struct intel_lt_phy_pll_state *a,
5009+
const struct intel_lt_phy_pll_state *b)
5010+
{
5011+
struct intel_display *display = to_intel_display(crtc);
5012+
char *chipname = "LTPHY";
5013+
5014+
pipe_config_mismatch(p, fastset, crtc, name, chipname);
5015+
5016+
drm_printf(p, "expected:\n");
5017+
intel_lt_phy_dump_hw_state(display, a);
5018+
drm_printf(p, "found:\n");
5019+
intel_lt_phy_dump_hw_state(display, b);
5020+
}
5021+
50035022
bool
50045023
intel_pipe_config_compare(const struct intel_crtc_state *current_config,
50055024
const struct intel_crtc_state *pipe_config,
@@ -5124,6 +5143,16 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
51245143
} \
51255144
} while (0)
51265145

5146+
#define PIPE_CONF_CHECK_PLL_LT(name) do { \
5147+
if (!intel_lt_phy_pll_compare_hw_state(&current_config->name, \
5148+
&pipe_config->name)) { \
5149+
pipe_config_lt_phy_pll_mismatch(&p, fastset, crtc, __stringify(name), \
5150+
&current_config->name, \
5151+
&pipe_config->name); \
5152+
ret = false; \
5153+
} \
5154+
} while (0)
5155+
51275156
#define PIPE_CONF_CHECK_TIMINGS(name) do { \
51285157
PIPE_CONF_CHECK_I(name.crtc_hdisplay); \
51295158
PIPE_CONF_CHECK_I(name.crtc_htotal); \
@@ -5351,7 +5380,9 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
53515380
PIPE_CONF_CHECK_PLL(dpll_hw_state);
53525381

53535382
/* FIXME convert MTL+ platforms over to dpll_mgr */
5354-
if (DISPLAY_VER(display) >= 14)
5383+
if (HAS_LT_PHY(display))
5384+
PIPE_CONF_CHECK_PLL_LT(dpll_hw_state.ltpll);
5385+
else if (DISPLAY_VER(display) >= 14)
53555386
PIPE_CONF_CHECK_PLL_CX0(dpll_hw_state.cx0pll);
53565387

53575388
PIPE_CONF_CHECK_X(dsi_pll.ctrl);

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,36 @@ void intel_lt_phy_set_signal_levels(struct intel_encoder *encoder,
18561856
intel_lt_phy_transaction_end(encoder, wakeref);
18571857
}
18581858

1859+
void intel_lt_phy_dump_hw_state(struct intel_display *display,
1860+
const struct intel_lt_phy_pll_state *hw_state)
1861+
{
1862+
int i, j;
1863+
1864+
drm_dbg_kms(display->drm, "lt_phy_pll_hw_state:\n");
1865+
for (i = 0; i < 3; i++) {
1866+
drm_dbg_kms(display->drm, "config[%d] = 0x%.4x,\n",
1867+
i, hw_state->config[i]);
1868+
}
1869+
1870+
for (i = 0; i <= 12; i++)
1871+
for (j = 3; j >= 0; j--)
1872+
drm_dbg_kms(display->drm, "vdr_data[%d][%d] = 0x%.4x,\n",
1873+
i, j, hw_state->data[i][j]);
1874+
}
1875+
1876+
bool
1877+
intel_lt_phy_pll_compare_hw_state(const struct intel_lt_phy_pll_state *a,
1878+
const struct intel_lt_phy_pll_state *b)
1879+
{
1880+
if (memcmp(&a->config, &b->config, sizeof(a->config)) != 0)
1881+
return false;
1882+
1883+
if (memcmp(&a->data, &b->data, sizeof(a->data)) != 0)
1884+
return false;
1885+
1886+
return true;
1887+
}
1888+
18591889
void intel_xe3plpd_pll_enable(struct intel_encoder *encoder,
18601890
const struct intel_crtc_state *crtc_state)
18611891
{

drivers/gpu/drm/i915/display/intel_lt_phy.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <linux/types.h>
1010

11+
struct intel_display;
1112
struct intel_encoder;
1213
struct intel_crtc_state;
1314
struct intel_lt_phy_pll_state;
@@ -22,6 +23,11 @@ int intel_lt_phy_calc_port_clock(struct intel_encoder *encoder,
2223
const struct intel_crtc_state *crtc_state);
2324
void intel_lt_phy_set_signal_levels(struct intel_encoder *encoder,
2425
const struct intel_crtc_state *crtc_state);
26+
void intel_lt_phy_dump_hw_state(struct intel_display *display,
27+
const struct intel_lt_phy_pll_state *hw_state);
28+
bool
29+
intel_lt_phy_pll_compare_hw_state(const struct intel_lt_phy_pll_state *a,
30+
const struct intel_lt_phy_pll_state *b);
2531
void intel_xe3plpd_pll_enable(struct intel_encoder *encoder,
2632
const struct intel_crtc_state *crtc_state);
2733
void intel_xe3plpd_pll_disable(struct intel_encoder *encoder);

0 commit comments

Comments
 (0)