mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-14 06:35:12 +00:00
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>
This commit is contained in:
parent
3662bbfca5
commit
51ae3bd4f0
3 changed files with 26 additions and 6 deletions
|
@ -926,8 +926,10 @@ void zynqmp_disp_layer_disable(struct zynqmp_disp_layer *layer)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < layer->drm_fmt->num_planes; i++)
|
if (layer->disp->dpsub->dma_enabled) {
|
||||||
dmaengine_terminate_sync(layer->dmas[i].chan);
|
for (i = 0; i < layer->drm_fmt->num_planes; i++)
|
||||||
|
dmaengine_terminate_sync(layer->dmas[i].chan);
|
||||||
|
}
|
||||||
|
|
||||||
zynqmp_disp_avbuf_disable_video(layer->disp, layer);
|
zynqmp_disp_avbuf_disable_video(layer->disp, layer);
|
||||||
zynqmp_disp_blend_layer_disable(layer->disp, layer);
|
zynqmp_disp_blend_layer_disable(layer->disp, layer);
|
||||||
|
@ -950,6 +952,9 @@ void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer,
|
||||||
|
|
||||||
zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt);
|
zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt);
|
||||||
|
|
||||||
|
if (!layer->disp->dpsub->dma_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set pconfig for each DMA channel to indicate they're part of a
|
* Set pconfig for each DMA channel to indicate they're part of a
|
||||||
* video group.
|
* video group.
|
||||||
|
@ -985,6 +990,9 @@ int zynqmp_disp_layer_update(struct zynqmp_disp_layer *layer,
|
||||||
const struct drm_format_info *info = layer->drm_fmt;
|
const struct drm_format_info *info = layer->drm_fmt;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
if (!layer->disp->dpsub->dma_enabled)
|
||||||
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < info->num_planes; i++) {
|
for (i = 0; i < info->num_planes; i++) {
|
||||||
unsigned int width = state->crtc_w / (i ? info->hsub : 1);
|
unsigned int width = state->crtc_w / (i ? info->hsub : 1);
|
||||||
unsigned int height = state->crtc_h / (i ? info->vsub : 1);
|
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,
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (!layer->info)
|
if (!layer->info || !disp->dpsub->dma_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < layer->info->num_channels; i++) {
|
for (i = 0; i < layer->info->num_channels; i++) {
|
||||||
|
@ -1075,6 +1083,9 @@ static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp,
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!disp->dpsub->dma_enabled)
|
||||||
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < layer->info->num_channels; i++) {
|
for (i = 0; i < layer->info->num_channels; i++) {
|
||||||
struct zynqmp_disp_layer_dma *dma = &layer->dmas[i];
|
struct zynqmp_disp_layer_dma *dma = &layer->dmas[i];
|
||||||
char dma_channel_name[16];
|
char dma_channel_name[16];
|
||||||
|
@ -1217,7 +1228,6 @@ int zynqmp_disp_probe(struct zynqmp_dpsub *dpsub)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev = to_platform_device(dpsub->dev);
|
struct platform_device *pdev = to_platform_device(dpsub->dev);
|
||||||
struct zynqmp_disp *disp;
|
struct zynqmp_disp *disp;
|
||||||
struct zynqmp_disp_layer *layer;
|
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -1253,8 +1263,12 @@ int zynqmp_disp_probe(struct zynqmp_dpsub *dpsub)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
layer = &disp->layers[ZYNQMP_DPSUB_LAYER_VID];
|
if (disp->dpsub->dma_enabled) {
|
||||||
dpsub->dma_align = 1 << layer->dmas[0].chan->device->copy_align;
|
struct zynqmp_disp_layer *layer;
|
||||||
|
|
||||||
|
layer = &disp->layers[ZYNQMP_DPSUB_LAYER_VID];
|
||||||
|
dpsub->dma_align = 1 << layer->dmas[0].chan->device->copy_align;
|
||||||
|
}
|
||||||
|
|
||||||
dpsub->disp = disp;
|
dpsub->disp = disp;
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,7 @@ static int zynqmp_dpsub_parse_dt(struct zynqmp_dpsub *dpsub)
|
||||||
if (!np) {
|
if (!np) {
|
||||||
dev_warn(dpsub->dev, "missing ports, update DT bindings\n");
|
dev_warn(dpsub->dev, "missing ports, update DT bindings\n");
|
||||||
dpsub->connected_ports = BIT(ZYNQMP_DPSUB_PORT_OUT_DP);
|
dpsub->connected_ports = BIT(ZYNQMP_DPSUB_PORT_OUT_DP);
|
||||||
|
dpsub->dma_enabled = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +178,8 @@ static int zynqmp_dpsub_parse_dt(struct zynqmp_dpsub *dpsub)
|
||||||
(dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX)))
|
(dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX)))
|
||||||
dev_warn(dpsub->dev, "live video unsupported, ignoring\n");
|
dev_warn(dpsub->dev, "live video unsupported, ignoring\n");
|
||||||
|
|
||||||
|
dpsub->dma_enabled = true;
|
||||||
|
|
||||||
if (dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_AUDIO))
|
if (dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_AUDIO))
|
||||||
dev_warn(dpsub->dev, "live audio unsupported, ignoring\n");
|
dev_warn(dpsub->dev, "live audio unsupported, ignoring\n");
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ enum zynqmp_dpsub_format {
|
||||||
* @aud_clk: Audio clock
|
* @aud_clk: Audio clock
|
||||||
* @aud_clk_from_ps: True of the audio clock comes from PS, false from PL
|
* @aud_clk_from_ps: True of the audio clock comes from PS, false from PL
|
||||||
* @connected_ports: Bitmask of connected ports in the device tree
|
* @connected_ports: Bitmask of connected ports in the device tree
|
||||||
|
* @dma_enabled: True if the DMA interface is enabled, false if the DPSUB is
|
||||||
|
* driven by the live input
|
||||||
* @drm: The DRM/KMS device data
|
* @drm: The DRM/KMS device data
|
||||||
* @bridge: The DP encoder bridge
|
* @bridge: The DP encoder bridge
|
||||||
* @disp: The display controller
|
* @disp: The display controller
|
||||||
|
@ -64,6 +66,7 @@ struct zynqmp_dpsub {
|
||||||
bool aud_clk_from_ps;
|
bool aud_clk_from_ps;
|
||||||
|
|
||||||
unsigned int connected_ports;
|
unsigned int connected_ports;
|
||||||
|
bool dma_enabled;
|
||||||
|
|
||||||
struct zynqmp_dpsub_drm *drm;
|
struct zynqmp_dpsub_drm *drm;
|
||||||
struct drm_bridge *bridge;
|
struct drm_bridge *bridge;
|
||||||
|
|
Loading…
Reference in a new issue