Re: [PATCH] soundwire: stream: fix programming slave ports for non-continous port maps
From: Krzysztof Kozlowski
Date: Wed Sep 04 2024 - 07:46:38 EST
On 03/09/2024 17:17, Liao, Bard wrote:
>>>
>>> then dpn_prop[0].num = 1 and dpn_prop[1].num = 3. And we need to go
>>>
>>> throuth dpn_prop[0] and dpn_prop[1] instead of dpn_prop[1] and
>> dpn_prop[3].
>>>
>>
>> What are the source or sink ports in your case? Maybe you just generate
>> wrong mask?
>
> I checked my mask is 0xa when I do aplay and it matches the sink_ports of
> the rt722 codec.
>
>>
>> It's not only my patch which uses for_each_set_bit(). sysfs_slave_dpn
>> does the same.
>
> What sysfs_slave_dpn does is
> i = 0;
> for_each_set_bit(bit, &mask, 32) {
> if (bit == N) {
> return sprintf(buf, format_string,
> dpn[i].field);
> }
> i++;
> }
> It uses a variable "i" to represent the array index of dpn[i].
> But, it is for_each_set_bit(i, &mask, 32) in your patch and the variable "i"
> which represents each bit of the mask is used as the index of dpn_prop[i].
>
> Again, the point is that the bits of mask is not the index of the dpn_prop[]
> array.
Yes, you are right. I think I cannot achieve my initial goal of using
same dpn array with different indices. My patch should be reverted, I
believe.
I'll send a revert, sorry for the mess.
Best regards,
Krzysztof