diff mbox series

[RFC,05/17] drm/exynos: dsi: Get the mode from bridge

Message ID 20210704090230.26489-6-jagan@amarulasolutions.com
State New
Headers show
Series [RFC,01/17] drm/exynos: dsi: Convert to bridge driver | expand

Commit Message

Jagan Teki July 4, 2021, 9:02 a.m. UTC
Now the exynos dsi driver is fully aware of bridge
handling, so get the display mode from bridge, mode_set
API instead of legacy encoder crtc.

This makes bridge usage more efficient instead of relying
on encoder stack.

Add mode_set in drm_bridge_funcs.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Robert Foss July 29, 2021, 1:20 p.m. UTC | #1
Hey Jagan,

On Sun, 4 Jul 2021 at 11:04, Jagan Teki <jagan@amarulasolutions.com> wrote:
>

> Now the exynos dsi driver is fully aware of bridge

> handling, so get the display mode from bridge, mode_set

> API instead of legacy encoder crtc.

>

> This makes bridge usage more efficient instead of relying

> on encoder stack.

>

> Add mode_set in drm_bridge_funcs.

>

> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

> ---

>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 13 ++++++++++++-

>  1 file changed, 12 insertions(+), 1 deletion(-)

>

> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c

> index d828be07c325..99a1b8c22313 100644

> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c

> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c

> @@ -275,6 +275,7 @@ struct exynos_dsi {

>         u32 format;

>

>         int state;

> +       struct drm_display_mode mode;

>         struct drm_property *brightness;

>         struct completion completed;

>

> @@ -881,7 +882,7 @@ static int exynos_dsi_init_link(struct exynos_dsi *dsi)

>

>  static void exynos_dsi_set_display_mode(struct exynos_dsi *dsi)

>  {

> -       struct drm_display_mode *m = &dsi->encoder.crtc->state->adjusted_mode;

> +       struct drm_display_mode *m = &dsi->mode;

>         unsigned int num_bits_resol = dsi->driver_data->num_bits_resol;

>         u32 reg;

>

> @@ -1411,6 +1412,15 @@ static void exynos_dsi_bridge_disable(struct drm_bridge *bridge)

>         pm_runtime_put_sync(dsi->dev);

>  }

>

> +static void exynos_dsi_bridge_mode_set(struct drm_bridge *bridge,

> +                                      const struct drm_display_mode *mode,

> +                                      const struct drm_display_mode *adjusted_mode)

> +{

> +       struct exynos_dsi *dsi = bridge_to_dsi(bridge);

> +

> +       drm_mode_copy(&dsi->mode, adjusted_mode);

> +}

> +

>  static int exynos_dsi_panel_or_bridge(struct exynos_dsi *dsi,

>                                       struct device_node *node)

>  {

> @@ -1451,6 +1461,7 @@ static int exynos_dsi_bridge_attach(struct drm_bridge *bridge,

>  static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = {

>         .enable = exynos_dsi_bridge_enable,

>         .disable = exynos_dsi_bridge_disable,

> +       .mode_set = exynos_dsi_bridge_mode_set,


As far as I understand it, .enable(), .disable() &.mode_set() are
deprecated[1] and should be replaced by atomic_enable(),
atomic_disable() & atomic_enable() respectively.

[1] https://lore.kernel.org/dri-devel/20210722062246.2512666-8-sam@ravnborg.org/

>         .attach = exynos_dsi_bridge_attach,

>  };

>

> --

> 2.25.1

>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index d828be07c325..99a1b8c22313 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -275,6 +275,7 @@  struct exynos_dsi {
 	u32 format;
 
 	int state;
+	struct drm_display_mode mode;
 	struct drm_property *brightness;
 	struct completion completed;
 
@@ -881,7 +882,7 @@  static int exynos_dsi_init_link(struct exynos_dsi *dsi)
 
 static void exynos_dsi_set_display_mode(struct exynos_dsi *dsi)
 {
-	struct drm_display_mode *m = &dsi->encoder.crtc->state->adjusted_mode;
+	struct drm_display_mode *m = &dsi->mode;
 	unsigned int num_bits_resol = dsi->driver_data->num_bits_resol;
 	u32 reg;
 
@@ -1411,6 +1412,15 @@  static void exynos_dsi_bridge_disable(struct drm_bridge *bridge)
 	pm_runtime_put_sync(dsi->dev);
 }
 
+static void exynos_dsi_bridge_mode_set(struct drm_bridge *bridge,
+				       const struct drm_display_mode *mode,
+				       const struct drm_display_mode *adjusted_mode)
+{
+	struct exynos_dsi *dsi = bridge_to_dsi(bridge);
+
+	drm_mode_copy(&dsi->mode, adjusted_mode);
+}
+
 static int exynos_dsi_panel_or_bridge(struct exynos_dsi *dsi,
 				      struct device_node *node)
 {
@@ -1451,6 +1461,7 @@  static int exynos_dsi_bridge_attach(struct drm_bridge *bridge,
 static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = {
 	.enable = exynos_dsi_bridge_enable,
 	.disable = exynos_dsi_bridge_disable,
+	.mode_set = exynos_dsi_bridge_mode_set,
 	.attach = exynos_dsi_bridge_attach,
 };