7
7
8
8
#include <linux/string_helpers.h>
9
9
10
+ #include <drm/drm_print.h>
11
+
10
12
#include "g4x_dp.h"
11
- #include "i915_drv.h"
12
13
#include "i915_reg.h"
14
+ #include "i915_utils.h"
13
15
#include "intel_audio.h"
14
16
#include "intel_backlight.h"
15
17
#include "intel_connector.h"
28
30
#include "intel_hotplug.h"
29
31
#include "intel_pch_display.h"
30
32
#include "intel_pps.h"
31
- #include "vlv_sideband.h"
32
33
33
34
static const struct dpll g4x_dpll [] = {
34
35
{ .dot = 162000 , .p1 = 2 , .p2 = 10 , .n = 2 , .m1 = 23 , .m2 = 8 , },
@@ -60,14 +61,13 @@ static void g4x_dp_set_clock(struct intel_encoder *encoder,
60
61
struct intel_crtc_state * pipe_config )
61
62
{
62
63
struct intel_display * display = to_intel_display (encoder );
63
- struct drm_i915_private * dev_priv = to_i915 (encoder -> base .dev );
64
64
const struct dpll * divisor = NULL ;
65
65
int i , count = 0 ;
66
66
67
67
if (display -> platform .g4x ) {
68
68
divisor = g4x_dpll ;
69
69
count = ARRAY_SIZE (g4x_dpll );
70
- } else if (HAS_PCH_SPLIT (dev_priv )) {
70
+ } else if (HAS_PCH_SPLIT (display )) {
71
71
divisor = pch_dpll ;
72
72
count = ARRAY_SIZE (pch_dpll );
73
73
} else if (display -> platform .cherryview ) {
@@ -93,7 +93,6 @@ static void intel_dp_prepare(struct intel_encoder *encoder,
93
93
const struct intel_crtc_state * pipe_config )
94
94
{
95
95
struct intel_display * display = to_intel_display (encoder );
96
- struct drm_i915_private * dev_priv = to_i915 (encoder -> base .dev );
97
96
struct intel_dp * intel_dp = enc_to_intel_dp (encoder );
98
97
enum port port = encoder -> port ;
99
98
struct intel_crtc * crtc = to_intel_crtc (pipe_config -> uapi .crtc );
@@ -141,7 +140,7 @@ static void intel_dp_prepare(struct intel_encoder *encoder,
141
140
intel_dp -> DP |= DP_ENHANCED_FRAMING ;
142
141
143
142
intel_dp -> DP |= DP_PIPE_SEL_IVB (crtc -> pipe );
144
- } else if (HAS_PCH_CPT (dev_priv ) && port != PORT_A ) {
143
+ } else if (HAS_PCH_CPT (display ) && port != PORT_A ) {
145
144
intel_dp -> DP |= DP_LINK_TRAIN_OFF_CPT ;
146
145
147
146
intel_de_rmw (display , TRANS_DP_CTL (crtc -> pipe ),
@@ -183,7 +182,7 @@ static void assert_dp_port(struct intel_dp *intel_dp, bool state)
183
182
184
183
static void assert_edp_pll (struct intel_display * display , bool state )
185
184
{
186
- bool cur_state = intel_de_read (display , DP_A ) & DP_PLL_ENABLE ;
185
+ bool cur_state = intel_de_read (display , DP_A ) & EDP_PLL_ENABLE ;
187
186
188
187
INTEL_DISPLAY_STATE_WARN (display , cur_state != state ,
189
188
"eDP PLL state assertion failure (expected %s, current %s)\n" ,
@@ -205,12 +204,12 @@ static void ilk_edp_pll_on(struct intel_dp *intel_dp,
205
204
drm_dbg_kms (display -> drm , "enabling eDP PLL for clock %d\n" ,
206
205
pipe_config -> port_clock );
207
206
208
- intel_dp -> DP &= ~DP_PLL_FREQ_MASK ;
207
+ intel_dp -> DP &= ~EDP_PLL_FREQ_MASK ;
209
208
210
209
if (pipe_config -> port_clock == 162000 )
211
- intel_dp -> DP |= DP_PLL_FREQ_162MHZ ;
210
+ intel_dp -> DP |= EDP_PLL_FREQ_162MHZ ;
212
211
else
213
- intel_dp -> DP |= DP_PLL_FREQ_270MHZ ;
212
+ intel_dp -> DP |= EDP_PLL_FREQ_270MHZ ;
214
213
215
214
intel_de_write (display , DP_A , intel_dp -> DP );
216
215
intel_de_posting_read (display , DP_A );
@@ -225,7 +224,7 @@ static void ilk_edp_pll_on(struct intel_dp *intel_dp,
225
224
if (display -> platform .ironlake )
226
225
intel_wait_for_vblank_if_active (display , !crtc -> pipe );
227
226
228
- intel_dp -> DP |= DP_PLL_ENABLE ;
227
+ intel_dp -> DP |= EDP_PLL_ENABLE ;
229
228
230
229
intel_de_write (display , DP_A , intel_dp -> DP );
231
230
intel_de_posting_read (display , DP_A );
@@ -243,7 +242,7 @@ static void ilk_edp_pll_off(struct intel_dp *intel_dp,
243
242
244
243
drm_dbg_kms (display -> drm , "disabling eDP PLL\n" );
245
244
246
- intel_dp -> DP &= ~DP_PLL_ENABLE ;
245
+ intel_dp -> DP &= ~EDP_PLL_ENABLE ;
247
246
248
247
intel_de_write (display , DP_A , intel_dp -> DP );
249
248
intel_de_posting_read (display , DP_A );
@@ -277,7 +276,6 @@ bool g4x_dp_port_enabled(struct intel_display *display,
277
276
i915_reg_t dp_reg , enum port port ,
278
277
enum pipe * pipe )
279
278
{
280
- struct drm_i915_private * dev_priv = to_i915 (display -> drm );
281
279
bool ret ;
282
280
u32 val ;
283
281
@@ -287,13 +285,13 @@ bool g4x_dp_port_enabled(struct intel_display *display,
287
285
288
286
/* asserts want to know the pipe even if the port is disabled */
289
287
if (display -> platform .ivybridge && port == PORT_A )
290
- * pipe = ( val & DP_PIPE_SEL_MASK_IVB ) >> DP_PIPE_SEL_SHIFT_IVB ;
291
- else if (HAS_PCH_CPT (dev_priv ) && port != PORT_A )
288
+ * pipe = REG_FIELD_GET ( DP_PIPE_SEL_MASK_IVB , val ) ;
289
+ else if (HAS_PCH_CPT (display ) && port != PORT_A )
292
290
ret &= cpt_dp_port_selected (display , port , pipe );
293
291
else if (display -> platform .cherryview )
294
- * pipe = ( val & DP_PIPE_SEL_MASK_CHV ) >> DP_PIPE_SEL_SHIFT_CHV ;
292
+ * pipe = REG_FIELD_GET ( DP_PIPE_SEL_MASK_CHV , val ) ;
295
293
else
296
- * pipe = ( val & DP_PIPE_SEL_MASK ) >> DP_PIPE_SEL_SHIFT ;
294
+ * pipe = REG_FIELD_GET ( DP_PIPE_SEL_MASK , val ) ;
297
295
298
296
return ret ;
299
297
}
@@ -338,7 +336,6 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
338
336
struct intel_crtc_state * pipe_config )
339
337
{
340
338
struct intel_display * display = to_intel_display (encoder );
341
- struct drm_i915_private * dev_priv = to_i915 (encoder -> base .dev );
342
339
struct intel_dp * intel_dp = enc_to_intel_dp (encoder );
343
340
u32 tmp , flags = 0 ;
344
341
enum port port = encoder -> port ;
@@ -353,7 +350,7 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
353
350
354
351
pipe_config -> has_audio = tmp & DP_AUDIO_OUTPUT_ENABLE && port != PORT_A ;
355
352
356
- if (HAS_PCH_CPT (dev_priv ) && port != PORT_A ) {
353
+ if (HAS_PCH_CPT (display ) && port != PORT_A ) {
357
354
u32 trans_dp = intel_de_read (display ,
358
355
TRANS_DP_CTL (crtc -> pipe ));
359
356
@@ -389,13 +386,12 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
389
386
if (display -> platform .g4x && tmp & DP_COLOR_RANGE_16_235 )
390
387
pipe_config -> limited_color_range = true;
391
388
392
- pipe_config -> lane_count =
393
- ((tmp & DP_PORT_WIDTH_MASK ) >> DP_PORT_WIDTH_SHIFT ) + 1 ;
389
+ pipe_config -> lane_count = REG_FIELD_GET (DP_PORT_WIDTH_MASK , tmp ) + 1 ;
394
390
395
391
g4x_dp_get_m_n (pipe_config );
396
392
397
393
if (port == PORT_A ) {
398
- if ((intel_de_read (display , DP_A ) & DP_PLL_FREQ_MASK ) == DP_PLL_FREQ_162MHZ )
394
+ if ((intel_de_read (display , DP_A ) & EDP_PLL_FREQ_MASK ) == EDP_PLL_FREQ_162MHZ )
399
395
pipe_config -> port_clock = 162000 ;
400
396
else
401
397
pipe_config -> port_clock = 270000 ;
@@ -416,7 +412,6 @@ intel_dp_link_down(struct intel_encoder *encoder,
416
412
const struct intel_crtc_state * old_crtc_state )
417
413
{
418
414
struct intel_display * display = to_intel_display (encoder );
419
- struct drm_i915_private * dev_priv = to_i915 (encoder -> base .dev );
420
415
struct intel_dp * intel_dp = enc_to_intel_dp (encoder );
421
416
struct intel_crtc * crtc = to_intel_crtc (old_crtc_state -> uapi .crtc );
422
417
enum port port = encoder -> port ;
@@ -429,7 +424,7 @@ intel_dp_link_down(struct intel_encoder *encoder,
429
424
drm_dbg_kms (display -> drm , "\n" );
430
425
431
426
if ((display -> platform .ivybridge && port == PORT_A ) ||
432
- (HAS_PCH_CPT (dev_priv ) && port != PORT_A )) {
427
+ (HAS_PCH_CPT (display ) && port != PORT_A )) {
433
428
intel_dp -> DP &= ~DP_LINK_TRAIN_MASK_CPT ;
434
429
intel_dp -> DP |= DP_LINK_TRAIN_PAT_IDLE_CPT ;
435
430
} else {
@@ -448,7 +443,7 @@ intel_dp_link_down(struct intel_encoder *encoder,
448
443
* to transcoder A after disabling it to allow the
449
444
* matching HDMI port to be enabled on transcoder A.
450
445
*/
451
- if (HAS_PCH_IBX (dev_priv ) && crtc -> pipe == PIPE_B && port != PORT_A ) {
446
+ if (HAS_PCH_IBX (display ) && crtc -> pipe == PIPE_B && port != PORT_A ) {
452
447
/*
453
448
* We get CPU/PCH FIFO underruns on the other pipe when
454
449
* doing the workaround. Sweep them under the rug.
@@ -581,16 +576,10 @@ static void chv_post_disable_dp(struct intel_atomic_state *state,
581
576
const struct intel_crtc_state * old_crtc_state ,
582
577
const struct drm_connector_state * old_conn_state )
583
578
{
584
- struct drm_i915_private * dev_priv = to_i915 (encoder -> base .dev );
585
-
586
579
intel_dp_link_down (encoder , old_crtc_state );
587
580
588
- vlv_dpio_get (dev_priv );
589
-
590
581
/* Assert data lane reset */
591
582
chv_data_lane_soft_reset (encoder , old_crtc_state , true);
592
-
593
- vlv_dpio_put (dev_priv );
594
583
}
595
584
596
585
static void
@@ -1223,10 +1212,10 @@ static int g4x_dp_compute_config(struct intel_encoder *encoder,
1223
1212
struct intel_crtc_state * crtc_state ,
1224
1213
struct drm_connector_state * conn_state )
1225
1214
{
1226
- struct drm_i915_private * i915 = to_i915 (encoder -> base . dev );
1215
+ struct intel_display * display = to_intel_display (encoder );
1227
1216
int ret ;
1228
1217
1229
- if (HAS_PCH_SPLIT (i915 ) && encoder -> port != PORT_A )
1218
+ if (HAS_PCH_SPLIT (display ) && encoder -> port != PORT_A )
1230
1219
crtc_state -> has_pch_encoder = true;
1231
1220
1232
1221
ret = intel_dp_compute_config (encoder , crtc_state , conn_state );
@@ -1279,7 +1268,6 @@ static const struct drm_encoder_funcs intel_dp_enc_funcs = {
1279
1268
bool g4x_dp_init (struct intel_display * display ,
1280
1269
i915_reg_t output_reg , enum port port )
1281
1270
{
1282
- struct drm_i915_private * dev_priv = to_i915 (display -> drm );
1283
1271
const struct intel_bios_encoder_data * devdata ;
1284
1272
struct intel_digital_port * dig_port ;
1285
1273
struct intel_encoder * intel_encoder ;
@@ -1353,7 +1341,7 @@ bool g4x_dp_init(struct intel_display *display,
1353
1341
intel_encoder -> audio_disable = g4x_dp_audio_disable ;
1354
1342
1355
1343
if ((display -> platform .ivybridge && port == PORT_A ) ||
1356
- (HAS_PCH_CPT (dev_priv ) && port != PORT_A ))
1344
+ (HAS_PCH_CPT (display ) && port != PORT_A ))
1357
1345
dig_port -> dp .set_link_train = cpt_set_link_train ;
1358
1346
else
1359
1347
dig_port -> dp .set_link_train = g4x_set_link_train ;
@@ -1370,7 +1358,7 @@ bool g4x_dp_init(struct intel_display *display,
1370
1358
intel_encoder -> set_signal_levels = g4x_set_signal_levels ;
1371
1359
1372
1360
if (display -> platform .valleyview || display -> platform .cherryview ||
1373
- (HAS_PCH_SPLIT (dev_priv ) && port != PORT_A )) {
1361
+ (HAS_PCH_SPLIT (display ) && port != PORT_A )) {
1374
1362
dig_port -> dp .preemph_max = intel_dp_preemph_max_3 ;
1375
1363
dig_port -> dp .voltage_max = intel_dp_voltage_max_3 ;
1376
1364
} else {
0 commit comments