The dpi bridge uses the legacy non-atomic enable and disable bridge
callbacks.

In order to remove the legacy bridge callback support from the DRM
bridge core, switch to their atomic counterparts and add the bridge
atomic state handlers.

Generated by the following Coccinelle script:

@ is_bridge @
identifier funcs;
@@

 struct drm_bridge_funcs funcs = {
        ...,
 };

@ has_create_state depends on is_bridge @
identifier funcs, f;
@@

struct drm_bridge_funcs funcs = {
  ...,
  .atomic_create_state = f,
  ...,
};

@ update_struct depends on (is_bridge && !has_create_state) @
identifier is_bridge.funcs;
identifier f;
@@

 struct drm_bridge_funcs funcs = {
+       .atomic_create_state = drm_atomic_helper_bridge_create_state,
+       .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
+       .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
        ...,
 };

@ update_pre_enable_struct depends on (is_bridge && !has_create_state) @
identifier is_bridge.funcs;
identifier f;
@@

 struct drm_bridge_funcs funcs = {
        ...,
-       .pre_enable = f,
+       .atomic_pre_enable = f,
        ...,
 };

@ update_pre_enable_impl depends on update_pre_enable_struct @
identifier update_pre_enable_struct.f;
identifier b;
@@

-void f(struct drm_bridge *b)
+void f(struct drm_bridge *b, struct drm_atomic_commit *commit)
 {
        ...
 }

@ update_enable_struct depends on (is_bridge && !has_create_state) @
identifier is_bridge.funcs;
identifier f;
@@

 struct drm_bridge_funcs funcs = {
        ...,
-       .enable = f,
+       .atomic_enable = f,
        ...,
 };

@ update_enable_impl depends on update_enable_struct @
identifier update_enable_struct.f;
identifier b;
@@

-void f(struct drm_bridge *b)
+void f(struct drm_bridge *b, struct drm_atomic_commit *commit)
 {
        ...
 }

@ update_disable_struct depends on (is_bridge && !has_create_state) @
identifier is_bridge.funcs;
identifier f;
@@

 struct drm_bridge_funcs funcs = {
        ...,
-       .disable = f,
+       .atomic_disable = f,
        ...,
 };

@ update_disable_impl depends on update_disable_struct @
identifier update_disable_struct.f;
identifier b;
@@

-void f(struct drm_bridge *b)
+void f(struct drm_bridge *b, struct drm_atomic_commit *commit)
 {
        ...
 }

@ update_post_disable_struct depends on (is_bridge && !has_create_state) @
identifier is_bridge.funcs;
identifier f;
@@

 struct drm_bridge_funcs funcs = {
        ...,
-       .post_disable = f,
+       .atomic_post_disable = f,
        ...,
 };

@ update_post_disable_impl depends on update_post_disable_struct @
identifier update_post_disable_struct.f;
identifier b;
@@

-void f(struct drm_bridge *b)
+void f(struct drm_bridge *b, struct drm_atomic_commit *commit)
 {
        ...
 }

Signed-off-by: Maxime Ripard <[email protected]>

---
To: Tomi Valkeinen <[email protected]>
---
 drivers/gpu/drm/omapdrm/dss/dpi.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 9f86db774c39..419915e33816 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -20,10 +20,11 @@
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 #include <linux/string.h>
 #include <linux/sys_soc.h>
 
+#include <drm/drm_atomic_state_helper.h>
 #include <drm/drm_bridge.h>
 
 #include "dss.h"
 #include "omapdss.h"
 
@@ -480,11 +481,12 @@ static void dpi_bridge_mode_set(struct drm_bridge *bridge,
        struct dpi_data *dpi = drm_bridge_to_dpi(bridge);
 
        dpi->pixelclock = adjusted_mode->clock * 1000;
 }
 
-static void dpi_bridge_enable(struct drm_bridge *bridge)
+static void dpi_bridge_enable(struct drm_bridge *bridge,
+                             struct drm_atomic_commit *commit)
 {
        struct dpi_data *dpi = drm_bridge_to_dpi(bridge);
        int r;
 
        if (dpi->vdds_dsi_reg) {
@@ -531,11 +533,12 @@ static void dpi_bridge_enable(struct drm_bridge *bridge)
 err_get_dispc:
        if (dpi->vdds_dsi_reg)
                regulator_disable(dpi->vdds_dsi_reg);
 }
 
-static void dpi_bridge_disable(struct drm_bridge *bridge)
+static void dpi_bridge_disable(struct drm_bridge *bridge,
+                              struct drm_atomic_commit *commit)
 {
        struct dpi_data *dpi = drm_bridge_to_dpi(bridge);
 
        dss_mgr_disable(&dpi->output);
 
@@ -550,16 +553,19 @@ static void dpi_bridge_disable(struct drm_bridge *bridge)
        if (dpi->vdds_dsi_reg)
                regulator_disable(dpi->vdds_dsi_reg);
 }
 
 static const struct drm_bridge_funcs dpi_bridge_funcs = {
+       .atomic_create_state = drm_atomic_helper_bridge_create_state,
+       .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
+       .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
        .attach = dpi_bridge_attach,
        .mode_valid = dpi_bridge_mode_valid,
        .mode_fixup = dpi_bridge_mode_fixup,
        .mode_set = dpi_bridge_mode_set,
-       .enable = dpi_bridge_enable,
-       .disable = dpi_bridge_disable,
+       .atomic_enable = dpi_bridge_enable,
+       .atomic_disable = dpi_bridge_disable,
 };
 
 static void dpi_bridge_init(struct dpi_data *dpi)
 {
        dpi->bridge.of_node = dpi->pdev->dev.of_node;

-- 
2.54.0

Reply via email to