From: Lars-Peter Clausen
The AXI HDMI HDL driver is the driver for the HDL graphics core which is
used on various FPGA designs. It's mostly used to interface with the
ADV7511 driver on some Zynq boards (e.g. ZC702 & ZedBoard).
Link:
https://wiki.analog.com/resources/tools-software/linux-drivers/drm/hdl-axi-hdmi
Link: https://wiki.analog.com/resources/fpga/docs/axi_hdmi_tx
Signed-off-by: Lars-Peter Clausen
Signed-off-by: Mike Looijmans
Signed-off-by: Alexandru Ardelean
Signed-off-by: Bogdan Togorean
---
drivers/gpu/drm/Kconfig | 2 +
drivers/gpu/drm/Makefile | 1 +
drivers/gpu/drm/adi/Kconfig | 16 +
drivers/gpu/drm/adi/Makefile | 4 +
drivers/gpu/drm/adi/axi_hdmi_tx_crtc.c| 219 ++
drivers/gpu/drm/adi/axi_hdmi_tx_drv.c | 225 ++
drivers/gpu/drm/adi/axi_hdmi_tx_drv.h | 45 +++
drivers/gpu/drm/adi/axi_hdmi_tx_encoder.c | 344 ++
8 files changed, 856 insertions(+)
create mode 100644 drivers/gpu/drm/adi/Kconfig
create mode 100644 drivers/gpu/drm/adi/Makefile
create mode 100644 drivers/gpu/drm/adi/axi_hdmi_tx_crtc.c
create mode 100644 drivers/gpu/drm/adi/axi_hdmi_tx_drv.c
create mode 100644 drivers/gpu/drm/adi/axi_hdmi_tx_drv.h
create mode 100644 drivers/gpu/drm/adi/axi_hdmi_tx_encoder.c
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 147d61b9674e..fca4c7e89fab 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -231,6 +231,8 @@ config DRM_SCHED
source "drivers/gpu/drm/i2c/Kconfig"
+source "drivers/gpu/drm/adi/Kconfig"
+
source "drivers/gpu/drm/arm/Kconfig"
config DRM_RADEON
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2f31579f91d4..6ef28d1422ee 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM) += drm.o
obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o
obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o
obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o
+obj-y += adi/
obj-y += arm/
obj-$(CONFIG_DRM_TTM) += ttm/
obj-$(CONFIG_DRM_SCHED)+= scheduler/
diff --git a/drivers/gpu/drm/adi/Kconfig b/drivers/gpu/drm/adi/Kconfig
new file mode 100644
index ..bcb230e6d7de
--- /dev/null
+++ b/drivers/gpu/drm/adi/Kconfig
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config DRM_ADI_AXI_HDMI_TX
+ tristate "DRM Support for Analog Devices HDMI FPGA platforms"
+ depends on DRM
+ default n
+ select DRM_KMS_HELPER
+ select DRM_KMS_CMA_HELPER
+ select DMA_CMA if HAVE_DMA_CONTIGUOUS
+ select CMA if HAVE_DMA_CONTIGUOUS
+ select AXI_DMAC
+ select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE
+ help
+ Choose this option if you have an FPGA board using this AXI HDMI
+ Controller (aka GFX).
+
+ If M is selected this module will be called adi_axi_hdmi_tx.
diff --git a/drivers/gpu/drm/adi/Makefile b/drivers/gpu/drm/adi/Makefile
new file mode 100644
index ..2451cdc4480f
--- /dev/null
+++ b/drivers/gpu/drm/adi/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
+adi_axi_hdmi_tx-y := axi_hdmi_tx_encoder.o axi_hdmi_tx_crtc.o axi_hdmi_tx_drv.o
+
+obj-$(CONFIG_DRM_ADI_AXI_HDMI_TX) += adi_axi_hdmi_tx.o
diff --git a/drivers/gpu/drm/adi/axi_hdmi_tx_crtc.c
b/drivers/gpu/drm/adi/axi_hdmi_tx_crtc.c
new file mode 100644
index ..40dfe5c93f39
--- /dev/null
+++ b/drivers/gpu/drm/adi/axi_hdmi_tx_crtc.c
@@ -0,0 +1,219 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Analog Devices AXI HDMI TX DRM driver.
+ *
+ * Copyright 2012-2020 Analog Devices Inc.
+ * Author: Lars-Peter Clausen
+ */
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "axi_hdmi_tx_drv.h"
+
+struct axi_hdmi_tx_crtc {
+ struct drm_crtc drm_crtc;
+ struct drm_plane plane;
+
+ struct dma_chan *dma;
+ struct dma_interleaved_template *dma_template;
+};
+
+static struct axi_hdmi_tx_crtc *plane_to_axi_hdmi_tx_crtc(struct drm_plane
*plane)
+{
+ return container_of(plane, struct axi_hdmi_tx_crtc, plane);
+}
+
+static struct axi_hdmi_tx_crtc *to_axi_hdmi_tx_crtc(struct drm_crtc *crtc)
+{
+ return container_of(crtc, struct axi_hdmi_tx_crtc, drm_crtc);
+}
+
+static struct dma_async_tx_descriptor *axi_hdmi_tx_vdma_prep_interleaved_desc(
+ struct drm_plane *plane)
+{
+ struct axi_hdmi_tx_crtc *axi_hdmi_tx_crtc =
plane_to_axi_hdmi_tx_crtc(plane);
+ struct drm_framebuffer *fb = plane->state->fb;
+ size_t offset, hw_row_size;
+ struct drm_gem_cma_object *obj;
+
+ obj = drm_fb_cma_get_gem_obj(plane->state->fb, 0);
+
+ offset = plane->state->crtc_x * fb->format->cpp[0] +
+ plane->state->crtc_y * fb->pitches[0];
+
+ /* Interleaved DMA is used that way:
+* Each