39
39
drm_dp_phy_name(_dp_phy)
40
40
41
41
#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, \
43
43
LT_MSG_PREFIX _format, \
44
44
LT_MSG_ARGS(_intel_dp, _dp_phy), ## __VA_ARGS__)
45
45
46
46
#define lt_err (_intel_dp , _dp_phy , _format , ...) do { \
47
47
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, \
49
49
LT_MSG_PREFIX _format, \
50
50
LT_MSG_ARGS(_intel_dp, _dp_phy), ## __VA_ARGS__); \
51
51
else \
@@ -216,7 +216,8 @@ static int intel_dp_init_lttpr(struct intel_dp *intel_dp, const u8 dpcd[DP_RECEI
216
216
217
217
int intel_dp_read_dprx_caps (struct intel_dp * intel_dp , u8 dpcd [DP_RECEIVER_CAP_SIZE ])
218
218
{
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 );
220
221
221
222
if (intel_dp_is_edp (intel_dp ))
222
223
return 0 ;
@@ -225,7 +226,7 @@ int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_S
225
226
* Detecting LTTPRs must be avoided on platforms with an AUX timeout
226
227
* period < 3.2ms. (see DP Standard v2.0, 2.11.2, 3.6.6.1).
227
228
*/
228
- if (DISPLAY_VER (i915 ) >= 10 && !IS_GEMINILAKE (i915 ))
229
+ if (DISPLAY_VER (display ) >= 10 && !IS_GEMINILAKE (i915 ))
229
230
if (drm_dp_dpcd_probe (& intel_dp -> aux ,
230
231
DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV ))
231
232
return - EIO ;
@@ -256,15 +257,16 @@ int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_S
256
257
*/
257
258
int intel_dp_init_lttpr_and_dprx_caps (struct intel_dp * intel_dp )
258
259
{
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 );
260
262
int lttpr_count = 0 ;
261
263
262
264
/*
263
265
* Detecting LTTPRs must be avoided on platforms with an AUX timeout
264
266
* period < 3.2ms. (see DP Standard v2.0, 2.11.2, 3.6.6.1).
265
267
*/
266
268
if (!intel_dp_is_edp (intel_dp ) &&
267
- (DISPLAY_VER (i915 ) >= 10 && !IS_GEMINILAKE (i915 ))) {
269
+ (DISPLAY_VER (display ) >= 10 && !IS_GEMINILAKE (i915 ))) {
268
270
u8 dpcd [DP_RECEIVER_CAP_SIZE ];
269
271
int err = intel_dp_read_dprx_caps (intel_dp , dpcd );
270
272
@@ -327,10 +329,11 @@ static bool
327
329
intel_dp_phy_is_downstream_of_source (struct intel_dp * intel_dp ,
328
330
enum drm_dp_phy dp_phy )
329
331
{
330
- struct drm_i915_private * i915 = dp_to_i915 (intel_dp );
332
+ struct intel_display * display = to_intel_display (intel_dp );
331
333
int lttpr_count = drm_dp_lttpr_count (intel_dp -> lttpr_common_caps );
332
334
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 );
334
337
335
338
return lttpr_count <= 0 || dp_phy == DP_PHY_LTTPR (lttpr_count - 1 );
336
339
}
@@ -339,7 +342,7 @@ static u8 intel_dp_phy_voltage_max(struct intel_dp *intel_dp,
339
342
const struct intel_crtc_state * crtc_state ,
340
343
enum drm_dp_phy dp_phy )
341
344
{
342
- struct drm_i915_private * i915 = dp_to_i915 (intel_dp );
345
+ struct intel_display * display = to_intel_display (intel_dp );
343
346
u8 voltage_max ;
344
347
345
348
/*
@@ -351,7 +354,7 @@ static u8 intel_dp_phy_voltage_max(struct intel_dp *intel_dp,
351
354
else
352
355
voltage_max = intel_dp_lttpr_voltage_max (intel_dp , dp_phy + 1 );
353
356
354
- drm_WARN_ON_ONCE (& i915 -> drm ,
357
+ drm_WARN_ON_ONCE (display -> drm ,
355
358
voltage_max != DP_TRAIN_VOLTAGE_SWING_LEVEL_2 &&
356
359
voltage_max != DP_TRAIN_VOLTAGE_SWING_LEVEL_3 );
357
360
@@ -361,7 +364,7 @@ static u8 intel_dp_phy_voltage_max(struct intel_dp *intel_dp,
361
364
static u8 intel_dp_phy_preemph_max (struct intel_dp * intel_dp ,
362
365
enum drm_dp_phy dp_phy )
363
366
{
364
- struct drm_i915_private * i915 = dp_to_i915 (intel_dp );
367
+ struct intel_display * display = to_intel_display (intel_dp );
365
368
u8 preemph_max ;
366
369
367
370
/*
@@ -373,7 +376,7 @@ static u8 intel_dp_phy_preemph_max(struct intel_dp *intel_dp,
373
376
else
374
377
preemph_max = intel_dp_lttpr_preemph_max (intel_dp , dp_phy + 1 );
375
378
376
- drm_WARN_ON_ONCE (& i915 -> drm ,
379
+ drm_WARN_ON_ONCE (display -> drm ,
377
380
preemph_max != DP_TRAIN_PRE_EMPH_LEVEL_2 &&
378
381
preemph_max != DP_TRAIN_PRE_EMPH_LEVEL_3 );
379
382
@@ -383,10 +386,11 @@ static u8 intel_dp_phy_preemph_max(struct intel_dp *intel_dp,
383
386
static bool has_per_lane_signal_levels (struct intel_dp * intel_dp ,
384
387
enum drm_dp_phy dp_phy )
385
388
{
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 );
387
391
388
392
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 );
390
394
}
391
395
392
396
/* 128b/132b */
@@ -950,7 +954,8 @@ static u32 intel_dp_training_pattern(struct intel_dp *intel_dp,
950
954
const struct intel_crtc_state * crtc_state ,
951
955
enum drm_dp_phy dp_phy )
952
956
{
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 );
954
959
bool source_tps3 , sink_tps3 , source_tps4 , sink_tps4 ;
955
960
956
961
/* UHBR+ use separate 128b/132b TPS2 */
@@ -1586,7 +1591,7 @@ void intel_dp_start_link_train(struct intel_atomic_state *state,
1586
1591
struct intel_dp * intel_dp ,
1587
1592
const struct intel_crtc_state * crtc_state )
1588
1593
{
1589
- struct drm_i915_private * i915 = dp_to_i915 ( intel_dp );
1594
+ struct intel_display * display = to_intel_display ( state );
1590
1595
struct intel_digital_port * dig_port = dp_to_dig_port (intel_dp );
1591
1596
struct intel_encoder * encoder = & dig_port -> base ;
1592
1597
bool passed ;
@@ -1631,7 +1636,7 @@ void intel_dp_start_link_train(struct intel_atomic_state *state,
1631
1636
* For test cases which rely on the link training or processing of HPDs
1632
1637
* ignore_long_hpd flag can unset from the testcase.
1633
1638
*/
1634
- if (i915 -> display . hotplug .ignore_long_hpd ) {
1639
+ if (display -> hotplug .ignore_long_hpd ) {
1635
1640
lt_dbg (intel_dp , DP_PHY_DPRX , "Ignore the link failure\n" );
1636
1641
return ;
1637
1642
}
@@ -1683,22 +1688,22 @@ static struct intel_dp *intel_connector_to_intel_dp(struct intel_connector *conn
1683
1688
static int i915_dp_force_link_rate_show (struct seq_file * m , void * data )
1684
1689
{
1685
1690
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 );
1687
1692
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
1688
1693
int current_rate = -1 ;
1689
1694
int force_rate ;
1690
1695
int err ;
1691
1696
int i ;
1692
1697
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 );
1694
1699
if (err )
1695
1700
return err ;
1696
1701
1697
1702
if (intel_dp -> link_trained )
1698
1703
current_rate = intel_dp -> link_rate ;
1699
1704
force_rate = intel_dp -> link .force_rate ;
1700
1705
1701
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
1706
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
1702
1707
1703
1708
seq_printf (m , "%sauto%s" ,
1704
1709
force_rate == 0 ? "[" : "" ,
@@ -1754,7 +1759,7 @@ static ssize_t i915_dp_force_link_rate_write(struct file *file,
1754
1759
{
1755
1760
struct seq_file * m = file -> private_data ;
1756
1761
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 );
1758
1763
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
1759
1764
int rate ;
1760
1765
int err ;
@@ -1763,14 +1768,14 @@ static ssize_t i915_dp_force_link_rate_write(struct file *file,
1763
1768
if (rate < 0 )
1764
1769
return rate ;
1765
1770
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 );
1767
1772
if (err )
1768
1773
return err ;
1769
1774
1770
1775
intel_dp_reset_link_params (intel_dp );
1771
1776
intel_dp -> link .force_rate = rate ;
1772
1777
1773
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
1778
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
1774
1779
1775
1780
* offp += len ;
1776
1781
@@ -1781,22 +1786,22 @@ DEFINE_SHOW_STORE_ATTRIBUTE(i915_dp_force_link_rate);
1781
1786
static int i915_dp_force_lane_count_show (struct seq_file * m , void * data )
1782
1787
{
1783
1788
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 );
1785
1790
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
1786
1791
int current_lane_count = -1 ;
1787
1792
int force_lane_count ;
1788
1793
int err ;
1789
1794
int i ;
1790
1795
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 );
1792
1797
if (err )
1793
1798
return err ;
1794
1799
1795
1800
if (intel_dp -> link_trained )
1796
1801
current_lane_count = intel_dp -> lane_count ;
1797
1802
force_lane_count = intel_dp -> link .force_lane_count ;
1798
1803
1799
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
1804
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
1800
1805
1801
1806
seq_printf (m , "%sauto%s" ,
1802
1807
force_lane_count == 0 ? "[" : "" ,
@@ -1856,7 +1861,7 @@ static ssize_t i915_dp_force_lane_count_write(struct file *file,
1856
1861
{
1857
1862
struct seq_file * m = file -> private_data ;
1858
1863
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 );
1860
1865
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
1861
1866
int lane_count ;
1862
1867
int err ;
@@ -1865,14 +1870,14 @@ static ssize_t i915_dp_force_lane_count_write(struct file *file,
1865
1870
if (lane_count < 0 )
1866
1871
return lane_count ;
1867
1872
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 );
1869
1874
if (err )
1870
1875
return err ;
1871
1876
1872
1877
intel_dp_reset_link_params (intel_dp );
1873
1878
intel_dp -> link .force_lane_count = lane_count ;
1874
1879
1875
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
1880
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
1876
1881
1877
1882
* offp += len ;
1878
1883
@@ -1883,17 +1888,17 @@ DEFINE_SHOW_STORE_ATTRIBUTE(i915_dp_force_lane_count);
1883
1888
static int i915_dp_max_link_rate_show (void * data , u64 * val )
1884
1889
{
1885
1890
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 );
1887
1892
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
1888
1893
int err ;
1889
1894
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 );
1891
1896
if (err )
1892
1897
return err ;
1893
1898
1894
1899
* val = intel_dp -> link .max_rate ;
1895
1900
1896
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
1901
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
1897
1902
1898
1903
return 0 ;
1899
1904
}
@@ -1902,17 +1907,17 @@ DEFINE_DEBUGFS_ATTRIBUTE(i915_dp_max_link_rate_fops, i915_dp_max_link_rate_show,
1902
1907
static int i915_dp_max_lane_count_show (void * data , u64 * val )
1903
1908
{
1904
1909
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 );
1906
1911
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
1907
1912
int err ;
1908
1913
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 );
1910
1915
if (err )
1911
1916
return err ;
1912
1917
1913
1918
* val = intel_dp -> link .max_lane_count ;
1914
1919
1915
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
1920
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
1916
1921
1917
1922
return 0 ;
1918
1923
}
@@ -1921,38 +1926,38 @@ DEFINE_DEBUGFS_ATTRIBUTE(i915_dp_max_lane_count_fops, i915_dp_max_lane_count_sho
1921
1926
static int i915_dp_force_link_training_failure_show (void * data , u64 * val )
1922
1927
{
1923
1928
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 );
1925
1930
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
1926
1931
int err ;
1927
1932
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 );
1929
1934
if (err )
1930
1935
return err ;
1931
1936
1932
1937
* val = intel_dp -> link .force_train_failure ;
1933
1938
1934
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
1939
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
1935
1940
1936
1941
return 0 ;
1937
1942
}
1938
1943
1939
1944
static int i915_dp_force_link_training_failure_write (void * data , u64 val )
1940
1945
{
1941
1946
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 );
1943
1948
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
1944
1949
int err ;
1945
1950
1946
1951
if (val > 2 )
1947
1952
return - EINVAL ;
1948
1953
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 );
1950
1955
if (err )
1951
1956
return err ;
1952
1957
1953
1958
intel_dp -> link .force_train_failure = val ;
1954
1959
1955
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
1960
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
1956
1961
1957
1962
return 0 ;
1958
1963
}
@@ -1963,35 +1968,35 @@ DEFINE_DEBUGFS_ATTRIBUTE(i915_dp_force_link_training_failure_fops,
1963
1968
static int i915_dp_force_link_retrain_show (void * data , u64 * val )
1964
1969
{
1965
1970
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 );
1967
1972
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
1968
1973
int err ;
1969
1974
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 );
1971
1976
if (err )
1972
1977
return err ;
1973
1978
1974
1979
* val = intel_dp -> link .force_retrain ;
1975
1980
1976
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
1981
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
1977
1982
1978
1983
return 0 ;
1979
1984
}
1980
1985
1981
1986
static int i915_dp_force_link_retrain_write (void * data , u64 val )
1982
1987
{
1983
1988
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 );
1985
1990
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
1986
1991
int err ;
1987
1992
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 );
1989
1994
if (err )
1990
1995
return err ;
1991
1996
1992
1997
intel_dp -> link .force_retrain = val ;
1993
1998
1994
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
1999
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
1995
2000
1996
2001
intel_hpd_trigger_irq (dp_to_dig_port (intel_dp ));
1997
2002
@@ -2004,17 +2009,17 @@ DEFINE_DEBUGFS_ATTRIBUTE(i915_dp_force_link_retrain_fops,
2004
2009
static int i915_dp_link_retrain_disabled_show (struct seq_file * m , void * data )
2005
2010
{
2006
2011
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 );
2008
2013
struct intel_dp * intel_dp = intel_connector_to_intel_dp (connector );
2009
2014
int err ;
2010
2015
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 );
2012
2017
if (err )
2013
2018
return err ;
2014
2019
2015
2020
seq_printf (m , "%s\n" , str_yes_no (intel_dp -> link .retrain_disabled ));
2016
2021
2017
- drm_modeset_unlock (& i915 -> drm . mode_config .connection_mutex );
2022
+ drm_modeset_unlock (& display -> drm -> mode_config .connection_mutex );
2018
2023
2019
2024
return 0 ;
2020
2025
}
0 commit comments