--- a/dev/pci/azalia_codec.c
+++ b/dev/pci/azalia_codec.c
@@ -83,6 +83,13 @@
 		this->name = "Realtek ALC221";
 		this->qrks |= AZ_QRK_WID_CDIN_1C | AZ_QRK_WID_BEEP_1D;
 		break;
+	case 0x10ec0255:
+		this->name = "Realtek ALC255";
+		DPRINTF(("Realtek ALC255 0x%8x\n", this->subid));
+		if (this->subid == 0x193e10cf) { /* FUJITSU S938 */
+			this->qrks |= AZ_QRK_WID_HEADSET;
+		}
+		break;
 	case 0x10ec0260:
 		this->name = "Realtek ALC260";
 		if (this->subid == 0x008f1025)
@@ -656,6 +663,10 @@
 			    CORB_GET_PIN_SENSE, 0, &result);
 			if (!err && (result & CORB_PS_PRESENCE))
 				vol = 1;
+
+			// switch microphone to mic2
+			if (!err)
+				notify_hp_sense(result & CORB_PS_PRESENCE);
 		}
 		if (err)
 			break;
@@ -2590,6 +2601,14 @@
 		w->enable = 1;
 	}
 
+	if (this->qrks & AZ_QRK_WID_HEADSET &&
+	    nid == 0x19) {
+		/* Fujitsu S398 headphone jack */
+		w->d.pin.config = 0x03a19120;
+		azalia_pin_config_ov(w, CORB_CD_DEVICE_MASK, CORB_CD_MICIN);
+		w->enable = 1;
+	}
+
 	if (this->qrks & AZ_QRK_WID_CDIN_1C &&
 	    nid == 0x1c && w->enable == 0 && w->d.pin.device == CORB_CD_CD) {
 		azalia_pin_config_ov(w, CORB_CD_PORT_MASK, CORB_CD_FIXED);