From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: broonie@kernel.org
Cc: lgirdwood@gmail.com, vkoul@kernel.org,
yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.dev,
peter.ujfalusi@linux.intel.com, shumingf@realtek.com,
linux-sound@vger.kernel.org, patches@opensource.cirrus.com
Subject: [PATCH v2 4/4] ASoC: SDCA: Add lock to serialise the Function initialisation
Date: Thu, 18 Dec 2025 11:35:20 +0000 [thread overview]
Message-ID: <20251218113520.1287693-5-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20251218113520.1287693-1-ckeepax@opensource.cirrus.com>
To avoid issues on some devices serialise the boot of each SDCA Function
from the others.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
No changes since v1.
sound/soc/sdca/sdca_class.c | 1 +
sound/soc/sdca/sdca_class.h | 2 ++
sound/soc/sdca/sdca_class_function.c | 5 +++++
3 files changed, 8 insertions(+)
diff --git a/sound/soc/sdca/sdca_class.c b/sound/soc/sdca/sdca_class.c
index 438695291257e..1b83aad1d9d3b 100644
--- a/sound/soc/sdca/sdca_class.c
+++ b/sound/soc/sdca/sdca_class.c
@@ -205,6 +205,7 @@ static int class_sdw_probe(struct sdw_slave *sdw, const struct sdw_device_id *id
drv->dev = dev;
drv->sdw = sdw;
mutex_init(&drv->regmap_lock);
+ mutex_init(&drv->init_lock);
dev_set_drvdata(drv->dev, drv);
diff --git a/sound/soc/sdca/sdca_class.h b/sound/soc/sdca/sdca_class.h
index bb4c9dd124296..6f24ea2bbd381 100644
--- a/sound/soc/sdca/sdca_class.h
+++ b/sound/soc/sdca/sdca_class.h
@@ -28,6 +28,8 @@ struct sdca_class_drv {
struct sdca_interrupt_info *irq_info;
struct mutex regmap_lock;
+ /* Serialise function initialisations */
+ struct mutex init_lock;
struct work_struct boot_work;
struct completion device_attach;
diff --git a/sound/soc/sdca/sdca_class_function.c b/sound/soc/sdca/sdca_class_function.c
index 5a818d958543f..b4d2e40efe174 100644
--- a/sound/soc/sdca/sdca_class_function.c
+++ b/sound/soc/sdca/sdca_class_function.c
@@ -8,6 +8,7 @@
*/
#include <linux/auxiliary_bus.h>
+#include <linux/cleanup.h>
#include <linux/minmax.h>
#include <linux/module.h>
#include <linux/pm.h>
@@ -234,6 +235,8 @@ static int class_function_boot(struct class_function_drv *drv)
unsigned int val;
int ret;
+ guard(mutex)(&drv->core->init_lock);
+
ret = regmap_read(drv->regmap, reg, &val);
if (ret < 0) {
dev_err(drv->dev, "failed to read function status: %d\n", ret);
@@ -405,6 +408,8 @@ static int class_function_runtime_resume(struct device *dev)
struct class_function_drv *drv = auxiliary_get_drvdata(auxdev);
int ret;
+ guard(mutex)(&drv->core->init_lock);
+
regcache_mark_dirty(drv->regmap);
regcache_cache_only(drv->regmap, false);
--
2.47.3
prev parent reply other threads:[~2025-12-18 11:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 11:35 [PATCH v2 0/4] SDCA System Suspend Support Charles Keepax
2025-12-18 11:35 ` [PATCH v2 1/4] ASoC: SDCA: Add SDCA IRQ enable/disable helpers Charles Keepax
2026-01-06 17:17 ` Pierre-Louis Bossart
2026-01-07 10:02 ` Charles Keepax
2025-12-18 11:35 ` [PATCH v2 2/4] ASoC: SDCA: Add basic system suspend support Charles Keepax
2026-01-06 17:23 ` Pierre-Louis Bossart
2026-01-07 10:04 ` Charles Keepax
2026-01-08 10:18 ` Pierre-Louis Bossart
2026-01-08 10:40 ` Charles Keepax
2026-01-08 15:15 ` Pierre-Louis Bossart
2025-12-18 11:35 ` [PATCH v2 3/4] ASoC: SDCA: Device boot into the system suspend process Charles Keepax
2025-12-18 11:35 ` Charles Keepax [this message]
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=20251218113520.1287693-5-ckeepax@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=shumingf@realtek.com \
--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