The hda bridge still uses the deprecated non-atomic bridge
callbacks.

Switch to their atomic counterparts, adding the bridge state
handlers if not already present.

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: Alain Volmat <[email protected]>
To: Raphael Gallais-Pou <[email protected]>
Cc: [email protected]
---
 drivers/gpu/drm/sti/sti_hda.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 360a88ca8f0c..3806dd2c9be3 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -403,11 +403,12 @@ static void sti_hda_configure_awg(struct sti_hda *hda, 
u32 *awg_instr, int nb)
                hda_write(hda, awg_instr[i], HDA_SYNC_AWGI + i * 4);
        for (i = nb; i < AWG_MAX_INST; i++)
                hda_write(hda, 0, HDA_SYNC_AWGI + i * 4);
 }
 
-static void sti_hda_disable(struct drm_bridge *bridge)
+static void sti_hda_disable(struct drm_bridge *bridge,
+                           struct drm_atomic_commit *commit)
 {
        struct sti_hda *hda = drm_bridge_to_sti_hda(bridge);
        u32 val;
 
        if (!hda->enabled)
@@ -428,11 +429,12 @@ static void sti_hda_disable(struct drm_bridge *bridge)
        clk_disable_unprepare(hda->clk_pix);
 
        hda->enabled = false;
 }
 
-static void sti_hda_pre_enable(struct drm_bridge *bridge)
+static void sti_hda_pre_enable(struct drm_bridge *bridge,
+                              struct drm_atomic_commit *commit)
 {
        struct sti_hda *hda = drm_bridge_to_sti_hda(bridge);
        u32 val, i, mode_idx;
        u32 src_filter_y, src_filter_c;
        u32 *coef_y, *coef_c;
@@ -562,20 +564,24 @@ static void sti_hda_set_mode(struct drm_bridge *bridge,
        if (ret < 0)
                DRM_ERROR("Cannot set rate (%dHz) for hda_pix clk\n",
                          mode->clock * 1000);
 }
 
-static void sti_hda_bridge_nope(struct drm_bridge *bridge)
+static void sti_hda_bridge_nope(struct drm_bridge *bridge,
+                               struct drm_atomic_commit *commit)
 {
        /* do nothing */
 }
 
 static const struct drm_bridge_funcs sti_hda_bridge_funcs = {
-       .pre_enable = sti_hda_pre_enable,
-       .enable = sti_hda_bridge_nope,
-       .disable = sti_hda_disable,
-       .post_disable = sti_hda_bridge_nope,
+       .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,
+       .atomic_pre_enable = sti_hda_pre_enable,
+       .atomic_enable = sti_hda_bridge_nope,
+       .atomic_disable = sti_hda_disable,
+       .atomic_post_disable = sti_hda_bridge_nope,
        .mode_set = sti_hda_set_mode,
 };
 
 static int sti_hda_connector_get_modes(struct drm_connector *connector)
 {

-- 
2.54.0

Reply via email to