Re: [PATCH v2 2/2] soundwire: Assume default maximum valid channel if not specified
From: Charles Keepax
Date: Wed Nov 11 2026 - 04:39:54 EST
On Tue, Nov 10, 2026 at 06:11:13PM +0100, Pierre-Louis Bossart wrote:
> On 11/10/26 16:08, Charles Keepax wrote:
> > On Tue, Nov 10, 2026 at 03:30:43PM +0100, Pierre-Louis Bossart wrote:
> >> On 11/10/26 12:38, Charles Keepax wrote:
> >>> + 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;
> >> }
> >
> > I am happy to do so if you feel strongly. However, the spec
> > doesn't really appear to rule out both being present, it does
> > imply that the channel list takes precedence. But given it
> > doesn't rule out having both, I quite like parsing both and
> > allowing the driver to make a decision about what to do with
> > that information.
> humm, the wording "Conditions: If Property mipi-sdw-channel-number-list
> is present, then this [mipi-sdw-max-channel-number ]Property shall not
> be present" is pretty strong.
>
> I don't mind keeping your existing code but then we'd need to add a
> comment to say that we discarded the 'shall' to cover potentially broken
> cases.
Nah, its cool I will update the code as you suggest. Should be
able to get a spin out later today.
Thanks,
Charles