@@ -1337,13 +1337,14 @@ static void vlv_dpio_cmn_power_well_disable(struct drm_i915_private *dev_priv,
1337
1337
1338
1338
#define BITS_SET (val , bits ) (((val) & (bits)) == (bits))
1339
1339
1340
- static void assert_chv_phy_status (struct drm_i915_private * dev_priv )
1340
+ static void assert_chv_phy_status (struct intel_display * display )
1341
1341
{
1342
+ struct drm_i915_private * dev_priv = to_i915 (display -> drm );
1342
1343
struct i915_power_well * cmn_bc =
1343
1344
lookup_power_well (dev_priv , VLV_DISP_PW_DPIO_CMN_BC );
1344
1345
struct i915_power_well * cmn_d =
1345
1346
lookup_power_well (dev_priv , CHV_DISP_PW_DPIO_CMN_D );
1346
- u32 phy_control = dev_priv -> display . power .chv_phy_control ;
1347
+ u32 phy_control = display -> power .chv_phy_control ;
1347
1348
u32 phy_status = 0 ;
1348
1349
u32 phy_status_mask = 0xffffffff ;
1349
1350
@@ -1354,15 +1355,15 @@ static void assert_chv_phy_status(struct drm_i915_private *dev_priv)
1354
1355
* reset (ie. the power well has been disabled at
1355
1356
* least once).
1356
1357
*/
1357
- if (!dev_priv -> display . power .chv_phy_assert [DPIO_PHY0 ])
1358
+ if (!display -> power .chv_phy_assert [DPIO_PHY0 ])
1358
1359
phy_status_mask &= ~(PHY_STATUS_CMN_LDO (DPIO_PHY0 , DPIO_CH0 ) |
1359
1360
PHY_STATUS_SPLINE_LDO (DPIO_PHY0 , DPIO_CH0 , 0 ) |
1360
1361
PHY_STATUS_SPLINE_LDO (DPIO_PHY0 , DPIO_CH0 , 1 ) |
1361
1362
PHY_STATUS_CMN_LDO (DPIO_PHY0 , DPIO_CH1 ) |
1362
1363
PHY_STATUS_SPLINE_LDO (DPIO_PHY0 , DPIO_CH1 , 0 ) |
1363
1364
PHY_STATUS_SPLINE_LDO (DPIO_PHY0 , DPIO_CH1 , 1 ));
1364
1365
1365
- if (!dev_priv -> display . power .chv_phy_assert [DPIO_PHY1 ])
1366
+ if (!display -> power .chv_phy_assert [DPIO_PHY1 ])
1366
1367
phy_status_mask &= ~(PHY_STATUS_CMN_LDO (DPIO_PHY1 , DPIO_CH0 ) |
1367
1368
PHY_STATUS_SPLINE_LDO (DPIO_PHY1 , DPIO_CH0 , 0 ) |
1368
1369
PHY_STATUS_SPLINE_LDO (DPIO_PHY1 , DPIO_CH0 , 1 ));
@@ -1390,7 +1391,7 @@ static void assert_chv_phy_status(struct drm_i915_private *dev_priv)
1390
1391
*/
1391
1392
if (BITS_SET (phy_control ,
1392
1393
PHY_CH_POWER_DOWN_OVRD (0xf , DPIO_PHY0 , DPIO_CH1 )) &&
1393
- (intel_de_read (dev_priv , DPLL (dev_priv , PIPE_B )) & DPLL_VCO_ENABLE ) == 0 )
1394
+ (intel_de_read (display , DPLL (display , PIPE_B )) & DPLL_VCO_ENABLE ) == 0 )
1394
1395
phy_status |= PHY_STATUS_CMN_LDO (DPIO_PHY0 , DPIO_CH1 );
1395
1396
1396
1397
if (BITS_SET (phy_control ,
@@ -1433,24 +1434,25 @@ static void assert_chv_phy_status(struct drm_i915_private *dev_priv)
1433
1434
* The PHY may be busy with some initial calibration and whatnot,
1434
1435
* so the power state can take a while to actually change.
1435
1436
*/
1436
- if (intel_de_wait (dev_priv , DISPLAY_PHY_STATUS ,
1437
+ if (intel_de_wait (display , DISPLAY_PHY_STATUS ,
1437
1438
phy_status_mask , phy_status , 10 ))
1438
- drm_err (& dev_priv -> drm ,
1439
+ drm_err (display -> drm ,
1439
1440
"Unexpected PHY_STATUS 0x%08x, expected 0x%08x (PHY_CONTROL=0x%08x)\n" ,
1440
- intel_de_read (dev_priv , DISPLAY_PHY_STATUS ) & phy_status_mask ,
1441
- phy_status , dev_priv -> display . power .chv_phy_control );
1441
+ intel_de_read (display , DISPLAY_PHY_STATUS ) & phy_status_mask ,
1442
+ phy_status , display -> power .chv_phy_control );
1442
1443
}
1443
1444
1444
1445
#undef BITS_SET
1445
1446
1446
1447
static void chv_dpio_cmn_power_well_enable (struct drm_i915_private * dev_priv ,
1447
1448
struct i915_power_well * power_well )
1448
1449
{
1450
+ struct intel_display * display = & dev_priv -> display ;
1449
1451
enum i915_power_well_id id = i915_power_well_instance (power_well )-> id ;
1450
1452
enum dpio_phy phy ;
1451
1453
u32 tmp ;
1452
1454
1453
- drm_WARN_ON_ONCE (& dev_priv -> drm ,
1455
+ drm_WARN_ON_ONCE (display -> drm ,
1454
1456
id != VLV_DISP_PW_DPIO_CMN_BC &&
1455
1457
id != CHV_DISP_PW_DPIO_CMN_D );
1456
1458
@@ -1464,9 +1466,9 @@ static void chv_dpio_cmn_power_well_enable(struct drm_i915_private *dev_priv,
1464
1466
vlv_set_power_well (dev_priv , power_well , true);
1465
1467
1466
1468
/* Poll for phypwrgood signal */
1467
- if (intel_de_wait_for_set (dev_priv , DISPLAY_PHY_STATUS ,
1469
+ if (intel_de_wait_for_set (display , DISPLAY_PHY_STATUS ,
1468
1470
PHY_POWERGOOD (phy ), 1 ))
1469
- drm_err (& dev_priv -> drm , "Display PHY %d is not power up\n" ,
1471
+ drm_err (display -> drm , "Display PHY %d is not power up\n" ,
1470
1472
phy );
1471
1473
1472
1474
vlv_dpio_get (dev_priv );
@@ -1494,24 +1496,25 @@ static void chv_dpio_cmn_power_well_enable(struct drm_i915_private *dev_priv,
1494
1496
1495
1497
vlv_dpio_put (dev_priv );
1496
1498
1497
- dev_priv -> display . power .chv_phy_control |= PHY_COM_LANE_RESET_DEASSERT (phy );
1498
- intel_de_write (dev_priv , DISPLAY_PHY_CONTROL ,
1499
- dev_priv -> display . power .chv_phy_control );
1499
+ display -> power .chv_phy_control |= PHY_COM_LANE_RESET_DEASSERT (phy );
1500
+ intel_de_write (display , DISPLAY_PHY_CONTROL ,
1501
+ display -> power .chv_phy_control );
1500
1502
1501
- drm_dbg_kms (& dev_priv -> drm ,
1503
+ drm_dbg_kms (display -> drm ,
1502
1504
"Enabled DPIO PHY%d (PHY_CONTROL=0x%08x)\n" ,
1503
- phy , dev_priv -> display . power .chv_phy_control );
1505
+ phy , display -> power .chv_phy_control );
1504
1506
1505
- assert_chv_phy_status (dev_priv );
1507
+ assert_chv_phy_status (display );
1506
1508
}
1507
1509
1508
1510
static void chv_dpio_cmn_power_well_disable (struct drm_i915_private * dev_priv ,
1509
1511
struct i915_power_well * power_well )
1510
1512
{
1513
+ struct intel_display * display = & dev_priv -> display ;
1511
1514
enum i915_power_well_id id = i915_power_well_instance (power_well )-> id ;
1512
1515
enum dpio_phy phy ;
1513
1516
1514
- drm_WARN_ON_ONCE (& dev_priv -> drm ,
1517
+ drm_WARN_ON_ONCE (display -> drm ,
1515
1518
id != VLV_DISP_PW_DPIO_CMN_BC &&
1516
1519
id != CHV_DISP_PW_DPIO_CMN_D );
1517
1520
@@ -1524,20 +1527,20 @@ static void chv_dpio_cmn_power_well_disable(struct drm_i915_private *dev_priv,
1524
1527
assert_pll_disabled (dev_priv , PIPE_C );
1525
1528
}
1526
1529
1527
- dev_priv -> display . power .chv_phy_control &= ~PHY_COM_LANE_RESET_DEASSERT (phy );
1528
- intel_de_write (dev_priv , DISPLAY_PHY_CONTROL ,
1529
- dev_priv -> display . power .chv_phy_control );
1530
+ display -> power .chv_phy_control &= ~PHY_COM_LANE_RESET_DEASSERT (phy );
1531
+ intel_de_write (display , DISPLAY_PHY_CONTROL ,
1532
+ display -> power .chv_phy_control );
1530
1533
1531
1534
vlv_set_power_well (dev_priv , power_well , false);
1532
1535
1533
- drm_dbg_kms (& dev_priv -> drm ,
1536
+ drm_dbg_kms (display -> drm ,
1534
1537
"Disabled DPIO PHY%d (PHY_CONTROL=0x%08x)\n" ,
1535
- phy , dev_priv -> display . power .chv_phy_control );
1538
+ phy , display -> power .chv_phy_control );
1536
1539
1537
1540
/* PHY is fully reset now, so we can enable the PHY state asserts */
1538
- dev_priv -> display . power .chv_phy_assert [phy ] = true;
1541
+ display -> power .chv_phy_assert [phy ] = true;
1539
1542
1540
- assert_chv_phy_status (dev_priv );
1543
+ assert_chv_phy_status (display );
1541
1544
}
1542
1545
1543
1546
static void assert_chv_phy_powergate (struct drm_i915_private * dev_priv , enum dpio_phy phy ,
@@ -1607,29 +1610,30 @@ static void assert_chv_phy_powergate(struct drm_i915_private *dev_priv, enum dpi
1607
1610
bool chv_phy_powergate_ch (struct drm_i915_private * dev_priv , enum dpio_phy phy ,
1608
1611
enum dpio_channel ch , bool override )
1609
1612
{
1610
- struct i915_power_domains * power_domains = & dev_priv -> display .power .domains ;
1613
+ struct intel_display * display = & dev_priv -> display ;
1614
+ struct i915_power_domains * power_domains = & display -> power .domains ;
1611
1615
bool was_override ;
1612
1616
1613
1617
mutex_lock (& power_domains -> lock );
1614
1618
1615
- was_override = dev_priv -> display . power .chv_phy_control & PHY_CH_POWER_DOWN_OVRD_EN (phy , ch );
1619
+ was_override = display -> power .chv_phy_control & PHY_CH_POWER_DOWN_OVRD_EN (phy , ch );
1616
1620
1617
1621
if (override == was_override )
1618
1622
goto out ;
1619
1623
1620
1624
if (override )
1621
- dev_priv -> display . power .chv_phy_control |= PHY_CH_POWER_DOWN_OVRD_EN (phy , ch );
1625
+ display -> power .chv_phy_control |= PHY_CH_POWER_DOWN_OVRD_EN (phy , ch );
1622
1626
else
1623
- dev_priv -> display . power .chv_phy_control &= ~PHY_CH_POWER_DOWN_OVRD_EN (phy , ch );
1627
+ display -> power .chv_phy_control &= ~PHY_CH_POWER_DOWN_OVRD_EN (phy , ch );
1624
1628
1625
- intel_de_write (dev_priv , DISPLAY_PHY_CONTROL ,
1626
- dev_priv -> display . power .chv_phy_control );
1629
+ intel_de_write (display , DISPLAY_PHY_CONTROL ,
1630
+ display -> power .chv_phy_control );
1627
1631
1628
- drm_dbg_kms (& dev_priv -> drm ,
1632
+ drm_dbg_kms (display -> drm ,
1629
1633
"Power gating DPIO PHY%d CH%d (DPIO_PHY_CONTROL=0x%08x)\n" ,
1630
- phy , ch , dev_priv -> display . power .chv_phy_control );
1634
+ phy , ch , display -> power .chv_phy_control );
1631
1635
1632
- assert_chv_phy_status (dev_priv );
1636
+ assert_chv_phy_status (display );
1633
1637
1634
1638
out :
1635
1639
mutex_unlock (& power_domains -> lock );
@@ -1640,29 +1644,30 @@ bool chv_phy_powergate_ch(struct drm_i915_private *dev_priv, enum dpio_phy phy,
1640
1644
void chv_phy_powergate_lanes (struct intel_encoder * encoder ,
1641
1645
bool override , unsigned int mask )
1642
1646
{
1647
+ struct intel_display * display = to_intel_display (encoder );
1643
1648
struct drm_i915_private * dev_priv = to_i915 (encoder -> base .dev );
1644
- struct i915_power_domains * power_domains = & dev_priv -> display . power .domains ;
1649
+ struct i915_power_domains * power_domains = & display -> power .domains ;
1645
1650
enum dpio_phy phy = vlv_dig_port_to_phy (enc_to_dig_port (encoder ));
1646
1651
enum dpio_channel ch = vlv_dig_port_to_channel (enc_to_dig_port (encoder ));
1647
1652
1648
1653
mutex_lock (& power_domains -> lock );
1649
1654
1650
- dev_priv -> display . power .chv_phy_control &= ~PHY_CH_POWER_DOWN_OVRD (0xf , phy , ch );
1651
- dev_priv -> display . power .chv_phy_control |= PHY_CH_POWER_DOWN_OVRD (mask , phy , ch );
1655
+ display -> power .chv_phy_control &= ~PHY_CH_POWER_DOWN_OVRD (0xf , phy , ch );
1656
+ display -> power .chv_phy_control |= PHY_CH_POWER_DOWN_OVRD (mask , phy , ch );
1652
1657
1653
1658
if (override )
1654
- dev_priv -> display . power .chv_phy_control |= PHY_CH_POWER_DOWN_OVRD_EN (phy , ch );
1659
+ display -> power .chv_phy_control |= PHY_CH_POWER_DOWN_OVRD_EN (phy , ch );
1655
1660
else
1656
- dev_priv -> display . power .chv_phy_control &= ~PHY_CH_POWER_DOWN_OVRD_EN (phy , ch );
1661
+ display -> power .chv_phy_control &= ~PHY_CH_POWER_DOWN_OVRD_EN (phy , ch );
1657
1662
1658
- intel_de_write (dev_priv , DISPLAY_PHY_CONTROL ,
1659
- dev_priv -> display . power .chv_phy_control );
1663
+ intel_de_write (display , DISPLAY_PHY_CONTROL ,
1664
+ display -> power .chv_phy_control );
1660
1665
1661
- drm_dbg_kms (& dev_priv -> drm ,
1666
+ drm_dbg_kms (display -> drm ,
1662
1667
"Power gating DPIO PHY%d CH%d lanes 0x%x (PHY_CONTROL=0x%08x)\n" ,
1663
- phy , ch , mask , dev_priv -> display . power .chv_phy_control );
1668
+ phy , ch , mask , display -> power .chv_phy_control );
1664
1669
1665
- assert_chv_phy_status (dev_priv );
1670
+ assert_chv_phy_status (display );
1666
1671
1667
1672
assert_chv_phy_powergate (dev_priv , phy , ch , override , mask );
1668
1673
0 commit comments