From: Sasha Levin Date: Thu, 25 May 2023 14:38:28 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: review~92 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b258123ccaf5a85f92509a8763e3d7c437879311;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/add-acer-aspire-ethos-8951g-model-quirk.patch b/queue-4.19/add-acer-aspire-ethos-8951g-model-quirk.patch new file mode 100644 index 00000000000..6621b19afc7 --- /dev/null +++ b/queue-4.19/add-acer-aspire-ethos-8951g-model-quirk.patch @@ -0,0 +1,160 @@ +From c515d72299c6c37fdb5e41780b6c94eba561dd61 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Sep 2019 11:33:43 +0200 +Subject: Add Acer Aspire Ethos 8951G model quirk + +From: Sergey Bostandzhyan + +[ Upstream commit 00066e9733f629e536f6b7957de2ce11a85fe15a ] + +This notebook has 6 built in speakers for 5.1 surround support, however +only two got autodetected and have also not been assigned correctly. + +This patch enables all speakers and also fixes muting when headphones are +plugged in. + +The speaker layout is as follows: + +pin 0x15 Front Left / Front Right +pin 0x18 Front Center / Subwoofer +pin 0x1b Rear Left / Rear Right (Surround) + +The quirk will be enabled automatically on this hardware, but can also be +activated manually via the model=aspire-ethos module parameter. + +Caveat: pin 0x1b is shared between headphones jack and surround speakers. +When headphones are plugged in, the surround speakers get muted +automatically by the hardware, however all other speakers remain +unmuted. Currently it's not possible to make use of the generic automute +function in the driver, because such shared pins are not supported. + +If we would change the pin settings to identify the pin as headphones, +the surround channel and thus the ability to select 5.1 profiles would +get lost. + +This quirk solves the above problem by monitoring jack state of 0x1b and +by connecting/disconnecting all remaining speaker pins when something +gets plugged in or unplugged from the headphones jack port. + +Signed-off-by: Sergey Bostandzhyan +Link: https://lore.kernel.org/r/20190906093343.GA7640@xn--80adja5bqm.su +Signed-off-by: Takashi Iwai +Stable-dep-of: 90670ef774a8 ("ALSA: hda/realtek: Add a quirk for HP EliteDesk 805") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 71 +++++++++++++++++++++++++++++++++++ + 1 file changed, 71 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 546872e724275..98b6e93084e5e 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8511,6 +8511,45 @@ static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, + } + } + ++static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, ++ struct hda_jack_callback *cb) ++{ ++ /* surround speakers at 0x1b already get muted automatically when ++ * headphones are plugged in, but we have to mute/unmute the remaining ++ * channels manually: ++ * 0x15 - front left/front right ++ * 0x18 - front center/ LFE ++ */ ++ if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { ++ snd_hda_set_pin_ctl_cache(codec, 0x15, 0); ++ snd_hda_set_pin_ctl_cache(codec, 0x18, 0); ++ } else { ++ snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); ++ snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); ++ } ++} ++ ++static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ /* Pin 0x1b: shared headphones jack and surround speakers */ ++ if (!is_jack_detectable(codec, 0x1b)) ++ return; ++ ++ switch (action) { ++ case HDA_FIXUP_ACT_PRE_PROBE: ++ snd_hda_jack_detect_enable_callback(codec, 0x1b, ++ alc662_aspire_ethos_mute_speakers); ++ break; ++ case HDA_FIXUP_ACT_INIT: ++ /* Make sure to start in a correct state, i.e. if ++ * headphones have been plugged in before powering up the system ++ */ ++ alc662_aspire_ethos_mute_speakers(codec, NULL); ++ break; ++ } ++} ++ + static struct coef_fw alc668_coefs[] = { + WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), + WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), +@@ -8582,6 +8621,9 @@ enum { + ALC662_FIXUP_USI_FUNC, + ALC662_FIXUP_USI_HEADSET_MODE, + ALC662_FIXUP_LENOVO_MULTI_CODECS, ++ ALC669_FIXUP_ACER_ASPIRE_ETHOS, ++ ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER, ++ ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -8908,6 +8950,33 @@ static const struct hda_fixup alc662_fixups[] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc233_alc662_fixup_lenovo_dual_codecs, + }, ++ [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc662_fixup_aspire_ethos_hp, ++ }, ++ [ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER] = { ++ .type = HDA_FIXUP_VERBS, ++ /* subwoofer needs an extra GPIO setting to become audible */ ++ .v.verbs = (const struct hda_verb[]) { ++ {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, ++ {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, ++ {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET ++ }, ++ [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x15, 0x92130110 }, /* front speakers */ ++ { 0x18, 0x99130111 }, /* center/subwoofer */ ++ { 0x1b, 0x11130012 }, /* surround plus jack for HP */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -8953,6 +9022,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68), + SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON), + SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), ++ SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS), + + #if 0 + /* Below is a quirk table taken from the old code. +@@ -9045,6 +9115,7 @@ static const struct hda_model_fixup alc662_fixup_models[] = { + {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"}, + {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"}, + {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"}, ++ {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"}, + {} + }; + +-- +2.39.2 + diff --git a/queue-4.19/alsa-hda-realtek-add-a-quirk-for-hp-elitedesk-805.patch b/queue-4.19/alsa-hda-realtek-add-a-quirk-for-hp-elitedesk-805.patch new file mode 100644 index 00000000000..84fa7a71fd7 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-a-quirk-for-hp-elitedesk-805.patch @@ -0,0 +1,35 @@ +From 261ae27902fa013e8fedf88cb6ef5de2bf6ef088 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 6 May 2023 10:26:53 +0800 +Subject: ALSA: hda/realtek: Add a quirk for HP EliteDesk 805 + +From: Ai Chao + +[ Upstream commit 90670ef774a8b6700c38ce1222e6aa263be54d5f ] + +Add a quirk for HP EliteDesk 805 to fixup ALC3867 headset MIC no sound. + +Signed-off-by: Ai Chao +Cc: +Link: https://lore.kernel.org/r/20230506022653.2074343-1-aichao@kylinos.cn +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index cf76c3159d584..ea3e9b6925204 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -9121,6 +9121,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), + SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB), ++ SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB), + SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2), + SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE), + SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50), +-- +2.39.2 + diff --git a/queue-4.19/alsa-hda-realtek-add-headset-mic-support-for-lenovo-.patch b/queue-4.19/alsa-hda-realtek-add-headset-mic-support-for-lenovo-.patch new file mode 100644 index 00000000000..b5e0dbe0754 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-headset-mic-support-for-lenovo-.patch @@ -0,0 +1,98 @@ +From 1fc990ca371ae2d0a461f701dcbb929fe4e6ccbf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Nov 2021 16:32:44 +0800 +Subject: ALSA: hda/realtek - Add headset Mic support for Lenovo ALC897 + platform + +From: Kailang Yang + +[ Upstream commit d7f32791a9fcf0dae8b073cdea9b79e29098c5f4 ] + +Lenovo ALC897 platform had headset Mic. +This patch enable supported headset Mic. + +Signed-off-by: Kailang Yang +Cc: +Link: https://lore.kernel.org/r/baab2c2536cb4cc18677a862c6f6d840@realtek.com +Signed-off-by: Takashi Iwai +Stable-dep-of: 90670ef774a8 ("ALSA: hda/realtek: Add a quirk for HP EliteDesk 805") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 40 +++++++++++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 1f535504ee907..564851086125f 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8573,6 +8573,27 @@ static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, + } + } + ++static void alc897_hp_automute_hook(struct hda_codec *codec, ++ struct hda_jack_callback *jack) ++{ ++ struct alc_spec *spec = codec->spec; ++ int vref; ++ ++ snd_hda_gen_hp_automute(codec, jack); ++ vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP; ++ snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, ++ vref); ++} ++ ++static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ struct alc_spec *spec = codec->spec; ++ if (action == HDA_FIXUP_ACT_PRE_PROBE) { ++ spec->gen.hp_automute_hook = alc897_hp_automute_hook; ++ } ++} ++ + static const struct coef_fw alc668_coefs[] = { + WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), + WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), +@@ -8653,6 +8674,8 @@ enum { + ALC668_FIXUP_ASUS_NO_HEADSET_MIC, + ALC668_FIXUP_HEADSET_MIC, + ALC668_FIXUP_MIC_DET_COEF, ++ ALC897_FIXUP_LENOVO_HEADSET_MIC, ++ ALC897_FIXUP_HEADSET_MIC_PIN, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -9052,6 +9075,19 @@ static const struct hda_fixup alc662_fixups[] = { + {} + }, + }, ++ [ALC897_FIXUP_LENOVO_HEADSET_MIC] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc897_fixup_lenovo_headset_mic, ++ }, ++ [ALC897_FIXUP_HEADSET_MIC_PIN] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x1a, 0x03a11050 }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -9095,6 +9131,10 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), + SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE), + SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS), ++ SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN), ++ SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN), ++ SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN), ++ SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN), + SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), + SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), + SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO), +-- +2.39.2 + diff --git a/queue-4.19/alsa-hda-realtek-add-headset-mic-supported-for-hp-cp.patch b/queue-4.19/alsa-hda-realtek-add-headset-mic-supported-for-hp-cp.patch new file mode 100644 index 00000000000..a2807afd53d --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-headset-mic-supported-for-hp-cp.patch @@ -0,0 +1,99 @@ +From 0a5876c3e7536bf5a2d92f74170b2c1787c5f316 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Jan 2020 14:04:01 +0800 +Subject: ALSA: hda/realtek - Add Headset Mic supported for HP cPC + +From: Kailang Yang + +[ Upstream commit 5af29028fd6db9438b5584ab7179710a0a22569d ] + +HP ALC671 need to support Headset Mic. + +Signed-off-by: Kailang Yang +Link: https://lore.kernel.org/r/06a9d2b176e14706976d6584cbe2d92a@realtek.com +Signed-off-by: Takashi Iwai +Stable-dep-of: 90670ef774a8 ("ALSA: hda/realtek: Add a quirk for HP EliteDesk 805") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 44 +++++++++++++++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 3916f2eb5384a..a47946b4b22e1 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8550,6 +8550,29 @@ static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, + } + } + ++static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ struct alc_spec *spec = codec->spec; ++ ++ static const struct hda_pintbl pincfgs[] = { ++ { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */ ++ { 0x1b, 0x0181304f }, ++ { } ++ }; ++ ++ switch (action) { ++ case HDA_FIXUP_ACT_PRE_PROBE: ++ spec->gen.mixer_nid = 0; ++ spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; ++ snd_hda_apply_pincfgs(codec, pincfgs); ++ break; ++ case HDA_FIXUP_ACT_INIT: ++ alc_write_coef_idx(codec, 0x19, 0xa054); ++ break; ++ } ++} ++ + static const struct coef_fw alc668_coefs[] = { + WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), + WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), +@@ -8624,6 +8647,7 @@ enum { + ALC669_FIXUP_ACER_ASPIRE_ETHOS, + ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER, + ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET, ++ ALC671_FIXUP_HP_HEADSET_MIC2, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -8977,6 +9001,10 @@ static const struct hda_fixup alc662_fixups[] = { + .chained = true, + .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER + }, ++ [ALC671_FIXUP_HP_HEADSET_MIC2] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc671_fixup_hp_headset_mic2, ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -9158,6 +9186,22 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { + {0x12, 0x90a60130}, + {0x14, 0x90170110}, + {0x15, 0x0321101f}), ++ SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2, ++ {0x14, 0x01014010}, ++ {0x17, 0x90170150}, ++ {0x1b, 0x01813030}, ++ {0x21, 0x02211020}), ++ SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2, ++ {0x14, 0x01014010}, ++ {0x18, 0x01a19040}, ++ {0x1b, 0x01813030}, ++ {0x21, 0x02211020}), ++ SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2, ++ {0x14, 0x01014020}, ++ {0x17, 0x90170110}, ++ {0x18, 0x01a19050}, ++ {0x1b, 0x01813040}, ++ {0x21, 0x02211030}), + {} + }; + +-- +2.39.2 + diff --git a/queue-4.19/alsa-hda-realtek-alc897-headset-mic-no-sound.patch b/queue-4.19/alsa-hda-realtek-alc897-headset-mic-no-sound.patch new file mode 100644 index 00000000000..588b5e34975 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-alc897-headset-mic-no-sound.patch @@ -0,0 +1,60 @@ +From 1cf73f44937e2e146ba821579dd1d659848d728e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jun 2022 14:57:19 +0800 +Subject: ALSA: hda/realtek - ALC897 headset MIC no sound + +From: Kailang Yang + +[ Upstream commit fe6900bd8156467365bd5b976df64928fdebfeb0 ] + +There is not have Headset Mic verb table in BIOS default. +So, it will have recording issue from headset MIC. +Add the verb table value without jack detect. It will turn on Headset Mic. + +Signed-off-by: Kailang Yang +Cc: +Link: https://lore.kernel.org/r/719133a27d8844a890002cb817001dfa@realtek.com +Signed-off-by: Takashi Iwai +Stable-dep-of: 90670ef774a8 ("ALSA: hda/realtek: Add a quirk for HP EliteDesk 805") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 564851086125f..cf76c3159d584 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8676,6 +8676,7 @@ enum { + ALC668_FIXUP_MIC_DET_COEF, + ALC897_FIXUP_LENOVO_HEADSET_MIC, + ALC897_FIXUP_HEADSET_MIC_PIN, ++ ALC897_FIXUP_HP_HSMIC_VERB, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -9088,6 +9089,13 @@ static const struct hda_fixup alc662_fixups[] = { + .chained = true, + .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC + }, ++ [ALC897_FIXUP_HP_HSMIC_VERB] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ ++ { } ++ }, ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -9112,6 +9120,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), ++ SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB), + SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2), + SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE), + SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50), +-- +2.39.2 + diff --git a/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-x2660g-w.patch b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-x2660g-w.patch new file mode 100644 index 00000000000..b022adfdbca --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-x2660g-w.patch @@ -0,0 +1,61 @@ +From 8f53cc818c11dbd246ad596777b340a1279a0253 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Mar 2020 16:28:07 +0800 +Subject: ALSA: hda/realtek - Enable headset mic of Acer X2660G with ALC662 + +From: Jian-Hong Pan + +[ Upstream commit d858c706bdca97698752bd26b60c21ec07ef04f2 ] + +The Acer desktop X2660G with ALC662 can't detect the headset microphone +until ALC662_FIXUP_ACER_X2660G_HEADSET_MODE quirk applied. + +Signed-off-by: Jian-Hong Pan +Cc: +Link: https://lore.kernel.org/r/20200317082806.73194-2-jian-hong@endlessm.com +Signed-off-by: Takashi Iwai +Stable-dep-of: 90670ef774a8 ("ALSA: hda/realtek: Add a quirk for HP EliteDesk 805") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index a47946b4b22e1..f361bfd86846c 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8648,6 +8648,7 @@ enum { + ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER, + ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET, + ALC671_FIXUP_HP_HEADSET_MIC2, ++ ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -9005,6 +9006,15 @@ static const struct hda_fixup alc662_fixups[] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc671_fixup_hp_headset_mic2, + }, ++ [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC662_FIXUP_USI_FUNC ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -9016,6 +9026,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), ++ SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE), + SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13), +-- +2.39.2 + diff --git a/queue-4.19/alsa-hda-realtek-enable-the-headset-of-acer-n50-600-.patch b/queue-4.19/alsa-hda-realtek-enable-the-headset-of-acer-n50-600-.patch new file mode 100644 index 00000000000..a652b847cfa --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-enable-the-headset-of-acer-n50-600-.patch @@ -0,0 +1,62 @@ +From 444edc413bdf25e75d40ea70b4567e4010eb5b61 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Mar 2020 16:28:09 +0800 +Subject: ALSA: hda/realtek - Enable the headset of Acer N50-600 with ALC662 + +From: Jian-Hong Pan + +[ Upstream commit a124458a127ccd7629e20cd7bae3e1f758ed32aa ] + +A headset on the desktop like Acer N50-600 does not work, until quirk +ALC662_FIXUP_ACER_NITRO_HEADSET_MODE is applied. + +Signed-off-by: Jian-Hong Pan +Cc: +Link: https://lore.kernel.org/r/20200317082806.73194-3-jian-hong@endlessm.com +Signed-off-by: Takashi Iwai +Stable-dep-of: 90670ef774a8 ("ALSA: hda/realtek: Add a quirk for HP EliteDesk 805") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index f361bfd86846c..7f5063b5ce89b 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8649,6 +8649,7 @@ enum { + ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET, + ALC671_FIXUP_HP_HEADSET_MIC2, + ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, ++ ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -9015,6 +9016,16 @@ static const struct hda_fixup alc662_fixups[] = { + .chained = true, + .chain_id = ALC662_FIXUP_USI_FUNC + }, ++ [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */ ++ { 0x1b, 0x0221144f }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC662_FIXUP_USI_FUNC ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -9026,6 +9037,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), ++ SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE), + SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE), + SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), +-- +2.39.2 + diff --git a/queue-4.19/alsa-hda-realtek-fix-the-mic-type-detection-issue-fo.patch b/queue-4.19/alsa-hda-realtek-fix-the-mic-type-detection-issue-fo.patch new file mode 100644 index 00000000000..4faf9333e71 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-fix-the-mic-type-detection-issue-fo.patch @@ -0,0 +1,88 @@ +From 29ac9b177d90a2fc5395a43e91b3f01c2af24576 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Oct 2021 19:47:48 +0800 +Subject: ALSA: hda/realtek: Fix the mic type detection issue for ASUS G551JW + +From: Hui Wang + +[ Upstream commit a3fd1a986e499a06ac5ef95c3a39aa4611e7444c ] + +We need to define the codec pin 0x1b to be the mic, but somehow +the mic doesn't support hot plugging detection, and Windows also has +this issue, so we set it to phantom headset-mic. + +Also the determine_headset_type() often returns the omtp type by a +mistake when we plug a ctia headset, this makes the mic can't record +sound at all. Because most of the headset are ctia type nowadays and +some machines have the fixed ctia type audio jack, it is possible this +machine has the fixed ctia jack too. Here we set this mic jack to +fixed ctia type, this could avoid the mic type detection mistake and +make the ctia headset work stable. + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214537 +Reported-and-tested-by: msd +Cc: +Signed-off-by: Hui Wang +Link: https://lore.kernel.org/r/20211012114748.5238-1-hui.wang@canonical.com +Signed-off-by: Takashi Iwai +Stable-dep-of: 90670ef774a8 ("ALSA: hda/realtek: Add a quirk for HP EliteDesk 805") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index faef696b17989..1f535504ee907 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8650,6 +8650,9 @@ enum { + ALC671_FIXUP_HP_HEADSET_MIC2, + ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, + ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, ++ ALC668_FIXUP_ASUS_NO_HEADSET_MIC, ++ ALC668_FIXUP_HEADSET_MIC, ++ ALC668_FIXUP_MIC_DET_COEF, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -9026,6 +9029,29 @@ static const struct hda_fixup alc662_fixups[] = { + .chained = true, + .chain_id = ALC662_FIXUP_USI_FUNC + }, ++ [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x1b, 0x04a1112c }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC668_FIXUP_HEADSET_MIC ++ }, ++ [ALC668_FIXUP_HEADSET_MIC] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc269_fixup_headset_mic, ++ .chained = true, ++ .chain_id = ALC668_FIXUP_MIC_DET_COEF ++ }, ++ [ALC668_FIXUP_MIC_DET_COEF] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 }, ++ {} ++ }, ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -9060,6 +9086,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), + SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51), + SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51), ++ SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8), + SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), + SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), +-- +2.39.2 + diff --git a/queue-4.19/alsa-hda-realtek-more-constifications.patch b/queue-4.19/alsa-hda-realtek-more-constifications.patch new file mode 100644 index 00000000000..1e6f0993f1e --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-more-constifications.patch @@ -0,0 +1,480 @@ +From 33a7503c86c15ec5055103928bd654bbd142f7cc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 5 Jan 2020 15:47:18 +0100 +Subject: ALSA: hda/realtek - More constifications + +From: Takashi Iwai + +[ Upstream commit 6b0f95c49d890440c01a759c767dfe40e2acdbf2 ] + +Apply const prefix to each coef table array. + +Just for minor optimization and no functional changes. + +Link: https://lore.kernel.org/r/20200105144823.29547-4-tiwai@suse.de +Signed-off-by: Takashi Iwai +Stable-dep-of: 90670ef774a8 ("ALSA: hda/realtek: Add a quirk for HP EliteDesk 805") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 118 +++++++++++++++++----------------- + 1 file changed, 59 insertions(+), 59 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 98b6e93084e5e..3916f2eb5384a 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -956,7 +956,7 @@ struct alc_codec_rename_pci_table { + const char *name; + }; + +-static struct alc_codec_rename_table rename_tbl[] = { ++static const struct alc_codec_rename_table rename_tbl[] = { + { 0x10ec0221, 0xf00f, 0x1003, "ALC231" }, + { 0x10ec0269, 0xfff0, 0x3010, "ALC277" }, + { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" }, +@@ -977,7 +977,7 @@ static struct alc_codec_rename_table rename_tbl[] = { + { } /* terminator */ + }; + +-static struct alc_codec_rename_pci_table rename_pci_tbl[] = { ++static const struct alc_codec_rename_pci_table rename_pci_tbl[] = { + { 0x10ec0280, 0x1028, 0, "ALC3220" }, + { 0x10ec0282, 0x1028, 0, "ALC3221" }, + { 0x10ec0283, 0x1028, 0, "ALC3223" }, +@@ -3116,7 +3116,7 @@ static void alc269_shutup(struct hda_codec *codec) + alc_shutup_pins(codec); + } + +-static struct coef_fw alc282_coefs[] = { ++static const struct coef_fw alc282_coefs[] = { + WRITE_COEF(0x03, 0x0002), /* Power Down Control */ + UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */ + WRITE_COEF(0x07, 0x0200), /* DMIC control */ +@@ -3228,7 +3228,7 @@ static void alc282_shutup(struct hda_codec *codec) + alc_write_coef_idx(codec, 0x78, coef78); + } + +-static struct coef_fw alc283_coefs[] = { ++static const struct coef_fw alc283_coefs[] = { + WRITE_COEF(0x03, 0x0002), /* Power Down Control */ + UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */ + WRITE_COEF(0x07, 0x0200), /* DMIC control */ +@@ -4235,7 +4235,7 @@ static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, + } + } + +-static struct coef_fw alc225_pre_hsmode[] = { ++static const struct coef_fw alc225_pre_hsmode[] = { + UPDATE_COEF(0x4a, 1<<8, 0), + UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), + UPDATE_COEF(0x63, 3<<14, 3<<14), +@@ -4248,7 +4248,7 @@ static struct coef_fw alc225_pre_hsmode[] = { + + static void alc_headset_mode_unplugged(struct hda_codec *codec) + { +- static struct coef_fw coef0255[] = { ++ static const struct coef_fw coef0255[] = { + WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */ + WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */ + UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ +@@ -4256,7 +4256,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) + WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */ + {} + }; +- static struct coef_fw coef0256[] = { ++ static const struct coef_fw coef0256[] = { + WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */ + WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */ + WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */ +@@ -4264,7 +4264,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) + UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ + {} + }; +- static struct coef_fw coef0233[] = { ++ static const struct coef_fw coef0233[] = { + WRITE_COEF(0x1b, 0x0c0b), + WRITE_COEF(0x45, 0xc429), + UPDATE_COEF(0x35, 0x4000, 0), +@@ -4274,7 +4274,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) + WRITE_COEF(0x32, 0x42a3), + {} + }; +- static struct coef_fw coef0288[] = { ++ static const struct coef_fw coef0288[] = { + UPDATE_COEF(0x4f, 0xfcc0, 0xc400), + UPDATE_COEF(0x50, 0x2000, 0x2000), + UPDATE_COEF(0x56, 0x0006, 0x0006), +@@ -4282,18 +4282,18 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) + UPDATE_COEF(0x67, 0x2000, 0), + {} + }; +- static struct coef_fw coef0298[] = { ++ static const struct coef_fw coef0298[] = { + UPDATE_COEF(0x19, 0x1300, 0x0300), + {} + }; +- static struct coef_fw coef0292[] = { ++ static const struct coef_fw coef0292[] = { + WRITE_COEF(0x76, 0x000e), + WRITE_COEF(0x6c, 0x2400), + WRITE_COEF(0x18, 0x7308), + WRITE_COEF(0x6b, 0xc429), + {} + }; +- static struct coef_fw coef0293[] = { ++ static const struct coef_fw coef0293[] = { + UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */ + UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */ + UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */ +@@ -4302,16 +4302,16 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) + UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */ + {} + }; +- static struct coef_fw coef0668[] = { ++ static const struct coef_fw coef0668[] = { + WRITE_COEF(0x15, 0x0d40), + WRITE_COEF(0xb7, 0x802b), + {} + }; +- static struct coef_fw coef0225[] = { ++ static const struct coef_fw coef0225[] = { + UPDATE_COEF(0x63, 3<<14, 0), + {} + }; +- static struct coef_fw coef0274[] = { ++ static const struct coef_fw coef0274[] = { + UPDATE_COEF(0x4a, 0x0100, 0), + UPDATE_COEFEX(0x57, 0x05, 0x4000, 0), + UPDATE_COEF(0x6b, 0xf000, 0x5000), +@@ -4376,25 +4376,25 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) + static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, + hda_nid_t mic_pin) + { +- static struct coef_fw coef0255[] = { ++ static const struct coef_fw coef0255[] = { + WRITE_COEFEX(0x57, 0x03, 0x8aa6), + WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */ + {} + }; +- static struct coef_fw coef0256[] = { ++ static const struct coef_fw coef0256[] = { + UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/ + WRITE_COEFEX(0x57, 0x03, 0x09a3), + WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */ + {} + }; +- static struct coef_fw coef0233[] = { ++ static const struct coef_fw coef0233[] = { + UPDATE_COEF(0x35, 0, 1<<14), + WRITE_COEF(0x06, 0x2100), + WRITE_COEF(0x1a, 0x0021), + WRITE_COEF(0x26, 0x008c), + {} + }; +- static struct coef_fw coef0288[] = { ++ static const struct coef_fw coef0288[] = { + UPDATE_COEF(0x4f, 0x00c0, 0), + UPDATE_COEF(0x50, 0x2000, 0), + UPDATE_COEF(0x56, 0x0006, 0), +@@ -4403,30 +4403,30 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, + UPDATE_COEF(0x67, 0x2000, 0x2000), + {} + }; +- static struct coef_fw coef0292[] = { ++ static const struct coef_fw coef0292[] = { + WRITE_COEF(0x19, 0xa208), + WRITE_COEF(0x2e, 0xacf0), + {} + }; +- static struct coef_fw coef0293[] = { ++ static const struct coef_fw coef0293[] = { + UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */ + UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */ + UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ + {} + }; +- static struct coef_fw coef0688[] = { ++ static const struct coef_fw coef0688[] = { + WRITE_COEF(0xb7, 0x802b), + WRITE_COEF(0xb5, 0x1040), + UPDATE_COEF(0xc3, 0, 1<<12), + {} + }; +- static struct coef_fw coef0225[] = { ++ static const struct coef_fw coef0225[] = { + UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), + UPDATE_COEF(0x4a, 3<<4, 2<<4), + UPDATE_COEF(0x63, 3<<14, 0), + {} + }; +- static struct coef_fw coef0274[] = { ++ static const struct coef_fw coef0274[] = { + UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000), + UPDATE_COEF(0x4a, 0x0010, 0), + UPDATE_COEF(0x6b, 0xf000, 0), +@@ -4512,7 +4512,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, + + static void alc_headset_mode_default(struct hda_codec *codec) + { +- static struct coef_fw coef0225[] = { ++ static const struct coef_fw coef0225[] = { + UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10), + UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10), + UPDATE_COEF(0x49, 3<<8, 0<<8), +@@ -4521,14 +4521,14 @@ static void alc_headset_mode_default(struct hda_codec *codec) + UPDATE_COEF(0x67, 0xf000, 0x3000), + {} + }; +- static struct coef_fw coef0255[] = { ++ static const struct coef_fw coef0255[] = { + WRITE_COEF(0x45, 0xc089), + WRITE_COEF(0x45, 0xc489), + WRITE_COEFEX(0x57, 0x03, 0x8ea6), + WRITE_COEF(0x49, 0x0049), + {} + }; +- static struct coef_fw coef0256[] = { ++ static const struct coef_fw coef0256[] = { + WRITE_COEF(0x45, 0xc489), + WRITE_COEFEX(0x57, 0x03, 0x0da3), + WRITE_COEF(0x49, 0x0049), +@@ -4536,12 +4536,12 @@ static void alc_headset_mode_default(struct hda_codec *codec) + WRITE_COEF(0x06, 0x6100), + {} + }; +- static struct coef_fw coef0233[] = { ++ static const struct coef_fw coef0233[] = { + WRITE_COEF(0x06, 0x2100), + WRITE_COEF(0x32, 0x4ea3), + {} + }; +- static struct coef_fw coef0288[] = { ++ static const struct coef_fw coef0288[] = { + UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */ + UPDATE_COEF(0x50, 0x2000, 0x2000), + UPDATE_COEF(0x56, 0x0006, 0x0006), +@@ -4549,26 +4549,26 @@ static void alc_headset_mode_default(struct hda_codec *codec) + UPDATE_COEF(0x67, 0x2000, 0), + {} + }; +- static struct coef_fw coef0292[] = { ++ static const struct coef_fw coef0292[] = { + WRITE_COEF(0x76, 0x000e), + WRITE_COEF(0x6c, 0x2400), + WRITE_COEF(0x6b, 0xc429), + WRITE_COEF(0x18, 0x7308), + {} + }; +- static struct coef_fw coef0293[] = { ++ static const struct coef_fw coef0293[] = { + UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */ + WRITE_COEF(0x45, 0xC429), /* Set to TRS type */ + UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ + {} + }; +- static struct coef_fw coef0688[] = { ++ static const struct coef_fw coef0688[] = { + WRITE_COEF(0x11, 0x0041), + WRITE_COEF(0x15, 0x0d40), + WRITE_COEF(0xb7, 0x802b), + {} + }; +- static struct coef_fw coef0274[] = { ++ static const struct coef_fw coef0274[] = { + WRITE_COEF(0x45, 0x4289), + UPDATE_COEF(0x4a, 0x0010, 0x0010), + UPDATE_COEF(0x6b, 0x0f00, 0), +@@ -4631,53 +4631,53 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) + { + int val; + +- static struct coef_fw coef0255[] = { ++ static const struct coef_fw coef0255[] = { + WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */ + WRITE_COEF(0x1b, 0x0c2b), + WRITE_COEFEX(0x57, 0x03, 0x8ea6), + {} + }; +- static struct coef_fw coef0256[] = { ++ static const struct coef_fw coef0256[] = { + WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */ + WRITE_COEF(0x1b, 0x0e6b), + {} + }; +- static struct coef_fw coef0233[] = { ++ static const struct coef_fw coef0233[] = { + WRITE_COEF(0x45, 0xd429), + WRITE_COEF(0x1b, 0x0c2b), + WRITE_COEF(0x32, 0x4ea3), + {} + }; +- static struct coef_fw coef0288[] = { ++ static const struct coef_fw coef0288[] = { + UPDATE_COEF(0x50, 0x2000, 0x2000), + UPDATE_COEF(0x56, 0x0006, 0x0006), + UPDATE_COEF(0x66, 0x0008, 0), + UPDATE_COEF(0x67, 0x2000, 0), + {} + }; +- static struct coef_fw coef0292[] = { ++ static const struct coef_fw coef0292[] = { + WRITE_COEF(0x6b, 0xd429), + WRITE_COEF(0x76, 0x0008), + WRITE_COEF(0x18, 0x7388), + {} + }; +- static struct coef_fw coef0293[] = { ++ static const struct coef_fw coef0293[] = { + WRITE_COEF(0x45, 0xd429), /* Set to ctia type */ + UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ + {} + }; +- static struct coef_fw coef0688[] = { ++ static const struct coef_fw coef0688[] = { + WRITE_COEF(0x11, 0x0001), + WRITE_COEF(0x15, 0x0d60), + WRITE_COEF(0xc3, 0x0000), + {} + }; +- static struct coef_fw coef0225_1[] = { ++ static const struct coef_fw coef0225_1[] = { + UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10), + UPDATE_COEF(0x63, 3<<14, 2<<14), + {} + }; +- static struct coef_fw coef0225_2[] = { ++ static const struct coef_fw coef0225_2[] = { + UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10), + UPDATE_COEF(0x63, 3<<14, 1<<14), + {} +@@ -4749,48 +4749,48 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) + /* Nokia type */ + static void alc_headset_mode_omtp(struct hda_codec *codec) + { +- static struct coef_fw coef0255[] = { ++ static const struct coef_fw coef0255[] = { + WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */ + WRITE_COEF(0x1b, 0x0c2b), + WRITE_COEFEX(0x57, 0x03, 0x8ea6), + {} + }; +- static struct coef_fw coef0256[] = { ++ static const struct coef_fw coef0256[] = { + WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */ + WRITE_COEF(0x1b, 0x0e6b), + {} + }; +- static struct coef_fw coef0233[] = { ++ static const struct coef_fw coef0233[] = { + WRITE_COEF(0x45, 0xe429), + WRITE_COEF(0x1b, 0x0c2b), + WRITE_COEF(0x32, 0x4ea3), + {} + }; +- static struct coef_fw coef0288[] = { ++ static const struct coef_fw coef0288[] = { + UPDATE_COEF(0x50, 0x2000, 0x2000), + UPDATE_COEF(0x56, 0x0006, 0x0006), + UPDATE_COEF(0x66, 0x0008, 0), + UPDATE_COEF(0x67, 0x2000, 0), + {} + }; +- static struct coef_fw coef0292[] = { ++ static const struct coef_fw coef0292[] = { + WRITE_COEF(0x6b, 0xe429), + WRITE_COEF(0x76, 0x0008), + WRITE_COEF(0x18, 0x7388), + {} + }; +- static struct coef_fw coef0293[] = { ++ static const struct coef_fw coef0293[] = { + WRITE_COEF(0x45, 0xe429), /* Set to omtp type */ + UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ + {} + }; +- static struct coef_fw coef0688[] = { ++ static const struct coef_fw coef0688[] = { + WRITE_COEF(0x11, 0x0001), + WRITE_COEF(0x15, 0x0d50), + WRITE_COEF(0xc3, 0x0000), + {} + }; +- static struct coef_fw coef0225[] = { ++ static const struct coef_fw coef0225[] = { + UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10), + UPDATE_COEF(0x63, 3<<14, 2<<14), + {} +@@ -4850,17 +4850,17 @@ static void alc_determine_headset_type(struct hda_codec *codec) + int val; + bool is_ctia = false; + struct alc_spec *spec = codec->spec; +- static struct coef_fw coef0255[] = { ++ static const struct coef_fw coef0255[] = { + WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/ + WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref + conteol) */ + {} + }; +- static struct coef_fw coef0288[] = { ++ static const struct coef_fw coef0288[] = { + UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */ + {} + }; +- static struct coef_fw coef0298[] = { ++ static const struct coef_fw coef0298[] = { + UPDATE_COEF(0x50, 0x2000, 0x2000), + UPDATE_COEF(0x56, 0x0006, 0x0006), + UPDATE_COEF(0x66, 0x0008, 0), +@@ -4868,19 +4868,19 @@ static void alc_determine_headset_type(struct hda_codec *codec) + UPDATE_COEF(0x19, 0x1300, 0x1300), + {} + }; +- static struct coef_fw coef0293[] = { ++ static const struct coef_fw coef0293[] = { + UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */ + WRITE_COEF(0x45, 0xD429), /* Set to ctia type */ + {} + }; +- static struct coef_fw coef0688[] = { ++ static const struct coef_fw coef0688[] = { + WRITE_COEF(0x11, 0x0001), + WRITE_COEF(0xb7, 0x802b), + WRITE_COEF(0x15, 0x0d60), + WRITE_COEF(0xc3, 0x0c00), + {} + }; +- static struct coef_fw coef0274[] = { ++ static const struct coef_fw coef0274[] = { + UPDATE_COEF(0x4a, 0x0010, 0), + UPDATE_COEF(0x4a, 0x8000, 0), + WRITE_COEF(0x45, 0xd289), +@@ -5165,7 +5165,7 @@ static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, + static void alc255_set_default_jack_type(struct hda_codec *codec) + { + /* Set to iphone type */ +- static struct coef_fw alc255fw[] = { ++ static const struct coef_fw alc255fw[] = { + WRITE_COEF(0x1b, 0x880b), + WRITE_COEF(0x45, 0xd089), + WRITE_COEF(0x1b, 0x080b), +@@ -5173,7 +5173,7 @@ static void alc255_set_default_jack_type(struct hda_codec *codec) + WRITE_COEF(0x1b, 0x0c0b), + {} + }; +- static struct coef_fw alc256fw[] = { ++ static const struct coef_fw alc256fw[] = { + WRITE_COEF(0x1b, 0x884b), + WRITE_COEF(0x45, 0xd089), + WRITE_COEF(0x1b, 0x084b), +@@ -8550,7 +8550,7 @@ static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, + } + } + +-static struct coef_fw alc668_coefs[] = { ++static const struct coef_fw alc668_coefs[] = { + WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), + WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), + WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0), +-- +2.39.2 + diff --git a/queue-4.19/alsa-hda-realtek-the-front-mic-on-a-hp-machine-doesn.patch b/queue-4.19/alsa-hda-realtek-the-front-mic-on-a-hp-machine-doesn.patch new file mode 100644 index 00000000000..956dcad8dc2 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-the-front-mic-on-a-hp-machine-doesn.patch @@ -0,0 +1,39 @@ +From 3a24de1192bdacb9638abce1e3ba2cce3ce31306 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Oct 2020 18:56:44 +0800 +Subject: ALSA: hda/realtek - The front Mic on a HP machine doesn't work + +From: Jeremy Szu + +[ Upstream commit 148ebf548a1af366fc797fcc7d03f0bb92b12a79 ] + +On a HP ZCentral, the front Mic could not be detected. + +The codec of the HP ZCentrol is alc671 and it needs to override the pin +configuration to enable the headset mic. + +Signed-off-by: Jeremy Szu +Cc: +Link: https://lore.kernel.org/r/20201008105645.65505-1-jeremy.szu@canonical.com +Signed-off-by: Takashi Iwai +Stable-dep-of: 90670ef774a8 ("ALSA: hda/realtek: Add a quirk for HP EliteDesk 805") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 7f5063b5ce89b..faef696b17989 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -9050,6 +9050,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), ++ SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2), + SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE), + SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50), + SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A), +-- +2.39.2 + diff --git a/queue-4.19/lib-string_helpers-introduce-string_upper-and-string.patch b/queue-4.19/lib-string_helpers-introduce-string_upper-and-string.patch new file mode 100644 index 00000000000..69bd5c88590 --- /dev/null +++ b/queue-4.19/lib-string_helpers-introduce-string_upper-and-string.patch @@ -0,0 +1,56 @@ +From 23bb1834c96ba74b42f8f8dce746db4f86a854b9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jul 2020 15:01:53 +0300 +Subject: lib/string_helpers: Introduce string_upper() and string_lower() + helpers + +From: Vadim Pasternak + +[ Upstream commit 58eeba0bdb52afe5c18ce2a760ca9fe2901943e9 ] + +Provide the helpers for string conversions to upper and lower cases. + +Signed-off-by: Vadim Pasternak +Signed-off-by: Andy Shevchenko +Stable-dep-of: 3c0f4f09c063 ("usb: gadget: u_ether: Fix host MAC address case") +Signed-off-by: Sasha Levin +--- + include/linux/string_helpers.h | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h +index d23c5030901a2..0618885b3edc7 100644 +--- a/include/linux/string_helpers.h ++++ b/include/linux/string_helpers.h +@@ -2,6 +2,7 @@ + #ifndef _LINUX_STRING_HELPERS_H_ + #define _LINUX_STRING_HELPERS_H_ + ++#include + #include + + struct file; +@@ -72,6 +73,20 @@ static inline int string_escape_str_any_np(const char *src, char *dst, + return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, only); + } + ++static inline void string_upper(char *dst, const char *src) ++{ ++ do { ++ *dst++ = toupper(*src); ++ } while (*src++); ++} ++ ++static inline void string_lower(char *dst, const char *src) ++{ ++ do { ++ *dst++ = tolower(*src); ++ } while (*src++); ++} ++ + char *kstrdup_quotable(const char *src, gfp_t gfp); + char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp); + char *kstrdup_quotable_file(struct file *file, gfp_t gfp); +-- +2.39.2 + diff --git a/queue-4.19/s390-qdio-fix-do_sqbs-inline-assembly-constraint.patch b/queue-4.19/s390-qdio-fix-do_sqbs-inline-assembly-constraint.patch new file mode 100644 index 00000000000..bc0390d722b --- /dev/null +++ b/queue-4.19/s390-qdio-fix-do_sqbs-inline-assembly-constraint.patch @@ -0,0 +1,66 @@ +From 68282acf5f05129f5581c1422fb5532db9cb235f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 11 May 2023 17:04:41 +0200 +Subject: s390/qdio: fix do_sqbs() inline assembly constraint + +From: Heiko Carstens + +[ Upstream commit 2862a2fdfae875888e3c1c3634e3422e01d98147 ] + +Use "a" constraint instead of "d" constraint to pass the state parameter to +the do_sqbs() inline assembly. This prevents that general purpose register +zero is used for the state parameter. + +If the compiler would select general purpose register zero this would be +problematic for the used instruction in rsy format: the register used for +the state parameter is a base register. If the base register is general +purpose register zero the contents of the register are unexpectedly ignored +when the instruction is executed. + +This only applies to z/VM guests using QIOASSIST with dedicated (pass through) +QDIO-based devices such as FCP [zfcp driver] as well as real OSA or +HiperSockets [qeth driver]. + +A possible symptom for this case using zfcp is the following repeating kernel +message pattern: + +zfcp : A QDIO problem occurred +zfcp : A QDIO problem occurred +zfcp : qdio: ZFCP on SC using AI:1 QEBSM:1 PRI:1 TDD:1 SIGA: W +zfcp : A QDIO problem occurred +zfcp : A QDIO problem occurred + +Each of the qdio problem message can be accompanied by the following entries +for the affected subchannel in +/sys/kernel/debug/s390dbf/qdio_error/hex_ascii for zfcp or qeth: + + ccq: 69.... + SQBS ERROR. + +Reviewed-by: Benjamin Block +Cc: Steffen Maier +Fixes: 8129ee164267 ("[PATCH] s390: qdio V=V pass-through") +Cc: +Signed-off-by: Heiko Carstens +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + drivers/s390/cio/qdio.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h +index 289ee9db577a2..f98dc3a8e3c71 100644 +--- a/drivers/s390/cio/qdio.h ++++ b/drivers/s390/cio/qdio.h +@@ -95,7 +95,7 @@ static inline int do_sqbs(u64 token, unsigned char state, int queue, + " lgr 1,%[token]\n" + " .insn rsy,0xeb000000008a,%[qs],%[ccq],0(%[state])" + : [ccq] "+&d" (_ccq), [qs] "+&d" (_queuestart) +- : [state] "d" ((unsigned long)state), [token] "d" (token) ++ : [state] "a" ((unsigned long)state), [token] "d" (token) + : "memory", "cc", "1"); + *count = _ccq & 0xff; + *start = _queuestart & 0xff; +-- +2.39.2 + diff --git a/queue-4.19/s390-qdio-get-rid-of-register-asm.patch b/queue-4.19/s390-qdio-get-rid-of-register-asm.patch new file mode 100644 index 00000000000..9e0bc8839ca --- /dev/null +++ b/queue-4.19/s390-qdio-get-rid-of-register-asm.patch @@ -0,0 +1,172 @@ +From 7790f8dbdfa686e0dceded91c9952d0f8f84c9df Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jun 2021 15:26:16 +0200 +Subject: s390/qdio: get rid of register asm + +From: Heiko Carstens + +[ Upstream commit d3e2ff5436d6ee38b572ba5c01dc7994769bec54 ] + +Reviewed-by: Benjamin Block +Signed-off-by: Heiko Carstens +Signed-off-by: Vasily Gorbik +Stable-dep-of: 2862a2fdfae8 ("s390/qdio: fix do_sqbs() inline assembly constraint") +Signed-off-by: Sasha Levin +--- + drivers/s390/cio/qdio.h | 25 ++++++++------- + drivers/s390/cio/qdio_main.c | 62 +++++++++++++++++++----------------- + 2 files changed, 46 insertions(+), 41 deletions(-) + +diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h +index ed60b8d4efe68..289ee9db577a2 100644 +--- a/drivers/s390/cio/qdio.h ++++ b/drivers/s390/cio/qdio.h +@@ -88,15 +88,15 @@ enum qdio_irq_states { + static inline int do_sqbs(u64 token, unsigned char state, int queue, + int *start, int *count) + { +- register unsigned long _ccq asm ("0") = *count; +- register unsigned long _token asm ("1") = token; + unsigned long _queuestart = ((unsigned long)queue << 32) | *start; ++ unsigned long _ccq = *count; + + asm volatile( +- " .insn rsy,0xeb000000008A,%1,0,0(%2)" +- : "+d" (_ccq), "+d" (_queuestart) +- : "d" ((unsigned long)state), "d" (_token) +- : "memory", "cc"); ++ " lgr 1,%[token]\n" ++ " .insn rsy,0xeb000000008a,%[qs],%[ccq],0(%[state])" ++ : [ccq] "+&d" (_ccq), [qs] "+&d" (_queuestart) ++ : [state] "d" ((unsigned long)state), [token] "d" (token) ++ : "memory", "cc", "1"); + *count = _ccq & 0xff; + *start = _queuestart & 0xff; + +@@ -106,16 +106,17 @@ static inline int do_sqbs(u64 token, unsigned char state, int queue, + static inline int do_eqbs(u64 token, unsigned char *state, int queue, + int *start, int *count, int ack) + { +- register unsigned long _ccq asm ("0") = *count; +- register unsigned long _token asm ("1") = token; + unsigned long _queuestart = ((unsigned long)queue << 32) | *start; + unsigned long _state = (unsigned long)ack << 63; ++ unsigned long _ccq = *count; + + asm volatile( +- " .insn rrf,0xB99c0000,%1,%2,0,0" +- : "+d" (_ccq), "+d" (_queuestart), "+d" (_state) +- : "d" (_token) +- : "memory", "cc"); ++ " lgr 1,%[token]\n" ++ " .insn rrf,0xb99c0000,%[qs],%[state],%[ccq],0" ++ : [ccq] "+&d" (_ccq), [qs] "+&d" (_queuestart), ++ [state] "+&d" (_state) ++ : [token] "d" (token) ++ : "memory", "cc", "1"); + *count = _ccq & 0xff; + *start = _queuestart & 0xff; + *state = _state & 0xff; +diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c +index 4b7cc8d425b1c..6100cf4df54b6 100644 +--- a/drivers/s390/cio/qdio_main.c ++++ b/drivers/s390/cio/qdio_main.c +@@ -31,38 +31,41 @@ MODULE_DESCRIPTION("QDIO base support"); + MODULE_LICENSE("GPL"); + + static inline int do_siga_sync(unsigned long schid, +- unsigned int out_mask, unsigned int in_mask, ++ unsigned long out_mask, unsigned long in_mask, + unsigned int fc) + { +- register unsigned long __fc asm ("0") = fc; +- register unsigned long __schid asm ("1") = schid; +- register unsigned long out asm ("2") = out_mask; +- register unsigned long in asm ("3") = in_mask; + int cc; + + asm volatile( ++ " lgr 0,%[fc]\n" ++ " lgr 1,%[schid]\n" ++ " lgr 2,%[out]\n" ++ " lgr 3,%[in]\n" + " siga 0\n" +- " ipm %0\n" +- " srl %0,28\n" +- : "=d" (cc) +- : "d" (__fc), "d" (__schid), "d" (out), "d" (in) : "cc"); ++ " ipm %[cc]\n" ++ " srl %[cc],28\n" ++ : [cc] "=&d" (cc) ++ : [fc] "d" (fc), [schid] "d" (schid), ++ [out] "d" (out_mask), [in] "d" (in_mask) ++ : "cc", "0", "1", "2", "3"); + return cc; + } + +-static inline int do_siga_input(unsigned long schid, unsigned int mask, +- unsigned int fc) ++static inline int do_siga_input(unsigned long schid, unsigned long mask, ++ unsigned long fc) + { +- register unsigned long __fc asm ("0") = fc; +- register unsigned long __schid asm ("1") = schid; +- register unsigned long __mask asm ("2") = mask; + int cc; + + asm volatile( ++ " lgr 0,%[fc]\n" ++ " lgr 1,%[schid]\n" ++ " lgr 2,%[mask]\n" + " siga 0\n" +- " ipm %0\n" +- " srl %0,28\n" +- : "=d" (cc) +- : "d" (__fc), "d" (__schid), "d" (__mask) : "cc"); ++ " ipm %[cc]\n" ++ " srl %[cc],28\n" ++ : [cc] "=&d" (cc) ++ : [fc] "d" (fc), [schid] "d" (schid), [mask] "d" (mask) ++ : "cc", "0", "1", "2"); + return cc; + } + +@@ -78,23 +81,24 @@ static inline int do_siga_input(unsigned long schid, unsigned int mask, + * Note: For IQDC unicast queues only the highest priority queue is processed. + */ + static inline int do_siga_output(unsigned long schid, unsigned long mask, +- unsigned int *bb, unsigned int fc, ++ unsigned int *bb, unsigned long fc, + unsigned long aob) + { +- register unsigned long __fc asm("0") = fc; +- register unsigned long __schid asm("1") = schid; +- register unsigned long __mask asm("2") = mask; +- register unsigned long __aob asm("3") = aob; + int cc; + + asm volatile( ++ " lgr 0,%[fc]\n" ++ " lgr 1,%[schid]\n" ++ " lgr 2,%[mask]\n" ++ " lgr 3,%[aob]\n" + " siga 0\n" +- " ipm %0\n" +- " srl %0,28\n" +- : "=d" (cc), "+d" (__fc), "+d" (__aob) +- : "d" (__schid), "d" (__mask) +- : "cc"); +- *bb = __fc >> 31; ++ " lgr %[fc],0\n" ++ " ipm %[cc]\n" ++ " srl %[cc],28\n" ++ : [cc] "=&d" (cc), [fc] "+&d" (fc) ++ : [schid] "d" (schid), [mask] "d" (mask), [aob] "d" (aob) ++ : "cc", "0", "1", "2", "3"); ++ *bb = fc >> 31; + return cc; + } + +-- +2.39.2 + diff --git a/queue-4.19/series b/queue-4.19/series index bf5d196badd..099b6e281e4 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -83,3 +83,20 @@ netfilter-nf_tables-stricter-validation-of-element-d.patch netfilter-nf_tables-validate-nfta_set_elem_objref-ba.patch netfilter-nf_tables-do-not-allow-rule_id-to-refer-to.patch hid-wacom-force-pen-out-of-prox-if-no-events-have-been-received-in-a-while.patch +add-acer-aspire-ethos-8951g-model-quirk.patch +alsa-hda-realtek-more-constifications.patch +alsa-hda-realtek-add-headset-mic-supported-for-hp-cp.patch +alsa-hda-realtek-enable-headset-mic-of-acer-x2660g-w.patch +alsa-hda-realtek-enable-the-headset-of-acer-n50-600-.patch +alsa-hda-realtek-the-front-mic-on-a-hp-machine-doesn.patch +alsa-hda-realtek-fix-the-mic-type-detection-issue-fo.patch +alsa-hda-realtek-add-headset-mic-support-for-lenovo-.patch +alsa-hda-realtek-alc897-headset-mic-no-sound.patch +alsa-hda-realtek-add-a-quirk-for-hp-elitedesk-805.patch +lib-string_helpers-introduce-string_upper-and-string.patch +usb-gadget-u_ether-convert-prints-to-device-prints.patch +usb-gadget-u_ether-fix-host-mac-address-case.patch +vc_screen-rewrite-vcs_size-to-accept-vc-not-inode.patch +vc_screen-reload-load-of-struct-vc_data-pointer-in-v.patch +s390-qdio-get-rid-of-register-asm.patch +s390-qdio-fix-do_sqbs-inline-assembly-constraint.patch diff --git a/queue-4.19/usb-gadget-u_ether-convert-prints-to-device-prints.patch b/queue-4.19/usb-gadget-u_ether-convert-prints-to-device-prints.patch new file mode 100644 index 00000000000..972a9cabd78 --- /dev/null +++ b/queue-4.19/usb-gadget-u_ether-convert-prints-to-device-prints.patch @@ -0,0 +1,86 @@ +From 40bd9def31ffdc18182cdb6e9af03b7047c95df6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Feb 2023 12:53:18 +0000 +Subject: usb: gadget: u_ether: Convert prints to device prints + +From: Jon Hunter + +[ Upstream commit 938fc645317632d79c048608689683b5437496ea ] + +The USB ethernet gadget driver implements its own print macros which +call printk. Device drivers should use the device prints that print the +device name. Fortunately, the same macro names are defined in the header +file 'linux/usb/composite.h' and these use the device prints. Therefore, +remove the local definitions in the USB ethernet gadget driver and use +those in 'linux/usb/composite.h'. The only difference is that now the +device name is printed instead of the ethernet interface name. + +Tested using ethernet gadget on Jetson AGX Orin. + +Signed-off-by: Jon Hunter +Tested-by: Jon Hunter +Link: https://lore.kernel.org/r/20230209125319.18589-1-jonathanh@nvidia.com +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 3c0f4f09c063 ("usb: gadget: u_ether: Fix host MAC address case") +Signed-off-by: Sasha Levin +--- + drivers/usb/gadget/function/u_ether.c | 36 +-------------------------- + 1 file changed, 1 insertion(+), 35 deletions(-) + +diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c +index 2fe91f120bb1d..561a090ced6de 100644 +--- a/drivers/usb/gadget/function/u_ether.c ++++ b/drivers/usb/gadget/function/u_ether.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + #include "u_ether.h" + +@@ -102,41 +103,6 @@ static inline int qlen(struct usb_gadget *gadget, unsigned qmult) + + /*-------------------------------------------------------------------------*/ + +-/* REVISIT there must be a better way than having two sets +- * of debug calls ... +- */ +- +-#undef DBG +-#undef VDBG +-#undef ERROR +-#undef INFO +- +-#define xprintk(d, level, fmt, args...) \ +- printk(level "%s: " fmt , (d)->net->name , ## args) +- +-#ifdef DEBUG +-#undef DEBUG +-#define DBG(dev, fmt, args...) \ +- xprintk(dev , KERN_DEBUG , fmt , ## args) +-#else +-#define DBG(dev, fmt, args...) \ +- do { } while (0) +-#endif /* DEBUG */ +- +-#ifdef VERBOSE_DEBUG +-#define VDBG DBG +-#else +-#define VDBG(dev, fmt, args...) \ +- do { } while (0) +-#endif /* DEBUG */ +- +-#define ERROR(dev, fmt, args...) \ +- xprintk(dev , KERN_ERR , fmt , ## args) +-#define INFO(dev, fmt, args...) \ +- xprintk(dev , KERN_INFO , fmt , ## args) +- +-/*-------------------------------------------------------------------------*/ +- + /* NETWORK DRIVER HOOKUP (to the layer above this driver) */ + + static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p) +-- +2.39.2 + diff --git a/queue-4.19/usb-gadget-u_ether-fix-host-mac-address-case.patch b/queue-4.19/usb-gadget-u_ether-fix-host-mac-address-case.patch new file mode 100644 index 00000000000..b6a943956c1 --- /dev/null +++ b/queue-4.19/usb-gadget-u_ether-fix-host-mac-address-case.patch @@ -0,0 +1,64 @@ +From 402b7d575341707fa4a8ae12708cd43ee11cfa85 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 May 2023 16:36:40 +0200 +Subject: usb: gadget: u_ether: Fix host MAC address case +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Konrad Gräfe + +[ Upstream commit 3c0f4f09c063e143822393d99cb2b19a85451c07 ] + +The CDC-ECM specification [1] requires to send the host MAC address as +an uppercase hexadecimal string in chapter "5.4 Ethernet Networking +Functional Descriptor": + The Unicode character is chosen from the set of values 30h through + 39h and 41h through 46h (0-9 and A-F). + +However, snprintf(.., "%pm", ..) generates a lowercase MAC address +string. While most host drivers are tolerant to this, UsbNcm.sys on +Windows 10 is not. Instead it uses a different MAC address with all +bytes set to zero including and after the first byte containing a +lowercase letter. On Windows 11 Microsoft fixed it, but apparently they +did not backport the fix. + +This change fixes the issue by upper-casing the MAC to comply with the +specification. + +[1]: https://www.usb.org/document-library/class-definitions-communication-devices-12, file ECM120.pdf + +Fixes: bcd4a1c40bee ("usb: gadget: u_ether: construct with default values and add setters/getters") +Cc: stable@vger.kernel.org +Signed-off-by: Konrad Gräfe +Link: https://lore.kernel.org/r/20230505143640.443014-1-k.graefe@gateware.de +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/gadget/function/u_ether.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c +index 561a090ced6de..7d9a551c47f98 100644 +--- a/drivers/usb/gadget/function/u_ether.c ++++ b/drivers/usb/gadget/function/u_ether.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + #include + + #include "u_ether.h" +@@ -940,6 +941,8 @@ int gether_get_host_addr_cdc(struct net_device *net, char *host_addr, int len) + dev = netdev_priv(net); + snprintf(host_addr, len, "%pm", dev->host_mac); + ++ string_upper(host_addr, host_addr); ++ + return strlen(host_addr); + } + EXPORT_SYMBOL_GPL(gether_get_host_addr_cdc); +-- +2.39.2 + diff --git a/queue-4.19/vc_screen-reload-load-of-struct-vc_data-pointer-in-v.patch b/queue-4.19/vc_screen-reload-load-of-struct-vc_data-pointer-in-v.patch new file mode 100644 index 00000000000..32c92a46fb9 --- /dev/null +++ b/queue-4.19/vc_screen-reload-load-of-struct-vc_data-pointer-in-v.patch @@ -0,0 +1,120 @@ +From 155f5a581ddb4850f222bd13fdd6875f32346cb0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 May 2023 06:08:48 -0500 +Subject: vc_screen: reload load of struct vc_data pointer in vcs_write() to + avoid UAF +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: George Kennedy + +[ Upstream commit 8fb9ea65c9d1338b0d2bb0a9122dc942cdd32357 ] + +After a call to console_unlock() in vcs_write() the vc_data struct can be +freed by vc_port_destruct(). Because of that, the struct vc_data pointer +must be reloaded in the while loop in vcs_write() after console_lock() to +avoid a UAF when vcs_size() is called. + +Syzkaller reported a UAF in vcs_size(). + +BUG: KASAN: slab-use-after-free in vcs_size (drivers/tty/vt/vc_screen.c:215) +Read of size 4 at addr ffff8880beab89a8 by task repro_vcs_size/4119 + +Call Trace: + +__asan_report_load4_noabort (mm/kasan/report_generic.c:380) +vcs_size (drivers/tty/vt/vc_screen.c:215) +vcs_write (drivers/tty/vt/vc_screen.c:664) +vfs_write (fs/read_write.c:582 fs/read_write.c:564) +... + + +Allocated by task 1213: +kmalloc_trace (mm/slab_common.c:1064) +vc_allocate (./include/linux/slab.h:559 ./include/linux/slab.h:680 + drivers/tty/vt/vt.c:1078 drivers/tty/vt/vt.c:1058) +con_install (drivers/tty/vt/vt.c:3334) +tty_init_dev (drivers/tty/tty_io.c:1303 drivers/tty/tty_io.c:1415 + drivers/tty/tty_io.c:1392) +tty_open (drivers/tty/tty_io.c:2082 drivers/tty/tty_io.c:2128) +chrdev_open (fs/char_dev.c:415) +do_dentry_open (fs/open.c:921) +vfs_open (fs/open.c:1052) +... + +Freed by task 4116: +kfree (mm/slab_common.c:1016) +vc_port_destruct (drivers/tty/vt/vt.c:1044) +tty_port_destructor (drivers/tty/tty_port.c:296) +tty_port_put (drivers/tty/tty_port.c:312) +vt_disallocate_all (drivers/tty/vt/vt_ioctl.c:662 (discriminator 2)) +vt_ioctl (drivers/tty/vt/vt_ioctl.c:903) +tty_ioctl (drivers/tty/tty_io.c:2778) +... + +The buggy address belongs to the object at ffff8880beab8800 + which belongs to the cache kmalloc-1k of size 1024 +The buggy address is located 424 bytes inside of + freed 1024-byte region [ffff8880beab8800, ffff8880beab8c00) + +The buggy address belongs to the physical page: +page:00000000afc77580 refcount:1 mapcount:0 mapping:0000000000000000 + index:0x0 pfn:0xbeab8 +head:00000000afc77580 order:3 entire_mapcount:0 nr_pages_mapped:0 + pincount:0 +flags: 0xfffffc0010200(slab|head|node=0|zone=1|lastcpupid=0x1fffff) +page_type: 0xffffffff() +raw: 000fffffc0010200 ffff888100042dc0 ffffea000426de00 dead000000000002 +raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 +page dumped because: kasan: bad access detected + +Memory state around the buggy address: + ffff8880beab8880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb + ffff8880beab8900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb +>ffff8880beab8980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb + ^ + ffff8880beab8a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb + ffff8880beab8a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb +================================================================== +Disabling lock debugging due to kernel taint + +Fixes: ac751efa6a0d ("console: rename acquire/release_console_sem() to console_lock/unlock()") +Cc: stable +Reported-by: syzkaller +Signed-off-by: George Kennedy +Reviewed-by: Thomas Weißschuh +Link: https://lore.kernel.org/r/1683889728-10411-1-git-send-email-george.kennedy@oracle.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/vt/vc_screen.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c +index 5decdbad2d65c..78ea9b9c64501 100644 +--- a/drivers/tty/vt/vc_screen.c ++++ b/drivers/tty/vt/vc_screen.c +@@ -504,10 +504,17 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) + } + } + +- /* The vcs_size might have changed while we slept to grab +- * the user buffer, so recheck. ++ /* The vc might have been freed or vcs_size might have changed ++ * while we slept to grab the user buffer, so recheck. + * Return data written up to now on failure. + */ ++ vc = vcs_vc(inode, &viewed); ++ if (!vc) { ++ if (written) ++ break; ++ ret = -ENXIO; ++ goto unlock_out; ++ } + size = vcs_size(vc, attr, false); + if (size < 0) { + if (written) +-- +2.39.2 + diff --git a/queue-4.19/vc_screen-rewrite-vcs_size-to-accept-vc-not-inode.patch b/queue-4.19/vc_screen-rewrite-vcs_size-to-accept-vc-not-inode.patch new file mode 100644 index 00000000000..d1ffe60a7e5 --- /dev/null +++ b/queue-4.19/vc_screen-rewrite-vcs_size-to-accept-vc-not-inode.patch @@ -0,0 +1,126 @@ +From dcc29b38c4c87a7c1992bef85c3ac7a17dec714c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 Aug 2020 10:56:55 +0200 +Subject: vc_screen: rewrite vcs_size to accept vc, not inode + +From: Jiri Slaby + +[ Upstream commit 71d4abfab322e827a75304431fe0fad3c805cb80 ] + +It is weird to fetch the information from the inode over and over. Read +and write already have the needed information, so rewrite vcs_size to +accept a vc, attr and unicode and adapt vcs_lseek to that. + +Also make sure all sites check the return value of vcs_size for errors. + +And document it using kernel-doc. + +Signed-off-by: Jiri Slaby +Link: https://lore.kernel.org/r/20200818085706.12163-5-jslaby@suse.cz +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 8fb9ea65c9d1 ("vc_screen: reload load of struct vc_data pointer in vcs_write() to avoid UAF") +Signed-off-by: Sasha Levin +--- + drivers/tty/vt/vc_screen.c | 46 ++++++++++++++++++++++++-------------- + 1 file changed, 29 insertions(+), 17 deletions(-) + +diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c +index 28bc9c70de3ec..5decdbad2d65c 100644 +--- a/drivers/tty/vt/vc_screen.c ++++ b/drivers/tty/vt/vc_screen.c +@@ -182,39 +182,47 @@ vcs_vc(struct inode *inode, int *viewed) + return vc_cons[currcons].d; + } + +-/* +- * Returns size for VC carried by inode. ++/** ++ * vcs_size -- return size for a VC in @vc ++ * @vc: which VC ++ * @attr: does it use attributes? ++ * @unicode: is it unicode? ++ * + * Must be called with console_lock. + */ +-static int +-vcs_size(struct inode *inode) ++static int vcs_size(const struct vc_data *vc, bool attr, bool unicode) + { + int size; +- struct vc_data *vc; + + WARN_CONSOLE_UNLOCKED(); + +- vc = vcs_vc(inode, NULL); +- if (!vc) +- return -ENXIO; +- + size = vc->vc_rows * vc->vc_cols; + +- if (use_attributes(inode)) { +- if (use_unicode(inode)) ++ if (attr) { ++ if (unicode) + return -EOPNOTSUPP; +- size = 2*size + HEADER_SIZE; +- } else if (use_unicode(inode)) ++ ++ size = 2 * size + HEADER_SIZE; ++ } else if (unicode) + size *= 4; ++ + return size; + } + + static loff_t vcs_lseek(struct file *file, loff_t offset, int orig) + { ++ struct inode *inode = file_inode(file); ++ struct vc_data *vc; + int size; + + console_lock(); +- size = vcs_size(file_inode(file)); ++ vc = vcs_vc(inode, NULL); ++ if (!vc) { ++ console_unlock(); ++ return -ENXIO; ++ } ++ ++ size = vcs_size(vc, use_attributes(inode), use_unicode(inode)); + console_unlock(); + if (size < 0) + return size; +@@ -276,7 +284,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) + * as copy_to_user at the end of this loop + * could sleep. + */ +- size = vcs_size(inode); ++ size = vcs_size(vc, attr, uni_mode); + if (size < 0) { + ret = size; + break; +@@ -457,7 +465,11 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) + if (!vc) + goto unlock_out; + +- size = vcs_size(inode); ++ size = vcs_size(vc, attr, false); ++ if (size < 0) { ++ ret = size; ++ goto unlock_out; ++ } + ret = -EINVAL; + if (pos < 0 || pos > size) + goto unlock_out; +@@ -496,7 +508,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) + * the user buffer, so recheck. + * Return data written up to now on failure. + */ +- size = vcs_size(inode); ++ size = vcs_size(vc, attr, false); + if (size < 0) { + if (written) + break; +-- +2.39.2 +