Re: [PATCH] Azalia bug in codec Realtek ALC892

2023-01-05 Thread Jose Maldonado

El 5/1/23 a las 8:07, Alexandre Ratchov escribió:



Your device seems to stop because the azalia pci host stops (probably
interrupts stop and a reboot is needed), while this diff is about the


Yes,exactly. A quick review using vmstat -i show that, azalia interrupts 
is frozen, only hard reboot resolve this temporaly.



azalia codec (i.e. about handling the "analog" parts). So, I'm very
surprised this fixes the random audio hangs (though any strange
interaction between the host and the codec can't be excluded).



For the patch I investigate various things:

1.- Using sndiod -mplay option the audio stuck randomly. This workaround 
is very use in other cases, but in mine don´t work.


2.- Disabled MSI signaling. In the Hudson audio problem, disable MSI 
signaling solve problem. AMD Summit Ridge/Raven Ridge HD Audio need this 
fix for work correctly, but in my case the audio don´t work.


3.- I tried using PCIE SNOOP aproximation (used in AMD Summit 
Ridge/Raven Ridge HD Audio) but again, the audio don't work.


4.- Investigating ALC892 datasheet, I can see that ALC888 and ALC892 are 
"mostly" same codecs in specs. ALC888 use same code:


* this->qrks |= AZ_QRK_WID_CDIN_1C | AZ_QRK_WID_BEEP_1D; *

In this case I use a conditional to apply this code and it works, there 
is no audio problem with this patch. The only problem I see is that it 
is very specific to my hardware case (subid), but since the hardware and 
its configuration can change, enabling the option globally to the codec 
may end up affecting the audio of other configurations.



Are there other changes that may have fixed audio? Any BIOS tweaks?
Suspend-resume cycles? Any devices disabled meanwhile?



No, BIOS config is same, not changes or updates. Suspend-resume is a 
feature that I'm not use. Same device, nothing disabled.





Could you test with and without the diff applied in exactly the same
conditions?



I test the patch using this approx:

1.- Using mpd for listen audio only. Without patch audio stuck in a 
short and randomly time (few minutes, generally less a hour)


2.- Using various apps streaming audio (Chrome, Firefox and MPD, 
precisely) in same time, the audio stuck very quickly without patch.


3.- Recording, audio stuck in few minutes (using Audacity).


In all case, the patch resolve problem for me, various hours 
playing/recording and no audio stuck.




These hangs are a longstanding problem (and hard to debug because of
the randomness of the hangs), so I'm very intested in understanding
what's causing it. Thanks


Yeah, I can see this, in my investigation I see reports from 2018, and 
in various case the issue is very strange.



*** Note: Sorry for private, I'm remember how use the mailing list ***

--
Dios en su cielo, todo bien en la Tierra




Re: [PATCH] Azalia bug in codec Realtek ALC892

2023-01-05 Thread Jose Maldonado

El 5/1/23 a las 1:41, Greg Steuck escribió:


Thanks for the contribution Jose. The diff is OK gnezdo.  Aaron, in case
you still have that hardware, maybe you would like to test/commit?

Thanks
Greg


Thanks! The patch is very specific in hardware but maybe work in other 
cases, need testing.


--
Dios en su cielo, todo bien en la Tierra



Re: [PATCH] Azalia bug in codec Realtek ALC892

2023-01-05 Thread Alexandre Ratchov
On Tue, Jan 03, 2023 at 09:51:46PM -0400, Jose Maldonado wrote:
> Hi, everyone!
> 
> Right now I'm using OBSD 7.2 (my first time in OBSD) and the only issue is
> my onboard audio. The audio randomly stuck (listen music or not, with high
> CPU use or not) and only a hard reboot give me back audio to next stuck.
> 
> In dmesg don´t show nothing, but sndiod - give me this output:
> 
> * snd/0 watchdog timeout *
> 
> The error appear in debug info and my audio is gone. The issue is not new
> more info in this links:
> 
> https://www.reddit.com/r/openbsd/comments/mybklx/keep_losing_audio_with_azalia_on_current/
> 
> https://www.mail-archive.com/tech@openbsd.org/msg46701.html
> 
> https://deftly.net/posts/2018-10-15-openbsd-on-lenovo-a485.html
> 
> With this info I realized this patch (directly on OBSD-stable source, sorry)
> and...work! Not audio problems in my PC using this patch (one day testing,
> multiple apps using audio, not stuck/not latency problems).
> 
> If anybody can test, verify and give OK to this simple patch, I would
> appreciate it (and I'm sure others would too, specially living in -release
> versions).
> 
> PATCH:
> 
> Index: azalia_codec.c
> ===
> RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v
> retrieving revision 1.189
> diff -u -p -u -r1.189 azalia_codec.c
> --- azalia_codec.c8 Sep 2022 01:35:39 -   1.189
> +++ azalia_codec.c2 Jan 2023 19:42:28 -
> @@ -312,6 +312,9 @@ azalia_codec_init_vtbl(codec_t *this)
>   break;
>   case 0x10ec0892:
>   this->name = "Realtek ALC892";
> + if (this->subid == 0x1462ec95) {
> + this->qrks |= AZ_QRK_WID_CDIN_1C | AZ_QRK_WID_BEEP_1D;
> + }
>   break;
>   case 0x10ec0897:
>   this->name = "Realtek ALC897";
> 
> 

Your device seems to stop because the azalia pci host stops (probably
interrupts stop and a reboot is needed), while this diff is about the
azalia codec (i.e. about handling the "analog" parts). So, I'm very
surprised this fixes the random audio hangs (though any strange
interaction between the host and the codec can't be excluded).

Are there other changes that may have fixed audio? Any BIOS tweaks?
Suspend-resume cycles? Any devices disabled meanwhile?

Could you test with and without the diff applied in exactly the same
conditions?

These hangs are a longstanding problem (and hard to debug because of
the randomness of the hangs), so I'm very intested in understanding
what's causing it. Thanks



Re: [PATCH] Azalia bug in codec Realtek ALC892

2023-01-04 Thread Greg Steuck
Jose Maldonado  writes:

> Right now I'm using OBSD 7.2 (my first time in OBSD) and the only issue 
> is my onboard audio. The audio randomly stuck (listen music or not, with 
> high CPU use or not) and only a hard reboot give me back audio to next 
> stuck.
>
> In dmesg don´t show nothing, but sndiod - give me this output:
>
> * snd/0 watchdog timeout *
>
> The error appear in debug info and my audio is gone. The issue is not 
> new more info in this links:
>
> https://www.reddit.com/r/openbsd/comments/mybklx/keep_losing_audio_with_azalia_on_current/
>
> https://www.mail-archive.com/tech@openbsd.org/msg46701.html
>
> https://deftly.net/posts/2018-10-15-openbsd-on-lenovo-a485.html
...

> PATCH:
>
> Index: azalia_codec.c
> ===
> RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v
> retrieving revision 1.189
> diff -u -p -u -r1.189 azalia_codec.c
> --- azalia_codec.c8 Sep 2022 01:35:39 -   1.189
> +++ azalia_codec.c2 Jan 2023 19:42:28 -
> @@ -312,6 +312,9 @@ azalia_codec_init_vtbl(codec_t *this)
>   break;
>   case 0x10ec0892:
>   this->name = "Realtek ALC892";
> + if (this->subid == 0x1462ec95) {
> + this->qrks |= AZ_QRK_WID_CDIN_1C | AZ_QRK_WID_BEEP_1D;
> + }
>   break;
>   case 0x10ec0897:
>   this->name = "Realtek ALC897";

Thanks for the contribution Jose. The diff is OK gnezdo.  Aaron, in case
you still have that hardware, maybe you would like to test/commit?

Thanks
Greg



[PATCH] Azalia bug in codec Realtek ALC892

2023-01-03 Thread Jose Maldonado

Hi, everyone!

Right now I'm using OBSD 7.2 (my first time in OBSD) and the only issue 
is my onboard audio. The audio randomly stuck (listen music or not, with 
high CPU use or not) and only a hard reboot give me back audio to next 
stuck.


In dmesg don´t show nothing, but sndiod - give me this output:

* snd/0 watchdog timeout *

The error appear in debug info and my audio is gone. The issue is not 
new more info in this links:


https://www.reddit.com/r/openbsd/comments/mybklx/keep_losing_audio_with_azalia_on_current/

https://www.mail-archive.com/tech@openbsd.org/msg46701.html

https://deftly.net/posts/2018-10-15-openbsd-on-lenovo-a485.html

With this info I realized this patch (directly on OBSD-stable source, 
sorry) and...work! Not audio problems in my PC using this patch (one day 
testing, multiple apps using audio, not stuck/not latency problems).


If anybody can test, verify and give OK to this simple patch, I would 
appreciate it (and I'm sure others would too, specially living in 
-release versions).


PATCH:

Index: azalia_codec.c
===
RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v
retrieving revision 1.189
diff -u -p -u -r1.189 azalia_codec.c
--- azalia_codec.c  8 Sep 2022 01:35:39 -   1.189
+++ azalia_codec.c  2 Jan 2023 19:42:28 -
@@ -312,6 +312,9 @@ azalia_codec_init_vtbl(codec_t *this)
break;
case 0x10ec0892:
this->name = "Realtek ALC892";
+   if (this->subid == 0x1462ec95) {
+   this->qrks |= AZ_QRK_WID_CDIN_1C | AZ_QRK_WID_BEEP_1D;
+   }
break;
case 0x10ec0897:
this->name = "Realtek ALC897";


--
Dios en su cielo, todo bien en la TierraIndex: azalia_codec.c
===
RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v
retrieving revision 1.189
diff -u -p -u -r1.189 azalia_codec.c
--- azalia_codec.c	8 Sep 2022 01:35:39 -	1.189
+++ azalia_codec.c	2 Jan 2023 19:42:28 -
@@ -312,6 +312,9 @@ azalia_codec_init_vtbl(codec_t *this)
 		break;
 	case 0x10ec0892:
 		this->name = "Realtek ALC892";
+		if (this->subid == 0x1462ec95) {
+			this->qrks |= AZ_QRK_WID_CDIN_1C | AZ_QRK_WID_BEEP_1D;
+		}
 		break;
 	case 0x10ec0897:
 		this->name = "Realtek ALC897";