Azalia no Audio after suspend

2020-04-23
1 min read

I have been running -current on my laptop the last couple of weeks and after watching some videos I realized that audio playback is gone after I suspended my laptop. Reading through the code I arrived at this solution to restore audio playback after suspend.

The patch has been tested on this card these last couple of days without any issues.

audio0 at azalia0 azalia0 at pci0 dev 27 function 0 “Intel 82801GB HD Audio” rev 0x02: msi azalia0: codecs: Realtek ALC272 azalia0: codecs: Realtek ALC272

Index: azalia.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/azalia.c,v
retrieving revision 1.257
diff -u -p -u -p -r1.257 azalia.c
--- azalia.c	9 Jun 2020 03:36:05 -0000	1.257
+++ azalia.c	9 Jul 2020 21:15:32 -0000
@@ -904,6 +904,15 @@ azalia_init(azalia_t *az, int resuming)
 	if (err)
 		return(err);
 
+	if (resuming) {
+		err = azalia_init_codecs(az);
+		if (err)
+			return(err);
+		err = azalia_init_streams(az);
+		if (err)
+			return(err);
+	}
+
 	AZ_WRITE_4(az, INTCTL,
 	    AZ_READ_4(az, INTCTL) | HDA_INTCTL_CIE | HDA_INTCTL_GIE);