]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/mxsfb/lcdif: use DRM_BRIDGE_ATTACH_NO_CONNECTOR and the bridge-connector
authorLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 7 Apr 2026 12:24:25 +0000 (14:24 +0200)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 14 Apr 2026 11:53:36 +0000 (13:53 +0200)
Convert this driver to DRM_BRIDGE_ATTACH_NO_CONNECTOR and to the
drm_bridge_connector framework which is the current DRM bridge best
practice.

Based on the in-tree dts[i] files this introduces no regression. Based on
the kernel doc of drm_bridge_connector.c:

 * To make use of this helper, all bridges in the chain shall report bridge
 * operation flags (&drm_bridge->ops) and bridge output type
 * (&drm_bridge->type), as well as the DRM_BRIDGE_ATTACH_NO_CONNECTOR attach
 * flag (none of the bridges shall create a DRM connector directly).

and each of the 3 LCDIF blocks in the i.MX8MP, all of them comply with the
above requirement:

 * For the LCDIF3, the pipeline is:

   LCDIF3 -> fsl,imx8mp-hdmi-pvi -> fsl,imx8mp-hdmi-tx -> HDMI connector

   And the involved bridges are:

   * fsl,imx8mp-hdmi-pvi has ops = 0 (it doesn't set it) because it
     implements none the optional features mentioned by those flags, and it
     honors the DRM_BRIDGE_ATTACH_NO_CONNECTOR by propagating it

   * fsl,imx8mp-hdmi-tx is implemented based on dw-hdmi, which sets ops as
     appropriate and also propagates the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag

   * display-connector (enabled via the DT overlay if needed) sets ops and
     makes DRM_BRIDGE_ATTACH_NO_CONNECTOR mandatory

 * The LCDIF2 involves the panel-bridge, display-connector and lvds-decoder
   (even though only the pane-bridge is currently supported), and all these
   three also set ops as needed and propagate
   DRM_BRIDGE_ATTACH_NO_CONNECTOR or make it mandatory.

 * The LCDIF1 is used with the adv7511, tc358767 and the panel bridge
   drivers which also comply with the requirements.

Tested-by: Martyn Welch <martyn.welch@collabora.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> # TQMa8MPxL/MBa8MPxL
Reviewed-by: Liu Ying <victor.liu@nxp.com>
Link: https://patch.msgid.link/20260407-drm-lcdif-dbanc-v4-11-247a16e61ef9@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/mxsfb/Kconfig
drivers/gpu/drm/mxsfb/lcdif_drv.c

index 264e74f4555477937d4446b05668c796539d1ab5..31db7a824a93c96058764c444b418dba2e56a498 100644 (file)
@@ -33,6 +33,8 @@ config DRM_IMX_LCDIF
        select DRM_GEM_DMA_HELPER
        select DRM_PANEL
        select DRM_PANEL_BRIDGE
+       select DRM_DISPLAY_HELPER
+       select DRM_BRIDGE_CONNECTOR
        help
          Choose this option if you have an LCDIFv3 LCD controller.
          Those devices are found in various i.MX SoC (i.MX8MP,
index c8ba8f9b1da8b192305dc06859a6a1a005d85046..7f07ae24e0dc08a586678a852a75fe10a6219325 100644 (file)
@@ -18,6 +18,7 @@
 #include <drm/clients/drm_client_setup.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
+#include <drm/drm_bridge_connector.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_encoder.h>
 #include <drm/drm_fbdev_dma.h>
@@ -57,6 +58,7 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif)
                struct of_endpoint of_ep;
                struct drm_bridge *bridge;
                struct drm_encoder *encoder;
+               struct drm_connector *connector;
                int ret;
 
                if (!of_device_is_available(remote))
@@ -86,11 +88,23 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif)
                                             "Failed to initialize encoder for endpoint%u\n",
                                             of_ep.id);
 
-               ret = drm_bridge_attach(encoder, bridge, NULL, 0);
+               ret = drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
                if (ret)
                        return dev_err_probe(dev, ret,
                                             "Failed to attach bridge for endpoint%u\n",
                                             of_ep.id);
+
+               connector = drm_bridge_connector_init(lcdif->drm, encoder);
+               if (IS_ERR(connector))
+                       return dev_err_probe(dev, PTR_ERR(connector),
+                                            "Failed to init bridge_connector for endpoint%u\n",
+                                            of_ep.id);
+
+               ret = drm_connector_attach_encoder(connector, encoder);
+               if (ret)
+                       return dev_err_probe(dev, ret,
+                                            "Failed to attach connector for endpoint%u\n",
+                                            of_ep.id);
        }
 
        return 0;