From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1AD6A5 for ; Tue, 28 Nov 2023 02:48:13 -0800 (PST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 559E01F74B; Tue, 28 Nov 2023 10:48:12 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 03C0113763; Tue, 28 Nov 2023 10:48:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id QNchO2vFZWVvdwAAD6G6ig (envelope-from ); Tue, 28 Nov 2023 10:48:11 +0000 Date: Tue, 28 Nov 2023 11:48:11 +0100 Message-ID: <87plzum9w4.wl-tiwai@suse.de> From: Takashi Iwai To: =?ISO-8859-1?Q?P=E9ter?= Ujfalusi 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 In-Reply-To: <96d334c1-9c6b-415b-bfb8-1fab29b1d223@linux.intel.com> References: <20231127130245.24295-1-peter.ujfalusi@linux.intel.com> <20231127130245.24295-2-peter.ujfalusi@linux.intel.com> <87jzq3pc6r.wl-tiwai@suse.de> <87cyvvp8t6.wl-tiwai@suse.de> <8ede931b-8c9c-4b95-83e5-5f0db9819e8e@linux.intel.com> <878r6jp6jd.wl-tiwai@suse.de> <875y1np5g2.wl-tiwai@suse.de> <87y1eimd23.wl-tiwai@suse.de> <87ttp6mc04.wl-tiwai@suse.de> <96d334c1-9c6b-415b-bfb8-1fab29b1d223@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Level: X-Rspamd-Server: rspamd1 Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Queue-Id: 559E01F74B X-Spam-Score: -4.00 X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] On Tue, 28 Nov 2023 11:16:00 +0100, Péter Ujfalusi wrote: > > > > On 28/11/2023 12:02, Takashi Iwai wrote: > > On Tue, 28 Nov 2023 10:53:56 +0100, > > Péter Ujfalusi wrote: > >> > >> > >> > >> On 28/11/2023 11:39, Takashi Iwai wrote: > >>> Hm... I still find it's a bad move to use an exported symbol from > >>> another codec driver. > >> > >> The other option is to check for 0x4 (or address 2), but I'm not sure if > >> this is Intel only or universally true for HDMI codecs. > >> > >>> 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? > >> > >> Yes, it works with only HDMI codec (for example on SoundWire laptops) or > >> with UP2 board which only have HDMI audio support by default. > > > > Interesting. With your patch 2, hdac_hda_hdmi_codec is without the > > DAPM definitions, and even if that's the only one that is registered, > > it will still work? So it means that it works without DAPM > > definitions at all? > > Well, it is a bit more 'interesting' from that angle. > for patch two we needed: > https://lore.kernel.org/linux-sound/20231124124015.15878-1-peter.ujfalusi@linux.intel.com/ Ouch, this kind of information has to be mentioned in the patch description. Otherwise one would take only this series and face a problem easily. I can imagine such a problem on the stable tree. > The reason is that prior to patch 2 the analog codec would create the > DAPM widgets for the HDMI also and the DAPM route would be available but > the HDMI would still not work: > we had PCMs for HDMI but non operational ones. > > If we had a codec+HDMI then we would have the warnings that the second > codec is registering the same DAPM widgets again. > > With the linked patch plus this series we will not register the DAPM > widgets and the machine driver would drop the routes. > The PCMs will be still created and they will be still non functional but > we will have no warning when the system have two codecs. > > The core HDA+patch_hdmi is needed for the hdac_hda to have working HDMI > audio, but the patch init is after the codec driver's probe: > > # dmesg | grep peter > [ 4088.698111] [peter] hdac_hda_dev_probe: is_hdmi_codec(): 0 > [ 4088.698112] [peter] hdac_hda_dev_probe: hdev->is_hdmi: 0 > [ 4088.698114] [peter] hdac_hda_dev_probe: snd_hda_device_is_hdmi(): 1 > [ 4088.862882] [peter] patch_i915_tgl_hdmi: ENTER > [ 4088.862886] [peter] alloc_intel_hdmi: ENTER > [ 4088.872269] [peter] generic_hdmi_build_pcms: ENTER > [ 4088.872279] [peter] hdac_hda_codec_probe: is_hdmi_codec(): 1 > > We need to know if the codec is HDMI or not in hdac_hda_dev_probe() > > I would rather not risk to move the hdac_hda as Intel only using address > 2 as HDMI indication - which I'm still not sure if it is Intel only or > generic HDA convention. Sure, it doesn't sound right, either. Can we then add DAPM widgets and routes later conditionally instead of having it in component driver definition? Takashi