|
14 | 14 | #include <drm/drm_crtc.h>
|
15 | 15 | #include <drm/drm_device.h>
|
16 | 16 | #include <drm/drm_edid.h>
|
| 17 | +#include <drm/drm_fourcc.h> |
17 | 18 | #include <drm/drm_modes.h>
|
18 | 19 | #include <drm/drm_of.h>
|
19 | 20 |
|
@@ -1271,6 +1272,55 @@ static void zynqmp_dp_encoder_mode_set_stream(struct zynqmp_dp *dp,
|
1271 | 1272 | zynqmp_dp_write(dp, ZYNQMP_DP_USER_DATA_COUNT_PER_LANE, reg);
|
1272 | 1273 | }
|
1273 | 1274 |
|
| 1275 | +/* ----------------------------------------------------------------------------- |
| 1276 | + * DISP Configuration |
| 1277 | + */ |
| 1278 | + |
| 1279 | +static void zynqmp_dp_disp_enable(struct zynqmp_dp *dp, |
| 1280 | + struct drm_bridge_state *old_bridge_state) |
| 1281 | +{ |
| 1282 | + enum zynqmp_dpsub_layer_id layer_id; |
| 1283 | + struct zynqmp_disp_layer *layer; |
| 1284 | + const struct drm_format_info *info; |
| 1285 | + |
| 1286 | + if (dp->dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_VIDEO)) |
| 1287 | + layer_id = ZYNQMP_DPSUB_LAYER_VID; |
| 1288 | + else if (dp->dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX)) |
| 1289 | + layer_id = ZYNQMP_DPSUB_LAYER_GFX; |
| 1290 | + else |
| 1291 | + return; |
| 1292 | + |
| 1293 | + layer = dp->dpsub->layers[layer_id]; |
| 1294 | + |
| 1295 | + /* TODO: Make the format configurable. */ |
| 1296 | + info = drm_format_info(DRM_FORMAT_YUV422); |
| 1297 | + zynqmp_disp_layer_set_format(layer, info); |
| 1298 | + zynqmp_disp_layer_enable(layer, ZYNQMP_DPSUB_LAYER_LIVE); |
| 1299 | + |
| 1300 | + if (layer_id == ZYNQMP_DPSUB_LAYER_GFX) |
| 1301 | + zynqmp_disp_blend_set_global_alpha(dp->dpsub->disp, true, 255); |
| 1302 | + else |
| 1303 | + zynqmp_disp_blend_set_global_alpha(dp->dpsub->disp, false, 0); |
| 1304 | + |
| 1305 | + zynqmp_disp_enable(dp->dpsub->disp); |
| 1306 | +} |
| 1307 | + |
| 1308 | +static void zynqmp_dp_disp_disable(struct zynqmp_dp *dp, |
| 1309 | + struct drm_bridge_state *old_bridge_state) |
| 1310 | +{ |
| 1311 | + struct zynqmp_disp_layer *layer; |
| 1312 | + |
| 1313 | + if (dp->dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_VIDEO)) |
| 1314 | + layer = dp->dpsub->layers[ZYNQMP_DPSUB_LAYER_VID]; |
| 1315 | + else if (dp->dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX)) |
| 1316 | + layer = dp->dpsub->layers[ZYNQMP_DPSUB_LAYER_GFX]; |
| 1317 | + else |
| 1318 | + return; |
| 1319 | + |
| 1320 | + zynqmp_disp_disable(dp->dpsub->disp); |
| 1321 | + zynqmp_disp_layer_disable(layer); |
| 1322 | +} |
| 1323 | + |
1274 | 1324 | /* -----------------------------------------------------------------------------
|
1275 | 1325 | * DRM Bridge
|
1276 | 1326 | */
|
@@ -1355,6 +1405,8 @@ static void zynqmp_dp_bridge_atomic_enable(struct drm_bridge *bridge,
|
1355 | 1405 |
|
1356 | 1406 | pm_runtime_get_sync(dp->dev);
|
1357 | 1407 |
|
| 1408 | + zynqmp_dp_disp_enable(dp, old_bridge_state); |
| 1409 | + |
1358 | 1410 | /*
|
1359 | 1411 | * Retrieve the CRTC mode and adjusted mode. This requires a little
|
1360 | 1412 | * dance to go from the bridge to the encoder, to the connector and to
|
@@ -1428,6 +1480,9 @@ static void zynqmp_dp_bridge_atomic_disable(struct drm_bridge *bridge,
|
1428 | 1480 | ZYNQMP_DP_TX_PHY_POWER_DOWN_ALL);
|
1429 | 1481 | if (zynqmp_dpsub_audio_enabled(dp->dpsub))
|
1430 | 1482 | zynqmp_dp_write(dp, ZYNQMP_DP_TX_AUDIO_CONTROL, 0);
|
| 1483 | + |
| 1484 | + zynqmp_dp_disp_disable(dp, old_bridge_state); |
| 1485 | + |
1431 | 1486 | pm_runtime_put_sync(dp->dev);
|
1432 | 1487 | }
|
1433 | 1488 |
|
|
0 commit comments