@@ -934,7 +934,7 @@ static uint32_t
934
934
intel_dp_aux_wait_done (struct intel_dp * intel_dp , bool has_aux_irq )
935
935
{
936
936
struct drm_i915_private * dev_priv = to_i915 (intel_dp_to_dev (intel_dp ));
937
- i915_reg_t ch_ctl = intel_dp -> aux_ch_ctl_reg ;
937
+ i915_reg_t ch_ctl = intel_dp -> aux_ch_ctl_reg ( intel_dp ) ;
938
938
uint32_t status ;
939
939
bool done ;
940
940
@@ -1068,14 +1068,18 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
1068
1068
struct intel_digital_port * intel_dig_port = dp_to_dig_port (intel_dp );
1069
1069
struct drm_i915_private * dev_priv =
1070
1070
to_i915 (intel_dig_port -> base .base .dev );
1071
- i915_reg_t ch_ctl = intel_dp -> aux_ch_ctl_reg ;
1071
+ i915_reg_t ch_ctl , ch_data [ 5 ] ;
1072
1072
uint32_t aux_clock_divider ;
1073
1073
int i , ret , recv_bytes ;
1074
1074
uint32_t status ;
1075
1075
int try , clock = 0 ;
1076
1076
bool has_aux_irq = HAS_AUX_IRQ (dev_priv );
1077
1077
bool vdd ;
1078
1078
1079
+ ch_ctl = intel_dp -> aux_ch_ctl_reg (intel_dp );
1080
+ for (i = 0 ; i < ARRAY_SIZE (ch_data ); i ++ )
1081
+ ch_data [i ] = intel_dp -> aux_ch_data_reg (intel_dp , i );
1082
+
1079
1083
pps_lock (intel_dp );
1080
1084
1081
1085
/*
@@ -1132,7 +1136,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
1132
1136
for (try = 0 ; try < 5 ; try ++ ) {
1133
1137
/* Load the send data into the aux channel data registers */
1134
1138
for (i = 0 ; i < send_bytes ; i += 4 )
1135
- I915_WRITE (intel_dp -> aux_ch_data_reg [i >> 2 ],
1139
+ I915_WRITE (ch_data [i >> 2 ],
1136
1140
intel_dp_pack_aux (send + i ,
1137
1141
send_bytes - i ));
1138
1142
@@ -1217,7 +1221,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
1217
1221
recv_bytes = recv_size ;
1218
1222
1219
1223
for (i = 0 ; i < recv_bytes ; i += 4 )
1220
- intel_dp_unpack_aux (I915_READ (intel_dp -> aux_ch_data_reg [i >> 2 ]),
1224
+ intel_dp_unpack_aux (I915_READ (ch_data [i >> 2 ]),
1221
1225
recv + i , recv_bytes - i );
1222
1226
1223
1227
ret = recv_bytes ;
@@ -1372,9 +1376,11 @@ intel_aux_power_domain(struct intel_dp *intel_dp)
1372
1376
}
1373
1377
}
1374
1378
1375
- static i915_reg_t g4x_aux_ctl_reg (struct drm_i915_private * dev_priv ,
1376
- enum aux_ch aux_ch )
1379
+ static i915_reg_t g4x_aux_ctl_reg (struct intel_dp * intel_dp )
1377
1380
{
1381
+ struct drm_i915_private * dev_priv = to_i915 (intel_dp_to_dev (intel_dp ));
1382
+ enum aux_ch aux_ch = intel_dp -> aux_ch ;
1383
+
1378
1384
switch (aux_ch ) {
1379
1385
case AUX_CH_B :
1380
1386
case AUX_CH_C :
@@ -1386,9 +1392,11 @@ static i915_reg_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv,
1386
1392
}
1387
1393
}
1388
1394
1389
- static i915_reg_t g4x_aux_data_reg (struct drm_i915_private * dev_priv ,
1390
- enum aux_ch aux_ch , int index )
1395
+ static i915_reg_t g4x_aux_data_reg (struct intel_dp * intel_dp , int index )
1391
1396
{
1397
+ struct drm_i915_private * dev_priv = to_i915 (intel_dp_to_dev (intel_dp ));
1398
+ enum aux_ch aux_ch = intel_dp -> aux_ch ;
1399
+
1392
1400
switch (aux_ch ) {
1393
1401
case AUX_CH_B :
1394
1402
case AUX_CH_C :
@@ -1400,9 +1408,11 @@ static i915_reg_t g4x_aux_data_reg(struct drm_i915_private *dev_priv,
1400
1408
}
1401
1409
}
1402
1410
1403
- static i915_reg_t ilk_aux_ctl_reg (struct drm_i915_private * dev_priv ,
1404
- enum aux_ch aux_ch )
1411
+ static i915_reg_t ilk_aux_ctl_reg (struct intel_dp * intel_dp )
1405
1412
{
1413
+ struct drm_i915_private * dev_priv = to_i915 (intel_dp_to_dev (intel_dp ));
1414
+ enum aux_ch aux_ch = intel_dp -> aux_ch ;
1415
+
1406
1416
switch (aux_ch ) {
1407
1417
case AUX_CH_A :
1408
1418
return DP_AUX_CH_CTL (aux_ch );
@@ -1416,9 +1426,11 @@ static i915_reg_t ilk_aux_ctl_reg(struct drm_i915_private *dev_priv,
1416
1426
}
1417
1427
}
1418
1428
1419
- static i915_reg_t ilk_aux_data_reg (struct drm_i915_private * dev_priv ,
1420
- enum aux_ch aux_ch , int index )
1429
+ static i915_reg_t ilk_aux_data_reg (struct intel_dp * intel_dp , int index )
1421
1430
{
1431
+ struct drm_i915_private * dev_priv = to_i915 (intel_dp_to_dev (intel_dp ));
1432
+ enum aux_ch aux_ch = intel_dp -> aux_ch ;
1433
+
1422
1434
switch (aux_ch ) {
1423
1435
case AUX_CH_A :
1424
1436
return DP_AUX_CH_DATA (aux_ch , index );
@@ -1432,9 +1444,11 @@ static i915_reg_t ilk_aux_data_reg(struct drm_i915_private *dev_priv,
1432
1444
}
1433
1445
}
1434
1446
1435
- static i915_reg_t skl_aux_ctl_reg (struct drm_i915_private * dev_priv ,
1436
- enum aux_ch aux_ch )
1447
+ static i915_reg_t skl_aux_ctl_reg (struct intel_dp * intel_dp )
1437
1448
{
1449
+ struct drm_i915_private * dev_priv = to_i915 (intel_dp_to_dev (intel_dp ));
1450
+ enum aux_ch aux_ch = intel_dp -> aux_ch ;
1451
+
1438
1452
switch (aux_ch ) {
1439
1453
case AUX_CH_A :
1440
1454
case AUX_CH_B :
@@ -1448,9 +1462,11 @@ static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv,
1448
1462
}
1449
1463
}
1450
1464
1451
- static i915_reg_t skl_aux_data_reg (struct drm_i915_private * dev_priv ,
1452
- enum aux_ch aux_ch , int index )
1465
+ static i915_reg_t skl_aux_data_reg (struct intel_dp * intel_dp , int index )
1453
1466
{
1467
+ struct drm_i915_private * dev_priv = to_i915 (intel_dp_to_dev (intel_dp ));
1468
+ enum aux_ch aux_ch = intel_dp -> aux_ch ;
1469
+
1454
1470
switch (aux_ch ) {
1455
1471
case AUX_CH_A :
1456
1472
case AUX_CH_B :
@@ -1464,37 +1480,20 @@ static i915_reg_t skl_aux_data_reg(struct drm_i915_private *dev_priv,
1464
1480
}
1465
1481
}
1466
1482
1467
- static i915_reg_t intel_aux_ctl_reg (struct drm_i915_private * dev_priv ,
1468
- enum aux_ch aux_ch )
1469
- {
1470
- if (INTEL_GEN (dev_priv ) >= 9 )
1471
- return skl_aux_ctl_reg (dev_priv , aux_ch );
1472
- else if (HAS_PCH_SPLIT (dev_priv ))
1473
- return ilk_aux_ctl_reg (dev_priv , aux_ch );
1474
- else
1475
- return g4x_aux_ctl_reg (dev_priv , aux_ch );
1476
- }
1477
-
1478
- static i915_reg_t intel_aux_data_reg (struct drm_i915_private * dev_priv ,
1479
- enum aux_ch aux_ch , int index )
1480
- {
1481
- if (INTEL_GEN (dev_priv ) >= 9 )
1482
- return skl_aux_data_reg (dev_priv , aux_ch , index );
1483
- else if (HAS_PCH_SPLIT (dev_priv ))
1484
- return ilk_aux_data_reg (dev_priv , aux_ch , index );
1485
- else
1486
- return g4x_aux_data_reg (dev_priv , aux_ch , index );
1487
- }
1488
-
1489
1483
static void intel_aux_reg_init (struct intel_dp * intel_dp )
1490
1484
{
1491
1485
struct drm_i915_private * dev_priv = to_i915 (intel_dp_to_dev (intel_dp ));
1492
- enum aux_ch aux_ch = intel_dp -> aux_ch ;
1493
- int i ;
1494
1486
1495
- intel_dp -> aux_ch_ctl_reg = intel_aux_ctl_reg (dev_priv , aux_ch );
1496
- for (i = 0 ; i < ARRAY_SIZE (intel_dp -> aux_ch_data_reg ); i ++ )
1497
- intel_dp -> aux_ch_data_reg [i ] = intel_aux_data_reg (dev_priv , aux_ch , i );
1487
+ if (INTEL_GEN (dev_priv ) >= 9 ) {
1488
+ intel_dp -> aux_ch_ctl_reg = skl_aux_ctl_reg ;
1489
+ intel_dp -> aux_ch_data_reg = skl_aux_data_reg ;
1490
+ } else if (HAS_PCH_SPLIT (dev_priv )) {
1491
+ intel_dp -> aux_ch_ctl_reg = ilk_aux_ctl_reg ;
1492
+ intel_dp -> aux_ch_data_reg = ilk_aux_data_reg ;
1493
+ } else {
1494
+ intel_dp -> aux_ch_ctl_reg = g4x_aux_ctl_reg ;
1495
+ intel_dp -> aux_ch_data_reg = g4x_aux_data_reg ;
1496
+ }
1498
1497
}
1499
1498
1500
1499
static void
0 commit comments