public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, alsa-devel@alsa-project.org,
	linux-sound@vger.kernel.org,
	pierre-louis.bossart@linux.intel.com,
	kai.vehmanen@linux.intel.com, ranjani.sridharan@linux.intel.com
Subject: Re: [PATCH 1/2] ALSA: hda/hdmi: Add helper function to check if a device is HDMI codec
Date: Tue, 28 Nov 2023 10:39:48 +0100	[thread overview]
Message-ID: <87y1eimd23.wl-tiwai@suse.de> (raw)
In-Reply-To: <be4c418d-5147-4d4b-aa9b-a8e6f3c10a30@linux.intel.com>

On Tue, 28 Nov 2023 10:10:48 +0100,
Péter Ujfalusi wrote:
> 
> 
> 
> On 27/11/2023 17:43, Takashi Iwai wrote:
> > On Mon, 27 Nov 2023 16:40:57 +0100,
> >>> --- a/include/sound/hdaudio.h
> >>> +++ b/include/sound/hdaudio.h
> >>> @@ -95,6 +95,7 @@ struct hdac_device {
> >>>  	bool lazy_cache:1;	/* don't wake up for writes */
> >>>  	bool caps_overwriting:1; /* caps overwrite being in process */
> >>>  	bool cache_coef:1;	/* cache COEF read/write too */
> >>> +	bool is_hdmi:1;		/* a HDMI/DP codec */
> >>>  	unsigned int registered:1; /* codec was registered */
> >>>  };
> >>>  
> >>> --- a/sound/pci/hda/patch_hdmi.c
> >>> +++ b/sound/pci/hda/patch_hdmi.c
> >>> @@ -2597,6 +2597,7 @@ static int patch_generic_hdmi(struct hda_codec *codec)
> >>>  	}
> >>>  
> >>>  	generic_hdmi_init_per_pins(codec);
> >>> +	codec->core.is_hdmi = true;
> >>>  	return 0;
> >>>  }
> >>>  
> >>> @@ -3472,6 +3473,7 @@ static int patch_simple_hdmi(struct hda_codec *codec,
> >>>  	spec->pcm_playback = simple_pcm_playback;
> >>>  
> >>>  	codec->patch_ops = simple_hdmi_patch_ops;
> >>> +	codec->core.is_hdmi = true;
> >>>  
> >>>  	return 0;
> >>>  }
> >>
> >> I see,  so this is what I was not sure how to do ;)
> >> I will rework the series and resend tomorrow.
> >>
> >> Thanks for the code snippet, I will make you as author of it, if it is
> >> OK for you.
> > 
> > Sure, no problem.
> 
> The flag does not work with SOF stack which uses the hdac_hda codec driver:
> 
> patch_generic_hdmi() and patch_simple_hdmi() is not entered at all, so
> the flag is not set.
> 
> The codec driver have is_hdmi_codec() helper to check the struct
> hda_pcm.pcm_type, but that is not set early enough either.
> 
> The is HDMI or not needs to be known in hdac_hda_dev_probe(), I think
> this was one of the reason I have opted to have the exported function.
> We just don't have other information at the dev probe time.
> 
> # dmesg | grep peter
> [    3.810841] [peter] hdac_hda_dev_probe: is_hdmi_codec(): 0
> [    3.810846] [peter] hdac_hda_dev_probe: hdev->is_hdmi: 0
> [    3.810848] [peter] hdac_hda_dev_probe: snd_hda_device_is_hdmi(): 0
> ...
> [    3.814497] [peter] hdac_hda_dev_probe: is_hdmi_codec(): 0
> [    3.814499] [peter] hdac_hda_dev_probe: hdev->is_hdmi: 0
> [    3.814500] [peter] hdac_hda_dev_probe: snd_hda_device_is_hdmi(): 1
> ...
> [    3.986610] [peter] generic_hdmi_build_pcms: ENTER
> [    3.986627] [peter] hdac_hda_codec_probe: is_hdmi_codec(): 1
> ...
> [    3.996383] [peter] snd_hda_parse_pin_defcfg: ENTER
> [    4.001562] [peter] hdac_hda_codec_probe: is_hdmi_codec(): 0

Hm...  I still find it's a bad move to use an exported symbol from
another codec driver.

And, I wonder what if you have a system that has only one HDMI codec
without analog one?  Would it still work with your change? 


Takashi

  reply	other threads:[~2023-11-28  9:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 13:02 [PATCH 0/2] ALSA/ASoC: hdmi/hdac_hda: Conditionally register dais Peter Ujfalusi
2023-11-27 13:02 ` [PATCH 1/2] ALSA: hda/hdmi: Add helper function to check if a device is HDMI codec Peter Ujfalusi
2023-11-27 13:18   ` Takashi Iwai
2023-11-27 14:12     ` Péter Ujfalusi
2023-11-27 14:31       ` Takashi Iwai
2023-11-27 14:45         ` Péter Ujfalusi
2023-11-27 15:20           ` Takashi Iwai
2023-11-27 15:40             ` Péter Ujfalusi
2023-11-27 15:43               ` Takashi Iwai
2023-11-28  9:10                 ` Péter Ujfalusi
2023-11-28  9:39                   ` Takashi Iwai [this message]
2023-11-28  9:53                     ` Péter Ujfalusi
2023-11-28 10:02                       ` Takashi Iwai
2023-11-28 10:16                         ` Péter Ujfalusi
2023-11-28 10:48                           ` Takashi Iwai
2023-11-28 11:58                             ` Péter Ujfalusi
2023-11-28 12:16                               ` Péter Ujfalusi
2023-11-28 13:02                                 ` Takashi Iwai
2023-11-27 13:02 ` [PATCH 2/2] ASoC: hdac_hda: Conditionally register dais for HDMI and Analog Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1eimd23.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox