Skip to content

Commit 89e0a91

Browse files
committed
drm/i915/ltphy: Define function to readout LT Phy PLL state
Define a function to readout hw state for LT Phy PLL which can be used in get_config function call. 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-23-suraj.kandpal@intel.com
1 parent 3a6f155 commit 89e0a91

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4246,6 +4246,19 @@ void intel_ddi_get_clock(struct intel_encoder *encoder,
42464246
&crtc_state->dpll_hw_state);
42474247
}
42484248

4249+
static void xe3plpd_ddi_get_config(struct intel_encoder *encoder,
4250+
struct intel_crtc_state *crtc_state)
4251+
{
4252+
intel_lt_phy_pll_readout_hw_state(encoder, crtc_state, &crtc_state->dpll_hw_state.ltpll);
4253+
4254+
if (crtc_state->dpll_hw_state.ltpll.tbt_mode)
4255+
crtc_state->port_clock = intel_mtl_tbt_calc_port_clock(encoder);
4256+
else
4257+
crtc_state->port_clock =
4258+
intel_lt_phy_calc_port_clock(encoder, crtc_state);
4259+
intel_ddi_get_config(encoder, crtc_state);
4260+
}
4261+
42494262
static void mtl_ddi_get_config(struct intel_encoder *encoder,
42504263
struct intel_crtc_state *crtc_state)
42514264
{
@@ -5241,6 +5254,7 @@ void intel_ddi_init(struct intel_display *display,
52415254
encoder->enable_clock = intel_xe3plpd_pll_enable;
52425255
encoder->disable_clock = intel_xe3plpd_pll_disable;
52435256
encoder->port_pll_type = intel_mtl_port_pll_type;
5257+
encoder->get_config = xe3plpd_ddi_get_config;
52445258
} else if (DISPLAY_VER(display) >= 14) {
52455259
encoder->enable_clock = intel_mtl_pll_enable;
52465260
encoder->disable_clock = intel_mtl_pll_disable;

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,39 @@ intel_lt_phy_pll_compare_hw_state(const struct intel_lt_phy_pll_state *a,
18861886
return true;
18871887
}
18881888

1889+
void intel_lt_phy_pll_readout_hw_state(struct intel_encoder *encoder,
1890+
const struct intel_crtc_state *crtc_state,
1891+
struct intel_lt_phy_pll_state *pll_state)
1892+
{
1893+
u8 owned_lane_mask;
1894+
u8 lane;
1895+
intel_wakeref_t wakeref;
1896+
int i, j, k;
1897+
1898+
pll_state->tbt_mode = intel_tc_port_in_tbt_alt_mode(enc_to_dig_port(encoder));
1899+
if (pll_state->tbt_mode)
1900+
return;
1901+
1902+
owned_lane_mask = intel_lt_phy_get_owned_lane_mask(encoder);
1903+
lane = owned_lane_mask & INTEL_LT_PHY_LANE0 ? : INTEL_LT_PHY_LANE1;
1904+
wakeref = intel_lt_phy_transaction_begin(encoder);
1905+
1906+
pll_state->config[0] = intel_lt_phy_read(encoder, lane, LT_PHY_VDR_0_CONFIG);
1907+
pll_state->config[1] = intel_lt_phy_read(encoder, INTEL_LT_PHY_LANE0, LT_PHY_VDR_1_CONFIG);
1908+
pll_state->config[2] = intel_lt_phy_read(encoder, lane, LT_PHY_VDR_2_CONFIG);
1909+
1910+
for (i = 0; i <= 12; i++) {
1911+
for (j = 3, k = 0; j >= 0; j--, k++)
1912+
pll_state->data[i][k] =
1913+
intel_lt_phy_read(encoder, INTEL_LT_PHY_LANE0,
1914+
LT_PHY_VDR_X_DATAY(i, j));
1915+
}
1916+
1917+
pll_state->clock =
1918+
intel_lt_phy_calc_port_clock(encoder, crtc_state);
1919+
intel_lt_phy_transaction_end(encoder, wakeref);
1920+
}
1921+
18891922
void intel_xe3plpd_pll_enable(struct intel_encoder *encoder,
18901923
const struct intel_crtc_state *crtc_state)
18911924
{

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ void intel_lt_phy_dump_hw_state(struct intel_display *display,
2828
bool
2929
intel_lt_phy_pll_compare_hw_state(const struct intel_lt_phy_pll_state *a,
3030
const struct intel_lt_phy_pll_state *b);
31+
void intel_lt_phy_pll_readout_hw_state(struct intel_encoder *encoder,
32+
const struct intel_crtc_state *crtc_state,
33+
struct intel_lt_phy_pll_state *pll_state);
3134
void intel_xe3plpd_pll_enable(struct intel_encoder *encoder,
3235
const struct intel_crtc_state *crtc_state);
3336
void intel_xe3plpd_pll_disable(struct intel_encoder *encoder);

0 commit comments

Comments
 (0)