Skip to content

Commit 2dfd045

Browse files
committed
drm: xlnx: zynqmp_dpsub: Register AUX bus at bridge attach time
To prepare for operating as a standalone DP bridge with the DRM device implemented in the PL, move registration of the AUX bus to bridge attach time, as that's the earliest point when a DRM device is available. The DRM device pointer stored in zynqmp_dp isn't used anymore, drop it. Signed-off-by: Laurent Pinchart <[email protected]>
1 parent ee1229b commit 2dfd045

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

drivers/gpu/drm/xlnx/zynqmp_dp.c

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ struct zynqmp_dp_config {
276276
* struct zynqmp_dp - Xilinx DisplayPort core
277277
* @dev: device structure
278278
* @dpsub: Display subsystem
279-
* @drm: DRM core
280279
* @iomem: device I/O memory for register access
281280
* @reset: reset controller
282281
* @irq: irq
@@ -297,7 +296,6 @@ struct zynqmp_dp_config {
297296
struct zynqmp_dp {
298297
struct device *dev;
299298
struct zynqmp_dpsub *dpsub;
300-
struct drm_device *drm;
301299
void __iomem *iomem;
302300
struct reset_control *reset;
303301
int irq;
@@ -1057,7 +1055,7 @@ static int zynqmp_dp_aux_init(struct zynqmp_dp *dp)
10571055

10581056
dp->aux.name = "ZynqMP DP AUX";
10591057
dp->aux.dev = dp->dev;
1060-
dp->aux.drm_dev = dp->drm;
1058+
dp->aux.drm_dev = dp->bridge.dev;
10611059
dp->aux.transfer = zynqmp_dp_aux_transfer;
10621060

10631061
return drm_dp_aux_register(&dp->aux);
@@ -1283,14 +1281,35 @@ static int zynqmp_dp_bridge_attach(struct drm_bridge *bridge,
12831281
struct zynqmp_dp *dp = bridge_to_dp(bridge);
12841282
int ret;
12851283

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+
12861291
if (dp->next_bridge) {
12871292
ret = drm_bridge_attach(bridge->encoder, dp->next_bridge,
12881293
bridge, flags);
12891294
if (ret < 0)
1290-
return ret;
1295+
goto error;
12911296
}
12921297

1298+
/* Now that initialisation is complete, enable interrupts. */
1299+
zynqmp_dp_write(dp, ZYNQMP_DP_INT_EN, ZYNQMP_DP_INT_ALL);
1300+
12931301
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);
12941313
}
12951314

12961315
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,
14951514

14961515
static const struct drm_bridge_funcs zynqmp_dp_bridge_funcs = {
14971516
.attach = zynqmp_dp_bridge_attach,
1517+
.detach = zynqmp_dp_bridge_detach,
14981518
.mode_valid = zynqmp_dp_bridge_mode_valid,
14991519
.atomic_enable = zynqmp_dp_bridge_atomic_enable,
15001520
.atomic_disable = zynqmp_dp_bridge_atomic_disable,
@@ -1594,7 +1614,6 @@ int zynqmp_dp_drm_init(struct zynqmp_dpsub *dpsub)
15941614
{
15951615
struct zynqmp_dp *dp = dpsub->dp;
15961616
struct drm_bridge *bridge = &dp->bridge;
1597-
int ret;
15981617

15991618
dp->config.misc0 &= ~ZYNQMP_DP_MAIN_STREAM_MISC0_SYNC_LOCK;
16001619
zynqmp_dp_set_format(dp, NULL, ZYNQMP_DPSUB_FORMAT_RGB, 8);
@@ -1606,16 +1625,6 @@ int zynqmp_dp_drm_init(struct zynqmp_dpsub *dpsub)
16061625
bridge->type = DRM_MODE_CONNECTOR_DisplayPort;
16071626
dpsub->bridge = bridge;
16081627

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-
16191628
return 0;
16201629
}
16211630

@@ -1633,7 +1642,6 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm)
16331642
dp->dev = &pdev->dev;
16341643
dp->dpsub = dpsub;
16351644
dp->status = connector_status_disconnected;
1636-
dp->drm = drm;
16371645

16381646
INIT_DELAYED_WORK(&dp->hpd_work, zynqmp_dp_hpd_work_func);
16391647

@@ -1719,7 +1727,6 @@ void zynqmp_dp_remove(struct zynqmp_dpsub *dpsub)
17191727
disable_irq(dp->irq);
17201728

17211729
cancel_delayed_work_sync(&dp->hpd_work);
1722-
zynqmp_dp_aux_cleanup(dp);
17231730

17241731
zynqmp_dp_write(dp, ZYNQMP_DP_TRANSMITTER_ENABLE, 0);
17251732
zynqmp_dp_write(dp, ZYNQMP_DP_INT_DS, 0xffffffff);

0 commit comments

Comments
 (0)