Re: [PATCH 09/13] ASoC: amd: acp: add machine driver support for pdm use case

From: Krzysztof Kozlowski
Date: Fri Oct 27 2023 - 11:57:40 EST


On 27/10/2023 17:54, Mario Limonciello wrote:
> On 10/27/2023 10:51, Krzysztof Kozlowski wrote:
>> On 27/10/2023 17:28, Mario Limonciello wrote:
>>> On 10/27/2023 03:49, Krzysztof Kozlowski wrote:
>>>> On 21/10/2023 16:50, Syed Saba Kareem wrote:
>>>>> add pdm use case machine driver support
>>>>>
>>>>> Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@xxxxxxx>
>>>>> ---
>>>>
>>>>
>>>>> dmi_id = dmi_first_match(acp_quirk_table);
>>>>> if (dmi_id && dmi_id->driver_data)
>>>>> @@ -214,6 +221,10 @@ static const struct platform_device_id board_ids[] = {
>>>>> .name = "rmb-rt5682s-rt1019",
>>>>> .driver_data = (kernel_ulong_t)&rt5682s_rt1019_rmb_data,
>>>>> },
>>>>> + {
>>>>> + .name = "acp-pdm-mach",
>>>>> + .driver_data = (kernel_ulong_t)&acp_dmic_data,
>>>>> + },
>>>>> { }
>>>>> };
>>>>> static struct platform_driver acp_asoc_audio = {
>>>>> @@ -235,4 +246,5 @@ MODULE_ALIAS("platform:acp3xalc5682s1019");
>>>>> MODULE_ALIAS("platform:acp3x-es83xx");
>>>>> MODULE_ALIAS("platform:rmb-nau8825-max");
>>>>> MODULE_ALIAS("platform:rmb-rt5682s-rt1019");
>>>>> +MODULE_ALIAS("platform:acp-pdm-mach");
>>>>
>>>> Please stop growing the aliases. Module alias is not a substitute for
>>>> missing MODULE_DEVICE_TABLE.
>>>>
>>>> Best regards,
>>>> Krzysztof
>>>>
>>>
>>> I thought the way that this works is that top level ACP driver (IE
>>> acp-pci.c) will have MODULE_DEVICE_TABLE. This is how that module gets
>>> loaded.
>>>
>>> Then it creates platform devices based on the detected needs for the
>>> situation and the creation of those platform devices triggers a uevent
>>> which due to MODULE_ALIAS will get appropriate other platform drivers
>>> like this one loaded.
>>
>> And why you cannot use MODULE_DEVICE_TABLE here? IOW, why do you need to
>> manually duplicate entire table and re-invent MODULE_DEVICE_TABLE with
>> MODULE_ALIAS?
>
> What would actually go into MODULE_DEVICE_TABLE?

The table you have few lines above aliases.

>
> The platform devices created are contingent upon what was found during
> the top level ACP driver probe. You don't want all the "child" platform
> drivers to load unless they're needed.

How static alias differs here from static device ID table? Both are
built into the module and always there. I don't even understand what
does it mean by "loading child platform drivers". Why would unneeded
driver be loaded?

Best regards,
Krzysztof