* [PATCH] soundwire: bus: detect SDCA cascade on peripherals reporting class_id 0
@ 2026-11-28 8:03 Gopi Chandra Sekhar Reddy Kanala
2026-11-28 19:11 ` Pierre-Louis Bossart
0 siblings, 1 reply; 2+ messages in thread
From: Gopi Chandra Sekhar Reddy Kanala @ 2026-11-28 8:03 UTC (permalink / raw)
To: Vinod Koul, Bard Liao, Pierre-Louis Bossart
Cc: linux-sound, ckeepax, linux-kernel,
Gopi Chandra Sekhar Reddy Kanala
sdw_handle_slave_alerts() only reads DP0_INT, and so can only ever see
SDCA_CASCADE, when the peripheral enumerates with a non-zero class_id.
That is what the SDCA amendment requires, and it holds for most SDCA
peripherals.
A peripheral that enumerates with DevId_5 == 0 has its SDCA interrupts
left invisible to the bus driver: SDCA_CASCADE is never read, so
slave_notify is never set from it, and if the peripheral also masks
SCP_INT1.IMPL_DEF there is no other path to it either. Neither
handle_nested_irq() nor .interrupt_callback() is ever reached and the
SDCA regmap-irq handlers for its Functions never run, so interrupt
driven features such as jack detection silently do nothing. WCD9378 is
one such peripheral.
Fall back to sdca_data.num_functions when class_id is zero. It is
already maintained for every SDCA peripheral: the ACPI path fills it in
from the DisCo tables, and a peripheral with no DisCo enumeration seeds
it from its own .probe, in both cases long before an SDCA interrupt can
be unmasked. No new property or quirk is needed, and nothing changes
for a peripheral that reports its class_id correctly.
Signed-off-by: Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
---
A follow-up ASoC series enabling jack detection on the WCD9378 SDCA
codec depends on this at runtime; there is no build dependency and it
will be posted separately once this is applied.
---
drivers/soundwire/bus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index aeaae5a57c89..4a88b2af7447 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -1693,7 +1693,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
goto io_err;
}
- if (slave->id.class_id) {
+ if (slave->id.class_id || slave->sdca_data.num_functions) {
ret = sdw_read_no_pm(slave, SDW_DP0_INT);
if (ret < 0) {
dev_err(&slave->dev,
@@ -1833,7 +1833,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
goto io_err;
}
- if (slave->id.class_id) {
+ if (slave->id.class_id || slave->sdca_data.num_functions) {
ret = sdw_read_no_pm(slave, SDW_DP0_INT);
if (ret < 0) {
dev_err(&slave->dev,
---
base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726
change-id: 20261128-sdw-sdca-cascade-8c6ab0089ffb
Best regards,
--
Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] soundwire: bus: detect SDCA cascade on peripherals reporting class_id 0
2026-11-28 8:03 [PATCH] soundwire: bus: detect SDCA cascade on peripherals reporting class_id 0 Gopi Chandra Sekhar Reddy Kanala
@ 2026-11-28 19:11 ` Pierre-Louis Bossart
0 siblings, 0 replies; 2+ messages in thread
From: Pierre-Louis Bossart @ 2026-11-28 19:11 UTC (permalink / raw)
To: Gopi Chandra Sekhar Reddy Kanala, Vinod Koul, Bard Liao
Cc: linux-sound, ckeepax, linux-kernel
On 11/28/26 09:03, Gopi Chandra Sekhar Reddy Kanala wrote:
> sdw_handle_slave_alerts() only reads DP0_INT, and so can only ever see
> SDCA_CASCADE, when the peripheral enumerates with a non-zero class_id.
> That is what the SDCA amendment requires, and it holds for most SDCA
> peripherals.
>
> A peripheral that enumerates with DevId_5 == 0 has its SDCA interrupts
> left invisible to the bus driver: SDCA_CASCADE is never read, so
> slave_notify is never set from it, and if the peripheral also masks
> SCP_INT1.IMPL_DEF there is no other path to it either. Neither
> handle_nested_irq() nor .interrupt_callback() is ever reached and the
> SDCA regmap-irq handlers for its Functions never run, so interrupt
> driven features such as jack detection silently do nothing. WCD9378 is
> one such peripheral.
>
> Fall back to sdca_data.num_functions when class_id is zero. It is
> already maintained for every SDCA peripheral: the ACPI path fills it in
> from the DisCo tables, and a peripheral with no DisCo enumeration seeds
> it from its own .probe, in both cases long before an SDCA interrupt can
> be unmasked. No new property or quirk is needed, and nothing changes
> for a peripheral that reports its class_id correctly.
This would work to cover this very odd corner case.
Just wondering if it could be improved to only deal with SDCA cascade
*if* there are actually interrupts reported. the num_functions > 0
criterion is rather broad, a device such as a simple amplifier could be
built in such a way that no interrupts are reported, ever. With the
suggested solution one would read a register for no good reason. It's
not that bad, but it's not great either.
> Signed-off-by: Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
> ---
> A follow-up ASoC series enabling jack detection on the WCD9378 SDCA
> codec depends on this at runtime; there is no build dependency and it
> will be posted separately once this is applied.
> ---
> drivers/soundwire/bus.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> index aeaae5a57c89..4a88b2af7447 100644
> --- a/drivers/soundwire/bus.c
> +++ b/drivers/soundwire/bus.c
> @@ -1693,7 +1693,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
> goto io_err;
> }
>
> - if (slave->id.class_id) {
> + if (slave->id.class_id || slave->sdca_data.num_functions) {
> ret = sdw_read_no_pm(slave, SDW_DP0_INT);
> if (ret < 0) {
> dev_err(&slave->dev,
> @@ -1833,7 +1833,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
> goto io_err;
> }
>
> - if (slave->id.class_id) {
> + if (slave->id.class_id || slave->sdca_data.num_functions) {
> ret = sdw_read_no_pm(slave, SDW_DP0_INT);
> if (ret < 0) {
> dev_err(&slave->dev,
>
> ---
> base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726
> change-id: 20261128-sdw-sdca-cascade-8c6ab0089ffb
>
> Best regards,
> --
> Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-28 19:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 8:03 [PATCH] soundwire: bus: detect SDCA cascade on peripherals reporting class_id 0 Gopi Chandra Sekhar Reddy Kanala
2026-11-28 19:11 ` Pierre-Louis Bossart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox