@@ -276,7 +276,6 @@ struct zynqmp_dp_config {
276
276
* struct zynqmp_dp - Xilinx DisplayPort core
277
277
* @dev: device structure
278
278
* @dpsub: Display subsystem
279
- * @drm: DRM core
280
279
* @iomem: device I/O memory for register access
281
280
* @reset: reset controller
282
281
* @irq: irq
@@ -297,7 +296,6 @@ struct zynqmp_dp_config {
297
296
struct zynqmp_dp {
298
297
struct device * dev ;
299
298
struct zynqmp_dpsub * dpsub ;
300
- struct drm_device * drm ;
301
299
void __iomem * iomem ;
302
300
struct reset_control * reset ;
303
301
int irq ;
@@ -1057,7 +1055,7 @@ static int zynqmp_dp_aux_init(struct zynqmp_dp *dp)
1057
1055
1058
1056
dp -> aux .name = "ZynqMP DP AUX" ;
1059
1057
dp -> aux .dev = dp -> dev ;
1060
- dp -> aux .drm_dev = dp -> drm ;
1058
+ dp -> aux .drm_dev = dp -> bridge . dev ;
1061
1059
dp -> aux .transfer = zynqmp_dp_aux_transfer ;
1062
1060
1063
1061
return drm_dp_aux_register (& dp -> aux );
@@ -1283,14 +1281,35 @@ static int zynqmp_dp_bridge_attach(struct drm_bridge *bridge,
1283
1281
struct zynqmp_dp * dp = bridge_to_dp (bridge );
1284
1282
int ret ;
1285
1283
1284
+ /* Initialize and register the AUX adapter. */
1285
+ ret = zynqmp_dp_aux_init (dp );
1286
+ if (ret ) {
1287
+ dev_err (dp -> dev , "failed to initialize DP aux\n" );
1288
+ return ret ;
1289
+ }
1290
+
1286
1291
if (dp -> next_bridge ) {
1287
1292
ret = drm_bridge_attach (bridge -> encoder , dp -> next_bridge ,
1288
1293
bridge , flags );
1289
1294
if (ret < 0 )
1290
- return ret ;
1295
+ goto error ;
1291
1296
}
1292
1297
1298
+ /* Now that initialisation is complete, enable interrupts. */
1299
+ zynqmp_dp_write (dp , ZYNQMP_DP_INT_EN , ZYNQMP_DP_INT_ALL );
1300
+
1293
1301
return 0 ;
1302
+
1303
+ error :
1304
+ zynqmp_dp_aux_cleanup (dp );
1305
+ return ret ;
1306
+ }
1307
+
1308
+ static void zynqmp_dp_bridge_detach (struct drm_bridge * bridge )
1309
+ {
1310
+ struct zynqmp_dp * dp = bridge_to_dp (bridge );
1311
+
1312
+ zynqmp_dp_aux_cleanup (dp );
1294
1313
}
1295
1314
1296
1315
static int zynqmp_dp_bridge_mode_valid (struct drm_bridge * bridge ,
@@ -1495,6 +1514,7 @@ static struct edid *zynqmp_dp_bridge_get_edid(struct drm_bridge *bridge,
1495
1514
1496
1515
static const struct drm_bridge_funcs zynqmp_dp_bridge_funcs = {
1497
1516
.attach = zynqmp_dp_bridge_attach ,
1517
+ .detach = zynqmp_dp_bridge_detach ,
1498
1518
.mode_valid = zynqmp_dp_bridge_mode_valid ,
1499
1519
.atomic_enable = zynqmp_dp_bridge_atomic_enable ,
1500
1520
.atomic_disable = zynqmp_dp_bridge_atomic_disable ,
@@ -1594,7 +1614,6 @@ int zynqmp_dp_drm_init(struct zynqmp_dpsub *dpsub)
1594
1614
{
1595
1615
struct zynqmp_dp * dp = dpsub -> dp ;
1596
1616
struct drm_bridge * bridge = & dp -> bridge ;
1597
- int ret ;
1598
1617
1599
1618
dp -> config .misc0 &= ~ZYNQMP_DP_MAIN_STREAM_MISC0_SYNC_LOCK ;
1600
1619
zynqmp_dp_set_format (dp , NULL , ZYNQMP_DPSUB_FORMAT_RGB , 8 );
@@ -1606,16 +1625,6 @@ int zynqmp_dp_drm_init(struct zynqmp_dpsub *dpsub)
1606
1625
bridge -> type = DRM_MODE_CONNECTOR_DisplayPort ;
1607
1626
dpsub -> bridge = bridge ;
1608
1627
1609
- /* Initialize and register the AUX adapter. */
1610
- ret = zynqmp_dp_aux_init (dp );
1611
- if (ret ) {
1612
- dev_err (dp -> dev , "failed to initialize DP aux\n" );
1613
- return ret ;
1614
- }
1615
-
1616
- /* Now that initialisation is complete, enable interrupts. */
1617
- zynqmp_dp_write (dp , ZYNQMP_DP_INT_EN , ZYNQMP_DP_INT_ALL );
1618
-
1619
1628
return 0 ;
1620
1629
}
1621
1630
@@ -1633,7 +1642,6 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm)
1633
1642
dp -> dev = & pdev -> dev ;
1634
1643
dp -> dpsub = dpsub ;
1635
1644
dp -> status = connector_status_disconnected ;
1636
- dp -> drm = drm ;
1637
1645
1638
1646
INIT_DELAYED_WORK (& dp -> hpd_work , zynqmp_dp_hpd_work_func );
1639
1647
@@ -1719,7 +1727,6 @@ void zynqmp_dp_remove(struct zynqmp_dpsub *dpsub)
1719
1727
disable_irq (dp -> irq );
1720
1728
1721
1729
cancel_delayed_work_sync (& dp -> hpd_work );
1722
- zynqmp_dp_aux_cleanup (dp );
1723
1730
1724
1731
zynqmp_dp_write (dp , ZYNQMP_DP_TRANSMITTER_ENABLE , 0 );
1725
1732
zynqmp_dp_write (dp , ZYNQMP_DP_INT_DS , 0xffffffff );
0 commit comments