mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* nwl-dsi: fixup mode only for LCDIF input, not DCSS
@ 2020-11-24 17:12 Lukas F. Hartmann
  2020-11-25  8:50 ` Guido Günther
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas F. Hartmann @ 2020-11-24 17:12 UTC (permalink / raw)
  To: lukas
  Cc: agx, laurentiu.palcu, Andrzej Hajda, Neil Armstrong,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, David Airlie,
	Daniel Vetter, dri-devel, linux-kernel

The fixup of HSYNC and VSYNC should not be done when the input source is
DCSS, or internal display does not work on MNT Reform 2 (open hardware 
laptop based on NXP i.MX8M using DCSS->DSI->eDP for internal display).

Signed-off-by: Lukas F. Hartmann <lukas@mntre.com>
---
 drivers/gpu/drm/bridge/nwl-dsi.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 66b67402f..6735ab2a2 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -807,10 +807,16 @@ static bool nwl_dsi_bridge_mode_fixup(struct drm_bridge *bridge,
 				      const struct drm_display_mode *mode,
 				      struct drm_display_mode *adjusted_mode)
 {
-	/* At least LCDIF + NWL needs active high sync */
-	adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
-	adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
+	struct device_node *remote;
+	struct nwl_dsi *dsi = bridge_to_dsi(bridge);
+
+	remote = of_graph_get_remote_node(dsi->dev->of_node, 0,
+						NWL_DSI_ENDPOINT_LCDIF);
+	if (remote) {
+		/* At least LCDIF + NWL needs active high sync */
+		adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
+		adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
+	}

 	return true;
 }
--
2.28.0

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

* Re: nwl-dsi: fixup mode only for LCDIF input, not DCSS
  2020-11-24 17:12 nwl-dsi: fixup mode only for LCDIF input, not DCSS Lukas F. Hartmann
@ 2020-11-25  8:50 ` Guido Günther
  0 siblings, 0 replies; 2+ messages in thread
From: Guido Günther @ 2020-11-25  8:50 UTC (permalink / raw)
  To: Lukas F. Hartmann
  Cc: laurentiu.palcu, Andrzej Hajda, Neil Armstrong, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
	dri-devel, linux-kernel

Hi Lukas,
On Tue, Nov 24, 2020 at 06:12:17PM +0100, Lukas F. Hartmann wrote:
> The fixup of HSYNC and VSYNC should not be done when the input source is
> DCSS, or internal display does not work on MNT Reform 2 (open hardware 
> laptop based on NXP i.MX8M using DCSS->DSI->eDP for internal display).
> 
> Signed-off-by: Lukas F. Hartmann <lukas@mntre.com>
> ---
>  drivers/gpu/drm/bridge/nwl-dsi.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
> index 66b67402f..6735ab2a2 100644
> --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> @@ -807,10 +807,16 @@ static bool nwl_dsi_bridge_mode_fixup(struct drm_bridge *bridge,
>  				      const struct drm_display_mode *mode,
>  				      struct drm_display_mode *adjusted_mode)
>  {
> -	/* At least LCDIF + NWL needs active high sync */
> -	adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
> -	adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
> +	struct device_node *remote;
> +	struct nwl_dsi *dsi = bridge_to_dsi(bridge);
> +
> +	remote = of_graph_get_remote_node(dsi->dev->of_node, 0,
> +						NWL_DSI_ENDPOINT_LCDIF);
> +	if (remote) {
> +		/* At least LCDIF + NWL needs active high sync */
> +		adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
> +		adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
> +	}

When submitting the NWL driver i was told to not change properties based
on the endpoint. The argument is that this breaks when putting the
bridge into another chain and that there might be other bridges in
between. Maybe Laurent and Andrzej have a suggetion?

I intend to respin the input mux bridge
(https://lore.kernel.org/dri-devel/cover.1589548223.git.agx@sigxcpu.org/)
at some point but even then we need to carry over the flags, so any
input on how that should best be done would be welcome.

Cheers,
 -- Guido

> 
>  	return true;
>  }
> --
> 2.28.0
> 

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

end of thread, other threads:[~2020-11-25  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 17:12 nwl-dsi: fixup mode only for LCDIF input, not DCSS Lukas F. Hartmann
2020-11-25  8:50 ` Guido Günther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®