Re: [PATCH v1] drm/bridge: lt8912b: Add hot plug detection

2022-12-08 Thread Robert Foss
On Mon, 28 Nov 2022 12:23:20 +0100, Francesco Dolcini wrote:
> From: Stefan Eichenberger 
> 
> Enable hot plug detection when it is available on the HDMI port.
> Without this connecting to a different monitor with incompatible timing
> before the 10 seconds poll period will lead to a broken display output.
> 
> 
> [...]

Applied, thanks!

Repo: https://cgit.freedesktop.org/drm/drm-misc/


[1/1] drm/bridge: lt8912b: Add hot plug detection
  commit: 3b0a01a6a5224ed9b3f69f44edaa889b2e2b9779



rob



Re: [PATCH v1] drm/bridge: lt8912b: Add hot plug detection

2022-11-29 Thread Adrien Grassein
Le mar. 29 nov. 2022 à 12:15, Robert Foss  a écrit :
>
> On Mon, 28 Nov 2022 at 12:23, Francesco Dolcini  wrote:
> >
> > From: Stefan Eichenberger 
> >
> > Enable hot plug detection when it is available on the HDMI port.
> > Without this connecting to a different monitor with incompatible timing
> > before the 10 seconds poll period will lead to a broken display output.
> >
> > Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
> > Signed-off-by: Stefan Eichenberger 
> > Signed-off-by: Francesco Dolcini 
> > ---
> >  drivers/gpu/drm/bridge/lontium-lt8912b.c | 21 +++--
> >  1 file changed, 19 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
> > b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > index a98efef0ba0e..5f0c9cd2a970 100644
> > --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > @@ -517,14 +517,27 @@ static int lt8912_attach_dsi(struct lt8912 *lt)
> > return 0;
> >  }
> >
> > +static void lt8912_bridge_hpd_cb(void *data, enum drm_connector_status 
> > status)
> > +{
> > +   struct lt8912 *lt = data;
> > +
> > +   if (lt->bridge.dev)
> > +   drm_helper_hpd_irq_event(lt->bridge.dev);
> > +}
> > +
> >  static int lt8912_bridge_connector_init(struct drm_bridge *bridge)
> >  {
> > int ret;
> > struct lt8912 *lt = bridge_to_lt8912(bridge);
> > struct drm_connector *connector = <->connector;
> >
> > -   connector->polled = DRM_CONNECTOR_POLL_CONNECT |
> > -   DRM_CONNECTOR_POLL_DISCONNECT;
> > +   if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) {
> > +   drm_bridge_hpd_enable(lt->hdmi_port, lt8912_bridge_hpd_cb, 
> > lt);
> > +   connector->polled = DRM_CONNECTOR_POLL_HPD;
> > +   } else {
> > +   connector->polled = DRM_CONNECTOR_POLL_CONNECT |
> > +   DRM_CONNECTOR_POLL_DISCONNECT;
> > +   }
> >
> > ret = drm_connector_init(bridge->dev, connector,
> >  <8912_connector_funcs,
> > @@ -578,6 +591,10 @@ static void lt8912_bridge_detach(struct drm_bridge 
> > *bridge)
> >
> > if (lt->is_attached) {
> > lt8912_hard_power_off(lt);
> > +
> > +   if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD)
> > +   drm_bridge_hpd_disable(lt->hdmi_port);
> > +
> > drm_connector_unregister(<->connector);
> > drm_connector_cleanup(<->connector);
> > }
> > --
> > 2.25.1
> >
>
>
> Reviewed-by: Robert Foss 
Reviewed-by: Adrien Grassein 
>
> Snoozing this patch, will apply it in a few days if no issues are found.


Re: [PATCH v1] drm/bridge: lt8912b: Add hot plug detection

2022-11-29 Thread Robert Foss
On Mon, 28 Nov 2022 at 12:23, Francesco Dolcini  wrote:
>
> From: Stefan Eichenberger 
>
> Enable hot plug detection when it is available on the HDMI port.
> Without this connecting to a different monitor with incompatible timing
> before the 10 seconds poll period will lead to a broken display output.
>
> Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
> Signed-off-by: Stefan Eichenberger 
> Signed-off-by: Francesco Dolcini 
> ---
>  drivers/gpu/drm/bridge/lontium-lt8912b.c | 21 +++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
> b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> index a98efef0ba0e..5f0c9cd2a970 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> @@ -517,14 +517,27 @@ static int lt8912_attach_dsi(struct lt8912 *lt)
> return 0;
>  }
>
> +static void lt8912_bridge_hpd_cb(void *data, enum drm_connector_status 
> status)
> +{
> +   struct lt8912 *lt = data;
> +
> +   if (lt->bridge.dev)
> +   drm_helper_hpd_irq_event(lt->bridge.dev);
> +}
> +
>  static int lt8912_bridge_connector_init(struct drm_bridge *bridge)
>  {
> int ret;
> struct lt8912 *lt = bridge_to_lt8912(bridge);
> struct drm_connector *connector = <->connector;
>
> -   connector->polled = DRM_CONNECTOR_POLL_CONNECT |
> -   DRM_CONNECTOR_POLL_DISCONNECT;
> +   if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) {
> +   drm_bridge_hpd_enable(lt->hdmi_port, lt8912_bridge_hpd_cb, 
> lt);
> +   connector->polled = DRM_CONNECTOR_POLL_HPD;
> +   } else {
> +   connector->polled = DRM_CONNECTOR_POLL_CONNECT |
> +   DRM_CONNECTOR_POLL_DISCONNECT;
> +   }
>
> ret = drm_connector_init(bridge->dev, connector,
>  <8912_connector_funcs,
> @@ -578,6 +591,10 @@ static void lt8912_bridge_detach(struct drm_bridge 
> *bridge)
>
> if (lt->is_attached) {
> lt8912_hard_power_off(lt);
> +
> +   if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD)
> +   drm_bridge_hpd_disable(lt->hdmi_port);
> +
> drm_connector_unregister(<->connector);
> drm_connector_cleanup(<->connector);
> }
> --
> 2.25.1
>


Reviewed-by: Robert Foss 

Snoozing this patch, will apply it in a few days if no issues are found.


[PATCH v1] drm/bridge: lt8912b: Add hot plug detection

2022-11-28 Thread Francesco Dolcini
From: Stefan Eichenberger 

Enable hot plug detection when it is available on the HDMI port.
Without this connecting to a different monitor with incompatible timing
before the 10 seconds poll period will lead to a broken display output.

Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
Signed-off-by: Stefan Eichenberger 
Signed-off-by: Francesco Dolcini 
---
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index a98efef0ba0e..5f0c9cd2a970 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -517,14 +517,27 @@ static int lt8912_attach_dsi(struct lt8912 *lt)
return 0;
 }
 
+static void lt8912_bridge_hpd_cb(void *data, enum drm_connector_status status)
+{
+   struct lt8912 *lt = data;
+
+   if (lt->bridge.dev)
+   drm_helper_hpd_irq_event(lt->bridge.dev);
+}
+
 static int lt8912_bridge_connector_init(struct drm_bridge *bridge)
 {
int ret;
struct lt8912 *lt = bridge_to_lt8912(bridge);
struct drm_connector *connector = <->connector;
 
-   connector->polled = DRM_CONNECTOR_POLL_CONNECT |
-   DRM_CONNECTOR_POLL_DISCONNECT;
+   if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) {
+   drm_bridge_hpd_enable(lt->hdmi_port, lt8912_bridge_hpd_cb, lt);
+   connector->polled = DRM_CONNECTOR_POLL_HPD;
+   } else {
+   connector->polled = DRM_CONNECTOR_POLL_CONNECT |
+   DRM_CONNECTOR_POLL_DISCONNECT;
+   }
 
ret = drm_connector_init(bridge->dev, connector,
 <8912_connector_funcs,
@@ -578,6 +591,10 @@ static void lt8912_bridge_detach(struct drm_bridge *bridge)
 
if (lt->is_attached) {
lt8912_hard_power_off(lt);
+
+   if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD)
+   drm_bridge_hpd_disable(lt->hdmi_port);
+
drm_connector_unregister(<->connector);
drm_connector_cleanup(<->connector);
}
-- 
2.25.1