summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-08-04 19:21:41 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-10-19 16:51:02 +0300
commite8e357337dc91f6c2c28a06f783f0219b77ba07a (patch)
tree7b0379609ec0e39312b528f4084ef8948ef25108 /drivers/gpu/drm/xlnx/zynqmp_dpsub.c
parent2374b6ea30384f23a78555c3b962bce358a8869e (diff)
downloadlinux-e8e357337dc91f6c2c28a06f783f0219b77ba07a.tar.xz
drm: xlnx: zynqmp_dpsub: Move encoder to DPSUB core
As part of the transitition of the DP encoder to a DRM bridge, turn the DRM encoder into a dummy encoder and move it out of the DP code, to the DPSUB core. DP encoder operations are handled by the DP bridge, which is now attached to the encoder. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/gpu/drm/xlnx/zynqmp_dpsub.c')
-rw-r--r--drivers/gpu/drm/xlnx/zynqmp_dpsub.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
index 1de2d927c32b..bb7c74a73dc2 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
@@ -17,6 +17,7 @@
#include <linux/pm_runtime.h>
#include <drm/drm_atomic_helper.h>
+#include <drm/drm_bridge.h>
#include <drm/drm_device.h>
#include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h>
@@ -27,6 +28,7 @@
#include <drm/drm_mode_config.h>
#include <drm/drm_module.h>
#include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
#include <drm/drm_vblank.h>
#include "zynqmp_disp.h"
@@ -94,6 +96,7 @@ static const struct drm_driver zynqmp_dpsub_drm_driver = {
static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
{
+ struct drm_encoder *encoder = &dpsub->encoder;
struct drm_device *drm = &dpsub->drm;
int ret;
@@ -116,8 +119,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
/*
* Initialize the DISP and DP components. This will creates planes,
- * CRTC, encoder and connector. The DISP should be initialized first as
- * the DP encoder needs the CRTC.
+ * CRTC, and a bridge for the DP encoder.
*/
ret = zynqmp_disp_drm_init(dpsub);
if (ret)
@@ -127,6 +129,16 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
if (ret)
goto err_poll_fini;
+ /* Create the encoder and attach the bridge. */
+ encoder->possible_crtcs |= zynqmp_disp_get_crtc_mask(dpsub->disp);
+ drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_NONE);
+
+ ret = drm_bridge_attach(encoder, dpsub->bridge, NULL, 0);
+ if (ret) {
+ dev_err(dpsub->dev, "failed to attach bridge to encoder\n");
+ goto err_poll_fini;
+ }
+
/* Reset all components and register the DRM device. */
drm_mode_config_reset(drm);