From: Bard Liao <yung-chuan.liao@linux.intel.com>
To: linux-sound@vger.kernel.org, vkoul@kernel.org,
broonie@kernel.org, tiwai@suse.de
Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org,
pierre-louis.bossart@linux.dev, peter.ujfalusi@linux.intel.com,
bard.liao@intel.com
Subject: [PATCH 1/3] soundwire: allow drivers to check whether the peripheral is present
Date: Tue, 15 Sep 2026 21:13:25 +0800 [thread overview]
Message-ID: <20260915131327.1783551-2-yung-chuan.liao@linux.intel.com> (raw)
In-Reply-To: <20260915131327.1783551-1-yung-chuan.liao@linux.intel.com>
A ghost peripheral may be listed in the ACPI table and we want to skip
it. Add enumeration_complete and is_present in struct sdw_bus{} allow
the driver to wait and check whether a peripheral is present.
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
drivers/soundwire/bus.c | 7 +++++++
include/linux/soundwire/sdw.h | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index aeaae5a57c89..b49864ca683a 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -161,7 +161,13 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
bus->params.curr_dr_freq = bus->params.max_dr_freq;
bus->params.curr_bank = SDW_BANK0;
bus->params.next_bank = SDW_BANK1;
+ /*
+ * Set is_present = true by default. It will be set to false when no peripherals
+ * are attached on the bus.
+ */
+ bus->is_present = true;
+ init_completion(&bus->enumeration_complete);
return 0;
}
EXPORT_SYMBOL(sdw_bus_master_add);
@@ -847,6 +853,7 @@ static int sdw_program_device_num(struct sdw_bus *bus, bool *programmed)
if (ret == -ENODATA) { /* end of device id reads */
dev_dbg(bus->dev, "No more devices to enumerate\n");
ret = 0;
+ complete_all(&bus->enumeration_complete);
break;
}
if (ret < 0) {
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index f710e5932b4b..0cb7e4fef00e 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -1001,6 +1001,8 @@ struct sdw_stream_runtime {
* transport and port parameters
* @defer_msg: Defer message
* @params: Current bus parameters
+ * @enumeration_complete: completion utility to control potential races between
+ * enumeration completion and peripheral presence checks.
* @stream_refcount: number of streams currently using this bus
* @bpt_stream_refcount: number of BTP streams currently using this bus (should
* be zero or one, multiple streams per link is not supported).
@@ -1029,6 +1031,7 @@ struct sdw_stream_runtime {
* are supported. This flag is populated by drivers after reading
* appropriate firmware (ACPI/DT).
* @lane_used_bandwidth: how much bandwidth in bits per second is used by each lane
+ * @is_present: indicates whether any peripheral is present on the bus.
*/
struct sdw_bus {
struct device *dev;
@@ -1042,6 +1045,7 @@ struct sdw_bus {
struct list_head m_rt_list;
struct sdw_defer defer_msg;
struct sdw_bus_params params;
+ struct completion enumeration_complete;
int stream_refcount;
int bpt_stream_refcount;
struct sdw_stream_runtime *bpt_stream;
@@ -1064,6 +1068,7 @@ struct sdw_bus {
#endif
bool multi_link;
unsigned int lane_used_bandwidth[SDW_MAX_LANES];
+ bool is_present;
};
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name, enum sdw_stream_type type);
--
2.43.0
next prev parent reply other threads:[~2026-09-15 13:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 13:13 [PATCH 0/3] ASoC/soundwire: remove ghost peripherals from the mach table Bard Liao
2026-09-15 13:13 ` Bard Liao [this message]
2026-09-15 17:32 ` [PATCH 1/3] soundwire: allow drivers to check whether the peripheral is present Cezary Rojewski
2026-09-15 18:31 ` Pierre-Louis Bossart
2026-09-16 2:50 ` Liao, Bard
2026-09-15 13:13 ` [PATCH 2/3] soundwire: change sdw_show_ping_status type to int Bard Liao
2026-09-15 13:13 ` [PATCH 3/3] ASoC: SOF: Intel: wait and verifies the presence of SoundWire peripherals Bard Liao
2026-09-15 19:08 ` [PATCH 0/3] ASoC/soundwire: remove ghost peripherals from the mach table Pierre-Louis Bossart
2026-09-16 4:08 ` Liao, Bard
2026-10-07 2:25 ` Liao, Bard
2026-10-07 16:37 ` Pierre-Louis Bossart
2026-10-08 3:14 ` Liao, Bard
2026-10-08 17:09 ` Pierre-Louis Bossart
2026-10-12 14:46 ` Liao, Bard
2026-10-18 8:25 ` Pierre-Louis Bossart
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=20260915131327.1783551-2-yung-chuan.liao@linux.intel.com \
--to=yung-chuan.liao@linux.intel.com \
--cc=bard.liao@intel.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=tiwai@suse.de \
--cc=vinod.koul@linaro.org \
--cc=vkoul@kernel.org \
/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
all inboxes | Powered by JetHome®