Skip to contentSkip to conversation

ALSA: hda/realtek: Add quirk for ASRock NUC Box 1100

PATCH Superseded Werner Sembach 2 participants 3 messages Nov 12, 2021 Sound

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda/realtek: Add quirk for ASRock NUC Box 1100

This applies a SND_PCI_QUIRK(...) to the ASRock NUC Box 1100 series. This fixes the issue of the headphone jack not being detected unless warm rebooted from a certain other OS.

When booting a certain other OS some coeff settings are changed that enable the audio jack. These settings are preserved on a warm reboot and can be easily dumped.

The relevant indexes and values where gathered by naively diff-ing and reading a working and a non-working coeff dump.

---
 sound/pci/hda/patch_realtek.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
sound/pci/hda/patch_realtek.c +25 -0
index 2f1727faec69..2aef9866f170 100644
@@ -6521,6 +6521,25 @@ static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *co
 	alc_write_coef_idx(codec, 0x45, 0x5089);
 }
 
+static void alc233_fixup_asrock_nuc_box_1100_no_audio_jack(struct hda_codec *codec,
+							     const struct hda_fixup *fix,
+							     int action)
+{
+	/*
+	 * The audio jack input and output is not detected on the ASRock NUC Box 1100 series when
+	 * cold booting without this fix. Warm rebooting from a certain other OS makes the audio
+	 * functional, as COEF settings are preserved in this case. This fix sets these altered
+	 * COEF values as the default.
+	 */
+	alc_write_coef_idx(codec, 0x1a, 0x9003);
+	alc_write_coef_idx(codec, 0x1b, 0x0e2b);
+	alc_write_coef_idx(codec, 0x37, 0xfe06);
+	alc_write_coef_idx(codec, 0x38, 0x4981);
+	alc_write_coef_idx(codec, 0x45, 0xd489);
+	alc_write_coef_idx(codec, 0x46, 0x0074);
+	alc_write_coef_idx(codec, 0x49, 0x0149);
+}
+
 enum {
 	ALC269_FIXUP_GPIO2,
 	ALC269_FIXUP_SONY_VAIO,
@@ -6740,6 +6759,7 @@ enum {
 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
 	ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS,
 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
+	ALC233_FIXUP_ASROCK_NUC_BOX_1100_NO_AUDIO_JACK,
 };
 
 static const struct hda_fixup alc269_fixups[] = {
@@ -8460,6 +8480,10 @@ static const struct hda_fixup alc269_fixups[] = {
 		.chained = true,
 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
 	},
+	[ALC233_FIXUP_ASROCK_NUC_BOX_1100_NO_AUDIO_JACK] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc233_fixup_asrock_nuc_box_1100_no_audio_jack,
+	},
 };
 
 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -8894,6 +8918,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
+	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_ASROCK_NUC_BOX_1100_NO_AUDIO_JACK),
 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
Signature · 1 line
2.25.1
#1 lore raw
Quoted 9 lines · Werner Sembach

This applies a SND_PCI_QUIRK(...) to the ASRock NUC Box 1100 series. This fixes the issue of the headphone jack not being detected unless warm rebooted from a certain other OS.

When booting a certain other OS some coeff settings are changed that enable the audio jack. These settings are preserved on a warm reboot and can be easily dumped.

Quoted 5 lines

The relevant indexes and values where gathered by naively diff-ing and reading a working and a non-working coeff dump.

Thanks, the change looks almost good but in some small details:

sound/pci/hda/patch_realtek.c static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *co · line 6526

Quoted 3 lines
sound/pci/hda/patch_realtek.c +3 -0
+static void alc233_fixup_asrock_nuc_box_1100_no_audio_jack(struct hda_codec *codec,
+							     const struct hda_fixup *fix,
+							     int action)

The function name could be a bit shorter? It might be possible that the fixup could be re-used by others, too.

sound/pci/hda/patch_realtek.c static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *co · line 6532

Quoted 6 lines
sound/pci/hda/patch_realtek.c +6 -0
+{
+	/*
+	 * The audio jack input and output is not detected on the ASRock NUC Box 1100 series when
+	 * cold booting without this fix. Warm rebooting from a certain other OS makes the audio
+	 * functional, as COEF settings are preserved in this case. This fix sets these altered
+	 * COEF values as the default.

Fitting in 80 columns is still preferred, to align with other code.

sound/pci/hda/patch_realtek.c static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *co · line 6540

Quoted 7 lines
sound/pci/hda/patch_realtek.c +7 -0
+	alc_write_coef_idx(codec, 0x1a, 0x9003);
+	alc_write_coef_idx(codec, 0x1b, 0x0e2b);
+	alc_write_coef_idx(codec, 0x37, 0xfe06);
+	alc_write_coef_idx(codec, 0x38, 0x4981);
+	alc_write_coef_idx(codec, 0x45, 0xd489);
+	alc_write_coef_idx(codec, 0x46, 0x0074);
+	alc_write_coef_idx(codec, 0x49, 0x0149);

Can be put in the coef_fw table and processed via
alc_process_coef_fw() instead?

thanks,

Takashi

#2 lore raw

Am 12.11.21 um 11:07 schrieb Takashi Iwai:

Quoted 42 lines
Quoted 8 lines · Werner Sembach

This applies a SND_PCI_QUIRK(...) to the ASRock NUC Box 1100 series. This fixes the issue of the headphone jack not being detected unless warm rebooted from a certain other OS.

When booting a certain other OS some coeff settings are changed that enable the audio jack. These settings are preserved on a warm reboot and can be easily dumped.

Quoted 5 lines

The relevant indexes and values where gathered by naively diff-ing and reading a working and a non-working coeff dump.

Thanks, the change looks almost good but in some small details:

sound/pci/hda/patch_realtek.c static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *co · line 6526

Quoted 3 lines
sound/pci/hda/patch_realtek.c +3 -0
+static void alc233_fixup_asrock_nuc_box_1100_no_audio_jack(struct hda_codec *codec,
+							     const struct hda_fixup *fix,
+							     int action)

The function name could be a bit shorter? It might be possible that the fixup could be re-used by others, too.

sound/pci/hda/patch_realtek.c static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *co · line 6532

Quoted 6 lines
sound/pci/hda/patch_realtek.c +6 -0
+{
+	/*
+	 * The audio jack input and output is not detected on the ASRock NUC Box 1100 series when
+	 * cold booting without this fix. Warm rebooting from a certain other OS makes the audio
+	 * functional, as COEF settings are preserved in this case. This fix sets these altered
+	 * COEF values as the default.

Fitting in 80 columns is still preferred, to align with other code.

sound/pci/hda/patch_realtek.c static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *co · line 6540

Quoted 7 lines
sound/pci/hda/patch_realtek.c +7 -0
+	alc_write_coef_idx(codec, 0x1a, 0x9003);
+	alc_write_coef_idx(codec, 0x1b, 0x0e2b);
+	alc_write_coef_idx(codec, 0x37, 0xfe06);
+	alc_write_coef_idx(codec, 0x38, 0x4981);
+	alc_write_coef_idx(codec, 0x45, 0xd489);
+	alc_write_coef_idx(codec, 0x46, 0x0074);
+	alc_write_coef_idx(codec, 0x49, 0x0149);

Can be put in the coef_fw table and processed via
alc_process_coef_fw() instead?

Quoted 3 lines

thanks,

Takashi

Done. I was not aware of the alc_process_coef_fw() function, thanks.

Testing now and then sending v2.

Kind regards,

Werner Sembach