2020-11-24 23:48:06

by Lukas F. Hartmann

[permalink] [raw]
Subject: [RFC] dcss: fix attaching to sn56dsi86 bridge

The sn56dsi86 DSI to eDP bridge driver does not support attaching
without a drm connector. This patch makes the attachment work. Required
for the display chain in MNT Reform 2.0 (DCSS->NWL DSI->SN56DSI86->EDP).

Signed-off-by: Lukas F. Hartmann <[email protected]>
---
drivers/gpu/drm/imx/dcss/dcss-kms.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/imx/dcss/dcss-kms.c b/drivers/gpu/drm/imx/dcss/dcss-kms.c
index 135a62366..4967f828b 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-kms.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-kms.c
@@ -82,6 +82,7 @@ static int dcss_kms_bridge_connector_init(struct dcss_kms_dev *kms)
struct drm_crtc *crtc = (struct drm_crtc *)&kms->crtc;
struct drm_panel *panel;
struct drm_bridge *bridge;
+ struct drm_connector_list_iter iter;
int ret;

ret = drm_of_find_panel_or_bridge(ddev->dev->of_node, 0, 0,
@@ -104,19 +105,19 @@ static int dcss_kms_bridge_connector_init(struct dcss_kms_dev *kms)
return ret;
}

- ret = drm_bridge_attach(encoder, bridge, NULL,
- DRM_BRIDGE_ATTACH_NO_CONNECTOR);
+ ret = drm_bridge_attach(encoder, bridge, NULL, 0);
if (ret < 0) {
dev_err(ddev->dev, "Unable to attach bridge %pOF\n",
bridge->of_node);
return ret;
}

- kms->connector = drm_bridge_connector_init(ddev, encoder);
- if (IS_ERR(kms->connector)) {
- dev_err(ddev->dev, "Unable to create bridge connector.\n");
- return PTR_ERR(kms->connector);
- }
+ /*
+ * This hack to look up the connector is copied from mxsfb.
+ */
+ drm_connector_list_iter_begin(ddev, &iter);
+ kms->connector = drm_connector_list_iter_next(&iter);
+ drm_connector_list_iter_end(&iter);

drm_connector_attach_encoder(kms->connector, encoder);

--
2.28.0


2020-11-25 07:00:05

by Laurentiu Palcu

[permalink] [raw]
Subject: Re: [RFC] dcss: fix attaching to sn56dsi86 bridge

Hi Lukas,

On Tue, Nov 24, 2020 at 06:19:57PM +0100, Lukas F. Hartmann wrote:
> The sn56dsi86 DSI to eDP bridge driver does not support attaching
> without a drm connector.

I think the SN65DSI86 driver is exactly what you should focus on, so
that it works when connector is optional. The ADV7511/ADV7533/ADV7535
driver provides the best example on how it should be done.

Thanks,
laurentiu

> This patch makes the attachment work. Required for the display chain
> in MNT Reform 2.0 (DCSS->NWL DSI->SN56DSI86->EDP).
>
> Signed-off-by: Lukas F. Hartmann <[email protected]>
> ---
> drivers/gpu/drm/imx/dcss/dcss-kms.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/imx/dcss/dcss-kms.c b/drivers/gpu/drm/imx/dcss/dcss-kms.c
> index 135a62366..4967f828b 100644
> --- a/drivers/gpu/drm/imx/dcss/dcss-kms.c
> +++ b/drivers/gpu/drm/imx/dcss/dcss-kms.c
> @@ -82,6 +82,7 @@ static int dcss_kms_bridge_connector_init(struct dcss_kms_dev *kms)
> struct drm_crtc *crtc = (struct drm_crtc *)&kms->crtc;
> struct drm_panel *panel;
> struct drm_bridge *bridge;
> + struct drm_connector_list_iter iter;
> int ret;
>
> ret = drm_of_find_panel_or_bridge(ddev->dev->of_node, 0, 0,
> @@ -104,19 +105,19 @@ static int dcss_kms_bridge_connector_init(struct dcss_kms_dev *kms)
> return ret;
> }
>
> - ret = drm_bridge_attach(encoder, bridge, NULL,
> - DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> + ret = drm_bridge_attach(encoder, bridge, NULL, 0);
> if (ret < 0) {
> dev_err(ddev->dev, "Unable to attach bridge %pOF\n",
> bridge->of_node);
> return ret;
> }
>
> - kms->connector = drm_bridge_connector_init(ddev, encoder);
> - if (IS_ERR(kms->connector)) {
> - dev_err(ddev->dev, "Unable to create bridge connector.\n");
> - return PTR_ERR(kms->connector);
> - }
> + /*
> + * This hack to look up the connector is copied from mxsfb.
> + */
> + drm_connector_list_iter_begin(ddev, &iter);
> + kms->connector = drm_connector_list_iter_next(&iter);
> + drm_connector_list_iter_end(&iter);
>
> drm_connector_attach_encoder(kms->connector, encoder);
>
> --
> 2.28.0