From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: broonie@kernel.org, vkoul@kernel.org, lee@kernel.org
Cc: lgirdwood@gmail.com, pierre-louis.bossart@linux.dev,
yung-chuan.liao@linux.intel.com, peter.ujfalusi@linux.intel.com,
oder_chiou@realtek.com, jack.yu@realtek.com,
shumingf@realtek.com, srini@kernel.org,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, patches@opensource.cirrus.com
Subject: [PATCH v2 03/10] mfd: cs42l43: Use new SoundWire enumeration helper
Date: Fri, 5 Jun 2026 09:48:03 +0100 [thread overview]
Message-ID: <20260605084810.1575539-4-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20260605084810.1575539-1-ckeepax@opensource.cirrus.com>
Now the new wait for SoundWire enumeration helper no longer depends on
unattach_request it is safe to use from probe time. Update the driver
to use the new core helper.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
Changes since v1:
- Completely remove attached variable since it was now unused.
drivers/mfd/cs42l43-i2c.c | 2 --
drivers/mfd/cs42l43-sdw.c | 7 -------
drivers/mfd/cs42l43.c | 15 ++++++---------
include/linux/mfd/cs42l43.h | 2 --
4 files changed, 6 insertions(+), 20 deletions(-)
diff --git a/drivers/mfd/cs42l43-i2c.c b/drivers/mfd/cs42l43-i2c.c
index 0a0ab5e549a5a..4db452b41220d 100644
--- a/drivers/mfd/cs42l43-i2c.c
+++ b/drivers/mfd/cs42l43-i2c.c
@@ -45,8 +45,6 @@ static int cs42l43_i2c_probe(struct i2c_client *i2c)
cs42l43->dev = &i2c->dev;
cs42l43->irq = i2c->irq;
- /* A device on an I2C is always attached by definition. */
- cs42l43->attached = true;
cs42l43->variant_id = (long)device_get_match_data(cs42l43->dev);
cs42l43->regmap = devm_regmap_init_i2c(i2c, &cs42l43_i2c_regmap);
diff --git a/drivers/mfd/cs42l43-sdw.c b/drivers/mfd/cs42l43-sdw.c
index 794c983781750..2b87ae2d79c51 100644
--- a/drivers/mfd/cs42l43-sdw.c
+++ b/drivers/mfd/cs42l43-sdw.c
@@ -100,17 +100,10 @@ static int cs42l43_sdw_update_status(struct sdw_slave *sdw, enum sdw_slave_statu
sdw_write_no_pm(sdw, CS42L43_GEN_INT_MASK_1,
CS42L43_INT_STAT_GEN1_MASK);
-
- cs42l43->attached = true;
-
- complete(&cs42l43->device_attach);
break;
case SDW_SLAVE_UNATTACHED:
dev_dbg(cs42l43->dev, "Device detach\n");
- cs42l43->attached = false;
-
- reinit_completion(&cs42l43->device_attach);
complete(&cs42l43->device_detach);
break;
default:
diff --git a/drivers/mfd/cs42l43.c b/drivers/mfd/cs42l43.c
index 166881751e698..cb1e175586bd1 100644
--- a/drivers/mfd/cs42l43.c
+++ b/drivers/mfd/cs42l43.c
@@ -586,15 +586,13 @@ static int cs42l43_soft_reset(struct cs42l43 *cs42l43)
*/
static int cs42l43_wait_for_attach(struct cs42l43 *cs42l43)
{
- if (!cs42l43->attached) {
- unsigned long timeout = msecs_to_jiffies(CS42L43_SDW_ATTACH_TIMEOUT_MS);
- unsigned long time;
+ int ret;
- time = wait_for_completion_timeout(&cs42l43->device_attach, timeout);
- if (!time) {
- dev_err(cs42l43->dev, "Timed out waiting for device re-attach\n");
- return -ETIMEDOUT;
- }
+ if (cs42l43->sdw) {
+ ret = sdw_slave_wait_for_init(cs42l43->sdw,
+ CS42L43_SDW_ATTACH_TIMEOUT_MS);
+ if (ret)
+ return ret;
}
regcache_cache_only(cs42l43->regmap, false);
@@ -1120,7 +1118,6 @@ int cs42l43_dev_probe(struct cs42l43 *cs42l43)
dev_set_drvdata(cs42l43->dev, cs42l43);
mutex_init(&cs42l43->pll_lock);
- init_completion(&cs42l43->device_attach);
init_completion(&cs42l43->device_detach);
init_completion(&cs42l43->firmware_download);
INIT_WORK(&cs42l43->boot_work, cs42l43_boot_work);
diff --git a/include/linux/mfd/cs42l43.h b/include/linux/mfd/cs42l43.h
index ff0f7e365a19f..8e993fb535e68 100644
--- a/include/linux/mfd/cs42l43.h
+++ b/include/linux/mfd/cs42l43.h
@@ -86,7 +86,6 @@ struct cs42l43 {
struct regmap_irq_chip_data *irq_data;
struct work_struct boot_work;
- struct completion device_attach;
struct completion device_detach;
struct completion firmware_download;
int firmware_error;
@@ -96,7 +95,6 @@ struct cs42l43 {
struct mutex pll_lock;
bool sdw_pll_active;
- bool attached;
bool hw_lock;
long variant_id;
};
--
2.47.3
next prev parent reply other threads:[~2026-06-05 8:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 8:48 [PATCH v2 00/10] Expand SoundWire enumeration helper coverage Charles Keepax
2026-06-05 8:48 ` [PATCH v2 01/10] soundwire: Always wait for initialisation of unattached devices Charles Keepax
2026-06-05 11:43 ` Srinivas Kandagatla
2026-06-05 16:10 ` Charles Keepax
2026-06-05 8:48 ` [PATCH v2 02/10] ASoC: wsa881x: Use new SoundWire enumeration helper Charles Keepax
2026-06-05 8:48 ` Charles Keepax [this message]
2026-06-05 8:48 ` [PATCH v2 04/10] ASoC: rt5682: " Charles Keepax
2026-06-05 8:48 ` [PATCH v2 05/10] ASoC: pm4125: " Charles Keepax
2026-06-05 8:48 ` [PATCH v2 06/10] ASoC: wcd937x: " Charles Keepax
2026-06-05 8:48 ` [PATCH v2 07/10] ASoC: wcd938x: " Charles Keepax
2026-06-05 8:48 ` [PATCH v2 08/10] ASoC: wcd939x: " Charles Keepax
2026-06-05 8:48 ` [PATCH v2 09/10] ASoC: SDCA: " Charles Keepax
2026-06-05 8:48 ` [PATCH v2 10/10] ASoC: cs35l56: Remove unnecessary conditionals waiting for enumeration Charles Keepax
2026-06-05 11:42 ` [PATCH v2 00/10] Expand SoundWire enumeration helper coverage Srinivas Kandagatla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260605084810.1575539-4-ckeepax@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=jack.yu@realtek.com \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=patches@opensource.cirrus.com \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=shumingf@realtek.com \
--cc=srini@kernel.org \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome