Skip to content

Commit a9d9fea

Browse files
Enric Balletbo i SerraChun-Kuang Hu
authored andcommitted
drm/mediatek: mtk_dsi: Create connector for bridges
Use the drm_bridge_connector helper to create a connector for pipelines that use drm_bridge. This allows splitting connector operations across multiple bridges when necessary, instead of having the last bridge in the chain creating the connector and handling all connector operations internally. Signed-off-by: Enric Balletbo i Serra <[email protected]> Acked-by: Sam Ravnborg <[email protected]> Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 2dd8075 commit a9d9fea

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/gpu/drm/mediatek/mtk_dsi.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include <drm/drm_atomic_helper.h>
1919
#include <drm/drm_bridge.h>
20+
#include <drm/drm_bridge_connector.h>
2021
#include <drm/drm_mipi_dsi.h>
2122
#include <drm/drm_of.h>
2223
#include <drm/drm_panel.h>
@@ -183,6 +184,7 @@ struct mtk_dsi {
183184
struct drm_encoder encoder;
184185
struct drm_bridge bridge;
185186
struct drm_bridge *next_bridge;
187+
struct drm_connector *connector;
186188
struct phy *phy;
187189

188190
void __iomem *regs;
@@ -974,10 +976,19 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
974976
*/
975977
dsi->encoder.possible_crtcs = 1;
976978

977-
ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0);
979+
ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
980+
DRM_BRIDGE_ATTACH_NO_CONNECTOR);
978981
if (ret)
979982
goto err_cleanup_encoder;
980983

984+
dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder);
985+
if (IS_ERR(dsi->connector)) {
986+
DRM_ERROR("Unable to create bridge connector\n");
987+
ret = PTR_ERR(dsi->connector);
988+
goto err_cleanup_encoder;
989+
}
990+
drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
991+
981992
return 0;
982993

983994
err_cleanup_encoder:

0 commit comments

Comments
 (0)