Message ID | 20201016103917.26838-2-nikhil.nd@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/tidss: Use new connector model for tidss | expand |
On 16/10/2020 13:39, Nikhil Devshatwar wrote: > To be able to support connector operations across multiple > bridges, it is recommended that the connector should be > created by the SoC driver instead of the bridges. > > Modify the tidss modesetting initialization sequence to > create the connector and attach bridges with flag > DRM_BRIDGE_ATTACH_NO_CONNECTOR > > Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> > --- > drivers/gpu/drm/tidss/tidss_drv.h | 3 +++ > drivers/gpu/drm/tidss/tidss_kms.c | 15 ++++++++++++++- > 2 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/tidss/tidss_drv.h b/drivers/gpu/drm/tidss/tidss_drv.h > index 7de4bba52e6f..cfbf85a4d92b 100644 > --- a/drivers/gpu/drm/tidss/tidss_drv.h > +++ b/drivers/gpu/drm/tidss/tidss_drv.h > @@ -27,6 +27,9 @@ struct tidss_device { > unsigned int num_planes; > struct drm_plane *planes[TIDSS_MAX_PLANES]; > > + unsigned int num_connectors; > + struct drm_connector *connectors[TIDSS_MAX_PORTS]; > + > spinlock_t wait_lock; /* protects the irq masks */ > dispc_irq_t irq_mask; /* enabled irqs in addition to wait_list */ > }; > diff --git a/drivers/gpu/drm/tidss/tidss_kms.c b/drivers/gpu/drm/tidss/tidss_kms.c > index 09485c7f0d6f..51c24b4a6a21 100644 > --- a/drivers/gpu/drm/tidss/tidss_kms.c > +++ b/drivers/gpu/drm/tidss/tidss_kms.c > @@ -7,6 +7,7 @@ > #include <drm/drm_atomic.h> > #include <drm/drm_atomic_helper.h> > #include <drm/drm_bridge.h> > +#include <drm/drm_bridge_connector.h> > #include <drm/drm_crtc_helper.h> > #include <drm/drm_fb_cma_helper.h> > #include <drm/drm_fb_helper.h> > @@ -192,6 +193,7 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss) > for (i = 0; i < num_pipes; ++i) { > struct tidss_plane *tplane; > struct tidss_crtc *tcrtc; > + struct drm_connector *connector; > struct drm_encoder *enc; > u32 hw_plane_id = feat->vid_order[tidss->num_planes]; > int ret; > @@ -222,11 +224,22 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss) > return PTR_ERR(enc); > } > > - ret = drm_bridge_attach(enc, pipes[i].bridge, NULL, 0); > + ret = drm_bridge_attach(enc, pipes[i].bridge, NULL, > + DRM_BRIDGE_ATTACH_NO_CONNECTOR); > if (ret) { > dev_err(tidss->dev, "bridge attach failed: %d\n", ret); > return ret; > } > + > + connector = drm_bridge_connector_init(&tidss->ddev, enc); > + if (IS_ERR(connector)) { > + dev_err(tidss->dev, "bridge_connector create failed\n"); > + return PTR_ERR(connector); > + } > + > + tidss->connectors[tidss->num_connectors++] = connector; > + > + drm_connector_attach_encoder(connector, enc); This call may return an error. Tomi
Hi Nikhil, Thank you for the patch. On Fri, Oct 16, 2020 at 04:09:13PM +0530, Nikhil Devshatwar wrote: > To be able to support connector operations across multiple > bridges, it is recommended that the connector should be > created by the SoC driver instead of the bridges. > > Modify the tidss modesetting initialization sequence to > create the connector and attach bridges with flag > DRM_BRIDGE_ATTACH_NO_CONNECTOR > > Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> > --- > drivers/gpu/drm/tidss/tidss_drv.h | 3 +++ > drivers/gpu/drm/tidss/tidss_kms.c | 15 ++++++++++++++- > 2 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/tidss/tidss_drv.h b/drivers/gpu/drm/tidss/tidss_drv.h > index 7de4bba52e6f..cfbf85a4d92b 100644 > --- a/drivers/gpu/drm/tidss/tidss_drv.h > +++ b/drivers/gpu/drm/tidss/tidss_drv.h > @@ -27,6 +27,9 @@ struct tidss_device { > unsigned int num_planes; > struct drm_plane *planes[TIDSS_MAX_PLANES]; > > + unsigned int num_connectors; > + struct drm_connector *connectors[TIDSS_MAX_PORTS]; > + > spinlock_t wait_lock; /* protects the irq masks */ > dispc_irq_t irq_mask; /* enabled irqs in addition to wait_list */ > }; > diff --git a/drivers/gpu/drm/tidss/tidss_kms.c b/drivers/gpu/drm/tidss/tidss_kms.c > index 09485c7f0d6f..51c24b4a6a21 100644 > --- a/drivers/gpu/drm/tidss/tidss_kms.c > +++ b/drivers/gpu/drm/tidss/tidss_kms.c > @@ -7,6 +7,7 @@ > #include <drm/drm_atomic.h> > #include <drm/drm_atomic_helper.h> > #include <drm/drm_bridge.h> > +#include <drm/drm_bridge_connector.h> > #include <drm/drm_crtc_helper.h> > #include <drm/drm_fb_cma_helper.h> > #include <drm/drm_fb_helper.h> > @@ -192,6 +193,7 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss) > for (i = 0; i < num_pipes; ++i) { > struct tidss_plane *tplane; > struct tidss_crtc *tcrtc; > + struct drm_connector *connector; > struct drm_encoder *enc; > u32 hw_plane_id = feat->vid_order[tidss->num_planes]; > int ret; > @@ -222,11 +224,22 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss) > return PTR_ERR(enc); > } > > - ret = drm_bridge_attach(enc, pipes[i].bridge, NULL, 0); > + ret = drm_bridge_attach(enc, pipes[i].bridge, NULL, > + DRM_BRIDGE_ATTACH_NO_CONNECTOR); > if (ret) { > dev_err(tidss->dev, "bridge attach failed: %d\n", ret); > return ret; > } > + > + connector = drm_bridge_connector_init(&tidss->ddev, enc); > + if (IS_ERR(connector)) { > + dev_err(tidss->dev, "bridge_connector create failed\n"); > + return PTR_ERR(connector); > + } > + > + tidss->connectors[tidss->num_connectors++] = connector; > + > + drm_connector_attach_encoder(connector, enc); Apart from the issue reported by Tomi, the patch looks goood to me. Fix this fixed, and the series reordered to move this to the end, Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > } > > /* create overlay planes of the leftover planes */
diff --git a/drivers/gpu/drm/tidss/tidss_drv.h b/drivers/gpu/drm/tidss/tidss_drv.h index 7de4bba52e6f..cfbf85a4d92b 100644 --- a/drivers/gpu/drm/tidss/tidss_drv.h +++ b/drivers/gpu/drm/tidss/tidss_drv.h @@ -27,6 +27,9 @@ struct tidss_device { unsigned int num_planes; struct drm_plane *planes[TIDSS_MAX_PLANES]; + unsigned int num_connectors; + struct drm_connector *connectors[TIDSS_MAX_PORTS]; + spinlock_t wait_lock; /* protects the irq masks */ dispc_irq_t irq_mask; /* enabled irqs in addition to wait_list */ }; diff --git a/drivers/gpu/drm/tidss/tidss_kms.c b/drivers/gpu/drm/tidss/tidss_kms.c index 09485c7f0d6f..51c24b4a6a21 100644 --- a/drivers/gpu/drm/tidss/tidss_kms.c +++ b/drivers/gpu/drm/tidss/tidss_kms.c @@ -7,6 +7,7 @@ #include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_bridge.h> +#include <drm/drm_bridge_connector.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_helper.h> @@ -192,6 +193,7 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss) for (i = 0; i < num_pipes; ++i) { struct tidss_plane *tplane; struct tidss_crtc *tcrtc; + struct drm_connector *connector; struct drm_encoder *enc; u32 hw_plane_id = feat->vid_order[tidss->num_planes]; int ret; @@ -222,11 +224,22 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss) return PTR_ERR(enc); } - ret = drm_bridge_attach(enc, pipes[i].bridge, NULL, 0); + ret = drm_bridge_attach(enc, pipes[i].bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) { dev_err(tidss->dev, "bridge attach failed: %d\n", ret); return ret; } + + connector = drm_bridge_connector_init(&tidss->ddev, enc); + if (IS_ERR(connector)) { + dev_err(tidss->dev, "bridge_connector create failed\n"); + return PTR_ERR(connector); + } + + tidss->connectors[tidss->num_connectors++] = connector; + + drm_connector_attach_encoder(connector, enc); } /* create overlay planes of the leftover planes */
To be able to support connector operations across multiple bridges, it is recommended that the connector should be created by the SoC driver instead of the bridges. Modify the tidss modesetting initialization sequence to create the connector and attach bridges with flag DRM_BRIDGE_ATTACH_NO_CONNECTOR Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> --- drivers/gpu/drm/tidss/tidss_drv.h | 3 +++ drivers/gpu/drm/tidss/tidss_kms.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)