Re: [PATCH v1 1/2] ASoC: simple-card: Support custom DAI system clock IDs

From: Aidan MacDonald
Date: Mon Oct 24 2022 - 20:36:19 EST



Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> writes:

> Hi Aidan
>
> Thank you for your patch
>
>> Some DAIs have multiple system clock sources, which can be chosen
>> using the "clk_id" argument to snd_soc_dai_set_sysclk(). Currently
>> this is hardcoded to 0 when using simple cards, but that choice is
>> not always suitable.
>>
>> Add the "system-clock-id" property to allow selecting a different
>> clock ID on a per-DAI basis.
>>
>> To simplify the logic on DPCM cards, add a dummy "asoc_simple_dai"
>> instance and use that for the dummy components on DPCM links. This
>> ensures that when we're iterating over DAIs in the PCM runtime there
>> is always a matching "asoc_simple_dai" we can dereference.
>>
>> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@xxxxxxxxx>
>> ---
>
> I think adding "system-clock-id" and adding "dummy asoc_simple_dai" are
> different topics. This patch should be separated into 2 patches.

Sounds good to me.

> And I couldn't understand the reason why we need to add dummy asoc_simple_dai.
> In my understanding, we don't parse DT for dummy connection.
> Which process are you talking about specifically here?
>
> This ensures that when we're iterating over DAIs in the PCM runtime there
> is always a matching "asoc_simple_dai" we can dereference.
> -
> Thank you for your help !!
>
> Best regards
> ---
> Kuninori Morimoto

DPCM DAI links have some real DAIs and one dummy DAI. Each real DAI has
an asoc_simple_dai associated with it to contain the information parsed
from the DT. The dummy DAI does not have an asoc_simple_dai. I'm adding
a dummy asoc_simple_dai for these dummy DAIs to make the mapping of
snd_soc_dai to asoc_simple_dai 1-to-1.

The non 1-to-1 mapping is problematic, because if I have a snd_soc_dai
and want to look up a simple-card property I would need to check if the
matching asoc_simple_dai exists first, and have a special case for DPCM
dummy DAIs. With a 1-to-1 mapping I can handle all DAIs the same way.

Regards,
Aidan