diff mbox series

[RFC,17/17] drm: bridge: samsung-dsim: Add bridge mode_fixup

Message ID 20210704090230.26489-18-jagan@amarulasolutions.com (mailing list archive)
State New, archived
Headers show
Series drm: bridge: Samsung MIPI DSIM bridge | expand

Commit Message

Jagan Teki July 4, 2021, 9:02 a.m. UTC
Fixing up the mode flags are required in order to correlate
the correct sync flags in i.MX8MM eLCDIF.

So, handle the mode flags via bridge, mode_fixup.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/gpu/drm/bridge/samsung-dsim.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Sam Ravnborg July 25, 2021, 5:50 p.m. UTC | #1
Hi Jagan,
On Sun, Jul 04, 2021 at 02:32:30PM +0530, Jagan Teki wrote:
> Fixing up the mode flags are required in order to correlate
> the correct sync flags in i.MX8MM eLCDIF.
> 
> So, handle the mode flags via bridge, mode_fixup.

Please do this in atomic_check.
Check rcar-du for a way to get access to adjusted_mode.

I have a helper in the works, but I may not return to it until a week or
more.

	Sam

> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  drivers/gpu/drm/bridge/samsung-dsim.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> index 0ed218f5eefc..c2a76ee5ac4e 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -1474,6 +1474,16 @@ static void samsung_dsim_bridge_disable(struct drm_bridge *bridge)
>  	pm_runtime_put_sync(dsi->dev);
>  }
>  
> +static bool samsung_dsim_bridge_mode_fixup(struct drm_bridge *bridge,
> +					   const struct drm_display_mode *mode,
> +					   struct drm_display_mode *adjusted_mode)
> +{
> +	adjusted_mode->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
> +	adjusted_mode->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
> +
> +	return true;
> +}
> +
>  static void samsung_dsim_bridge_mode_set(struct drm_bridge *bridge,
>  					 const struct drm_display_mode *mode,
>  					 const struct drm_display_mode *adjusted_mode)
> @@ -1542,6 +1552,7 @@ static const struct drm_bridge_funcs samsung_dsim_bridge_funcs = {
>  	.enable = samsung_dsim_bridge_enable,
>  	.disable = samsung_dsim_bridge_disable,
>  	.mode_set = samsung_dsim_bridge_mode_set,
> +	.mode_fixup = samsung_dsim_bridge_mode_fixup,
>  	.attach = samsung_dsim_bridge_attach,
>  };
>  
> -- 
> 2.25.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
index 0ed218f5eefc..c2a76ee5ac4e 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -1474,6 +1474,16 @@  static void samsung_dsim_bridge_disable(struct drm_bridge *bridge)
 	pm_runtime_put_sync(dsi->dev);
 }
 
+static bool samsung_dsim_bridge_mode_fixup(struct drm_bridge *bridge,
+					   const struct drm_display_mode *mode,
+					   struct drm_display_mode *adjusted_mode)
+{
+	adjusted_mode->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
+	adjusted_mode->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
+
+	return true;
+}
+
 static void samsung_dsim_bridge_mode_set(struct drm_bridge *bridge,
 					 const struct drm_display_mode *mode,
 					 const struct drm_display_mode *adjusted_mode)
@@ -1542,6 +1552,7 @@  static const struct drm_bridge_funcs samsung_dsim_bridge_funcs = {
 	.enable = samsung_dsim_bridge_enable,
 	.disable = samsung_dsim_bridge_disable,
 	.mode_set = samsung_dsim_bridge_mode_set,
+	.mode_fixup = samsung_dsim_bridge_mode_fixup,
 	.attach = samsung_dsim_bridge_attach,
 };