[PATCH v2 10/10] ASoC: cs35l56: Remove unnecessary conditionals waiting for enumeration

From: Charles Keepax

Date: Fri Jun 05 2026 - 05:04:36 EST


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@xxxxxxxxxxxxxxxxxxxxx>
---

No change since v1.

sound/soc/codecs/cs35l56-sdw.c | 47 ++++++++--------------------------
sound/soc/codecs/cs35l56.h | 1 -
2 files changed, 10 insertions(+), 38 deletions(-)

diff --git a/sound/soc/codecs/cs35l56-sdw.c b/sound/soc/codecs/cs35l56-sdw.c
index 847e88f3b2044..0a55b93b96f96 100644
--- a/sound/soc/codecs/cs35l56-sdw.c
+++ b/sound/soc/codecs/cs35l56-sdw.c
@@ -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;
}
diff --git a/sound/soc/codecs/cs35l56.h b/sound/soc/codecs/cs35l56.h
index 6a27ef2b7569a..9acd2e7e17c93 100644
--- a/sound/soc/codecs/cs35l56.h
+++ b/sound/soc/codecs/cs35l56.h
@@ -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;
--
2.47.3