From: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
To: Charles Keepax <ckeepax@opensource.cirrus.com>, vkoul@kernel.org
Cc: yung-chuan.liao@linux.intel.com, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org, patches@opensource.cirrus.com
Subject: Re: [PATCH v2 2/2] soundwire: Assume default maximum valid channel if not specified
Date: Tue, 10 Nov 2026 15:30:43 +0100 [thread overview]
Message-ID: <105b2b77-7eb6-4b96-821d-51af94a2e21d@linux.dev> (raw)
In-Reply-To: <20261110113842.347883-3-ckeepax@opensource.cirrus.com>
On 11/10/26 12:38, Charles Keepax wrote:
> 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.
>
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
>
> No changes since v1.
>
> 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..eadbda55f377f 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;
> @@ -309,6 +303,14 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave,
> return ret;
> }
>
> + 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].num_channels)
> + dpn[i].max_ch = 7;
> +
this works, maybe with one possible improvement: in theory if
"mipi-sdw-channel-number-list" is defined one can ignore the min/max,
the two approaches with the list or min/max are mutually exclusive.
Something like this:
if (!dpn[i].num_channels) {
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");
> if (nval > 0) {
> dpn[i].num_ch_combinations = nval;
next prev parent reply other threads:[~2026-11-10 14:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 11:38 [PATCH v2 0/2] Update handling of min and max channel in DisCo Charles Keepax
2026-11-10 11:38 ` [PATCH v2 1/2] soundwire: Improve channel min/max comments Charles Keepax
2026-11-10 11:38 ` [PATCH v2 2/2] soundwire: Assume default maximum valid channel if not specified Charles Keepax
2026-11-10 14:30 ` Pierre-Louis Bossart [this message]
2026-11-10 15:08 ` Charles Keepax
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=105b2b77-7eb6-4b96-821d-51af94a2e21d@linux.dev \
--to=pierre-louis.bossart@linux.dev \
--cc=ckeepax@opensource.cirrus.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.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
all inboxes | Powered by JetHome®