Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <laurent.pinchart@ideasonboard.com>

+26 -6
+20 -6
drivers/gpu/drm/xlnx/zynqmp_disp.c
··· 926 926 { 927 927 unsigned int i; 928 928 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 + } 931 933 932 934 zynqmp_disp_avbuf_disable_video(layer->disp, layer); 933 935 zynqmp_disp_blend_layer_disable(layer->disp, layer); ··· 951 949 layer->drm_fmt = info; 952 950 953 951 zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt); 952 + 953 + if (!layer->disp->dpsub->dma_enabled) 954 + return; 954 955 955 956 /* 956 957 * Set pconfig for each DMA channel to indicate they're part of a ··· 989 984 { 990 985 const struct drm_format_info *info = layer->drm_fmt; 991 986 unsigned int i; 987 + 988 + if (!layer->disp->dpsub->dma_enabled) 989 + return 0; 992 990 993 991 for (i = 0; i < info->num_planes; i++) { 994 992 unsigned int width = state->crtc_w / (i ? info->hsub : 1); ··· 1040 1032 { 1041 1033 unsigned int i; 1042 1034 1043 - if (!layer->info) 1035 + if (!layer->info || !disp->dpsub->dma_enabled) 1044 1036 return; 1045 1037 1046 1038 for (i = 0; i < layer->info->num_channels; i++) { ··· 1082 1074 static const char * const dma_names[] = { "vid", "gfx" }; 1083 1075 unsigned int i; 1084 1076 int ret; 1077 + 1078 + if (!disp->dpsub->dma_enabled) 1079 + return 0; 1085 1080 1086 1081 for (i = 0; i < layer->info->num_channels; i++) { 1087 1082 struct zynqmp_disp_layer_dma *dma = &layer->dmas[i]; ··· 1228 1217 { 1229 1218 struct platform_device *pdev = to_platform_device(dpsub->dev); 1230 1219 struct zynqmp_disp *disp; 1231 - struct zynqmp_disp_layer *layer; 1232 1220 struct resource *res; 1233 1221 int ret; 1234 1222 ··· 1263 1253 if (ret) 1264 1254 goto error; 1265 1255 1266 - layer = &disp->layers[ZYNQMP_DPSUB_LAYER_VID]; 1267 - dpsub->dma_align = 1 << layer->dmas[0].chan->device->copy_align; 1256 + if (disp->dpsub->dma_enabled) { 1257 + struct zynqmp_disp_layer *layer; 1258 + 1259 + layer = &disp->layers[ZYNQMP_DPSUB_LAYER_VID]; 1260 + dpsub->dma_align = 1 << layer->dmas[0].chan->device->copy_align; 1261 + } 1268 1262 1269 1263 dpsub->disp = disp; 1270 1264
+3
drivers/gpu/drm/xlnx/zynqmp_dpsub.c
··· 158 158 if (!np) { 159 159 dev_warn(dpsub->dev, "missing ports, update DT bindings\n"); 160 160 dpsub->connected_ports = BIT(ZYNQMP_DPSUB_PORT_OUT_DP); 161 + dpsub->dma_enabled = true; 161 162 return 0; 162 163 } 163 164 ··· 177 176 if ((dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_VIDEO)) || 178 177 (dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX))) 179 178 dev_warn(dpsub->dev, "live video unsupported, ignoring\n"); 179 + 180 + dpsub->dma_enabled = true; 180 181 181 182 if (dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_AUDIO)) 182 183 dev_warn(dpsub->dev, "live audio unsupported, ignoring\n");
+3
drivers/gpu/drm/xlnx/zynqmp_dpsub.h
··· 48 48 * @aud_clk: Audio clock 49 49 * @aud_clk_from_ps: True of the audio clock comes from PS, false from PL 50 50 * @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 51 53 * @drm: The DRM/KMS device data 52 54 * @bridge: The DP encoder bridge 53 55 * @disp: The display controller ··· 66 64 bool aud_clk_from_ps; 67 65 68 66 unsigned int connected_ports; 67 + bool dma_enabled; 69 68 70 69 struct zynqmp_dpsub_drm *drm; 71 70 struct drm_bridge *bridge;