drm/bridge: adv7511: Attach next bridge without creating connector
Subsystems (3)
PATCH 1/1 drm/bridge: adv7511: Attach next bridge without creating connector
The connector is created by either this ADV7511 bridge driver or any DRM device driver/previous bridge driver, so this ADV7511 bridge driver should not let the next bridge driver create connector.
If the next bridge is a HDMI connector, the next bridge driver would fail to attach bridge from display_connector_attach() without the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag.
Add that flag to drm_bridge_attach() function call in adv7511_bridge_attach() to fix the issue.
This fixes the issue where the HDMI connector bridge fails to attach to the previous ADV7535 bridge on i.MX8MP EVK platform:
[ 2.216442] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /hdmi-connector to encoder None-37: -22 [ 2.220675] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA [ 2.226262] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/i2c@30a30000/hdmi@3d to encoder None-37: -22 [ 2.245204] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@32c00000/dsi@32e60000 to encoder None-37: -22 [ 2.256445] imx-lcdif 32e80000.display-controller: error -EINVAL: Failed to attach bridge for endpoint0 [ 2.265850] imx-lcdif 32e80000.display-controller: error -EINVAL: Cannot connect bridge [ 2.274009] imx-lcdif 32e80000.display-controller: probe with driver imx-lcdif failed with error -22
--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +2 -1
@@ -953,7 +953,8 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,int ret =0 ;if (adv->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, flags); + ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, + flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret)return ret; }
Signature · 1 line
2.34.1
Hi,
Quoted 14 lines · Liu Ying
The connector is created by either this ADV7511 bridge driver or any DRM device driver/previous bridge driver, so this ADV7511 bridge driver should not let the next bridge driver create connector.
If the next bridge is a HDMI connector, the next bridge driver would fail to attach bridge from
display_connector_attach()without theDRM_BRIDGE_ATTACH_NO_CONNECTORflag.Add that flag to
drm_bridge_attach()function call inadv7511_bridge_attach()to fix the issue.This fixes the issue where the HDMI connector bridge fails to attach to the previous ADV7535 bridge on i.MX8MP EVK platform:
Quoted 8 lines
[ 2.216442] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /hdmi-connector to encoder None-37: -22 [ 2.220675] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA [ 2.226262] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/i2c@30a30000/hdmi@3d to encoder None-37: -22 [ 2.245204] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@32c00000/dsi@32e60000 to encoder None-37: -22 [ 2.256445] imx-lcdif 32e80000.display-controller: error -EINVAL: Failed to attach bridge for endpoint0 [ 2.265850] imx-lcdif 32e80000.display-controller: error -EINVAL: Cannot connect bridge [ 2.274009] imx-lcdif 32e80000.display-controller: probe with driver imx-lcdif failed with error -22
Indeed, looks safer finally.
Quoted 2 lines
Fixes 14b3cdbd0e5b ("drm/bridge: adv7511: make it honour next bridge in DT")Signed-off-by Liu Ying <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +2
-1@@ -953,7 +953,8 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,int ret =0 ;if (adv->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, flags); + ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, + flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret)return ret; }
Signature · 2 lines
Best regards Sui Jingfeng
Hi,
Quoted 33 lines · Liu Ying
The connector is created by either this ADV7511 bridge driver or any DRM device driver/previous bridge driver, so this ADV7511 bridge driver should not let the next bridge driver create connector.
If the next bridge is a HDMI connector, the next bridge driver would fail to attach bridge from
display_connector_attach()without theDRM_BRIDGE_ATTACH_NO_CONNECTORflag.Add that flag to
drm_bridge_attach()function call inadv7511_bridge_attach()to fix the issue.This fixes the issue where the HDMI connector bridge fails to attach to the previous ADV7535 bridge on i.MX8MP EVK platform:
[ 2.216442] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /hdmi-connector to encoder None-37: -22 [ 2.220675] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA [ 2.226262] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/i2c@30a30000/hdmi@3d to encoder None-37: -22 [ 2.245204] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@32c00000/dsi@32e60000 to encoder None-37: -22 [ 2.256445] imx-lcdif 32e80000.display-controller: error -EINVAL: Failed to attach bridge for endpoint0 [ 2.265850] imx-lcdif 32e80000.display-controller: error -EINVAL: Cannot connect bridge [ 2.274009] imx-lcdif 32e80000.display-controller: probe with driver imx-lcdif failed with error -22Fixes 14b3cdbd0e5b ("drm/bridge: adv7511: make it honour next bridge in DT")Signed-off-by Liu Ying <[email protected]>--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0
-0
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_bridge_attach(struct drm_bridge *bridge, · line 957
Quoted 6 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +2
-1@@ -953,7 +953,8 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,int ret =0 ;if (adv->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, flags); + ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, + flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );
As a side note, I think, maybe you could do better in the future.
If we know that the KMS display driver side has the HDMI connector already created for us, we should pass DRM_BRIDGE_ATTACH_NO_CONNECTOR from the root KMS driver side. Which is to forbidden all potential drm bridge drivers to create a connector in the middle.
The KMS display driver side could parse the DT to know if there is a hdmi connector, or merely just hdmi connector device node, or something else.
However, other maintainer and/or reviewer's opinion are of cause more valuable. I send a A-b because I thought the bug is urgency and it's probably more important to solve this bug first. And maybe you can Cc: <[email protected]> if you like.
Thanks.
Quoted 3 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0
-0if (ret)return ret; }
Signature · 2 lines
Best regards Sui Jingfeng
Quoted 52 lines · Sui Jingfeng
Hi,
Quoted 33 lines · Liu Ying
The connector is created by either this ADV7511 bridge driver or any DRM device driver/previous bridge driver, so this ADV7511 bridge driver should not let the next bridge driver create connector.
If the next bridge is a HDMI connector, the next bridge driver would fail to attach bridge from
display_connector_attach()without theDRM_BRIDGE_ATTACH_NO_CONNECTORflag.Add that flag to
drm_bridge_attach()function call inadv7511_bridge_attach()to fix the issue.This fixes the issue where the HDMI connector bridge fails to attach to the previous ADV7535 bridge on i.MX8MP EVK platform:
[ 2.216442] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /hdmi-connector to encoder None-37: -22 [ 2.220675] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA [ 2.226262] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/i2c@30a30000/hdmi@3d to encoder None-37: -22 [ 2.245204] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@32c00000/dsi@32e60000 to encoder None-37: -22 [ 2.256445] imx-lcdif 32e80000.display-controller: error -EINVAL: Failed to attach bridge for endpoint0 [ 2.265850] imx-lcdif 32e80000.display-controller: error -EINVAL: Cannot connect bridge [ 2.274009] imx-lcdif 32e80000.display-controller: probe with driver imx-lcdif failed with error -22Fixes 14b3cdbd0e5b ("drm/bridge: adv7511: make it honour next bridge in DT")Signed-off-by Liu Ying <[email protected]>--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0
-0drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_bridge_attach(struct drm_bridge *bridge, · line 957
Quoted 6 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +2
-1@@ -953,7 +953,8 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,int ret =0 ;if (adv->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, flags); + ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, + flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );As a side note, I think, maybe you could do better in the future.
If we know that the KMS display driver side has the HDMI connector already created for us, we should pass
DRM_BRIDGE_ATTACH_NO_CONNECTORfrom the root KMS driver side. Which is to forbidden all potential drm bridge drivers to create a connector in the middle.
Quoted 9 lines
The KMS display driver side could parse the DT to know if there is a hdmi connector, or merely just hdmi connector device node, or something else.
However, other maintainer and/or reviewer's opinion are of cause more valuable. I send a A-b because I thought the bug is urgency and it's probably more important to solve this bug first. And maybe you can Cc: <[email protected]> if you like.
Hello,
Quoted 8 lines · Sui Jingfeng
Quoted 7 lines · Liu Ying
The connector is created by either this ADV7511 bridge driver or any DRM device driver/previous bridge driver, so this ADV7511 bridge driver should not let the next bridge driver create connector.
If the next bridge is a HDMI connector, the next bridge driver would fail to attach bridge from
display_connector_attach()without theDRM_BRIDGE_ATTACH_NO_CONNECTORflag.
In theory we could have another HDMI-to-something bridge connected to the ADV7511 output, and that bridge could create a connector. However, before commit 14b3cdbd0e5b the adv7511 driver didn't try to attach to the next bridge, so it's clear that no platform support in mainline had such a setup. It should be safe to set DRM_BRIDGE_ATTACH_NO_CONNECTOR unconditionally here.
Quoted 35 lines
Quoted 26 lines
Add that flag to
drm_bridge_attach()function call inadv7511_bridge_attach()to fix the issue.This fixes the issue where the HDMI connector bridge fails to attach to the previous ADV7535 bridge on i.MX8MP EVK platform:
[ 2.216442] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /hdmi-connector to encoder None-37: -22 [ 2.220675] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA [ 2.226262] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/i2c@30a30000/hdmi@3d to encoder None-37: -22 [ 2.245204] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@32c00000/dsi@32e60000 to encoder None-37: -22 [ 2.256445] imx-lcdif 32e80000.display-controller: error -EINVAL: Failed to attach bridge for endpoint0 [ 2.265850] imx-lcdif 32e80000.display-controller: error -EINVAL: Cannot connect bridge [ 2.274009] imx-lcdif 32e80000.display-controller: probe with driver imx-lcdif failed with error -22Fixes 14b3cdbd0e5b ("drm/bridge: adv7511: make it honour next bridge in DT")Signed-off-by Liu Ying <[email protected]>--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0
-0drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_bridge_attach(struct drm_bridge *bridge, · line 957
Quoted 6 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +2
-1@@ -953,7 +953,8 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,int ret =0 ;if (adv->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, flags); + ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, + flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );As a side note, I think, maybe you could do better in the future.
Quoted 4 lines
If we know that the KMS display driver side has the HDMI connector already created for us, we should pass
DRM_BRIDGE_ATTACH_NO_CONNECTORfrom the root KMS driver side. Which is to forbidden all potential drm bridge drivers to create a connector in the middle.
That's the recommended way for new drivers. Using the drm_bridge_connector helper handles all this for you.
Quoted 3 lines
The KMS display driver side could parse the DT to know if there is a hdmi connector, or merely just hdmi connector device node, or something else.
No, that would violate the basic principle of not peeking into the DT of devices you know nothing about. The display engine driver can't walk the pipeline in DT and expect to understand all the DT nodes on the path, and what their properties mean.
What KMS drivers should do is to use the drm_bridge_connector helper. Calling drm_bridge_connector_init() will create a connector for a chain of bridges. The KMS driver should then attach to the first bridge with DRM_BRIDGE_ATTACH_NO_CONNECTOR, unconditionally.
Quoted 8 lines
However, other maintainer and/or reviewer's opinion are of cause more valuable. I send a A-b because I thought the bug is urgency and it's probably more important to solve this bug first. And maybe you can Cc: <[email protected]> if you like.
Quoted 3 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0
-0if (ret)return ret; }
Signature · 3 lines
Regards, Laurent Pinchart
Hi,
Quoted 12 lines · Laurent Pinchart
Hello,
Quoted 8 lines · Sui Jingfeng
Quoted 7 lines · Liu Ying
The connector is created by either this ADV7511 bridge driver or any DRM device driver/previous bridge driver, so this ADV7511 bridge driver should not let the next bridge driver create connector.
If the next bridge is a HDMI connector, the next bridge driver would fail to attach bridge from
display_connector_attach()without theDRM_BRIDGE_ATTACH_NO_CONNECTORflag.
Quoted 6 lines
In theory we could have another HDMI-to-something bridge connected to the ADV7511 output, and that bridge could create a connector. However, before commit
14b3cdbd0e5bthe adv7511 driver didn't try to attach to the next bridge, so it's clear that no platform support in mainline had such a setup. It should be safe to setDRM_BRIDGE_ATTACH_NO_CONNECTORunconditionally here.
But what if there is a drm bridge prior to adv7511 but after the KMS engine? Even though we are still safe if it doesn't create connector by obeying modern rule.
Quoted 46 lines
Reviewed-by Laurent Pinchart <[email protected]>Quoted 35 lines
Quoted 26 lines
Add that flag to
drm_bridge_attach()function call inadv7511_bridge_attach()to fix the issue.This fixes the issue where the HDMI connector bridge fails to attach to the previous ADV7535 bridge on i.MX8MP EVK platform:
[ 2.216442] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /hdmi-connector to encoder None-37: -22 [ 2.220675] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA [ 2.226262] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/i2c@30a30000/hdmi@3d to encoder None-37: -22 [ 2.245204] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@32c00000/dsi@32e60000 to encoder None-37: -22 [ 2.256445] imx-lcdif 32e80000.display-controller: error -EINVAL: Failed to attach bridge for endpoint0 [ 2.265850] imx-lcdif 32e80000.display-controller: error -EINVAL: Cannot connect bridge [ 2.274009] imx-lcdif 32e80000.display-controller: probe with driver imx-lcdif failed with error -22Fixes 14b3cdbd0e5b ("drm/bridge: adv7511: make it honour next bridge in DT")Signed-off-by Liu Ying <[email protected]>--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0
-0drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_bridge_attach(struct drm_bridge *bridge, · line 957
Quoted 6 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +2
-1@@ -953,7 +953,8 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,int ret =0 ;if (adv->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, flags); + ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, + flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );As a side note, I think, maybe you could do better in the future.
Quoted 4 lines
If we know that the KMS display driver side has the HDMI connector already created for us, we should pass
DRM_BRIDGE_ATTACH_NO_CONNECTORfrom the root KMS driver side. Which is to forbidden all potential drm bridge drivers to create a connector in the middle.That's the recommended way for new drivers. Using the
drm_bridge_connectorhelper handles all this for you.
Quoted 9 lines
Quoted 3 lines
The KMS display driver side could parse the DT to know if there is a hdmi connector, or merely just hdmi connector device node, or something else.
No, that would violate the basic principle of not peeking into the DT of devices you know nothing about. The display engine driver can't walk the pipeline in DT and expect to understand all the DT nodes on the path, and what their properties mean.
The (next) bridge at the remote port is not necessary a display bridge. Or it is a bridge from the perspective of hardware viewpoint, but under controlled by a more complex foreign driver which generic drm bridge driver has no authority to attach.
Quoted 5 lines
What KMS drivers should do is to use the
drm_bridge_connectorhelper. Callingdrm_bridge_connector_init()will create a connector for a chain of bridges. The KMS driver should then attach to the first bridge withDRM_BRIDGE_ATTACH_NO_CONNECTOR, unconditionally.
OK, thanks for teaching us the modern way to use drm_bridge_connector helper, also thanks Ying for providing the patch.
Quoted 9 lines
Quoted 8 lines
However, other maintainer and/or reviewer's opinion are of cause more valuable. I send a A-b because I thought the bug is urgency and it's probably more important to solve this bug first. And maybe you can Cc: <[email protected]> if you like.
Quoted 3 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0
-0if (ret)return ret; }
Signature · 2 lines
Best regards Sui
Laurent Pinchart
reviewerHi Sui,
Quoted 18 lines · Sui Jingfeng
Quoted 10 lines · Laurent Pinchart
Quoted 8 lines · Sui Jingfeng
Quoted 7 lines · Liu Ying
The connector is created by either this ADV7511 bridge driver or any DRM device driver/previous bridge driver, so this ADV7511 bridge driver should not let the next bridge driver create connector.
If the next bridge is a HDMI connector, the next bridge driver would fail to attach bridge from
display_connector_attach()without theDRM_BRIDGE_ATTACH_NO_CONNECTORflag.Quoted 6 lines
In theory we could have another HDMI-to-something bridge connected to the ADV7511 output, and that bridge could create a connector. However, before commit
14b3cdbd0e5bthe adv7511 driver didn't try to attach to the next bridge, so it's clear that no platform support in mainline had such a setup. It should be safe to setDRM_BRIDGE_ATTACH_NO_CONNECTORunconditionally here.
Quoted 3 lines
But what if there is a drm bridge prior to adv7511 but after the KMS engine? Even though we are still safe if it doesn't create connector by obeying modern rule.
In the "old world", that bridge wouln't have created a connector, because it would detect that there's a next bridge. With modern KMS drivers, DRM_BRIDGE_ATTACH_NO_CONNECTOR is passed by the drm_bridge_connector helper to the very first bridge when attaching to it, so no bridge will create a connector. Modern bridge drivers should not support the !DRM_BRIDGE_ATTACH_NO_CONNECTOR case at all, they should not offer the option of creating a connector.
Quoted 75 lines
Quoted 45 lines
Reviewed-by Laurent Pinchart <[email protected]>Quoted 35 lines
Quoted 26 lines
Add that flag to
drm_bridge_attach()function call inadv7511_bridge_attach()to fix the issue.This fixes the issue where the HDMI connector bridge fails to attach to the previous ADV7535 bridge on i.MX8MP EVK platform:
[ 2.216442] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /hdmi-connector to encoder None-37: -22 [ 2.220675] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA [ 2.226262] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/i2c@30a30000/hdmi@3d to encoder None-37: -22 [ 2.245204] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@32c00000/dsi@32e60000 to encoder None-37: -22 [ 2.256445] imx-lcdif 32e80000.display-controller: error -EINVAL: Failed to attach bridge for endpoint0 [ 2.265850] imx-lcdif 32e80000.display-controller: error -EINVAL: Cannot connect bridge [ 2.274009] imx-lcdif 32e80000.display-controller: probe with driver imx-lcdif failed with error -22Fixes 14b3cdbd0e5b ("drm/bridge: adv7511: make it honour next bridge in DT")Signed-off-by Liu Ying <[email protected]>--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0
-0drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_bridge_attach(struct drm_bridge *bridge, · line 957
Quoted 6 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +2
-1@@ -953,7 +953,8 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,int ret =0 ;if (adv->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, flags); + ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, + flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );As a side note, I think, maybe you could do better in the future.
Quoted 4 lines
If we know that the KMS display driver side has the HDMI connector already created for us, we should pass
DRM_BRIDGE_ATTACH_NO_CONNECTORfrom the root KMS driver side. Which is to forbidden all potential drm bridge drivers to create a connector in the middle.That's the recommended way for new drivers. Using the
drm_bridge_connectorhelper handles all this for you.Quoted 8 lines
Quoted 3 lines
The KMS display driver side could parse the DT to know if there is a hdmi connector, or merely just hdmi connector device node, or something else.
No, that would violate the basic principle of not peeking into the DT of devices you know nothing about. The display engine driver can't walk the pipeline in DT and expect to understand all the DT nodes on the path, and what their properties mean.
The (next) bridge at the remote port is not necessary a display bridge. Or it is a bridge from the perspective of hardware viewpoint, but under controlled by a more complex foreign driver which generic drm bridge driver has no authority to attach.
Quoted 4 lines
What KMS drivers should do is to use the
drm_bridge_connectorhelper. Callingdrm_bridge_connector_init()will create a connector for a chain of bridges. The KMS driver should then attach to the first bridge withDRM_BRIDGE_ATTACH_NO_CONNECTOR, unconditionally.OK, thanks for teaching us the modern way to use
drm_bridge_connectorhelper, also thanks Ying for providing the patch.Quoted 8 lines
Quoted 8 lines
However, other maintainer and/or reviewer's opinion are of cause more valuable. I send a A-b because I thought the bug is urgency and it's probably more important to solve this bug first. And maybe you can Cc: <[email protected]> if you like.
Quoted 3 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0
-0if (ret)return ret; }
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 23 lines · Liu Ying
The connector is created by either this ADV7511 bridge driver or any DRM device driver/previous bridge driver, so this ADV7511 bridge driver should not let the next bridge driver create connector.
If the next bridge is a HDMI connector, the next bridge driver would fail to attach bridge from
display_connector_attach()without theDRM_BRIDGE_ATTACH_NO_CONNECTORflag.Add that flag to
drm_bridge_attach()function call inadv7511_bridge_attach()to fix the issue.This fixes the issue where the HDMI connector bridge fails to attach to the previous ADV7535 bridge on i.MX8MP EVK platform:
[ 2.216442] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /hdmi-connector to encoder None-37: -22 [ 2.220675] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA [ 2.226262] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/i2c@30a30000/hdmi@3d to encoder None-37: -22 [ 2.245204] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@32c00000/dsi@32e60000 to encoder None-37: -22 [ 2.256445] imx-lcdif 32e80000.display-controller: error -EINVAL: Failed to attach bridge for endpoint0 [ 2.265850] imx-lcdif 32e80000.display-controller: error -EINVAL: Cannot connect bridge [ 2.274009] imx-lcdif 32e80000.display-controller: probe with driver imx-lcdif failed with error -22
Quoted 6 lines
Fixes 14b3cdbd0e5b ("drm/bridge: adv7511: make it honour next bridge in DT")Signed-off-by Liu Ying <[email protected]>--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 2 lines
With best wishes Dmitry
Dmitry Baryshkov
AppliedQuoted 9 lines · Liu Ying
The connector is created by either this ADV7511 bridge driver or any DRM device driver/previous bridge driver, so this ADV7511 bridge driver should not let the next bridge driver create connector.
If the next bridge is a HDMI connector, the next bridge driver would fail to attach bridge from
display_connector_attach()without theDRM_BRIDGE_ATTACH_NO_CONNECTORflag.[...]
Applied to drm-misc-next-fixes, thanks!
[1/1] drm/bridge: adv7511: Attach next bridge without creating connector
commit: 20da948e3a807c67f0efe4f665e64728be370f3d
Best regards,
Signature · 2 lines
With best wishes Dmitry