linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] drm: msm+ti-sn65dsi86 support for NO_CONNECTOR
@ 2021-09-20 22:57 Rob Clark
  2021-09-20 22:57 ` [PATCH v2 1/3] drm/msm/dsi: Support NO_CONNECTOR bridges Rob Clark
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Clark @ 2021-09-20 22:57 UTC (permalink / raw)
  To: dri-devel
  Cc: freedreno, Douglas Anderson, Laurent Pinchart, Rob Clark,
	Abhinav Kumar, Bjorn Andersson, Dmitry Baryshkov, Jernej Skrabec,
	Jonas Karlman, Laurent Pinchart,
	open list:DRM DRIVER FOR MSM ADRENO GPU, open list

From: Rob Clark <robdclark@chromium.org>

Respin of https://www.spinics.net/lists/linux-arm-msm/msg92182.html with
the remaining 3 patches that are not yet merged.

At the end of this series, but drm/msm and ti-sn65dsi86 work in both
combinations, so the two bridge patches can be merged indepdendently of
the msm/dsi patch.

The last patch has some conficts with https://www.spinics.net/lists/linux-arm-msm/msg93731.html
but I already have a rebased variant of it depending on which order
patches land.

Rob Clark (3):
  drm/msm/dsi: Support NO_CONNECTOR bridges
  drm/bridge: ti-sn65dsi86: Implement bridge->mode_valid()
  drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support

 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 64 ++++++++++++++++++---------
 drivers/gpu/drm/msm/Kconfig           |  2 +
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 50 +++++++++++++++------
 3 files changed, 81 insertions(+), 35 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/3] drm/msm/dsi: Support NO_CONNECTOR bridges
  2021-09-20 22:57 [PATCH v2 0/3] drm: msm+ti-sn65dsi86 support for NO_CONNECTOR Rob Clark
@ 2021-09-20 22:57 ` Rob Clark
  2021-10-01 17:28   ` Dmitry Baryshkov
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Clark @ 2021-09-20 22:57 UTC (permalink / raw)
  To: dri-devel
  Cc: freedreno, Douglas Anderson, Laurent Pinchart, Rob Clark,
	Rob Clark, Sean Paul, David Airlie, Daniel Vetter,
	Dmitry Baryshkov, Abhinav Kumar, Bjorn Andersson,
	open list:DRM DRIVER FOR MSM ADRENO GPU, open list

From: Rob Clark <robdclark@chromium.org>

For now, since we have a mix of bridges which support this flag, which
which do *not* support this flag, or work both ways, try it once with
NO_CONNECTOR and then fall back to the old way if that doesn't work.
Eventually we can drop the fallback path.

v2: Add missing drm_connector_attach_encoder() so display actually comes
    up when the bridge properly handles the NO_CONNECTOR flag

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/msm/Kconfig           |  2 ++
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 50 ++++++++++++++++++++-------
 2 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index e9c6af78b1d7..36e5ba3ccc28 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -14,6 +14,8 @@ config DRM_MSM
 	select REGULATOR
 	select DRM_KMS_HELPER
 	select DRM_PANEL
+	select DRM_BRIDGE
+	select DRM_PANEL_BRIDGE
 	select DRM_SCHED
 	select SHMEM
 	select TMPFS
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index c41d39f5b7cf..e25877073d31 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -3,6 +3,8 @@
  * Copyright (c) 2015, The Linux Foundation. All rights reserved.
  */
 
+#include "drm/drm_bridge_connector.h"
+
 #include "msm_kms.h"
 #include "dsi.h"
 
@@ -688,10 +690,10 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id)
 {
 	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
 	struct drm_device *dev = msm_dsi->dev;
+	struct drm_connector *connector;
 	struct drm_encoder *encoder;
 	struct drm_bridge *int_bridge, *ext_bridge;
-	struct drm_connector *connector;
-	struct list_head *connector_list;
+	int ret;
 
 	int_bridge = msm_dsi->bridge;
 	ext_bridge = msm_dsi->external_bridge =
@@ -699,22 +701,44 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id)
 
 	encoder = msm_dsi->encoder;
 
-	/* link the internal dsi bridge to the external bridge */
-	drm_bridge_attach(encoder, ext_bridge, int_bridge, 0);
-
 	/*
-	 * we need the drm_connector created by the external bridge
-	 * driver (or someone else) to feed it to our driver's
-	 * priv->connector[] list, mainly for msm_fbdev_init()
+	 * Try first to create the bridge without it creating its own
+	 * connector.. currently some bridges support this, and others
+	 * do not (and some support both modes)
 	 */
-	connector_list = &dev->mode_config.connector_list;
+	ret = drm_bridge_attach(encoder, ext_bridge, int_bridge,
+			DRM_BRIDGE_ATTACH_NO_CONNECTOR);
+	if (ret == -EINVAL) {
+		struct drm_connector *connector;
+		struct list_head *connector_list;
+
+		/* link the internal dsi bridge to the external bridge */
+		drm_bridge_attach(encoder, ext_bridge, int_bridge, 0);
+
+		/*
+		 * we need the drm_connector created by the external bridge
+		 * driver (or someone else) to feed it to our driver's
+		 * priv->connector[] list, mainly for msm_fbdev_init()
+		 */
+		connector_list = &dev->mode_config.connector_list;
 
-	list_for_each_entry(connector, connector_list, head) {
-		if (drm_connector_has_possible_encoder(connector, encoder))
-			return connector;
+		list_for_each_entry(connector, connector_list, head) {
+			if (drm_connector_has_possible_encoder(connector, encoder))
+				return connector;
+		}
+
+		return ERR_PTR(-ENODEV);
+	}
+
+	connector = drm_bridge_connector_init(dev, encoder);
+	if (IS_ERR(connector)) {
+		DRM_ERROR("Unable to create bridge connector\n");
+		return ERR_CAST(connector);
 	}
 
-	return ERR_PTR(-ENODEV);
+	drm_connector_attach_encoder(connector, encoder);
+
+	return connector;
 }
 
 void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/3] drm/msm/dsi: Support NO_CONNECTOR bridges
  2021-09-20 22:57 ` [PATCH v2 1/3] drm/msm/dsi: Support NO_CONNECTOR bridges Rob Clark
@ 2021-10-01 17:28   ` Dmitry Baryshkov
  2021-10-01 18:02     ` Rob Clark
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Baryshkov @ 2021-10-01 17:28 UTC (permalink / raw)
  To: Rob Clark, dri-devel
  Cc: freedreno, Douglas Anderson, Laurent Pinchart, Rob Clark,
	Sean Paul, David Airlie, Daniel Vetter, Abhinav Kumar,
	Bjorn Andersson, open list:DRM DRIVER FOR MSM ADRENO GPU,
	open list

On 21/09/2021 01:57, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
> 
> For now, since we have a mix of bridges which support this flag, which
> which do *not* support this flag, or work both ways, try it once with
> NO_CONNECTOR and then fall back to the old way if that doesn't work.
> Eventually we can drop the fallback path.
> 
> v2: Add missing drm_connector_attach_encoder() so display actually comes
>      up when the bridge properly handles the NO_CONNECTOR flag
> 
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

I think this patch can go through the drm/msm, while two other patches 
would need to through the drm-misc. Is it correct?

> ---
>   drivers/gpu/drm/msm/Kconfig           |  2 ++
>   drivers/gpu/drm/msm/dsi/dsi_manager.c | 50 ++++++++++++++++++++-------
>   2 files changed, 39 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
> index e9c6af78b1d7..36e5ba3ccc28 100644
> --- a/drivers/gpu/drm/msm/Kconfig
> +++ b/drivers/gpu/drm/msm/Kconfig
> @@ -14,6 +14,8 @@ config DRM_MSM
>   	select REGULATOR
>   	select DRM_KMS_HELPER
>   	select DRM_PANEL
> +	select DRM_BRIDGE
> +	select DRM_PANEL_BRIDGE
>   	select DRM_SCHED
>   	select SHMEM
>   	select TMPFS
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> index c41d39f5b7cf..e25877073d31 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> @@ -3,6 +3,8 @@
>    * Copyright (c) 2015, The Linux Foundation. All rights reserved.
>    */
>   
> +#include "drm/drm_bridge_connector.h"
> +
>   #include "msm_kms.h"
>   #include "dsi.h"
>   
> @@ -688,10 +690,10 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id)
>   {
>   	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
>   	struct drm_device *dev = msm_dsi->dev;
> +	struct drm_connector *connector;
>   	struct drm_encoder *encoder;
>   	struct drm_bridge *int_bridge, *ext_bridge;
> -	struct drm_connector *connector;
> -	struct list_head *connector_list;
> +	int ret;
>   
>   	int_bridge = msm_dsi->bridge;
>   	ext_bridge = msm_dsi->external_bridge =
> @@ -699,22 +701,44 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id)
>   
>   	encoder = msm_dsi->encoder;
>   
> -	/* link the internal dsi bridge to the external bridge */
> -	drm_bridge_attach(encoder, ext_bridge, int_bridge, 0);
> -
>   	/*
> -	 * we need the drm_connector created by the external bridge
> -	 * driver (or someone else) to feed it to our driver's
> -	 * priv->connector[] list, mainly for msm_fbdev_init()
> +	 * Try first to create the bridge without it creating its own
> +	 * connector.. currently some bridges support this, and others
> +	 * do not (and some support both modes)
>   	 */
> -	connector_list = &dev->mode_config.connector_list;
> +	ret = drm_bridge_attach(encoder, ext_bridge, int_bridge,
> +			DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> +	if (ret == -EINVAL) {
> +		struct drm_connector *connector;
> +		struct list_head *connector_list;
> +
> +		/* link the internal dsi bridge to the external bridge */
> +		drm_bridge_attach(encoder, ext_bridge, int_bridge, 0);
> +
> +		/*
> +		 * we need the drm_connector created by the external bridge
> +		 * driver (or someone else) to feed it to our driver's
> +		 * priv->connector[] list, mainly for msm_fbdev_init()
> +		 */
> +		connector_list = &dev->mode_config.connector_list;
>   
> -	list_for_each_entry(connector, connector_list, head) {
> -		if (drm_connector_has_possible_encoder(connector, encoder))
> -			return connector;
> +		list_for_each_entry(connector, connector_list, head) {
> +			if (drm_connector_has_possible_encoder(connector, encoder))
> +				return connector;
> +		}
> +
> +		return ERR_PTR(-ENODEV);
> +	}
> +
> +	connector = drm_bridge_connector_init(dev, encoder);
> +	if (IS_ERR(connector)) {
> +		DRM_ERROR("Unable to create bridge connector\n");
> +		return ERR_CAST(connector);
>   	}
>   
> -	return ERR_PTR(-ENODEV);
> +	drm_connector_attach_encoder(connector, encoder);
> +
> +	return connector;
>   }
>   
>   void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge)
> 


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/3] drm/msm/dsi: Support NO_CONNECTOR bridges
  2021-10-01 17:28   ` Dmitry Baryshkov
@ 2021-10-01 18:02     ` Rob Clark
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Clark @ 2021-10-01 18:02 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: dri-devel, freedreno, Douglas Anderson, Laurent Pinchart,
	Rob Clark, Sean Paul, David Airlie, Daniel Vetter, Abhinav Kumar,
	Bjorn Andersson, open list:DRM DRIVER FOR MSM ADRENO GPU,
	open list

On Fri, Oct 1, 2021 at 10:28 AM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On 21/09/2021 01:57, Rob Clark wrote:
> > From: Rob Clark <robdclark@chromium.org>
> >
> > For now, since we have a mix of bridges which support this flag, which
> > which do *not* support this flag, or work both ways, try it once with
> > NO_CONNECTOR and then fall back to the old way if that doesn't work.
> > Eventually we can drop the fallback path.
> >
> > v2: Add missing drm_connector_attach_encoder() so display actually comes
> >      up when the bridge properly handles the NO_CONNECTOR flag
> >
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>
> I think this patch can go through the drm/msm, while two other patches
> would need to through the drm-misc. Is it correct?

Correct, I made sure things worked in either order (ie. with msm patch
but without bridge patches, and visa versa), so they can land through
different trees

BR,
-R

>
> > ---
> >   drivers/gpu/drm/msm/Kconfig           |  2 ++
> >   drivers/gpu/drm/msm/dsi/dsi_manager.c | 50 ++++++++++++++++++++-------
> >   2 files changed, 39 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
> > index e9c6af78b1d7..36e5ba3ccc28 100644
> > --- a/drivers/gpu/drm/msm/Kconfig
> > +++ b/drivers/gpu/drm/msm/Kconfig
> > @@ -14,6 +14,8 @@ config DRM_MSM
> >       select REGULATOR
> >       select DRM_KMS_HELPER
> >       select DRM_PANEL
> > +     select DRM_BRIDGE
> > +     select DRM_PANEL_BRIDGE
> >       select DRM_SCHED
> >       select SHMEM
> >       select TMPFS
> > diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> > index c41d39f5b7cf..e25877073d31 100644
> > --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> > +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> > @@ -3,6 +3,8 @@
> >    * Copyright (c) 2015, The Linux Foundation. All rights reserved.
> >    */
> >
> > +#include "drm/drm_bridge_connector.h"
> > +
> >   #include "msm_kms.h"
> >   #include "dsi.h"
> >
> > @@ -688,10 +690,10 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id)
> >   {
> >       struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
> >       struct drm_device *dev = msm_dsi->dev;
> > +     struct drm_connector *connector;
> >       struct drm_encoder *encoder;
> >       struct drm_bridge *int_bridge, *ext_bridge;
> > -     struct drm_connector *connector;
> > -     struct list_head *connector_list;
> > +     int ret;
> >
> >       int_bridge = msm_dsi->bridge;
> >       ext_bridge = msm_dsi->external_bridge =
> > @@ -699,22 +701,44 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id)
> >
> >       encoder = msm_dsi->encoder;
> >
> > -     /* link the internal dsi bridge to the external bridge */
> > -     drm_bridge_attach(encoder, ext_bridge, int_bridge, 0);
> > -
> >       /*
> > -      * we need the drm_connector created by the external bridge
> > -      * driver (or someone else) to feed it to our driver's
> > -      * priv->connector[] list, mainly for msm_fbdev_init()
> > +      * Try first to create the bridge without it creating its own
> > +      * connector.. currently some bridges support this, and others
> > +      * do not (and some support both modes)
> >        */
> > -     connector_list = &dev->mode_config.connector_list;
> > +     ret = drm_bridge_attach(encoder, ext_bridge, int_bridge,
> > +                     DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> > +     if (ret == -EINVAL) {
> > +             struct drm_connector *connector;
> > +             struct list_head *connector_list;
> > +
> > +             /* link the internal dsi bridge to the external bridge */
> > +             drm_bridge_attach(encoder, ext_bridge, int_bridge, 0);
> > +
> > +             /*
> > +              * we need the drm_connector created by the external bridge
> > +              * driver (or someone else) to feed it to our driver's
> > +              * priv->connector[] list, mainly for msm_fbdev_init()
> > +              */
> > +             connector_list = &dev->mode_config.connector_list;
> >
> > -     list_for_each_entry(connector, connector_list, head) {
> > -             if (drm_connector_has_possible_encoder(connector, encoder))
> > -                     return connector;
> > +             list_for_each_entry(connector, connector_list, head) {
> > +                     if (drm_connector_has_possible_encoder(connector, encoder))
> > +                             return connector;
> > +             }
> > +
> > +             return ERR_PTR(-ENODEV);
> > +     }
> > +
> > +     connector = drm_bridge_connector_init(dev, encoder);
> > +     if (IS_ERR(connector)) {
> > +             DRM_ERROR("Unable to create bridge connector\n");
> > +             return ERR_CAST(connector);
> >       }
> >
> > -     return ERR_PTR(-ENODEV);
> > +     drm_connector_attach_encoder(connector, encoder);
> > +
> > +     return connector;
> >   }
> >
> >   void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge)
> >
>
>
> --
> With best wishes
> Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-01 17:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 22:57 [PATCH v2 0/3] drm: msm+ti-sn65dsi86 support for NO_CONNECTOR Rob Clark
2021-09-20 22:57 ` [PATCH v2 1/3] drm/msm/dsi: Support NO_CONNECTOR bridges Rob Clark
2021-10-01 17:28   ` Dmitry Baryshkov
2021-10-01 18:02     ` Rob Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).