Skip to content

Commit 402bd11

Browse files
committed
drm/i915/dp: convert intel_dp_link_training.[ch] to struct intel_display
Going forward, struct intel_display shall replace struct drm_i915_private as the main display device data pointer type. Convert intel_dp_link_training.[ch] to struct intel_display. Reviewed-by: Ville Syrjälä <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/72b202e75f5a7ecc84a906f1c49d21dbe24fb7c2.1725012870.git.jani.nikula@intel.com
1 parent f70e437 commit 402bd11

File tree

1 file changed

+55
-50
lines changed

1 file changed

+55
-50
lines changed

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

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
drm_dp_phy_name(_dp_phy)
4040

4141
#define lt_dbg(_intel_dp, _dp_phy, _format, ...) \
42-
drm_dbg_kms(&dp_to_i915(_intel_dp)->drm, \
42+
drm_dbg_kms(to_intel_display(_intel_dp)->drm, \
4343
LT_MSG_PREFIX _format, \
4444
LT_MSG_ARGS(_intel_dp, _dp_phy), ## __VA_ARGS__)
4545

4646
#define lt_err(_intel_dp, _dp_phy, _format, ...) do { \
4747
if (intel_digital_port_connected(&dp_to_dig_port(_intel_dp)->base)) \
48-
drm_err(&dp_to_i915(_intel_dp)->drm, \
48+
drm_err(to_intel_display(_intel_dp)->drm, \
4949
LT_MSG_PREFIX _format, \
5050
LT_MSG_ARGS(_intel_dp, _dp_phy), ## __VA_ARGS__); \
5151
else \
@@ -216,7 +216,8 @@ static int intel_dp_init_lttpr(struct intel_dp *intel_dp, const u8 dpcd[DP_RECEI
216216

217217
int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_SIZE])
218218
{
219-
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
219+
struct intel_display *display = to_intel_display(intel_dp);
220+
struct drm_i915_private *i915 = to_i915(display->drm);
220221

221222
if (intel_dp_is_edp(intel_dp))
222223
return 0;
@@ -225,7 +226,7 @@ int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_S
225226
* Detecting LTTPRs must be avoided on platforms with an AUX timeout
226227
* period < 3.2ms. (see DP Standard v2.0, 2.11.2, 3.6.6.1).
227228
*/
228-
if (DISPLAY_VER(i915) >= 10 && !IS_GEMINILAKE(i915))
229+
if (DISPLAY_VER(display) >= 10 && !IS_GEMINILAKE(i915))
229230
if (drm_dp_dpcd_probe(&intel_dp->aux,
230231
DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV))
231232
return -EIO;
@@ -256,15 +257,16 @@ int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_S
256257
*/
257258
int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp)
258259
{
259-
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
260+
struct intel_display *display = to_intel_display(intel_dp);
261+
struct drm_i915_private *i915 = to_i915(display->drm);
260262
int lttpr_count = 0;
261263

262264
/*
263265
* Detecting LTTPRs must be avoided on platforms with an AUX timeout
264266
* period < 3.2ms. (see DP Standard v2.0, 2.11.2, 3.6.6.1).
265267
*/
266268
if (!intel_dp_is_edp(intel_dp) &&
267-
(DISPLAY_VER(i915) >= 10 && !IS_GEMINILAKE(i915))) {
269+
(DISPLAY_VER(display) >= 10 && !IS_GEMINILAKE(i915))) {
268270
u8 dpcd[DP_RECEIVER_CAP_SIZE];
269271
int err = intel_dp_read_dprx_caps(intel_dp, dpcd);
270272

@@ -327,10 +329,11 @@ static bool
327329
intel_dp_phy_is_downstream_of_source(struct intel_dp *intel_dp,
328330
enum drm_dp_phy dp_phy)
329331
{
330-
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
332+
struct intel_display *display = to_intel_display(intel_dp);
331333
int lttpr_count = drm_dp_lttpr_count(intel_dp->lttpr_common_caps);
332334

333-
drm_WARN_ON_ONCE(&i915->drm, lttpr_count <= 0 && dp_phy != DP_PHY_DPRX);
335+
drm_WARN_ON_ONCE(display->drm,
336+
lttpr_count <= 0 && dp_phy != DP_PHY_DPRX);
334337

335338
return lttpr_count <= 0 || dp_phy == DP_PHY_LTTPR(lttpr_count - 1);
336339
}
@@ -339,7 +342,7 @@ static u8 intel_dp_phy_voltage_max(struct intel_dp *intel_dp,
339342
const struct intel_crtc_state *crtc_state,
340343
enum drm_dp_phy dp_phy)
341344
{
342-
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
345+
struct intel_display *display = to_intel_display(intel_dp);
343346
u8 voltage_max;
344347

345348
/*
@@ -351,7 +354,7 @@ static u8 intel_dp_phy_voltage_max(struct intel_dp *intel_dp,
351354
else
352355
voltage_max = intel_dp_lttpr_voltage_max(intel_dp, dp_phy + 1);
353356

354-
drm_WARN_ON_ONCE(&i915->drm,
357+
drm_WARN_ON_ONCE(display->drm,
355358
voltage_max != DP_TRAIN_VOLTAGE_SWING_LEVEL_2 &&
356359
voltage_max != DP_TRAIN_VOLTAGE_SWING_LEVEL_3);
357360

@@ -361,7 +364,7 @@ static u8 intel_dp_phy_voltage_max(struct intel_dp *intel_dp,
361364
static u8 intel_dp_phy_preemph_max(struct intel_dp *intel_dp,
362365
enum drm_dp_phy dp_phy)
363366
{
364-
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
367+
struct intel_display *display = to_intel_display(intel_dp);
365368
u8 preemph_max;
366369

367370
/*
@@ -373,7 +376,7 @@ static u8 intel_dp_phy_preemph_max(struct intel_dp *intel_dp,
373376
else
374377
preemph_max = intel_dp_lttpr_preemph_max(intel_dp, dp_phy + 1);
375378

376-
drm_WARN_ON_ONCE(&i915->drm,
379+
drm_WARN_ON_ONCE(display->drm,
377380
preemph_max != DP_TRAIN_PRE_EMPH_LEVEL_2 &&
378381
preemph_max != DP_TRAIN_PRE_EMPH_LEVEL_3);
379382

@@ -383,10 +386,11 @@ static u8 intel_dp_phy_preemph_max(struct intel_dp *intel_dp,
383386
static bool has_per_lane_signal_levels(struct intel_dp *intel_dp,
384387
enum drm_dp_phy dp_phy)
385388
{
386-
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
389+
struct intel_display *display = to_intel_display(intel_dp);
390+
struct drm_i915_private *i915 = to_i915(display->drm);
387391

388392
return !intel_dp_phy_is_downstream_of_source(intel_dp, dp_phy) ||
389-
DISPLAY_VER(i915) >= 10 || IS_BROXTON(i915);
393+
DISPLAY_VER(display) >= 10 || IS_BROXTON(i915);
390394
}
391395

392396
/* 128b/132b */
@@ -950,7 +954,8 @@ static u32 intel_dp_training_pattern(struct intel_dp *intel_dp,
950954
const struct intel_crtc_state *crtc_state,
951955
enum drm_dp_phy dp_phy)
952956
{
953-
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
957+
struct intel_display *display = to_intel_display(intel_dp);
958+
struct drm_i915_private *i915 = to_i915(display->drm);
954959
bool source_tps3, sink_tps3, source_tps4, sink_tps4;
955960

956961
/* UHBR+ use separate 128b/132b TPS2 */
@@ -1586,7 +1591,7 @@ void intel_dp_start_link_train(struct intel_atomic_state *state,
15861591
struct intel_dp *intel_dp,
15871592
const struct intel_crtc_state *crtc_state)
15881593
{
1589-
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
1594+
struct intel_display *display = to_intel_display(state);
15901595
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
15911596
struct intel_encoder *encoder = &dig_port->base;
15921597
bool passed;
@@ -1631,7 +1636,7 @@ void intel_dp_start_link_train(struct intel_atomic_state *state,
16311636
* For test cases which rely on the link training or processing of HPDs
16321637
* ignore_long_hpd flag can unset from the testcase.
16331638
*/
1634-
if (i915->display.hotplug.ignore_long_hpd) {
1639+
if (display->hotplug.ignore_long_hpd) {
16351640
lt_dbg(intel_dp, DP_PHY_DPRX, "Ignore the link failure\n");
16361641
return;
16371642
}
@@ -1683,22 +1688,22 @@ static struct intel_dp *intel_connector_to_intel_dp(struct intel_connector *conn
16831688
static int i915_dp_force_link_rate_show(struct seq_file *m, void *data)
16841689
{
16851690
struct intel_connector *connector = to_intel_connector(m->private);
1686-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
1691+
struct intel_display *display = to_intel_display(connector);
16871692
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
16881693
int current_rate = -1;
16891694
int force_rate;
16901695
int err;
16911696
int i;
16921697

1693-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
1698+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
16941699
if (err)
16951700
return err;
16961701

16971702
if (intel_dp->link_trained)
16981703
current_rate = intel_dp->link_rate;
16991704
force_rate = intel_dp->link.force_rate;
17001705

1701-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
1706+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
17021707

17031708
seq_printf(m, "%sauto%s",
17041709
force_rate == 0 ? "[" : "",
@@ -1754,7 +1759,7 @@ static ssize_t i915_dp_force_link_rate_write(struct file *file,
17541759
{
17551760
struct seq_file *m = file->private_data;
17561761
struct intel_connector *connector = to_intel_connector(m->private);
1757-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
1762+
struct intel_display *display = to_intel_display(connector);
17581763
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
17591764
int rate;
17601765
int err;
@@ -1763,14 +1768,14 @@ static ssize_t i915_dp_force_link_rate_write(struct file *file,
17631768
if (rate < 0)
17641769
return rate;
17651770

1766-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
1771+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
17671772
if (err)
17681773
return err;
17691774

17701775
intel_dp_reset_link_params(intel_dp);
17711776
intel_dp->link.force_rate = rate;
17721777

1773-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
1778+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
17741779

17751780
*offp += len;
17761781

@@ -1781,22 +1786,22 @@ DEFINE_SHOW_STORE_ATTRIBUTE(i915_dp_force_link_rate);
17811786
static int i915_dp_force_lane_count_show(struct seq_file *m, void *data)
17821787
{
17831788
struct intel_connector *connector = to_intel_connector(m->private);
1784-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
1789+
struct intel_display *display = to_intel_display(connector);
17851790
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
17861791
int current_lane_count = -1;
17871792
int force_lane_count;
17881793
int err;
17891794
int i;
17901795

1791-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
1796+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
17921797
if (err)
17931798
return err;
17941799

17951800
if (intel_dp->link_trained)
17961801
current_lane_count = intel_dp->lane_count;
17971802
force_lane_count = intel_dp->link.force_lane_count;
17981803

1799-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
1804+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
18001805

18011806
seq_printf(m, "%sauto%s",
18021807
force_lane_count == 0 ? "[" : "",
@@ -1856,7 +1861,7 @@ static ssize_t i915_dp_force_lane_count_write(struct file *file,
18561861
{
18571862
struct seq_file *m = file->private_data;
18581863
struct intel_connector *connector = to_intel_connector(m->private);
1859-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
1864+
struct intel_display *display = to_intel_display(connector);
18601865
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
18611866
int lane_count;
18621867
int err;
@@ -1865,14 +1870,14 @@ static ssize_t i915_dp_force_lane_count_write(struct file *file,
18651870
if (lane_count < 0)
18661871
return lane_count;
18671872

1868-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
1873+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
18691874
if (err)
18701875
return err;
18711876

18721877
intel_dp_reset_link_params(intel_dp);
18731878
intel_dp->link.force_lane_count = lane_count;
18741879

1875-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
1880+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
18761881

18771882
*offp += len;
18781883

@@ -1883,17 +1888,17 @@ DEFINE_SHOW_STORE_ATTRIBUTE(i915_dp_force_lane_count);
18831888
static int i915_dp_max_link_rate_show(void *data, u64 *val)
18841889
{
18851890
struct intel_connector *connector = to_intel_connector(data);
1886-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
1891+
struct intel_display *display = to_intel_display(connector);
18871892
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
18881893
int err;
18891894

1890-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
1895+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
18911896
if (err)
18921897
return err;
18931898

18941899
*val = intel_dp->link.max_rate;
18951900

1896-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
1901+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
18971902

18981903
return 0;
18991904
}
@@ -1902,17 +1907,17 @@ DEFINE_DEBUGFS_ATTRIBUTE(i915_dp_max_link_rate_fops, i915_dp_max_link_rate_show,
19021907
static int i915_dp_max_lane_count_show(void *data, u64 *val)
19031908
{
19041909
struct intel_connector *connector = to_intel_connector(data);
1905-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
1910+
struct intel_display *display = to_intel_display(connector);
19061911
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
19071912
int err;
19081913

1909-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
1914+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
19101915
if (err)
19111916
return err;
19121917

19131918
*val = intel_dp->link.max_lane_count;
19141919

1915-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
1920+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
19161921

19171922
return 0;
19181923
}
@@ -1921,38 +1926,38 @@ DEFINE_DEBUGFS_ATTRIBUTE(i915_dp_max_lane_count_fops, i915_dp_max_lane_count_sho
19211926
static int i915_dp_force_link_training_failure_show(void *data, u64 *val)
19221927
{
19231928
struct intel_connector *connector = to_intel_connector(data);
1924-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
1929+
struct intel_display *display = to_intel_display(connector);
19251930
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
19261931
int err;
19271932

1928-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
1933+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
19291934
if (err)
19301935
return err;
19311936

19321937
*val = intel_dp->link.force_train_failure;
19331938

1934-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
1939+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
19351940

19361941
return 0;
19371942
}
19381943

19391944
static int i915_dp_force_link_training_failure_write(void *data, u64 val)
19401945
{
19411946
struct intel_connector *connector = to_intel_connector(data);
1942-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
1947+
struct intel_display *display = to_intel_display(connector);
19431948
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
19441949
int err;
19451950

19461951
if (val > 2)
19471952
return -EINVAL;
19481953

1949-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
1954+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
19501955
if (err)
19511956
return err;
19521957

19531958
intel_dp->link.force_train_failure = val;
19541959

1955-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
1960+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
19561961

19571962
return 0;
19581963
}
@@ -1963,35 +1968,35 @@ DEFINE_DEBUGFS_ATTRIBUTE(i915_dp_force_link_training_failure_fops,
19631968
static int i915_dp_force_link_retrain_show(void *data, u64 *val)
19641969
{
19651970
struct intel_connector *connector = to_intel_connector(data);
1966-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
1971+
struct intel_display *display = to_intel_display(connector);
19671972
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
19681973
int err;
19691974

1970-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
1975+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
19711976
if (err)
19721977
return err;
19731978

19741979
*val = intel_dp->link.force_retrain;
19751980

1976-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
1981+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
19771982

19781983
return 0;
19791984
}
19801985

19811986
static int i915_dp_force_link_retrain_write(void *data, u64 val)
19821987
{
19831988
struct intel_connector *connector = to_intel_connector(data);
1984-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
1989+
struct intel_display *display = to_intel_display(connector);
19851990
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
19861991
int err;
19871992

1988-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
1993+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
19891994
if (err)
19901995
return err;
19911996

19921997
intel_dp->link.force_retrain = val;
19931998

1994-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
1999+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
19952000

19962001
intel_hpd_trigger_irq(dp_to_dig_port(intel_dp));
19972002

@@ -2004,17 +2009,17 @@ DEFINE_DEBUGFS_ATTRIBUTE(i915_dp_force_link_retrain_fops,
20042009
static int i915_dp_link_retrain_disabled_show(struct seq_file *m, void *data)
20052010
{
20062011
struct intel_connector *connector = to_intel_connector(m->private);
2007-
struct drm_i915_private *i915 = to_i915(connector->base.dev);
2012+
struct intel_display *display = to_intel_display(connector);
20082013
struct intel_dp *intel_dp = intel_connector_to_intel_dp(connector);
20092014
int err;
20102015

2011-
err = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
2016+
err = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
20122017
if (err)
20132018
return err;
20142019

20152020
seq_printf(m, "%s\n", str_yes_no(intel_dp->link.retrain_disabled));
20162021

2017-
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
2022+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
20182023

20192024
return 0;
20202025
}

0 commit comments

Comments
 (0)