[PATCH v3 2/2] soundwire: Assume default maximum valid channel if not specified
From: Charles Keepax
Date: Wed Nov 11 2026 - 12:05:43 EST
The SoundWire/DisCo specification defines all the supported channel
properties as optional and states that in the case none are specified
defaults of min_ch=0 and max_ch=7 should be used. If both properties
are not present in the DisCo the current code results in min_ch=0
and max_ch=0. As min_ch and max_ch are both channel indexes, users
can't discern if they should interpret this as the default case
(1-8 channels supported) or the DisCo specified a single valid
channel of 0 (1 channel supported).
In the case there are no valid supported channel properties populate
max_ch with 7 as the specification suggests, to avoid the ambiguity.
Also as the specification says only parse the channel number properties
if there is no channel number list.
Signed-off-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
---
Changes since v2:
- Moved the parsing of min/max channels to only be processed if
num_channels is missing
drivers/soundwire/mipi_disco.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c
index 259ad98b5b7a9..2dad95f8e1ab2 100644
--- a/drivers/soundwire/mipi_disco.c
+++ b/drivers/soundwire/mipi_disco.c
@@ -284,12 +284,6 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave,
"mipi-sdw-imp-def-dpn-interrupts-supported",
&dpn[i].imp_def_interrupts);
- fwnode_property_read_u32(node, "mipi-sdw-min-channel-number",
- &dpn[i].min_ch);
-
- fwnode_property_read_u32(node, "mipi-sdw-max-channel-number",
- &dpn[i].max_ch);
-
nval = fwnode_property_count_u32(node, "mipi-sdw-channel-number-list");
if (nval > 0) {
dpn[i].num_channels = nval;
@@ -307,6 +301,14 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave,
dpn[i].channels, dpn[i].num_channels);
if (ret < 0)
return ret;
+ } else {
+ fwnode_property_read_u32(node, "mipi-sdw-min-channel-number",
+ &dpn[i].min_ch);
+
+ ret = fwnode_property_read_u32(node, "mipi-sdw-max-channel-number",
+ &dpn[i].max_ch);
+ if (ret)
+ dpn[i].max_ch = 7;
}
nval = fwnode_property_count_u32(node, "mipi-sdw-channel-combination-list");
--
2.47.3