public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: Poll jack events for LS7A HD-Audio
@ 2024-11-15 15:06 Huacai Chen
  2024-11-18 13:41 ` Takashi Iwai
  2024-11-20  7:02 ` Mingcong Bai
  0 siblings, 2 replies; 3+ messages in thread
From: Huacai Chen @ 2024-11-15 15:06 UTC (permalink / raw)
  To: Takashi Iwai, Jaroslav Kysela, Huacai Chen
  Cc: linux-sound, linux-kernel, Xuerui Wang, Jiaxun Yang, Huacai Chen,
	stable

LS7A HD-Audio disable interrupts and use polling mode due to hardware
drawbacks. As a result, unsolicited jack events are also unusable. If
we want to support headphone hotplug, we need to also poll jack events.

Here we use 1500ms as the poll interval if no module parameter specify
it.

Cc: stable@vger.kernel.org
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 sound/pci/hda/hda_intel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b4540c5cd2a6..5060d5428caf 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1867,6 +1867,8 @@ static int azx_first_init(struct azx *chip)
 		bus->polling_mode = 1;
 		bus->not_use_interrupts = 1;
 		bus->access_sdnctl_in_dword = 1;
+		if (!chip->jackpoll_interval)
+			chip->jackpoll_interval = msecs_to_jiffies(1500);
 	}
 
 	err = pcim_iomap_regions(pci, 1 << 0, "ICH HD audio");
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ALSA: hda: Poll jack events for LS7A HD-Audio
  2024-11-15 15:06 [PATCH] ALSA: hda: Poll jack events for LS7A HD-Audio Huacai Chen
@ 2024-11-18 13:41 ` Takashi Iwai
  2024-11-20  7:02 ` Mingcong Bai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2024-11-18 13:41 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Takashi Iwai, Jaroslav Kysela, Huacai Chen, linux-sound,
	linux-kernel, Xuerui Wang, Jiaxun Yang, stable

On Fri, 15 Nov 2024 16:06:53 +0100,
Huacai Chen wrote:
> 
> LS7A HD-Audio disable interrupts and use polling mode due to hardware
> drawbacks. As a result, unsolicited jack events are also unusable. If
> we want to support headphone hotplug, we need to also poll jack events.
> 
> Here we use 1500ms as the poll interval if no module parameter specify
> it.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

Thanks, applied now.


Takashi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ALSA: hda: Poll jack events for LS7A HD-Audio
  2024-11-15 15:06 [PATCH] ALSA: hda: Poll jack events for LS7A HD-Audio Huacai Chen
  2024-11-18 13:41 ` Takashi Iwai
@ 2024-11-20  7:02 ` Mingcong Bai
  1 sibling, 0 replies; 3+ messages in thread
From: Mingcong Bai @ 2024-11-20  7:02 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Takashi Iwai, Jaroslav Kysela, Huacai Chen, linux-sound,
	linux-kernel, Xuerui Wang, Jiaxun Yang, stable

Hi Huacai,

在 2024-11-15 23:06,Huacai Chen 写道:
> LS7A HD-Audio disable interrupts and use polling mode due to hardware
> drawbacks. As a result, unsolicited jack events are also unusable. If
> we want to support headphone hotplug, we need to also poll jack events.
> 
> Here we use 1500ms as the poll interval if no module parameter specify
> it.

A little late since Takashi Iwai already queued this patch, but for the 
sake of the record, I have tested this patch and found that it resolved 
the issue where hot-plugged (plugged in after boot) headphones were not 
detected on the following boards:

- Loongson XA61200
- Loongson XA612A0
- Loongson Loongson-3A5000-HV-7A2000-1w-V0.1-EVB
- ASUS XC-LS3A6M

Hooray.

But I would also like to note that this issue was only reproducible on 
Loongson (or Loongson-drived, in the case of that ASUS board) firmware. 
However, with the XA61200 board, when using Byosoft's firmware 
(https://github.com/loongson/Firmware/blob/main/6000Series/PC/XA61200/Byosoft_3A6000_7A2000_CRB_R0103.bin), 
audio jack hot-plugging works with or without this patch. So I do 
suspect that there are still a firmware issue at play.

Bottom line - this patch should have fixed audio jack hot-plugging for 
most users.

Best Regards,
Mingcong Bai

> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
>  sound/pci/hda/hda_intel.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index b4540c5cd2a6..5060d5428caf 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -1867,6 +1867,8 @@ static int azx_first_init(struct azx *chip)
>  		bus->polling_mode = 1;
>  		bus->not_use_interrupts = 1;
>  		bus->access_sdnctl_in_dword = 1;
> +		if (!chip->jackpoll_interval)
> +			chip->jackpoll_interval = msecs_to_jiffies(1500);
>  	}
> 
>  	err = pcim_iomap_regions(pci, 1 << 0, "ICH HD audio");

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-20  7:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15 15:06 [PATCH] ALSA: hda: Poll jack events for LS7A HD-Audio Huacai Chen
2024-11-18 13:41 ` Takashi Iwai
2024-11-20  7:02 ` Mingcong Bai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox