* [PATCH v4 0/4] Allow SoundWire devices to communicate during remove
@ 2026-11-24 16:09 Charles Keepax
2026-11-24 16:09 ` [PATCH v4 1/4] ASoC: SOF: Intel: Add IRQ chip to distribute the SoundWire IRQ Charles Keepax
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Charles Keepax @ 2026-11-24 16:09 UTC (permalink / raw)
To: vkoul, broonie
Cc: yung-chuan.liao, pierre-louis.bossart, lgirdwood, peter.ujfalusi,
kai.vehmanen, linux-sound, linux-kernel, patches
Currently on Intel systems SoundWire drivers can't communicate with the
device during driver removal. This is primarily because the IRQs are
disabled before the driver remove callback is run. The result of this is
such transactions timeout causing a) a lot of errors in the log and b)
driver remove to take a very long time.
This issue affects cs42l43 and cs42l45, primarily due to both using
regmap IRQ.
soundwire_intel soundwire_intel.link.0: IO transfer timed out, cmd 3 device 6 addr 5d len 1
soundwire sdw-master-0-0: trf on Slave 6 failed:-110 write addr 5d count 0
sdca_class sdw:0:0:01fa:4245:01: Failed to sync masks in 5d
As regmap IRQ is torn down it will mask the interrupts that are
removed. However, there are many valid reasons a driver might want
communicate with the device during removal, others would include
disabling jack detection, putting the device into the lowest possible
power state to save power, etc.
This patch set attempts to address this problem trying to locate the
reason interrupts are disabled, fixing that and then leaving the IRQs
enabled for the remove callback.
Thanks,
Charles
Changes since v3:
- Add IRQ chip to the Intel HDA stuff and use that to call the link
IRQs.
Changes since v2:
- Added a comment in the code for the splitting of device_unregister()
- Fixed missing i++ in error path if devm_add_action_or_reset() fails
during loop over links.
Changes since v1:
- Add a new helper to destroy the children on the bus separately, this
allows the IRQs to be disabled for final cleanup.
- Split device_unregister into device_del and put_device.
Charles Keepax (4):
ASoC: SOF: Intel: Add IRQ chip to distribute the SoundWire IRQ
soundwire: bus: Don't unassign dev_num before unregistering device
soundwire: bus: Expose a helper to remove devices from the bus
soundwire: intel_auxdevice: Don't disable IRQs before removing
children
drivers/soundwire/bus.c | 55 ++++++++++++++++++++++-------
drivers/soundwire/intel_auxdevice.c | 17 ++++++++-
drivers/soundwire/intel_init.c | 16 +++------
include/linux/soundwire/sdw.h | 1 +
include/linux/soundwire/sdw_intel.h | 6 ++--
sound/soc/sof/intel/hda.c | 42 ++++++++++++++++++----
sound/soc/sof/intel/hda.h | 8 +++++
7 files changed, 112 insertions(+), 33 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 1/4] ASoC: SOF: Intel: Add IRQ chip to distribute the SoundWire IRQ
2026-11-24 16:09 [PATCH v4 0/4] Allow SoundWire devices to communicate during remove Charles Keepax
@ 2026-11-24 16:09 ` Charles Keepax
2026-11-24 16:49 ` Pierre-Louis Bossart
2026-11-24 16:09 ` [PATCH v4 2/4] soundwire: bus: Don't unassign dev_num before unregistering device Charles Keepax
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Charles Keepax @ 2026-11-24 16:09 UTC (permalink / raw)
To: vkoul, broonie
Cc: yung-chuan.liao, pierre-louis.bossart, lgirdwood, peter.ujfalusi,
kai.vehmanen, linux-sound, linux-kernel, patches
Add an IRQ chip into the HDA code that can be used to trigger the
SoundWire IRQ for each link. Currently, only the SoundWire IRQ
is moved over to this IRQ chip, although in time the other IRQ
functions could be too.
This will allow refactoring such that the individual links each
request and free their IRQs locally, rather than having to rely
on looping over a list of links which is tricky to maintain while
destroying the devices.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
New since v3.
drivers/soundwire/intel_auxdevice.c | 10 +++++++
drivers/soundwire/intel_init.c | 16 +++--------
include/linux/soundwire/sdw_intel.h | 6 +++--
sound/soc/sof/intel/hda.c | 42 ++++++++++++++++++++++++-----
sound/soc/sof/intel/hda.h | 8 ++++++
5 files changed, 62 insertions(+), 20 deletions(-)
diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
index 8bdb2bf1c6446..d84fbe716febc 100644
--- a/drivers/soundwire/intel_auxdevice.c
+++ b/drivers/soundwire/intel_auxdevice.c
@@ -366,6 +366,14 @@ static int intel_link_probe(struct auxiliary_device *auxdev,
/* use generic bandwidth allocation algorithm */
sdw->cdns.bus.compute_params = sdw_compute_params;
+ ret = request_threaded_irq(sdw->link_res->irq, NULL, sdw_cdns_irq,
+ IRQF_SHARED | IRQF_ONESHOT, dev_name(dev),
+ cdns);
+ if (ret) {
+ dev_err(dev, "failed to request IRQ: %d\n", ret);
+ return ret;
+ }
+
ret = sdw_bus_master_add(bus, dev, dev->fwnode);
if (ret) {
dev_err(dev, "sdw_bus_master_add fail: %d\n", ret);
@@ -503,6 +511,8 @@ static void intel_link_remove(struct auxiliary_device *auxdev)
struct sdw_intel *sdw = cdns_to_intel(cdns);
struct sdw_bus *bus = &cdns->bus;
+ free_irq(sdw->link_res->irq, cdns);
+
/*
* Since pm_runtime is already disabled, we don't decrease
* the refcount when the clock_stop_quirk is
diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index ad48d67fa9358..d08d79f259629 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -89,6 +89,8 @@ static struct sdw_intel_link_dev *intel_link_dev_register(struct sdw_intel_res *
link->hbus = res->hbus;
+ link->irq = ctx->irq;
+
/* now follow the two-step init/add sequence */
ret = auxiliary_device_init(auxdev);
if (ret < 0) {
@@ -140,18 +142,6 @@ static int sdw_intel_cleanup(struct sdw_intel_ctx *ctx)
return 0;
}
-irqreturn_t sdw_intel_thread(int irq, void *dev_id)
-{
- struct sdw_intel_ctx *ctx = dev_id;
- struct sdw_intel_link_res *link;
-
- list_for_each_entry(link, &ctx->link_list, list)
- sdw_cdns_irq(irq, link->cdns);
-
- return IRQ_HANDLED;
-}
-EXPORT_SYMBOL_NS(sdw_intel_thread, "SOUNDWIRE_INTEL_INIT");
-
static struct sdw_intel_ctx
*sdw_intel_probe_controller(struct sdw_intel_res *res)
{
@@ -215,6 +205,8 @@ static struct sdw_intel_ctx
INIT_LIST_HEAD(&ctx->link_list);
+ ctx->irq = res->irq;
+
for (i = 0; i < count; i++) {
if (!(link_mask & BIT(i)))
continue;
diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
index 9710f2dc04e29..a23b187df283b 100644
--- a/include/linux/soundwire/sdw_intel.h
+++ b/include/linux/soundwire/sdw_intel.h
@@ -5,6 +5,8 @@
#define __SDW_INTEL_H
#include <linux/acpi.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
#include <linux/irqreturn.h>
#include <linux/soundwire/sdw.h>
@@ -299,6 +301,7 @@ struct hdac_bus;
* @shim_base: sdw shim base.
* @alh_base: sdw alh base.
* @peripherals: array representing Peripherals exposed across all enabled links
+ * @irq: Interrupt line for the SoundWire
*/
struct sdw_intel_ctx {
int count;
@@ -312,6 +315,7 @@ struct sdw_intel_ctx {
u32 shim_base;
u32 alh_base;
struct sdw_peripherals *peripherals;
+ int irq;
};
/**
@@ -382,8 +386,6 @@ int sdw_intel_startup(struct sdw_intel_ctx *ctx);
void sdw_intel_exit(struct sdw_intel_ctx *ctx);
-irqreturn_t sdw_intel_thread(int irq, void *dev_id);
-
#define SDW_INTEL_QUIRK_MASK_BUS_DISABLE BIT(1)
struct sdw_intel;
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 9fc95806697e1..06961e5e666ff 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -46,6 +46,22 @@
/* platform specific devices */
#include "shim.h"
+static int hda_irq_map(struct irq_domain *h, unsigned int virq, irq_hw_number_t hw)
+{
+ struct sof_intel_hda_dev *hdev = h->host_data;
+
+ irq_set_chip_data(virq, hdev);
+ irq_set_chip(virq, &hdev->irq_chip);
+ irq_set_nested_thread(virq, 1);
+ irq_set_noprobe(virq);
+
+ return 0;
+}
+
+static const struct irq_domain_ops hda_domain_ops = {
+ .map = hda_irq_map,
+};
+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)
/*
@@ -198,7 +214,7 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev)
if (chip->hw_ip_version >= SOF_INTEL_ACE_3_0)
res.mic_privacy = true;
}
- res.irq = sdev->ipc_irq;
+ res.irq = irq_create_mapping(hdev->domain, HDA_IRQ_SDW);
res.handle = hdev->info.handle;
res.parent = sdev->dev;
@@ -260,6 +276,8 @@ static int hda_sdw_exit(struct snd_sof_dev *sdev)
sdw_intel_exit(hdev->sdw);
hdev->sdw = NULL;
+ irq_dispose_mapping(irq_find_mapping(hdev->domain, HDA_IRQ_SDW));
+
hda_sdw_int_enable(sdev, false);
return 0;
@@ -307,9 +325,9 @@ static bool hda_dsp_check_sdw_irq(struct snd_sof_dev *sdev)
return false;
}
-static irqreturn_t hda_dsp_sdw_thread(int irq, void *context)
+static void hda_dsp_sdw_thread(struct sof_intel_hda_dev *hdev)
{
- return sdw_intel_thread(irq, context);
+ handle_nested_irq(irq_find_mapping(hdev->domain, HDA_IRQ_SDW));
}
bool hda_sdw_check_wakeen_irq_common(struct snd_sof_dev *sdev)
@@ -399,9 +417,8 @@ static inline bool hda_dsp_check_sdw_irq(struct snd_sof_dev *sdev)
return false;
}
-static inline irqreturn_t hda_dsp_sdw_thread(int irq, void *context)
+static inline void hda_dsp_sdw_thread(struct sof_intel_hda_dev *hdev)
{
- return IRQ_HANDLED;
}
static inline bool hda_sdw_check_wakeen_irq(struct snd_sof_dev *sdev)
@@ -727,7 +744,7 @@ static irqreturn_t hda_dsp_interrupt_thread(int irq, void *context)
if (hda_dsp_check_sdw_irq(sdev)) {
trace_sof_intel_hda_irq(sdev, "sdw");
- hda_dsp_sdw_thread(irq, hdev->sdw);
+ hda_dsp_sdw_thread(hdev);
if (hda_dsp_sdw_check_mic_privacy_irq(sdev)) {
trace_sof_intel_hda_irq(sdev, "mic privacy");
@@ -883,6 +900,14 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
sdev->ipc_irq = pci->irq;
}
+ hdev->irq_chip.name = dev_name(sdev->dev);
+ hdev->domain = irq_domain_create_linear(NULL, HDA_IRQ_COUNT,
+ &hda_domain_ops, hdev);
+ if (!hdev->domain) {
+ dev_err(sdev->dev, "failed to create IRQ domain\n");
+ goto remove_irq_domain;
+ }
+
dev_dbg(sdev->dev, "using IPC IRQ %d\n", sdev->ipc_irq);
ret = request_threaded_irq(sdev->ipc_irq, hda_dsp_interrupt_handler,
hda_dsp_interrupt_thread,
@@ -941,6 +966,8 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
free_ipc_irq:
hda_dsp_ctrl_stop_chip(sdev);
free_irq(sdev->ipc_irq, sdev);
+remove_irq_domain:
+ irq_domain_remove(hdev->domain);
free_irq_vector:
if (sdev->msi_enabled)
pci_free_irq_vectors(pci);
@@ -1011,6 +1038,9 @@ void hda_dsp_remove(struct snd_sof_dev *sdev)
hda_dsp_ctrl_stop_chip(sdev);
free_irq(sdev->ipc_irq, sdev);
+
+ irq_domain_remove(hda->domain);
+
if (sdev->msi_enabled)
pci_free_irq_vectors(pci);
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 43fb11b247740..29b9feb0daef4 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -466,6 +466,10 @@ struct sof_intel_dsp_bdl {
__le32 ioc;
} __attribute((packed));
+/* HDA IRQs */
+#define HDA_IRQ_SDW 0
+#define HDA_IRQ_COUNT 1
+
#define SOF_HDA_PLAYBACK_STREAMS 16
#define SOF_HDA_CAPTURE_STREAMS 16
#define SOF_HDA_PLAYBACK 0
@@ -580,6 +584,10 @@ struct sof_intel_hda_dev {
* is received from the DSP for the previous message)
*/
struct snd_sof_ipc_msg *delayed_ipc_tx_msg;
+
+ /* Used to distribute IRQs */
+ struct irq_domain *domain;
+ struct irq_chip irq_chip;
};
static inline struct hdac_bus *sof_to_bus(struct snd_sof_dev *s)
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v4 2/4] soundwire: bus: Don't unassign dev_num before unregistering device
2026-11-24 16:09 [PATCH v4 0/4] Allow SoundWire devices to communicate during remove Charles Keepax
2026-11-24 16:09 ` [PATCH v4 1/4] ASoC: SOF: Intel: Add IRQ chip to distribute the SoundWire IRQ Charles Keepax
@ 2026-11-24 16:09 ` Charles Keepax
2026-11-24 16:10 ` [PATCH v4 3/4] soundwire: bus: Expose a helper to remove devices from the bus Charles Keepax
2026-11-24 16:10 ` [PATCH v4 4/4] soundwire: intel_auxdevice: Don't disable IRQs before removing children Charles Keepax
3 siblings, 0 replies; 7+ messages in thread
From: Charles Keepax @ 2026-11-24 16:09 UTC (permalink / raw)
To: vkoul, broonie
Cc: yung-chuan.liao, pierre-louis.bossart, lgirdwood, peter.ujfalusi,
kai.vehmanen, linux-sound, linux-kernel, patches
Don't mark dev_num as unassigned until after the driver remove has
been called. The driver may want to communicate with the device
as part of the driver remove operation, so the dev_num should
remain assigned until that has completed. This requires moving from
device_unregister() to manually calling device_del() and device_put()
to ensure that the slave struct isn't freed too early.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
No changes since v3.
drivers/soundwire/bus.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 15c66effbf4f4..001407fa50ddc 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -175,8 +175,18 @@ static int sdw_delete_slave(struct device *dev, void *data)
sdw_slave_debugfs_exit(slave);
- mutex_lock(&bus->bus_lock);
+ /*
+ * Split device_unregister(), the framework level needs to access
+ * members of the slave structure after the slave driver has been
+ * removed, thus the device_put() needs to be delayed. The device
+ * number needs to be marked as unused and the slave needs to be
+ * removed from the slave list. These can't be done before the
+ * drivers remove callback as the remove callback should still
+ * be able to communicate with the device.
+ */
+ device_del(dev);
+ mutex_lock(&bus->bus_lock);
if (slave->dev_num) { /* clear dev_num if assigned */
clear_bit(slave->dev_num, bus->assigned);
if (bus->ops && bus->ops->put_device_num)
@@ -185,7 +195,8 @@ static int sdw_delete_slave(struct device *dev, void *data)
list_del_init(&slave->node);
mutex_unlock(&bus->bus_lock);
- device_unregister(dev);
+ put_device(dev);
+
return 0;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v4 3/4] soundwire: bus: Expose a helper to remove devices from the bus
2026-11-24 16:09 [PATCH v4 0/4] Allow SoundWire devices to communicate during remove Charles Keepax
2026-11-24 16:09 ` [PATCH v4 1/4] ASoC: SOF: Intel: Add IRQ chip to distribute the SoundWire IRQ Charles Keepax
2026-11-24 16:09 ` [PATCH v4 2/4] soundwire: bus: Don't unassign dev_num before unregistering device Charles Keepax
@ 2026-11-24 16:10 ` Charles Keepax
2026-11-24 16:10 ` [PATCH v4 4/4] soundwire: intel_auxdevice: Don't disable IRQs before removing children Charles Keepax
3 siblings, 0 replies; 7+ messages in thread
From: Charles Keepax @ 2026-11-24 16:10 UTC (permalink / raw)
To: vkoul, broonie
Cc: yung-chuan.liao, pierre-louis.bossart, lgirdwood, peter.ujfalusi,
kai.vehmanen, linux-sound, linux-kernel, patches
Some SoundWire controllers may have features such as IRQs that are
needed to support peripheral operation, it is desirable to continue
to support these whilst peripheral drivers are removed. However,
the current sdw_bus_master_delete() monolithically removes the
peripherals and destroys the controller giving no chance for the
controller driver to perform clean up after the slaves are removed,
but before it is itself destroyed.
Split out a separate helper function that only removes the
peripherals, this will allow drivers that require this to sequence
things appropriately. The functionality of the current helper is
left as is, if the peripherals have already been removed the call
to do this is a no-op which allows drivers that don't need this
functionality to remain untouched.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
No changes since v3.
drivers/soundwire/bus.c | 44 +++++++++++++++++++++++++----------
include/linux/soundwire/sdw.h | 1 +
2 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 001407fa50ddc..5baae0bedaf09 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -169,7 +169,6 @@ EXPORT_SYMBOL(sdw_bus_master_add);
static int sdw_delete_slave(struct device *dev, void *data)
{
struct sdw_slave *slave = dev_to_sdw_dev(dev);
- struct sdw_bus *bus = slave->bus;
pm_runtime_disable(dev);
@@ -186,18 +185,38 @@ static int sdw_delete_slave(struct device *dev, void *data)
*/
device_del(dev);
- mutex_lock(&bus->bus_lock);
- if (slave->dev_num) { /* clear dev_num if assigned */
- clear_bit(slave->dev_num, bus->assigned);
- if (bus->ops && bus->ops->put_device_num)
- bus->ops->put_device_num(bus, slave);
- }
- list_del_init(&slave->node);
- mutex_unlock(&bus->bus_lock);
+ return 0;
+}
- put_device(dev);
+/**
+ * sdw_bus_slaves_delete() - delete all peripherals on a bus
+ * @bus: bus with peripherals to be deleted
+ *
+ * Delete the child devices.
+ */
+void sdw_bus_slaves_delete(struct sdw_bus *bus)
+{
+ device_for_each_child(bus->dev, NULL, sdw_delete_slave);
+}
+EXPORT_SYMBOL(sdw_bus_slaves_delete);
- return 0;
+static void sdw_bus_slaves_put(struct sdw_bus *bus)
+{
+ struct sdw_slave *slave, *tmp;
+
+ list_for_each_entry_safe(slave, tmp, &bus->slaves, node) {
+ mutex_lock(&bus->bus_lock);
+ if (slave->dev_num) { /* clear dev_num if assigned */
+ clear_bit(slave->dev_num, bus->assigned);
+ if (bus->ops && bus->ops->put_device_num)
+ bus->ops->put_device_num(bus, slave);
+ }
+ list_del_init(&slave->node);
+ mutex_unlock(&bus->bus_lock);
+
+ /* See comment in sdw_delete_slave() */
+ put_device(&slave->dev);
+ }
}
/**
@@ -208,7 +227,8 @@ static int sdw_delete_slave(struct device *dev, void *data)
*/
void sdw_bus_master_delete(struct sdw_bus *bus)
{
- device_for_each_child(bus->dev, NULL, sdw_delete_slave);
+ sdw_bus_slaves_delete(bus);
+ sdw_bus_slaves_put(bus);
sdw_irq_delete(bus);
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index b8f5ad39e9b37..f83b7f622288a 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -899,6 +899,7 @@ struct sdw_master_ops {
int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
struct fwnode_handle *fwnode);
+void sdw_bus_slaves_delete(struct sdw_bus *bus);
void sdw_bus_master_delete(struct sdw_bus *bus);
void sdw_show_ping_status(struct sdw_bus *bus, bool sync_delay);
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v4 4/4] soundwire: intel_auxdevice: Don't disable IRQs before removing children
2026-11-24 16:09 [PATCH v4 0/4] Allow SoundWire devices to communicate during remove Charles Keepax
` (2 preceding siblings ...)
2026-11-24 16:10 ` [PATCH v4 3/4] soundwire: bus: Expose a helper to remove devices from the bus Charles Keepax
@ 2026-11-24 16:10 ` Charles Keepax
3 siblings, 0 replies; 7+ messages in thread
From: Charles Keepax @ 2026-11-24 16:10 UTC (permalink / raw)
To: vkoul, broonie
Cc: yung-chuan.liao, pierre-louis.bossart, lgirdwood, peter.ujfalusi,
kai.vehmanen, linux-sound, linux-kernel, patches
Currently the auxiliary device for the link disables IRQs before it
calls sdw_bus_master_delete(). This has the side effect that none
of the devices on the link can access their own registers whilst
their remove functions run, because the IRQs are required for bus
transactions to function.
Now that the link auxiliary drivers register their own IRQs and a
core helper is available to destroy the slaves before the master
is destroyed, it is save to update intel_link_remove() to leave
the IRQ enabled whilst the slaves are destroyed.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
Changes since v3:
- Dropped all the link lock and list stuff and just use the IRQ core.
- Removed Pierre's Reviewed-by as things have changed quite
substantively.
drivers/soundwire/intel_auxdevice.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
index d84fbe716febc..450c3927f0910 100644
--- a/drivers/soundwire/intel_auxdevice.c
+++ b/drivers/soundwire/intel_auxdevice.c
@@ -511,8 +511,6 @@ static void intel_link_remove(struct auxiliary_device *auxdev)
struct sdw_intel *sdw = cdns_to_intel(cdns);
struct sdw_bus *bus = &cdns->bus;
- free_irq(sdw->link_res->irq, cdns);
-
/*
* Since pm_runtime is already disabled, we don't decrease
* the refcount when the clock_stop_quirk is
@@ -521,8 +519,15 @@ static void intel_link_remove(struct auxiliary_device *auxdev)
if (!bus->prop.hw_disabled) {
sdw_intel_debugfs_exit(sdw);
cancel_delayed_work_sync(&cdns->attach_dwork);
- sdw_cdns_enable_interrupt(cdns, false);
}
+
+ sdw_bus_slaves_delete(bus);
+
+ free_irq(sdw->link_res->irq, cdns);
+
+ if (!bus->prop.hw_disabled)
+ sdw_cdns_enable_interrupt(cdns, false);
+
sdw_bus_master_delete(bus);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/4] ASoC: SOF: Intel: Add IRQ chip to distribute the SoundWire IRQ
2026-11-24 16:09 ` [PATCH v4 1/4] ASoC: SOF: Intel: Add IRQ chip to distribute the SoundWire IRQ Charles Keepax
@ 2026-11-24 16:49 ` Pierre-Louis Bossart
2026-11-24 17:06 ` Charles Keepax
0 siblings, 1 reply; 7+ messages in thread
From: Pierre-Louis Bossart @ 2026-11-24 16:49 UTC (permalink / raw)
To: Charles Keepax, vkoul, broonie
Cc: yung-chuan.liao, lgirdwood, peter.ujfalusi, kai.vehmanen,
linux-sound, linux-kernel, patches
On 11/24/26 17:09, Charles Keepax wrote:
> Add an IRQ chip into the HDA code that can be used to trigger the
> SoundWire IRQ for each link. Currently, only the SoundWire IRQ
> is moved over to this IRQ chip, although in time the other IRQ
> functions could be too.
>
> This will allow refactoring such that the individual links each
> request and free their IRQs locally, rather than having to rely
> on looping over a list of links which is tricky to maintain while
> destroying the devices.
Well, there's no such thing as a per-link SoundWire IRQ...
The hardware is built in such a way that once a global interrupt is
received at the HDAudio controller level, the handler has to check if
this was an IPC, HDA, SoundWire interrupt - in that order. And in the
latter case there's no other way than iterating over each link.
Using an abstraction to make each interrupt source 'self-contained'
would be fine and probably make the code cleaner, but then why stop at
SoundWire? I'd err on the side of 'go big or go home'...
At any rate this would be a significant change on both SOF/HDA and
SoundWire sides that should be handled as a well-tested prerequisite to
the series to allow for communication with the device during remove - it
doesn't seem right as a patch casually added in a v4...
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/4] ASoC: SOF: Intel: Add IRQ chip to distribute the SoundWire IRQ
2026-11-24 16:49 ` Pierre-Louis Bossart
@ 2026-11-24 17:06 ` Charles Keepax
0 siblings, 0 replies; 7+ messages in thread
From: Charles Keepax @ 2026-11-24 17:06 UTC (permalink / raw)
To: Pierre-Louis Bossart
Cc: vkoul, broonie, yung-chuan.liao, lgirdwood, peter.ujfalusi,
kai.vehmanen, linux-sound, linux-kernel, patches
On Tue, Nov 24, 2026 at 05:49:21PM +0100, Pierre-Louis Bossart wrote:
> On 11/24/26 17:09, Charles Keepax wrote:
> > Add an IRQ chip into the HDA code that can be used to trigger the
> > SoundWire IRQ for each link. Currently, only the SoundWire IRQ
> > is moved over to this IRQ chip, although in time the other IRQ
> > functions could be too.
> >
> > This will allow refactoring such that the individual links each
> > request and free their IRQs locally, rather than having to rely
> > on looping over a list of links which is tricky to maintain while
> > destroying the devices.
>
> Well, there's no such thing as a per-link SoundWire IRQ...
>
> The hardware is built in such a way that once a global interrupt is
> received at the HDAudio controller level, the handler has to check if
> this was an IPC, HDA, SoundWire interrupt - in that order. And in the
> latter case there's no other way than iterating over each link.
Yeah, hence why we add the IRQ domain and claim a shared interrupt.
I will reword a bit for the next spin.
> Using an abstraction to make each interrupt source 'self-contained'
> would be fine and probably make the code cleaner, but then why stop at
> SoundWire? I'd err on the side of 'go big or go home'...
Yeah this definitely could be expanded to the other handlers, as
I note in one of the commit messages. But not really sure I want
to go that far as it no longer relates to the issues I am trying
to solve.
> At any rate this would be a significant change on both SOF/HDA and
> SoundWire sides that should be handled as a well-tested prerequisite to
> the series to allow for communication with the device during remove - it
> doesn't seem right as a patch casually added in a v4...
I can split this patch out to a separate series if you prefer?
Apologies, for the changes a few revisions in but I had generally
imagined doing this would be too much work, hence the more hacky
approach in the previous versions. But it turned out the rabbit
hole was much shallower than I thought.
Thanks,
Charles
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-24 17:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 16:09 [PATCH v4 0/4] Allow SoundWire devices to communicate during remove Charles Keepax
2026-11-24 16:09 ` [PATCH v4 1/4] ASoC: SOF: Intel: Add IRQ chip to distribute the SoundWire IRQ Charles Keepax
2026-11-24 16:49 ` Pierre-Louis Bossart
2026-11-24 17:06 ` Charles Keepax
2026-11-24 16:09 ` [PATCH v4 2/4] soundwire: bus: Don't unassign dev_num before unregistering device Charles Keepax
2026-11-24 16:10 ` [PATCH v4 3/4] soundwire: bus: Expose a helper to remove devices from the bus Charles Keepax
2026-11-24 16:10 ` [PATCH v4 4/4] soundwire: intel_auxdevice: Don't disable IRQs before removing children Charles Keepax
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox