Re: [PATCH] ALSA: hda/tegra: Fix hda Jack detection

From: Takashi Iwai
Date: Tue Apr 05 2022 - 01:57:16 EST


On Tue, 05 Apr 2022 05:26:07 +0200,
Mohan Kumar wrote:
>
> Tegra HDA Jack detection logic doesn't work when the HDACODEC
> in runtime suspended state as unsol event won't be triggered
> during D3 state. As pulseaudio server in userspace rely on the
> jack mixer control status to show the audio devices in gui and
> any display sink device hotplug event during D3 state will never
> updates the jack status which will result in no audio device option
> available in userspace settings.
>
> The possible option available to resolve this issue for multiple
> tegra platforms is to use Jack polling method for every 5 seconds.
> Also to make Jack detection work seamlessly the Jack worker thread
> needs to run continuously after HDA sound card registered
> irrespective of whether HDMI sink device connected or not, but the
> Jack state update call happens only when Codec is not powered on.
>
> Signed-off-by: Mohan Kumar <mkumard@xxxxxxxxxx>

Hmm, any reason not to use the standard jackpoll stuff that is already
implemented in HD-audio controller side? That is, doesn't the
following oneliner work instead?


thanks,

Takashi

-- 8< --
--- a/sound/pci/hda/hda_tegra.c
+++ b/sound/pci/hda/hda_tegra.c
@@ -421,6 +421,7 @@ static int hda_tegra_create(struct snd_card *card,
chip->driver_type = driver_caps & 0xff;
chip->dev_index = 0;
INIT_LIST_HEAD(&chip->pcm_list);
+ chip->jackpoll_interval = msecs_to_jiffies(5000);

chip->codec_probe_mask = -1;