]> git.hungrycats.org Git - linux/commitdiff
ASoC: cs35l56: Remove unnecessary conditionals waiting for enumeration
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Mon, 8 Jun 2026 10:27:14 +0000 (11:27 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 11 Jun 2026 19:46:55 +0000 (20:46 +0100)
Commit [1] updated the core to use complete_all() which means that
the wait_for_completion() will now simply return if the device
is already attached, so skipping the completion isn't required
anymore.  Update the code to simply call sdw_slave_wait_for_init()
unconditionally.

[1] c40d6b3249b1 ("soundwire: fix enumeration completion")

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20260608102714.2503120-11-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs35l56-sdw.c
sound/soc/codecs/cs35l56.h

index 847e88f3b204439965a54f0c984bd70a8bccc9d1..0a55b93b96f9660cebdbf5ec4c705cbb73f7d1b5 100644 (file)
@@ -330,7 +330,6 @@ static int cs35l56_sdw_update_status(struct sdw_slave *peripheral,
 
        switch (status) {
        case SDW_SLAVE_ATTACHED:
-               cs35l56->sdw_in_clock_stop_1 = false;
                if (cs35l56->sdw_attached)
                        break;
 
@@ -352,31 +351,10 @@ static int cs35l56_sdw_update_status(struct sdw_slave *peripheral,
        return 0;
 }
 
-static int __maybe_unused cs35l56_sdw_clk_stop(struct sdw_slave *peripheral,
-                                              enum sdw_clk_stop_mode mode,
-                                              enum sdw_clk_stop_type type)
-{
-       struct cs35l56_private *cs35l56 = dev_get_drvdata(&peripheral->dev);
-
-       dev_dbg(cs35l56->base.dev, "%s: clock_stop_mode%d stage:%d\n", __func__, mode, type);
-
-       switch (type) {
-       case SDW_CLK_POST_PREPARE:
-               if (mode == SDW_CLK_STOP_MODE1)
-                       cs35l56->sdw_in_clock_stop_1 = true;
-               else
-                       cs35l56->sdw_in_clock_stop_1 = false;
-               return 0;
-       default:
-               return 0;
-       }
-}
-
 static const struct sdw_slave_ops cs35l56_sdw_ops = {
        .read_prop = cs35l56_sdw_read_prop,
        .interrupt_callback = cs35l56_sdw_interrupt,
        .update_status = cs35l56_sdw_update_status,
-       .clk_stop = cs35l56_sdw_clk_stop,
 };
 
 static int __maybe_unused cs35l56_sdw_handle_unattach(struct cs35l56_private *cs35l56)
@@ -384,23 +362,18 @@ static int __maybe_unused cs35l56_sdw_handle_unattach(struct cs35l56_private *cs
        struct sdw_slave *peripheral = cs35l56->sdw_peripheral;
        int ret;
 
-       dev_dbg(cs35l56->base.dev, "attached:%u unattach_request:%u in_clock_stop_1:%u\n",
-               cs35l56->sdw_attached, peripheral->unattach_request, cs35l56->sdw_in_clock_stop_1);
+       dev_dbg(cs35l56->base.dev, "attached:%u unattach_request:%u\n",
+               cs35l56->sdw_attached, peripheral->unattach_request);
 
-       if (cs35l56->sdw_in_clock_stop_1 || peripheral->unattach_request) {
-               /* Cannot access registers until bus is re-initialized. */
-               dev_dbg(cs35l56->base.dev, "Wait for initialization_complete\n");
-               ret = sdw_slave_wait_for_init(peripheral, 5000);
-               if (ret)
-                       return ret;
-
-               cs35l56->sdw_in_clock_stop_1 = false;
+       /* Cannot access registers until bus is re-initialized. */
+       ret = sdw_slave_wait_for_init(peripheral, 5000);
+       if (ret)
+               return ret;
 
-               /*
-                * Don't call regcache_mark_dirty(), we can't be sure that the
-                * Manager really did issue a Bus Reset.
-                */
-       }
+       /*
+        * Don't call regcache_mark_dirty(), we can't be sure that the
+        * Manager really did issue a Bus Reset.
+        */
 
        return 0;
 }
index 6a27ef2b7569a2c92f0bd03e8b4d3d4c17142636..9acd2e7e17c93ac00199d76d27dc7115fd244c2b 100644 (file)
@@ -43,7 +43,6 @@ struct cs35l56_private {
        bool sdw_irq_no_unmask;
        bool soft_resetting;
        bool sdw_attached;
-       bool sdw_in_clock_stop_1;
        struct completion init_completion;
 
        int speaker_id;