The dsi 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/dsi.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 27fe7bca9e2c..7aaee94f86e4 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -33,10 +33,11 @@
 #include <linux/of_graph.h>
 #include <linux/of_platform.h>
 #include <linux/component.h>
 #include <linux/sys_soc.h>
 
+#include <drm/drm_atomic_state_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
 #include <video/mipi_display.h>
 
@@ -4652,11 +4653,12 @@ static void dsi_bridge_mode_set(struct drm_bridge 
*bridge,
        struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
 
        dsi_set_config(&dsi->output, adjusted_mode);
 }
 
-static void dsi_bridge_enable(struct drm_bridge *bridge)
+static void dsi_bridge_enable(struct drm_bridge *bridge,
+                             struct drm_atomic_commit *commit)
 {
        struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
        struct omap_dss_device *dssdev = &dsi->output;
 
        cancel_delayed_work_sync(&dsi->dsi_disable_work);
@@ -4671,11 +4673,12 @@ static void dsi_bridge_enable(struct drm_bridge *bridge)
        dsi->video_enabled = true;
 
        dsi_bus_unlock(dsi);
 }
 
-static void dsi_bridge_disable(struct drm_bridge *bridge)
+static void dsi_bridge_disable(struct drm_bridge *bridge,
+                              struct drm_atomic_commit *commit)
 {
        struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
        struct omap_dss_device *dssdev = &dsi->output;
 
        cancel_delayed_work_sync(&dsi->dsi_disable_work);
@@ -4690,15 +4693,18 @@ static void dsi_bridge_disable(struct drm_bridge 
*bridge)
 
        dsi_bus_unlock(dsi);
 }
 
 static const struct drm_bridge_funcs dsi_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 = dsi_bridge_attach,
        .mode_valid = dsi_bridge_mode_valid,
        .mode_set = dsi_bridge_mode_set,
-       .enable = dsi_bridge_enable,
-       .disable = dsi_bridge_disable,
+       .atomic_enable = dsi_bridge_enable,
+       .atomic_disable = dsi_bridge_disable,
 };
 
 static void dsi_bridge_init(struct dsi_data *dsi)
 {
        dsi->bridge.of_node = dsi->host.dev->of_node;

-- 
2.54.0

Reply via email to