Re: [PATCH 1/2] ALSA: hda/hdmi: Add helper function to check if a device is HDMI codec

Péter Ujfalusi
2023-11-27T14:45:23Z

On 27/11/2023 16:31, Takashi Iwai wrote:
> On Mon, 27 Nov 2023 15:12:51 +0100,
> Péter Ujfalusi wrote:
>>
>>
>>
>> On 27/11/2023 15:18, Takashi Iwai wrote:
>>>> +bool snd_hda_device_is_hdmi(struct hdac_device *hdev)
>>>> +{
>>>> + int i;
>>>> +
>>>> + for (i = 0; i < ARRAY_SIZE(snd_hda_id_hdmi); i++) {
>>>> + if (snd_hda_id_hdmi[i].vendor_id == hdev->vendor_id)
>>>> + return true;
>>>> + }
>>>> +
>>>> + return false;
>>>> +}
>>>> +EXPORT_SYMBOL_GPL(snd_hda_device_is_hdmi);
>>>
>>> I'm afraid that this will bring unnecessary dependency on HDMI codec
>>> driver.
>>
>> For HDMI support we anyways need HDMI code?
>
> But the ASoC hdac-hda driver isn't specifically bound with HDMI, I
> thought?
>
> With your patch, now it becomes a hard-dependency. It'll be even
> build failure when HDMI codec driver isn't enabled in Kconfig.

The change in hdaudio.h handles the config dependency, if
CONFIG_SND_HDA_CODEC_HDMI is not enabled in Kconfig then
snd_hda_device_is_hdmi() will return false.

--
Péter