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

From: Mohan Kumar D
Date: Tue Apr 05 2022 - 02:05:21 EST



On 4/5/2022 11:27 AM, Takashi Iwai wrote:
External email: Use caution opening links or attachments


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?
The reason is, the Jack poll thread implemented in hda_codec.c runs only when HDACODEC is in runtime resume state. But the problem trying resolve here is something opposite, bcaz when hdacodec is in runtime resume state unsol event would work but not during suspend state. So either need to make some changes on hda_codec.c specific to tegra or make it on tegra specific driver. So I went with second option.


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;