Re: [PATCH v2 2/2] soundwire: Assume default maximum valid channel if not specified
From: Pierre-Louis Bossart
Date: Tue Nov 10 2026 - 12:38:08 EST
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.