Skip to content

Commit 51ae3bd

Browse files
committed
drm: xlnx: zynqmp_dpsub: Support operation without DMA engine
To prepare for usage of the DPSUB as a DisplayPort bridge without creating a DRM device, make initialization and usage of the DMA engine optional. The flag that controls this feature is currently hardcoded to operating with the DMA engine, this will be made dynamic based on the device tree configuration in a subsequent change. Signed-off-by: Laurent Pinchart <[email protected]>
1 parent 3662bbf commit 51ae3bd

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

drivers/gpu/drm/xlnx/zynqmp_disp.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -926,8 +926,10 @@ void zynqmp_disp_layer_disable(struct zynqmp_disp_layer *layer)
926926
{
927927
unsigned int i;
928928

929-
for (i = 0; i < layer->drm_fmt->num_planes; i++)
930-
dmaengine_terminate_sync(layer->dmas[i].chan);
929+
if (layer->disp->dpsub->dma_enabled) {
930+
for (i = 0; i < layer->drm_fmt->num_planes; i++)
931+
dmaengine_terminate_sync(layer->dmas[i].chan);
932+
}
931933

932934
zynqmp_disp_avbuf_disable_video(layer->disp, layer);
933935
zynqmp_disp_blend_layer_disable(layer->disp, layer);
@@ -950,6 +952,9 @@ void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer,
950952

951953
zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt);
952954

955+
if (!layer->disp->dpsub->dma_enabled)
956+
return;
957+
953958
/*
954959
* Set pconfig for each DMA channel to indicate they're part of a
955960
* video group.
@@ -985,6 +990,9 @@ int zynqmp_disp_layer_update(struct zynqmp_disp_layer *layer,
985990
const struct drm_format_info *info = layer->drm_fmt;
986991
unsigned int i;
987992

993+
if (!layer->disp->dpsub->dma_enabled)
994+
return 0;
995+
988996
for (i = 0; i < info->num_planes; i++) {
989997
unsigned int width = state->crtc_w / (i ? info->hsub : 1);
990998
unsigned int height = state->crtc_h / (i ? info->vsub : 1);
@@ -1032,7 +1040,7 @@ static void zynqmp_disp_layer_release_dma(struct zynqmp_disp *disp,
10321040
{
10331041
unsigned int i;
10341042

1035-
if (!layer->info)
1043+
if (!layer->info || !disp->dpsub->dma_enabled)
10361044
return;
10371045

10381046
for (i = 0; i < layer->info->num_channels; i++) {
@@ -1075,6 +1083,9 @@ static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp,
10751083
unsigned int i;
10761084
int ret;
10771085

1086+
if (!disp->dpsub->dma_enabled)
1087+
return 0;
1088+
10781089
for (i = 0; i < layer->info->num_channels; i++) {
10791090
struct zynqmp_disp_layer_dma *dma = &layer->dmas[i];
10801091
char dma_channel_name[16];
@@ -1217,7 +1228,6 @@ int zynqmp_disp_probe(struct zynqmp_dpsub *dpsub)
12171228
{
12181229
struct platform_device *pdev = to_platform_device(dpsub->dev);
12191230
struct zynqmp_disp *disp;
1220-
struct zynqmp_disp_layer *layer;
12211231
struct resource *res;
12221232
int ret;
12231233

@@ -1253,8 +1263,12 @@ int zynqmp_disp_probe(struct zynqmp_dpsub *dpsub)
12531263
if (ret)
12541264
goto error;
12551265

1256-
layer = &disp->layers[ZYNQMP_DPSUB_LAYER_VID];
1257-
dpsub->dma_align = 1 << layer->dmas[0].chan->device->copy_align;
1266+
if (disp->dpsub->dma_enabled) {
1267+
struct zynqmp_disp_layer *layer;
1268+
1269+
layer = &disp->layers[ZYNQMP_DPSUB_LAYER_VID];
1270+
dpsub->dma_align = 1 << layer->dmas[0].chan->device->copy_align;
1271+
}
12581272

12591273
dpsub->disp = disp;
12601274

drivers/gpu/drm/xlnx/zynqmp_dpsub.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ static int zynqmp_dpsub_parse_dt(struct zynqmp_dpsub *dpsub)
158158
if (!np) {
159159
dev_warn(dpsub->dev, "missing ports, update DT bindings\n");
160160
dpsub->connected_ports = BIT(ZYNQMP_DPSUB_PORT_OUT_DP);
161+
dpsub->dma_enabled = true;
161162
return 0;
162163
}
163164

@@ -177,6 +178,8 @@ static int zynqmp_dpsub_parse_dt(struct zynqmp_dpsub *dpsub)
177178
(dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX)))
178179
dev_warn(dpsub->dev, "live video unsupported, ignoring\n");
179180

181+
dpsub->dma_enabled = true;
182+
180183
if (dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_AUDIO))
181184
dev_warn(dpsub->dev, "live audio unsupported, ignoring\n");
182185

drivers/gpu/drm/xlnx/zynqmp_dpsub.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ enum zynqmp_dpsub_format {
4848
* @aud_clk: Audio clock
4949
* @aud_clk_from_ps: True of the audio clock comes from PS, false from PL
5050
* @connected_ports: Bitmask of connected ports in the device tree
51+
* @dma_enabled: True if the DMA interface is enabled, false if the DPSUB is
52+
* driven by the live input
5153
* @drm: The DRM/KMS device data
5254
* @bridge: The DP encoder bridge
5355
* @disp: The display controller
@@ -64,6 +66,7 @@ struct zynqmp_dpsub {
6466
bool aud_clk_from_ps;
6567

6668
unsigned int connected_ports;
69+
bool dma_enabled;
6770

6871
struct zynqmp_dpsub_drm *drm;
6972
struct drm_bridge *bridge;

0 commit comments

Comments
 (0)