From 94b10911468c8e3ae6f2c88a5f2e55a0420c6664 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sat, 1 Oct 2022 18:03:40 -0400 Subject: [PATCH] Fixes for 4.19 Signed-off-by: Sasha Levin --- ...-fixup-headset-for-asus-gu502-laptop.patch | 120 +++++++++++ ...-fixup-headset-for-asus-gx502-laptop.patch | 125 +++++++++++ .../alsa-hda-hdmi-add-icelake-support.patch | 169 +++++++++++++++ .../alsa-hda-hdmi-add-tigerlake-support.patch | 57 +++++ ...-hda-hdmi-fix-pin-setup-on-tigerlake.patch | 45 ++++ ...-add-coef-workaround-for-asus-zenboo.patch | 66 ++++++ ...-add-hp-new-mute-led-supported-for-a.patch | 117 +++++++++++ ...k-add-model-alc298-samsung-headphone.patch | 38 ++++ ...-add-mute-led-and-micmute-led-suppor.patch | 41 ++++ ...tek-add-pincfg-for-asus-g513-hp-jack.patch | 61 ++++++ ...ek-add-pincfg-for-asus-g533z-hp-jack.patch | 61 ++++++ ...tek-add-quirk-for-asus-ga503r-laptop.patch | 39 ++++ ...altek-add-quirk-for-samsung-notebook.patch | 63 ++++++ ...ek-add-supported-new-mute-led-for-hp.patch | 150 ++++++++++++++ ...-enable-audio-jacks-of-acer-vcopperb.patch | 66 ++++++ ...-enable-headset-mic-of-acer-c20-820-.patch | 63 ++++++ ...-enable-headset-mic-of-acer-travelma.patch | 64 ++++++ ...-enable-headset-mic-of-acer-veriton-.patch | 63 ++++++ ...-enable-headset-mic-of-asus-gl503vm-.patch | 69 +++++++ ...-enable-headset-mic-of-asus-rog-zeph.patch | 63 ++++++ ...e-headset-mic-of-asus-rog-zeph.patch-26261 | 63 ++++++ ...ltek-fixed-hp-right-speaker-no-sound.patch | 77 +++++++ ...altek-ga503-use-same-quirks-as-ga401.patch | 38 ++++ ...-re-order-alc269-asus-quirk-table-en.patch | 66 ++++++ ...-typo_fix-enable-headset-mic-of-asus.patch | 57 +++++ ...a-hda-tegra-add-runtime-pm-callbacks.patch | 52 +++++ ...-avoid-build-error-without-config_pm.patch | 90 ++++++++ ...orrect-number-of-sdo-lines-for-tegra.patch | 94 +++++++++ ...tegra-fix-tegra194-hda-reset-failure.patch | 129 ++++++++++++ ...gra-get-clock-handles-early-in-probe.patch | 97 +++++++++ ...gra-implement-runtime-suspend-resume.patch | 114 ++++++++++ ...ra-program-wakeen-register-for-tegra.patch | 52 +++++ .../alsa-hda-tegra-reset-hardware.patch | 86 ++++++++ .../alsa-hda-tegra-use-clk_bulk-helpers.patch | 143 +++++++++++++ ...uring-unmount-when-stopping-a-space-.patch | 165 +++++++++++++++ ...umber-of-retries-after-discarding-pr.patch | 80 ++++++++ ...roduce-pcpu-seqcnt-for-freeing-pa-to.patch | 194 ++++++++++++++++++ ...actor-ext4_mb_discard_preallocations.patch | 68 ++++++ .../riscv-fix-a-nasty-sigreturn-bug.patch | 45 ++++ queue-4.19/series | 42 ++++ ...-lc-specific-functionality-into-a-se.patch | 157 ++++++++++++++ ...-nvm-upgrade-support-flag-to-struct-.patch | 88 ++++++++ ...nderbolt-rename-tunnel_pci-to-tunnel.patch | 96 +++++++++ 43 files changed, 3633 insertions(+) create mode 100644 queue-4.19/alsa-hda-fixup-headset-for-asus-gu502-laptop.patch create mode 100644 queue-4.19/alsa-hda-fixup-headset-for-asus-gx502-laptop.patch create mode 100644 queue-4.19/alsa-hda-hdmi-add-icelake-support.patch create mode 100644 queue-4.19/alsa-hda-hdmi-add-tigerlake-support.patch create mode 100644 queue-4.19/alsa-hda-hdmi-fix-pin-setup-on-tigerlake.patch create mode 100644 queue-4.19/alsa-hda-realtek-add-coef-workaround-for-asus-zenboo.patch create mode 100644 queue-4.19/alsa-hda-realtek-add-hp-new-mute-led-supported-for-a.patch create mode 100644 queue-4.19/alsa-hda-realtek-add-model-alc298-samsung-headphone.patch create mode 100644 queue-4.19/alsa-hda-realtek-add-mute-led-and-micmute-led-suppor.patch create mode 100644 queue-4.19/alsa-hda-realtek-add-pincfg-for-asus-g513-hp-jack.patch create mode 100644 queue-4.19/alsa-hda-realtek-add-pincfg-for-asus-g533z-hp-jack.patch create mode 100644 queue-4.19/alsa-hda-realtek-add-quirk-for-asus-ga503r-laptop.patch create mode 100644 queue-4.19/alsa-hda-realtek-add-quirk-for-samsung-notebook.patch create mode 100644 queue-4.19/alsa-hda-realtek-add-supported-new-mute-led-for-hp.patch create mode 100644 queue-4.19/alsa-hda-realtek-enable-audio-jacks-of-acer-vcopperb.patch create mode 100644 queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-c20-820-.patch create mode 100644 queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-travelma.patch create mode 100644 queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-veriton-.patch create mode 100644 queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-gl503vm-.patch create mode 100644 queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-rog-zeph.patch create mode 100644 queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-rog-zeph.patch-26261 create mode 100644 queue-4.19/alsa-hda-realtek-fixed-hp-right-speaker-no-sound.patch create mode 100644 queue-4.19/alsa-hda-realtek-ga503-use-same-quirks-as-ga401.patch create mode 100644 queue-4.19/alsa-hda-realtek-re-order-alc269-asus-quirk-table-en.patch create mode 100644 queue-4.19/alsa-hda-realtek-typo_fix-enable-headset-mic-of-asus.patch create mode 100644 queue-4.19/alsa-hda-tegra-add-runtime-pm-callbacks.patch create mode 100644 queue-4.19/alsa-hda-tegra-avoid-build-error-without-config_pm.patch create mode 100644 queue-4.19/alsa-hda-tegra-correct-number-of-sdo-lines-for-tegra.patch create mode 100644 queue-4.19/alsa-hda-tegra-fix-tegra194-hda-reset-failure.patch create mode 100644 queue-4.19/alsa-hda-tegra-get-clock-handles-early-in-probe.patch create mode 100644 queue-4.19/alsa-hda-tegra-implement-runtime-suspend-resume.patch create mode 100644 queue-4.19/alsa-hda-tegra-program-wakeen-register-for-tegra.patch create mode 100644 queue-4.19/alsa-hda-tegra-reset-hardware.patch create mode 100644 queue-4.19/alsa-hda-tegra-use-clk_bulk-helpers.patch create mode 100644 queue-4.19/btrfs-fix-hang-during-unmount-when-stopping-a-space-.patch create mode 100644 queue-4.19/ext4-limit-the-number-of-retries-after-discarding-pr.patch create mode 100644 queue-4.19/ext4-mballoc-introduce-pcpu-seqcnt-for-freeing-pa-to.patch create mode 100644 queue-4.19/ext4-mballoc-refactor-ext4_mb_discard_preallocations.patch create mode 100644 queue-4.19/riscv-fix-a-nasty-sigreturn-bug.patch create mode 100644 queue-4.19/series create mode 100644 queue-4.19/thunderbolt-move-lc-specific-functionality-into-a-se.patch create mode 100644 queue-4.19/thunderbolt-move-nvm-upgrade-support-flag-to-struct-.patch create mode 100644 queue-4.19/thunderbolt-rename-tunnel_pci-to-tunnel.patch diff --git a/queue-4.19/alsa-hda-fixup-headset-for-asus-gu502-laptop.patch b/queue-4.19/alsa-hda-fixup-headset-for-asus-gu502-laptop.patch new file mode 100644 index 00000000000..4f39fdc4c19 --- /dev/null +++ b/queue-4.19/alsa-hda-fixup-headset-for-asus-gu502-laptop.patch @@ -0,0 +1,120 @@ +From a763663dcd8a0e96fe85a99750b58114d07a67e6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 7 May 2021 12:31:16 -0500 +Subject: ALSA: hda: fixup headset for ASUS GU502 laptop + +From: Daniel Cordova A + +[ Upstream commit c1b55029493879f5bd585ff79f326e71f0bc05e3 ] + +The GU502 requires a few steps to make headset i/o works properly: +pincfg, verbs to unmute headphone out and callback to toggle output +between speakers and headphone using jack. + +Signed-off-by: Daniel Cordova A +Cc: +Link: https://lore.kernel.org/r/20210507173116.12043-1-danesc87@gmail.com +Signed-off-by: Takashi Iwai +Stable-dep-of: c611e6590441 ("ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 62 +++++++++++++++++++++++++++++++++++ + 1 file changed, 62 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index c0f6e0ff8e53..6e65e50508dc 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -5867,6 +5867,35 @@ static void alc294_fixup_gx502_hp(struct hda_codec *codec, + } + } + ++static void alc294_gu502_toggle_output(struct hda_codec *codec, ++ struct hda_jack_callback *cb) ++{ ++ /* Windows sets 0x10 to 0x8420 for Node 0x20 which is ++ * responsible from changes between speakers and headphones ++ */ ++ if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) ++ alc_write_coef_idx(codec, 0x10, 0x8420); ++ else ++ alc_write_coef_idx(codec, 0x10, 0x0a20); ++} ++ ++static void alc294_fixup_gu502_hp(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ if (!is_jack_detectable(codec, 0x21)) ++ return; ++ ++ switch (action) { ++ case HDA_FIXUP_ACT_PRE_PROBE: ++ snd_hda_jack_detect_enable_callback(codec, 0x21, ++ alc294_gu502_toggle_output); ++ break; ++ case HDA_FIXUP_ACT_INIT: ++ alc294_gu502_toggle_output(codec, NULL); ++ break; ++ } ++} ++ + static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, + const struct hda_fixup *fix, int action) + { +@@ -6049,6 +6078,9 @@ enum { + ALC294_FIXUP_ASUS_GX502_HP, + ALC294_FIXUP_ASUS_GX502_PINS, + ALC294_FIXUP_ASUS_GX502_VERBS, ++ ALC294_FIXUP_ASUS_GU502_HP, ++ ALC294_FIXUP_ASUS_GU502_PINS, ++ ALC294_FIXUP_ASUS_GU502_VERBS, + ALC285_FIXUP_HP_GPIO_LED, + ALC285_FIXUP_HP_MUTE_LED, + ALC236_FIXUP_HP_MUTE_LED, +@@ -7209,6 +7241,35 @@ static const struct hda_fixup alc269_fixups[] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc294_fixup_gx502_hp, + }, ++ [ALC294_FIXUP_ASUS_GU502_PINS] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x01a11050 }, /* rear HP mic */ ++ { 0x1a, 0x01a11830 }, /* rear external mic */ ++ { 0x21, 0x012110f0 }, /* rear HP out */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS ++ }, ++ [ALC294_FIXUP_ASUS_GU502_VERBS] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ /* set 0x15 to HP-OUT ctrl */ ++ { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, ++ /* unmute the 0x15 amp */ ++ { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 }, ++ /* set 0x1b to HP-OUT */ ++ { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC294_FIXUP_ASUS_GU502_HP ++ }, ++ [ALC294_FIXUP_ASUS_GU502_HP] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc294_fixup_gu502_hp, ++ }, + [ALC294_FIXUP_ASUS_COEF_1B] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { +@@ -7491,6 +7552,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), ++ SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), + SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-fixup-headset-for-asus-gx502-laptop.patch b/queue-4.19/alsa-hda-fixup-headset-for-asus-gx502-laptop.patch new file mode 100644 index 00000000000..98f8a3d3f0f --- /dev/null +++ b/queue-4.19/alsa-hda-fixup-headset-for-asus-gx502-laptop.patch @@ -0,0 +1,125 @@ +From 6b4ca0eca5353e74fc536281e4c21a7b310ca1be Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Sep 2020 20:19:59 +1200 +Subject: ALSA: hda: fixup headset for ASUS GX502 laptop + +From: Luke D Jones + +[ Upstream commit c3cdf189276c2a63da62ee250615bd55e3fb680d ] + +The GX502 requires a few steps to enable the headset i/o: pincfg, +verbs to enable and unmute the amp used for headpone out, and +a jacksense callback to toggle output via internal or jack using +a verb. + +Signed-off-by: Luke D Jones +Cc: +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208005 +Link: https://lore.kernel.org/r/20200907081959.56186-1-luke@ljones.dev +Signed-off-by: Takashi Iwai +Stable-dep-of: c611e6590441 ("ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 65 +++++++++++++++++++++++++++++++++++ + 1 file changed, 65 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index e6432ee62851..c5c6367699e9 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -5833,6 +5833,40 @@ static void alc_fixup_disable_mic_vref(struct hda_codec *codec, + snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); + } + ++ ++static void alc294_gx502_toggle_output(struct hda_codec *codec, ++ struct hda_jack_callback *cb) ++{ ++ /* The Windows driver sets the codec up in a very different way where ++ * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it ++ */ ++ if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) ++ alc_write_coef_idx(codec, 0x10, 0x8a20); ++ else ++ alc_write_coef_idx(codec, 0x10, 0x0a20); ++} ++ ++static void alc294_fixup_gx502_hp(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ /* Pin 0x21: headphones/headset mic */ ++ if (!is_jack_detectable(codec, 0x21)) ++ return; ++ ++ switch (action) { ++ case HDA_FIXUP_ACT_PRE_PROBE: ++ snd_hda_jack_detect_enable_callback(codec, 0x21, ++ alc294_gx502_toggle_output); ++ 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 ++ */ ++ alc294_gx502_toggle_output(codec, NULL); ++ break; ++ } ++} ++ + static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, + const struct hda_fixup *fix, int action) + { +@@ -6012,6 +6046,9 @@ enum { + ALC294_FIXUP_ASUS_DUAL_SPK, + ALC294_FIXUP_ASUS_HPE, + ALC294_FIXUP_ASUS_COEF_1B, ++ ALC294_FIXUP_ASUS_GX502_HP, ++ ALC294_FIXUP_ASUS_GX502_PINS, ++ ALC294_FIXUP_ASUS_GX502_VERBS, + ALC285_FIXUP_HP_GPIO_LED, + ALC285_FIXUP_HP_MUTE_LED, + ALC236_FIXUP_HP_MUTE_LED, +@@ -7145,6 +7182,33 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC + }, ++ [ALC294_FIXUP_ASUS_GX502_PINS] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x03a11050 }, /* front HP mic */ ++ { 0x1a, 0x01a11830 }, /* rear external mic */ ++ { 0x21, 0x03211020 }, /* front HP out */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS ++ }, ++ [ALC294_FIXUP_ASUS_GX502_VERBS] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ /* set 0x15 to HP-OUT ctrl */ ++ { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, ++ /* unmute the 0x15 amp */ ++ { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC294_FIXUP_ASUS_GX502_HP ++ }, ++ [ALC294_FIXUP_ASUS_GX502_HP] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc294_fixup_gx502_hp, ++ }, + [ALC294_FIXUP_ASUS_COEF_1B] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { +@@ -7428,6 +7492,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), ++ SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), + SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-hdmi-add-icelake-support.patch b/queue-4.19/alsa-hda-hdmi-add-icelake-support.patch new file mode 100644 index 00000000000..75bda62f933 --- /dev/null +++ b/queue-4.19/alsa-hda-hdmi-add-icelake-support.patch @@ -0,0 +1,169 @@ +From 956ad6dab8230890cd68e02d7f4cb21c1cebfd86 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Mar 2019 17:09:23 +0100 +Subject: ALSA: hda: hdmi - add Icelake support + +From: Jaroslav Kysela + +[ Upstream commit b0d8bc50b9f221e3af76afe0473f7c171cebbb40 ] + +This is just a port of the ASoC Icelake HDMI codec code to the legacy +HDA driver with some cleanups. + +ASoC commit 019033c854a20e10f691f6cc0e897df8817d9521: + "ASoC: Intel: hdac_hdmi: add Icelake support" + +Signed-off-by: Jaroslav Kysela +Cc: Bard liao +Cc: Pierre-Louis Bossart +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_hdmi.c | 67 +++++++++++++++++++++++++++++--------- + 1 file changed, 51 insertions(+), 16 deletions(-) + +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c +index cbd5118570fd..a6fa82890d9b 100644 +--- a/sound/pci/hda/patch_hdmi.c ++++ b/sound/pci/hda/patch_hdmi.c +@@ -57,10 +57,11 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); + #define is_geminilake(codec) (((codec)->core.vendor_id == 0x8086280d) || \ + ((codec)->core.vendor_id == 0x80862800)) + #define is_cannonlake(codec) ((codec)->core.vendor_id == 0x8086280c) ++#define is_icelake(codec) ((codec)->core.vendor_id == 0x8086280f) + #define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \ + || is_skylake(codec) || is_broxton(codec) \ +- || is_kabylake(codec)) || is_geminilake(codec) \ +- || is_cannonlake(codec) ++ || is_kabylake(codec) || is_geminilake(codec) \ ++ || is_cannonlake(codec) || is_icelake(codec)) + #define is_valleyview(codec) ((codec)->core.vendor_id == 0x80862882) + #define is_cherryview(codec) ((codec)->core.vendor_id == 0x80862883) + #define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec)) +@@ -181,6 +182,8 @@ struct hdmi_spec { + + struct hdac_chmap chmap; + hda_nid_t vendor_nid; ++ const int *port_map; ++ int port_num; + }; + + #ifdef CONFIG_SND_HDA_COMPONENT +@@ -2440,12 +2443,11 @@ static void intel_haswell_fixup_connect_list(struct hda_codec *codec, + snd_hda_override_conn_list(codec, nid, spec->num_cvts, spec->cvt_nids); + } + +-#define INTEL_VENDOR_NID 0x08 +-#define INTEL_GLK_VENDOR_NID 0x0B +-#define INTEL_GET_VENDOR_VERB 0xf81 +-#define INTEL_SET_VENDOR_VERB 0x781 +-#define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */ +-#define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */ ++#define INTEL_GET_VENDOR_VERB 0xf81 ++#define INTEL_GET_VENDOR_VERB 0xf81 ++#define INTEL_SET_VENDOR_VERB 0x781 ++#define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */ ++#define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */ + + static void intel_haswell_enable_all_pins(struct hda_codec *codec, + bool update_tree) +@@ -2525,11 +2527,29 @@ static int intel_base_nid(struct hda_codec *codec) + + static int intel_pin2port(void *audio_ptr, int pin_nid) + { +- int base_nid = intel_base_nid(audio_ptr); ++ struct hda_codec *codec = audio_ptr; ++ struct hdmi_spec *spec = codec->spec; ++ int base_nid, i; + +- if (WARN_ON(pin_nid < base_nid || pin_nid >= base_nid + 3)) +- return -1; +- return pin_nid - base_nid + 1; /* intel port is 1-based */ ++ if (!spec->port_num) { ++ base_nid = intel_base_nid(codec); ++ if (WARN_ON(pin_nid < base_nid || pin_nid >= base_nid + 3)) ++ return -1; ++ return pin_nid - base_nid + 1; /* intel port is 1-based */ ++ } ++ ++ /* ++ * looking for the pin number in the mapping table and return ++ * the index which indicate the port number ++ */ ++ for (i = 0; i < spec->port_num; i++) { ++ if (pin_nid == spec->port_map[i]) ++ return i + 1; ++ } ++ ++ /* return -1 if pin number exceeds our expectation */ ++ codec_info(codec, "Can't find the HDMI/DP port for pin %d\n", pin_nid); ++ return -1; + } + + static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe) +@@ -2643,7 +2663,8 @@ static int parse_intel_hdmi(struct hda_codec *codec) + } + + /* Intel Haswell and onwards; audio component with eld notifier */ +-static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid) ++static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid, ++ const int *port_map, int port_num) + { + struct hdmi_spec *spec; + int err; +@@ -2655,6 +2676,8 @@ static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid) + codec->dp_mst = true; + spec->dyn_pcm_assign = true; + spec->vendor_nid = vendor_nid; ++ spec->port_map = port_map; ++ spec->port_num = port_num; + + intel_haswell_enable_all_pins(codec, true); + intel_haswell_fixup_enable_dp12(codec); +@@ -2677,12 +2700,23 @@ static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid) + + static int patch_i915_hsw_hdmi(struct hda_codec *codec) + { +- return intel_hsw_common_init(codec, INTEL_VENDOR_NID); ++ return intel_hsw_common_init(codec, 0x08, NULL, 0); + } + + static int patch_i915_glk_hdmi(struct hda_codec *codec) + { +- return intel_hsw_common_init(codec, INTEL_GLK_VENDOR_NID); ++ return intel_hsw_common_init(codec, 0x0b, NULL, 0); ++} ++ ++static int patch_i915_icl_hdmi(struct hda_codec *codec) ++{ ++ /* ++ * pin to port mapping table where the value indicate the pin number and ++ * the index indicate the port number with 1 base. ++ */ ++ static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb}; ++ ++ return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map)); + } + + /* Intel Baytrail and Braswell; with eld notifier */ +@@ -3934,6 +3968,7 @@ HDA_CODEC_ENTRY(0x11069f81, "VX900 HDMI/DP", patch_via_hdmi), + HDA_CODEC_ENTRY(0x11069f84, "VX11 HDMI/DP", patch_generic_hdmi), + HDA_CODEC_ENTRY(0x11069f85, "VX11 HDMI/DP", patch_generic_hdmi), + HDA_CODEC_ENTRY(0x80860054, "IbexPeak HDMI", patch_i915_cpt_hdmi), ++HDA_CODEC_ENTRY(0x80862800, "Geminilake HDMI", patch_i915_glk_hdmi), + HDA_CODEC_ENTRY(0x80862801, "Bearlake HDMI", patch_generic_hdmi), + HDA_CODEC_ENTRY(0x80862802, "Cantiga HDMI", patch_generic_hdmi), + HDA_CODEC_ENTRY(0x80862803, "Eaglelake HDMI", patch_generic_hdmi), +@@ -3947,7 +3982,7 @@ HDA_CODEC_ENTRY(0x8086280a, "Broxton HDMI", patch_i915_hsw_hdmi), + HDA_CODEC_ENTRY(0x8086280b, "Kabylake HDMI", patch_i915_hsw_hdmi), + HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi), + HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), +-HDA_CODEC_ENTRY(0x80862800, "Geminilake HDMI", patch_i915_glk_hdmi), ++HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), + HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), + HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi), + HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-hdmi-add-tigerlake-support.patch b/queue-4.19/alsa-hda-hdmi-add-tigerlake-support.patch new file mode 100644 index 00000000000..9ac0dc1d064 --- /dev/null +++ b/queue-4.19/alsa-hda-hdmi-add-tigerlake-support.patch @@ -0,0 +1,57 @@ +From 59ede0b227739cca90ba82a9c0852aded7afa422 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Nov 2019 18:10:53 +0200 +Subject: ALSA: hda: hdmi - add Tigerlake support + +From: Kai Vehmanen + +[ Upstream commit 9a11ba7388f165762549903492fc34d29bbb3c04 ] + +Add Tigerlake HDMI codec support. + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205379 +BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=112171 +Cc: Pan Xiuli +Signed-off-by: Kai Vehmanen +Link: https://lore.kernel.org/r/20191105161053.22958-1-kai.vehmanen@linux.intel.com +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_hdmi.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c +index a6fa82890d9b..a2f6f2d50a4d 100644 +--- a/sound/pci/hda/patch_hdmi.c ++++ b/sound/pci/hda/patch_hdmi.c +@@ -2719,6 +2719,18 @@ static int patch_i915_icl_hdmi(struct hda_codec *codec) + return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map)); + } + ++static int patch_i915_tgl_hdmi(struct hda_codec *codec) ++{ ++ /* ++ * pin to port mapping table where the value indicate the pin number and ++ * the index indicate the port number with 1 base. ++ */ ++ static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf}; ++ ++ return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map)); ++} ++ ++ + /* Intel Baytrail and Braswell; with eld notifier */ + static int patch_i915_byt_hdmi(struct hda_codec *codec) + { +@@ -3983,6 +3995,7 @@ HDA_CODEC_ENTRY(0x8086280b, "Kabylake HDMI", patch_i915_hsw_hdmi), + HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi), + HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), + HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), ++HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi), + HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), + HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi), + HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-hdmi-fix-pin-setup-on-tigerlake.patch b/queue-4.19/alsa-hda-hdmi-fix-pin-setup-on-tigerlake.patch new file mode 100644 index 00000000000..18f7b02f802 --- /dev/null +++ b/queue-4.19/alsa-hda-hdmi-fix-pin-setup-on-tigerlake.patch @@ -0,0 +1,45 @@ +From eb4d877dca7721919c4a37d68f34bcca7fb7d0fb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Nov 2019 15:38:38 +0200 +Subject: ALSA: hda: hdmi - fix pin setup on Tigerlake + +From: Kai Vehmanen + +[ Upstream commit a7d0358ea3b7f8d7216e663c1ae71cabf7ac24e3 ] + +Apply same logic to pin setup as on previous platforms. Fixes +errors in HDMI/DP playback. + +Tested with both snd-hda-intel and SOF drivers. + +Fixes: 9a11ba7388f1 ("ALSA: hda: hdmi - add Tigerlake support") +Signed-off-by: Kai Vehmanen +Link: https://lore.kernel.org/r/20191111133838.21213-1-kai.vehmanen@linux.intel.com +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_hdmi.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c +index a2f6f2d50a4d..3d518d3cca39 100644 +--- a/sound/pci/hda/patch_hdmi.c ++++ b/sound/pci/hda/patch_hdmi.c +@@ -58,10 +58,12 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); + ((codec)->core.vendor_id == 0x80862800)) + #define is_cannonlake(codec) ((codec)->core.vendor_id == 0x8086280c) + #define is_icelake(codec) ((codec)->core.vendor_id == 0x8086280f) ++#define is_tigerlake(codec) ((codec)->core.vendor_id == 0x80862812) + #define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \ + || is_skylake(codec) || is_broxton(codec) \ + || is_kabylake(codec) || is_geminilake(codec) \ +- || is_cannonlake(codec) || is_icelake(codec)) ++ || is_cannonlake(codec) || is_icelake(codec) \ ++ || is_tigerlake(codec)) + #define is_valleyview(codec) ((codec)->core.vendor_id == 0x80862882) + #define is_cherryview(codec) ((codec)->core.vendor_id == 0x80862883) + #define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec)) +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-add-coef-workaround-for-asus-zenboo.patch b/queue-4.19/alsa-hda-realtek-add-coef-workaround-for-asus-zenboo.patch new file mode 100644 index 00000000000..55e0ed37b07 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-coef-workaround-for-asus-zenboo.patch @@ -0,0 +1,66 @@ +From 32945fe5d2000fa8e99252c7bcbbc5e7b922c429 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 May 2020 09:32:03 +0200 +Subject: ALSA: hda/realtek - Add COEF workaround for ASUS ZenBook UX431DA + +From: Takashi Iwai + +[ Upstream commit 1b94e59d30afecf18254ad413e953e7587645a20 ] + +ASUS ZenBook UX431DA requires an additional COEF setup when booted +from the recent Windows 10, otherwise it produces the noisy output. +The quirk turns on COEF 0x1b bit 10 that has been cleared supposedly +due to the pop noise reduction. + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207553 +Cc: +Signed-off-by: Takashi Iwai +Link: https://lore.kernel.org/r/20200512073203.14091-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Stable-dep-of: c611e6590441 ("ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index e88a82f3f8f8..b930ce8968ae 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6011,6 +6011,7 @@ enum { + ALC294_FIXUP_SPK2_TO_DAC1, + ALC294_FIXUP_ASUS_DUAL_SPK, + ALC294_FIXUP_ASUS_HPE, ++ ALC294_FIXUP_ASUS_COEF_1B, + ALC285_FIXUP_HP_GPIO_LED, + ALC285_FIXUP_HP_MUTE_LED, + ALC236_FIXUP_HP_MUTE_LED, +@@ -7143,6 +7144,17 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC + }, ++ [ALC294_FIXUP_ASUS_COEF_1B] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ /* Set bit 10 to correct noisy output after reboot from ++ * Windows 10 (due to pop noise reduction?) ++ */ ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b }, ++ { } ++ }, ++ }, + [ALC285_FIXUP_HP_GPIO_LED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_gpio_led, +@@ -7400,6 +7412,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE), + SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), + SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC), ++ SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B), + SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-add-hp-new-mute-led-supported-for-a.patch b/queue-4.19/alsa-hda-realtek-add-hp-new-mute-led-supported-for-a.patch new file mode 100644 index 00000000000..f761255c754 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-hp-new-mute-led-supported-for-a.patch @@ -0,0 +1,117 @@ +From 7c43bd73525a606efb935d2c8fd1df4c0c8dd531 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Apr 2020 14:52:42 +0800 +Subject: ALSA: hda/realtek - Add HP new mute led supported for ALC236 + +From: Kailang Yang + +[ Upstream commit 24164f434dc9c23cd34fca1e36acea9d0581bdde ] + +HP new platform has new mute led feature. +COEF index 0x34 bit 5 to control playback mute led. +COEF index 0x35 bit 2 and bit 3 to control Mic mute led. + +[ corrected typos by tiwai ] + +Signed-off-by: Kailang Yang +Link: https://lore.kernel.org/r/6741211598ba499687362ff2aa30626b@realtek.com +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +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 f220736d752a..75f150406958 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -4148,6 +4148,23 @@ static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, + } + } + ++static void alc236_fixup_hp_mute_led_coefbit(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->mute_led_polarity = 0; ++ spec->mute_led_coef_idx = 0x34; ++ spec->mute_led_coefbit_mask = 1<<5; ++ spec->mute_led_coefbit_on = 0; ++ spec->mute_led_coefbit_off = 1<<5; ++ spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook; ++ spec->gen.vmaster_mute_enum = 1; ++ } ++} ++ + /* turn on/off mic-mute LED per capture hook by coef bit */ + static void alc_hp_cap_micmute_update(struct hda_codec *codec) + { +@@ -4175,6 +4192,20 @@ static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, + } + } + ++static void alc236_fixup_hp_coef_micmute_led(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->mic_led_coef_idx = 0x35; ++ spec->mic_led_coefbit_mask = 3<<2; ++ spec->mic_led_coefbit_on = 2<<2; ++ spec->mic_led_coefbit_off = 1<<2; ++ snd_hda_gen_add_micmute_led(codec, alc_hp_cap_micmute_update); ++ } ++} ++ + static void alc285_fixup_hp_mute_led(struct hda_codec *codec, + const struct hda_fixup *fix, int action) + { +@@ -4182,6 +4213,13 @@ static void alc285_fixup_hp_mute_led(struct hda_codec *codec, + alc285_fixup_hp_coef_micmute_led(codec, fix, action); + } + ++static void alc236_fixup_hp_mute_led(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ alc236_fixup_hp_mute_led_coefbit(codec, fix, action); ++ alc236_fixup_hp_coef_micmute_led(codec, fix, action); ++} ++ + #if IS_REACHABLE(CONFIG_INPUT) + static void gpio2_mic_hotkey_event(struct hda_codec *codec, + struct hda_jack_callback *event) +@@ -5965,6 +6003,7 @@ enum { + ALC294_FIXUP_ASUS_HPE, + ALC285_FIXUP_HP_GPIO_LED, + ALC285_FIXUP_HP_MUTE_LED, ++ ALC236_FIXUP_HP_MUTE_LED, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7094,6 +7133,10 @@ static const struct hda_fixup alc269_fixups[] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_mute_led, + }, ++ [ALC236_FIXUP_HP_MUTE_LED] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc236_fixup_hp_mute_led, ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -7243,6 +7286,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED), ++ SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED), + SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), + SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-add-model-alc298-samsung-headphone.patch b/queue-4.19/alsa-hda-realtek-add-model-alc298-samsung-headphone.patch new file mode 100644 index 00000000000..1358bf8f43a --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-model-alc298-samsung-headphone.patch @@ -0,0 +1,38 @@ +From 3af8bb31251df1d60610e06f22297ff683d969d5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 16 Aug 2020 21:32:17 -0700 +Subject: ALSA: hda/realtek: Add model alc298-samsung-headphone + +From: Mike Pozulp + +[ Upstream commit 23dc958689449be85e39351a8c809c3d344b155b ] + +The very quiet and distorted headphone output bug that afflicted my +Samsung Notebook 9 is appearing in many other Samsung laptops. Expose +the quirk which fixed my laptop as a model so other users can try it. + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207423 +Signed-off-by: Mike Pozulp +Link: https://lore.kernel.org/r/20200817043219.458889-1-pozulp.kernel@gmail.com +Signed-off-by: Takashi Iwai +Stable-dep-of: bdc9b7396f7d ("ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5570 laptop") +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 49b9bf1a6950..e88a82f3f8f8 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -7735,6 +7735,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { + {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"}, + {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"}, + {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"}, ++ {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"}, + {} + }; + #define ALC225_STANDARD_PINS \ +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-add-mute-led-and-micmute-led-suppor.patch b/queue-4.19/alsa-hda-realtek-add-mute-led-and-micmute-led-suppor.patch new file mode 100644 index 00000000000..38a9de3fe5b --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-mute-led-and-micmute-led-suppor.patch @@ -0,0 +1,41 @@ +From ca44f8e21a329459ccc0995f6bc7bd4a807b402b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 17 Jun 2020 18:29:02 +0800 +Subject: ALSA: hda/realtek: Add mute LED and micmute LED support for HP + systems + +From: Kai-Heng Feng + +[ Upstream commit b2c22910fe5aae10b7e17b0721e63a3edf0c9553 ] + +There are two more HP systems control mute LED from HDA codec and need +to expose micmute led class so SoF can control micmute LED. + +Add quirks to support them. + +Signed-off-by: Kai-Heng Feng +Cc: +Link: https://lore.kernel.org/r/20200617102906.16156-2-kai.heng.feng@canonical.com +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index f4230d4da2bb..d0d004cf9b84 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -7302,6 +7302,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), ++ SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), ++ SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED), + SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-add-pincfg-for-asus-g513-hp-jack.patch b/queue-4.19/alsa-hda-realtek-add-pincfg-for-asus-g513-hp-jack.patch new file mode 100644 index 00000000000..ccf4d87384e --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-pincfg-for-asus-g513-hp-jack.patch @@ -0,0 +1,61 @@ +From 1b252464f699254be37a626ef3c626ef6c302391 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 15 Sep 2022 20:09:19 +1200 +Subject: ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack + +From: Luke D. Jones + +[ Upstream commit c611e659044168e7abcbae8ba1ea833521498fbb ] + +Fixes up the pincfg for ASUS ROG Strix G513 headphone and mic combo jack + +[ Fixed the position in the quirk table by tiwai ] + +Signed-off-by: Luke D. Jones +Cc: +Link: https://lore.kernel.org/r/20220915080921.35563-2-luke@ljones.dev +Signed-off-by: Takashi Iwai +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 6e65e50508dc..8888544ac474 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6081,6 +6081,7 @@ enum { + ALC294_FIXUP_ASUS_GU502_HP, + ALC294_FIXUP_ASUS_GU502_PINS, + ALC294_FIXUP_ASUS_GU502_VERBS, ++ ALC294_FIXUP_ASUS_G513_PINS, + ALC285_FIXUP_HP_GPIO_LED, + ALC285_FIXUP_HP_MUTE_LED, + ALC236_FIXUP_HP_MUTE_LED, +@@ -7269,6 +7270,15 @@ static const struct hda_fixup alc269_fixups[] = { + [ALC294_FIXUP_ASUS_GU502_HP] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc294_fixup_gu502_hp, ++ }, ++ [ALC294_FIXUP_ASUS_G513_PINS] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x03a11050 }, /* front HP mic */ ++ { 0x1a, 0x03a11c30 }, /* rear external mic */ ++ { 0x21, 0x03211420 }, /* front HP out */ ++ { } ++ }, + }, + [ALC294_FIXUP_ASUS_COEF_1B] = { + .type = HDA_FIXUP_VERBS, +@@ -7553,6 +7563,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), + SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), ++ SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS), + SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-add-pincfg-for-asus-g533z-hp-jack.patch b/queue-4.19/alsa-hda-realtek-add-pincfg-for-asus-g533z-hp-jack.patch new file mode 100644 index 00000000000..283a1c32631 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-pincfg-for-asus-g533z-hp-jack.patch @@ -0,0 +1,61 @@ +From b9fd8e1edb3ac904f8b527932a2397b8b822e5f6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 15 Sep 2022 20:09:20 +1200 +Subject: ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack + +From: Luke D. Jones + +[ Upstream commit bc2c23549ccd7105eb6ff0d4f0ac519285628673 ] + +Fixes up the pincfg for ASUS ROG Strix G15 (G533Z) headphone combo jack + +[ Fixed the position in the quirk table by tiwai ] + +Signed-off-by: Luke D. Jones +Cc: +Link: https://lore.kernel.org/r/20220915080921.35563-3-luke@ljones.dev +Signed-off-by: Takashi Iwai +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 1c04d7f62a6c..473e63685d26 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6082,6 +6082,7 @@ enum { + ALC294_FIXUP_ASUS_GU502_PINS, + ALC294_FIXUP_ASUS_GU502_VERBS, + ALC294_FIXUP_ASUS_G513_PINS, ++ ALC285_FIXUP_ASUS_G533Z_PINS, + ALC285_FIXUP_HP_GPIO_LED, + ALC285_FIXUP_HP_MUTE_LED, + ALC236_FIXUP_HP_MUTE_LED, +@@ -7280,6 +7281,15 @@ static const struct hda_fixup alc269_fixups[] = { + { } + }, + }, ++ [ALC285_FIXUP_ASUS_G533Z_PINS] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x14, 0x90170120 }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC294_FIXUP_ASUS_G513_PINS, ++ }, + [ALC294_FIXUP_ASUS_COEF_1B] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { +@@ -7561,6 +7571,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), ++ SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS), + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), + SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-add-quirk-for-asus-ga503r-laptop.patch b/queue-4.19/alsa-hda-realtek-add-quirk-for-asus-ga503r-laptop.patch new file mode 100644 index 00000000000..fb4591c72b0 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-quirk-for-asus-ga503r-laptop.patch @@ -0,0 +1,39 @@ +From a53b0042d329d7f149ca9d77281be98c56069720 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 15 Sep 2022 20:09:21 +1200 +Subject: ALSA: hda/realtek: Add quirk for ASUS GA503R laptop + +From: Luke D. Jones + +[ Upstream commit ba1f818053b0668a1ce2fe86b840e81b592cc560 ] + +The ASUS G15 2022 (GA503R) series laptop has the same node-to-DAC pairs +as early models and the G14, this includes bass speakers which are by +default mapped incorrectly to the 0x06 node. + +Add a quirk to use the same DAC pairs as the G14. + +Signed-off-by: Luke D. Jones +Cc: +Link: https://lore.kernel.org/r/20220915080921.35563-4-luke@ljones.dev +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 473e63685d26..7b65a51f4eec 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -7577,6 +7577,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), + SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS), + SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), ++ SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), + SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-add-quirk-for-samsung-notebook.patch b/queue-4.19/alsa-hda-realtek-add-quirk-for-samsung-notebook.patch new file mode 100644 index 00000000000..7bc3812bba8 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-quirk-for-samsung-notebook.patch @@ -0,0 +1,63 @@ +From 6354724578621bc691225ed9af55a17d63bb472b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 9 May 2020 20:28:37 -0700 +Subject: ALSA: hda/realtek: Add quirk for Samsung Notebook + +From: Mike Pozulp + +[ Upstream commit 14425f1f521fdfe274a7bb390637c786432e08b4 ] + +Some models of the Samsung Notebook 9 have very quiet and distorted +headphone output. This quirk changes the VREF value of the ALC298 +codec NID 0x1a from default HIZ to new 100. + +[ adjusted to 5.7-base and rearranged in SSID order -- tiwai ] + +Signed-off-by: Mike Pozulp +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207423 +Link: https://lore.kernel.org/r/20200510032838.1989130-1-pozulp.kernel@gmail.com +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 75f150406958..803e3131bb74 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6004,6 +6004,7 @@ enum { + ALC285_FIXUP_HP_GPIO_LED, + ALC285_FIXUP_HP_MUTE_LED, + ALC236_FIXUP_HP_MUTE_LED, ++ ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7137,6 +7138,13 @@ static const struct hda_fixup alc269_fixups[] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc236_fixup_hp_mute_led, + }, ++ [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 }, ++ { } ++ }, ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -7335,6 +7343,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE), + SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE), + SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), ++ SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), ++ SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), + SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8), + SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), + SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-add-supported-new-mute-led-for-hp.patch b/queue-4.19/alsa-hda-realtek-add-supported-new-mute-led-for-hp.patch new file mode 100644 index 00000000000..76e001ba8c9 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-add-supported-new-mute-led-for-hp.patch @@ -0,0 +1,150 @@ +From 38d3c0fb5e48ffe96276e5e0e76bafc35fddf9ca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Apr 2020 14:40:20 +0800 +Subject: ALSA: hda/realtek - Add supported new mute Led for HP + +From: Kailang Yang + +[ Upstream commit 431e76c3edd76d84a0ed1eb81a286b2ddecc5ee4 ] + +HP Note Book supported new mute Led. +Hardware PIN was not enough to meet old LED rule. +JD2 to control playback mute led. +GPO3 to control capture mute led. +(ALC285 didn't control GPO3 via verb command) +This two PIN just could control by COEF registers. + +[ corrected typos by tiwai ] + +Signed-off-by: Kailang Yang +Link: https://lore.kernel.org/r/6741211598ba499687362ff2aa30626b@realtek.com +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 81 +++++++++++++++++++++++++++++++++++ + 1 file changed, 81 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index cb556390de22..f220736d752a 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -100,6 +100,14 @@ struct alc_spec { + + unsigned int gpio_mute_led_mask; + unsigned int gpio_mic_led_mask; ++ unsigned int mute_led_coef_idx; ++ unsigned int mute_led_coefbit_mask; ++ unsigned int mute_led_coefbit_on; ++ unsigned int mute_led_coefbit_off; ++ unsigned int mic_led_coef_idx; ++ unsigned int mic_led_coefbit_mask; ++ unsigned int mic_led_coefbit_on; ++ unsigned int mic_led_coefbit_off; + + hda_nid_t headset_mic_pin; + hda_nid_t headphone_mic_pin; +@@ -4107,6 +4115,73 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec, + } + } + ++/* update mute-LED according to the speaker mute state via COEF bit */ ++static void alc_fixup_mute_led_coefbit_hook(void *private_data, int enabled) ++{ ++ struct hda_codec *codec = private_data; ++ struct alc_spec *spec = codec->spec; ++ ++ if (spec->mute_led_polarity) ++ enabled = !enabled; ++ ++ /* temporarily power up/down for setting COEF bit */ ++ enabled ? alc_update_coef_idx(codec, spec->mute_led_coef_idx, ++ spec->mute_led_coefbit_mask, spec->mute_led_coefbit_off) : ++ alc_update_coef_idx(codec, spec->mute_led_coef_idx, ++ spec->mute_led_coefbit_mask, spec->mute_led_coefbit_on); ++} ++ ++static void alc285_fixup_hp_mute_led_coefbit(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->mute_led_polarity = 0; ++ spec->mute_led_coef_idx = 0x0b; ++ spec->mute_led_coefbit_mask = 1<<3; ++ spec->mute_led_coefbit_on = 1<<3; ++ spec->mute_led_coefbit_off = 0; ++ spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook; ++ spec->gen.vmaster_mute_enum = 1; ++ } ++} ++ ++/* turn on/off mic-mute LED per capture hook by coef bit */ ++static void alc_hp_cap_micmute_update(struct hda_codec *codec) ++{ ++ struct alc_spec *spec = codec->spec; ++ ++ if (spec->gen.micmute_led.led_value) ++ alc_update_coef_idx(codec, spec->mic_led_coef_idx, ++ spec->mic_led_coefbit_mask, spec->mic_led_coefbit_on); ++ else ++ alc_update_coef_idx(codec, spec->mic_led_coef_idx, ++ spec->mic_led_coefbit_mask, spec->mic_led_coefbit_off); ++} ++ ++static void alc285_fixup_hp_coef_micmute_led(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->mic_led_coef_idx = 0x19; ++ spec->mic_led_coefbit_mask = 1<<13; ++ spec->mic_led_coefbit_on = 1<<13; ++ spec->mic_led_coefbit_off = 0; ++ snd_hda_gen_add_micmute_led(codec, alc_hp_cap_micmute_update); ++ } ++} ++ ++static void alc285_fixup_hp_mute_led(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ alc285_fixup_hp_mute_led_coefbit(codec, fix, action); ++ alc285_fixup_hp_coef_micmute_led(codec, fix, action); ++} ++ + #if IS_REACHABLE(CONFIG_INPUT) + static void gpio2_mic_hotkey_event(struct hda_codec *codec, + struct hda_jack_callback *event) +@@ -5889,6 +5964,7 @@ enum { + ALC294_FIXUP_ASUS_DUAL_SPK, + ALC294_FIXUP_ASUS_HPE, + ALC285_FIXUP_HP_GPIO_LED, ++ ALC285_FIXUP_HP_MUTE_LED, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7014,6 +7090,10 @@ static const struct hda_fixup alc269_fixups[] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_gpio_led, + }, ++ [ALC285_FIXUP_HP_MUTE_LED] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc285_fixup_hp_mute_led, ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -7162,6 +7242,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_LED), ++ SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED), + SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), + SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-enable-audio-jacks-of-acer-vcopperb.patch b/queue-4.19/alsa-hda-realtek-enable-audio-jacks-of-acer-vcopperb.patch new file mode 100644 index 00000000000..47aaf7c0020 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-enable-audio-jacks-of-acer-vcopperb.patch @@ -0,0 +1,66 @@ +From 66abf9f6cbc5c42b9e74763af35a6c174b56e8c4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jul 2020 15:18:25 +0800 +Subject: ALSA: hda/realtek - Enable audio jacks of Acer vCopperbox with + ALC269VC + +From: Jian-Hong Pan + +[ Upstream commit 8eae7e9b3967f08efaa4d70403aec513cbe45ad0 ] + +The Acer desktop vCopperbox with ALC269VC cannot detect the MIC of +headset, the line out and internal speaker until +ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS quirk applied. + +Signed-off-by: Jian-Hong Pan +Signed-off-by: Chris Chiu +Cc: +Link: https://lore.kernel.org/r/20200706071826.39726-1-jian-hong@endlessm.com +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index d0d004cf9b84..f397c9388129 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6006,6 +6006,7 @@ enum { + ALC236_FIXUP_HP_MUTE_LED, + ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, + ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, ++ ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7155,6 +7156,17 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MODE + }, ++ [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x14, 0x90100120 }, /* use as internal speaker */ ++ { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */ ++ { 0x1a, 0x01011020 }, /* use as line out */ ++ { }, ++ }, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MIC ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -7174,6 +7186,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK), ++ SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS), + SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-c20-820-.patch b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-c20-820-.patch new file mode 100644 index 00000000000..9cd962a25c7 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-c20-820-.patch @@ -0,0 +1,63 @@ +From 0cbca71a80b13bc12a944b8432705e4057fea629 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jul 2020 15:18:27 +0800 +Subject: ALSA: hda/realtek: Enable headset mic of Acer C20-820 with ALC269VC + +From: Jian-Hong Pan + +[ Upstream commit 6e15d1261d522d1d222f8f89b23c6966905e9049 ] + +The Acer Aspire C20-820 AIO's audio (1025:1065) with ALC269VC can't +detect the headset microphone until ALC269VC_FIXUP_ACER_HEADSET_MIC +quirk maps the NID 0x18 as the headset mic pin. + +Signed-off-by: Jian-Hong Pan +Signed-off-by: Daniel Drake +Cc: +Link: https://lore.kernel.org/r/20200706071826.39726-2-jian-hong@endlessm.com +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +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 f397c9388129..597cd93e8112 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6007,6 +6007,7 @@ enum { + ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, + ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, + ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS, ++ ALC269VC_FIXUP_ACER_HEADSET_MIC, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7167,6 +7168,15 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MIC + }, ++ [ALC269VC_FIXUP_ACER_HEADSET_MIC] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x18, 0x02a11030 }, /* use as headset mic */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MIC ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -7182,6 +7192,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), + SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), + SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK), + SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-travelma.patch b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-travelma.patch new file mode 100644 index 00000000000..4650b1b4434 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-travelma.patch @@ -0,0 +1,64 @@ +From 13834c566ec62a0645341367887ad81c8f1e88bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jul 2020 14:04:22 +0800 +Subject: ALSA: hda/realtek: Enable headset mic of Acer TravelMate B311R-31 + with ALC256 + +From: Jian-Hong Pan + +[ Upstream commit f50a121d2f32bccc1d6b94df925a1ce44ea7eff7 ] + +The Acer TravelMate B311R-31 laptop's audio (1025:1430) with ALC256 +cannot detect the headset microphone until +ALC256_FIXUP_ACER_MIC_NO_PRESENCE quirk maps the NID 0x19 as the headset +mic pin. + +Signed-off-by: Jian-Hong Pan +Cc: +Link: https://lore.kernel.org/r/20200713060421.62435-1-jian-hong@endlessm.com +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +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 c9ef417febaf..8c8dcb51edb7 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6010,6 +6010,7 @@ enum { + ALC269VC_FIXUP_ACER_HEADSET_MIC, + ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE, + ALC289_FIXUP_ASUS_G401, ++ ALC256_FIXUP_ACER_MIC_NO_PRESENCE, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7195,6 +7196,15 @@ static const struct hda_fixup alc269_fixups[] = { + { } + }, + }, ++ [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -7223,6 +7233,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), ++ SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), + SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X), + SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-veriton-.patch b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-veriton-.patch new file mode 100644 index 00000000000..dda848a25db --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-acer-veriton-.patch @@ -0,0 +1,63 @@ +From 2ba5840be8d1caa4f402dd38fcefc068bfaa4539 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jul 2020 15:18:29 +0800 +Subject: ALSA: hda/realtek: Enable headset mic of Acer Veriton N4660G with + ALC269VC + +From: Jian-Hong Pan + +[ Upstream commit 781c90c034d994c6a4e2badf189128a95ed864c2 ] + +The Acer Veriton N4660G desktop's audio (1025:1248) with ALC269VC cannot +detect the headset microphone until ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE +quirk maps the NID 0x18 as the headset mic pin. + +Signed-off-by: Jian-Hong Pan +Cc: +Link: https://lore.kernel.org/r/20200706071826.39726-3-jian-hong@endlessm.com +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +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 597cd93e8112..dd830b681134 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6008,6 +6008,7 @@ enum { + ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, + ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS, + ALC269VC_FIXUP_ACER_HEADSET_MIC, ++ ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7177,6 +7178,15 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MIC + }, ++ [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MIC ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -7198,6 +7208,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK), + SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS), ++ SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-gl503vm-.patch b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-gl503vm-.patch new file mode 100644 index 00000000000..62e3ce4c032 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-gl503vm-.patch @@ -0,0 +1,69 @@ +From 569dfcf21846002ec8851aa1c7b5b81868df6efe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 May 2020 14:15:24 +0800 +Subject: ALSA: hda/realtek - Enable headset mic of ASUS GL503VM with ALC295 + +From: Chris Chiu + +[ Upstream commit 9e43342b464f1de570a3ad8256ac77645749ef45 ] + +The ASUS laptop GL503VM with ALC295 can't detect the headset microphone. +The headset microphone does not work until pin 0x19 is enabled for it. + +Signed-off-by: Chris Chiu +Signed-off-by: Daniel Drake +Signed-off-by: Jian-Hong Pan +Link: https://lore.kernel.org/r/20200512061525.133985-1-jian-hong@endlessm.com +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 803e3131bb74..f4230d4da2bb 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6005,6 +6005,7 @@ enum { + ALC285_FIXUP_HP_MUTE_LED, + ALC236_FIXUP_HP_MUTE_LED, + ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, ++ ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7145,6 +7146,15 @@ static const struct hda_fixup alc269_fixups[] = { + { } + }, + }, ++ [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MODE ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -8039,6 +8049,14 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { + {0x12, 0x90a60130}, + {0x17, 0x90170110}, + {0x21, 0x03211020}), ++ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, ++ {0x12, 0x90a60130}, ++ {0x17, 0x90170110}, ++ {0x21, 0x03211020}), ++ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, ++ {0x12, 0x90a60130}, ++ {0x17, 0x90170110}, ++ {0x21, 0x03211020}), + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, + {0x14, 0x90170110}, + {0x21, 0x04211020}), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-rog-zeph.patch b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-rog-zeph.patch new file mode 100644 index 00000000000..cbaa81a4826 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-rog-zeph.patch @@ -0,0 +1,63 @@ +From cc2b62cf66b02885ad6194d3055ab8aa75327889 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 11 Jul 2020 13:05:57 +0200 +Subject: ALSA: hda/realtek: enable headset mic of ASUS ROG Zephyrus G14(G401) + series with ALC289 + +From: Armas Spann + +[ Upstream commit ff53664daff2a65f4bf2479ac56dfb3e908deff0 ] + +This patch adds support for headset mic to the ASUS ROG Zephyrus +G14(GA401) notebook series by adding the corresponding +vendor/pci_device id, as well as adding a new fixup for the used +realtek ALC289. The fixup stets the correct pin to get the headset mic +correctly recognized on audio-jack. + +Signed-off-by: Armas Spann +Cc: +Link: https://lore.kernel.org/r/20200711110557.18681-1-zappel@retarded.farm +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +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 dd830b681134..c9ef417febaf 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6009,6 +6009,7 @@ enum { + ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS, + ALC269VC_FIXUP_ACER_HEADSET_MIC, + ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE, ++ ALC289_FIXUP_ASUS_G401, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7187,6 +7188,13 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MIC + }, ++ [ALC289_FIXUP_ASUS_G401] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x03a11020 }, /* headset mic with jack detect */ ++ { } ++ }, ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -7369,6 +7377,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), + SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), ++ SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_G401), + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), + SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-rog-zeph.patch-26261 b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-rog-zeph.patch-26261 new file mode 100644 index 00000000000..b3b9f232f32 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-enable-headset-mic-of-asus-rog-zeph.patch-26261 @@ -0,0 +1,63 @@ +From 14d10b486f8dec4906fc2c329788c8052cbc7c55 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Jul 2020 16:06:16 +0200 +Subject: ALSA: hda/realtek: enable headset mic of ASUS ROG Zephyrus G15(GA502) + series with ALC289 + +From: Armas Spann + +[ Upstream commit 4b43d05a1978a93a19374c6e6b817c9c1ff4ba4b ] + +This patch adds support for headset mic to the ASUS ROG Zephyrus +G15(GA502) notebook series by adding the corresponding +vendor/pci_device id, as well as adding a new fixup for the used +realtek ALC289. The fixup stets the correct pin to get the headset mic +correctly recognized on audio-jack. + +Signed-off-by: Armas Spann +Cc: +Link: https://lore.kernel.org/r/20200724140616.298892-1-zappel@retarded.farm +Signed-off-by: Takashi Iwai +Stable-dep-of: c611e6590441 ("ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack") +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 b930ce8968ae..27850c95662a 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6021,6 +6021,7 @@ enum { + ALC269VC_FIXUP_ACER_HEADSET_MIC, + ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE, + ALC289_FIXUP_ASUS_G401, ++ ALC289_FIXUP_ASUS_GA502, + ALC256_FIXUP_ACER_MIC_NO_PRESENCE, + ALC285_FIXUP_HP_GPIO_AMP_INIT, + }; +@@ -7219,6 +7220,13 @@ static const struct hda_fixup alc269_fixups[] = { + { } + }, + }, ++ [ALC289_FIXUP_ASUS_GA502] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x03a11020 }, /* headset mic with jack detect */ ++ { } ++ }, ++ }, + [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl[]) { +@@ -7418,6 +7426,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), + SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), ++ SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_G401), + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), + SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-fixed-hp-right-speaker-no-sound.patch b/queue-4.19/alsa-hda-realtek-fixed-hp-right-speaker-no-sound.patch new file mode 100644 index 00000000000..c8c791dcfca --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-fixed-hp-right-speaker-no-sound.patch @@ -0,0 +1,77 @@ +From a7de981e0e7c38f2b7421929ec54e4f480f7d07e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Jul 2020 15:09:27 +0800 +Subject: ALSA: hda/realtek - Fixed HP right speaker no sound + +From: Kailang Yang + +[ Upstream commit 5649625344fe1f4695eace7c37d011e317bf66d5 ] + +HP NB right speaker had no sound output. +This platform was connected to I2S Amp for speaker out.(None Realtek I2S Amp IC) +EC need to check codec GPIO1 pin to initial I2S Amp. + +Signed-off-by: Kailang Yang +Cc: +Link: https://lore.kernel.org/r/01285f623ac7447187482fb4a8ecaa7c@realtek.com +Signed-off-by: Takashi Iwai +Stable-dep-of: cbcdf8c4d35c ("ALSA: hda/realtek: Add quirk for Huawei WRT-WX9") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 8c8dcb51edb7..49b9bf1a6950 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -5833,6 +5833,16 @@ static void alc_fixup_disable_mic_vref(struct hda_codec *codec, + snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); + } + ++static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ if (action != HDA_FIXUP_ACT_INIT) ++ return; ++ ++ msleep(100); ++ alc_write_coef_idx(codec, 0x65, 0x0); ++} ++ + /* for hda_fixup_thinkpad_acpi() */ + #include "thinkpad_helper.c" + +@@ -6011,6 +6021,7 @@ enum { + ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE, + ALC289_FIXUP_ASUS_G401, + ALC256_FIXUP_ACER_MIC_NO_PRESENCE, ++ ALC285_FIXUP_HP_GPIO_AMP_INIT, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7205,6 +7216,12 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE + }, ++ [ALC285_FIXUP_HP_GPIO_AMP_INIT] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc285_fixup_hp_gpio_amp_init, ++ .chained = true, ++ .chain_id = ALC285_FIXUP_HP_GPIO_LED ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -7358,7 +7375,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), + SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED), +- SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_LED), ++ SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT), + SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED), + SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED), + SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-ga503-use-same-quirks-as-ga401.patch b/queue-4.19/alsa-hda-realtek-ga503-use-same-quirks-as-ga401.patch new file mode 100644 index 00000000000..6ac264ad180 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-ga503-use-same-quirks-as-ga401.patch @@ -0,0 +1,38 @@ +From 6bdeaf88befa4618780b961a5400f3b58b4451e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Apr 2021 15:04:11 +1200 +Subject: ALSA: hda/realtek: GA503 use same quirks as GA401 + +From: Luke D Jones + +[ Upstream commit 76fae6185f5456865ff1bcb647709d44fd987eb6 ] + +The GA503 has almost exactly the same default setup as the GA401 +model with the same issues. The GA401 quirks solve all the issues +so we will use the full quirk chain. + +Signed-off-by: Luke D Jones +Cc: +Link: https://lore.kernel.org/r/20210419030411.28304-1-luke@ljones.dev +Signed-off-by: Takashi Iwai +Stable-dep-of: c611e6590441 ("ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack") +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 c5c6367699e9..c0f6e0ff8e53 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -7491,6 +7491,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), ++ SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-re-order-alc269-asus-quirk-table-en.patch b/queue-4.19/alsa-hda-realtek-re-order-alc269-asus-quirk-table-en.patch new file mode 100644 index 00000000000..1c39680e994 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-re-order-alc269-asus-quirk-table-en.patch @@ -0,0 +1,66 @@ +From 8f6efdea01aa5c718ae3499b52e226321d75c19c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 28 Apr 2021 13:26:58 +0200 +Subject: ALSA: hda/realtek: Re-order ALC269 ASUS quirk table entries + +From: Takashi Iwai + +[ Upstream commit 3cd0ed636dd19e7fbe3ebe8de8476e1718d5a8f1 ] + +Just re-order the alc269_fixup_tbl[] entries for ASUS devices for +avoiding the oversight of the duplicated or unapplied item in future. +No functional changes. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-8-tiwai@suse.de +Signed-off-by: Takashi Iwai +Stable-dep-of: bc2c23549ccd ("ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 8888544ac474..1c04d7f62a6c 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -7541,16 +7541,18 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), + SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), +- SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC), ++ SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), + SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), + SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), ++ SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), + SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE), + SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), +@@ -7559,14 +7561,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), +- SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), + SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), + SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS), + SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), +- SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), + SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-realtek-typo_fix-enable-headset-mic-of-asus.patch b/queue-4.19/alsa-hda-realtek-typo_fix-enable-headset-mic-of-asus.patch new file mode 100644 index 00000000000..003a797076d --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-typo_fix-enable-headset-mic-of-asus.patch @@ -0,0 +1,57 @@ +From 838e25cc2f8e62dee13d14902877d6550c803fda Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Jul 2020 16:08:37 +0200 +Subject: ALSA: hda/realtek: typo_fix: enable headset mic of ASUS ROG Zephyrus + G14(GA401) series with ALC289 + +From: Armas Spann + +[ Upstream commit 293a92c1d9913248b9987b68f3a5d6d2f0aae62b ] + +This patch fixes a small typo I accidently submitted with the initial patch. The board should be named GA401 not G401. + +Fixes: ff53664daff2 ("ALSA: hda/realtek: enable headset mic of ASUS ROG Zephyrus G14(G401) series with ALC289") +Signed-off-by: Armas Spann +Cc: +Link: https://lore.kernel.org/r/20200724140837.302763-1-zappel@retarded.farm +Signed-off-by: Takashi Iwai +Stable-dep-of: c611e6590441 ("ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 27850c95662a..e6432ee62851 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6020,7 +6020,7 @@ enum { + ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS, + ALC269VC_FIXUP_ACER_HEADSET_MIC, + ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE, +- ALC289_FIXUP_ASUS_G401, ++ ALC289_FIXUP_ASUS_GA401, + ALC289_FIXUP_ASUS_GA502, + ALC256_FIXUP_ACER_MIC_NO_PRESENCE, + ALC285_FIXUP_HP_GPIO_AMP_INIT, +@@ -7213,7 +7213,7 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MIC + }, +- [ALC289_FIXUP_ASUS_G401] = { ++ [ALC289_FIXUP_ASUS_GA401] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl[]) { + { 0x19, 0x03a11020 }, /* headset mic with jack detect */ +@@ -7427,7 +7427,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), +- SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_G401), ++ SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), + SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-tegra-add-runtime-pm-callbacks.patch b/queue-4.19/alsa-hda-tegra-add-runtime-pm-callbacks.patch new file mode 100644 index 00000000000..9bba87396ab --- /dev/null +++ b/queue-4.19/alsa-hda-tegra-add-runtime-pm-callbacks.patch @@ -0,0 +1,52 @@ +From e1218cc8eaeb45dec5b353e7397f1491aabf37cb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jan 2019 13:03:18 +0530 +Subject: ALSA: hda/tegra: add runtime PM callbacks + +From: Sameer Pujar + +[ Upstream commit f2974aa21a414f9a2421fc69d2e289d3c74b2d3d ] + +This patch adds skeleton of runtime suspend and resume callbacks. + +Signed-off-by: Sameer Pujar +Reviewed-by: Ravindra Lokhande +Reviewed-by: Mohan Kumar D +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_tegra.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c +index 40d71fe88f14..79a7d9bbf8ed 100644 +--- a/sound/pci/hda/hda_tegra.c ++++ b/sound/pci/hda/hda_tegra.c +@@ -279,8 +279,23 @@ static int hda_tegra_resume(struct device *dev) + } + #endif /* CONFIG_PM_SLEEP */ + ++#ifdef CONFIG_PM ++static int hda_tegra_runtime_suspend(struct device *dev) ++{ ++ return 0; ++} ++ ++static int hda_tegra_runtime_resume(struct device *dev) ++{ ++ return 0; ++} ++#endif /* CONFIG_PM */ ++ + static const struct dev_pm_ops hda_tegra_pm = { + SET_SYSTEM_SLEEP_PM_OPS(hda_tegra_suspend, hda_tegra_resume) ++ SET_RUNTIME_PM_OPS(hda_tegra_runtime_suspend, ++ hda_tegra_runtime_resume, ++ NULL) + }; + + static int hda_tegra_dev_disconnect(struct snd_device *device) +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-tegra-avoid-build-error-without-config_pm.patch b/queue-4.19/alsa-hda-tegra-avoid-build-error-without-config_pm.patch new file mode 100644 index 00000000000..e5bb6adc5b2 --- /dev/null +++ b/queue-4.19/alsa-hda-tegra-avoid-build-error-without-config_pm.patch @@ -0,0 +1,90 @@ +From 55b0f3b90409f378c294a511e3619a6874618250 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Mar 2019 21:33:25 +0100 +Subject: ALSA: hda/tegra: avoid build error without CONFIG_PM + +From: Arnd Bergmann + +[ Upstream commit 7472946915aad1cc751cce3edfd8c1fd5c845834 ] + +The #ifdef protection around the PM functions is wrong, leading to +a failed reference in some configurations: + +sound/pci/hda/hda_tegra.c: In function 'hda_tegra_runtime_suspend': +sound/pci/hda/hda_tegra.c:273:2: error: implicit declaration of function 'hda_tegra_disable_clocks'; did you mean 'hda_tegra_enable_clocks'? [-Werror=implicit-function-declaration] + +Better remove the #ifdefs entirely and rely on the compiler silently +dropping unused functions marked __maybe_unused. + +Fixes: 707e0759f2f4 ("ALSA: hda/tegra: implement runtime suspend/resume") +Acked-by: Thierry Reding +Signed-off-by: Arnd Bergmann +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_tegra.c | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c +index 7bcdbbab13fa..49a38865a295 100644 +--- a/sound/pci/hda/hda_tegra.c ++++ b/sound/pci/hda/hda_tegra.c +@@ -233,7 +233,6 @@ static int hda_tegra_enable_clocks(struct hda_tegra *data) + return rc; + } + +-#ifdef CONFIG_PM_SLEEP + static void hda_tegra_disable_clocks(struct hda_tegra *data) + { + clk_disable_unprepare(data->hda2hdmi_clk); +@@ -244,7 +243,7 @@ static void hda_tegra_disable_clocks(struct hda_tegra *data) + /* + * power management + */ +-static int hda_tegra_suspend(struct device *dev) ++static int __maybe_unused hda_tegra_suspend(struct device *dev) + { + struct snd_card *card = dev_get_drvdata(dev); + int rc; +@@ -257,7 +256,7 @@ static int hda_tegra_suspend(struct device *dev) + return 0; + } + +-static int hda_tegra_resume(struct device *dev) ++static int __maybe_unused hda_tegra_resume(struct device *dev) + { + struct snd_card *card = dev_get_drvdata(dev); + int rc; +@@ -269,10 +268,8 @@ static int hda_tegra_resume(struct device *dev) + + return 0; + } +-#endif /* CONFIG_PM_SLEEP */ + +-#ifdef CONFIG_PM +-static int hda_tegra_runtime_suspend(struct device *dev) ++static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev) + { + struct snd_card *card = dev_get_drvdata(dev); + struct azx *chip = card->private_data; +@@ -289,7 +286,7 @@ static int hda_tegra_runtime_suspend(struct device *dev) + return 0; + } + +-static int hda_tegra_runtime_resume(struct device *dev) ++static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) + { + struct snd_card *card = dev_get_drvdata(dev); + struct azx *chip = card->private_data; +@@ -306,7 +303,6 @@ static int hda_tegra_runtime_resume(struct device *dev) + + return 0; + } +-#endif /* CONFIG_PM */ + + static const struct dev_pm_ops hda_tegra_pm = { + SET_SYSTEM_SLEEP_PM_OPS(hda_tegra_suspend, hda_tegra_resume) +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-tegra-correct-number-of-sdo-lines-for-tegra.patch b/queue-4.19/alsa-hda-tegra-correct-number-of-sdo-lines-for-tegra.patch new file mode 100644 index 00000000000..8b9e7cf0375 --- /dev/null +++ b/queue-4.19/alsa-hda-tegra-correct-number-of-sdo-lines-for-tegra.patch @@ -0,0 +1,94 @@ +From 84ffe331206a154805066d1954b4f3a4ff92c002 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 May 2020 13:46:14 +0530 +Subject: ALSA: hda/tegra: correct number of SDO lines for Tegra194 + +From: Sameer Pujar + +[ Upstream commit bb9b02a4589cee66cdb92eb9b7191d6557afdd6f ] + +Tegra194 supports 4 SDO lines but GCAP register indicates 2 lines. Thus it +does not reflect the true capability of the HW. This patch presents a +workaround by updating NSDO value accordingly in T_AZA_DBG_CFG_2 register. + +Signed-off-by: Sameer Pujar +Link: https://lore.kernel.org/r/1588580176-2801-2-git-send-email-spujar@nvidia.com +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_tegra.c | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c +index 49a38865a295..bdd0459438f7 100644 +--- a/sound/pci/hda/hda_tegra.c ++++ b/sound/pci/hda/hda_tegra.c +@@ -62,10 +62,21 @@ + #define HDA_IPFS_INTR_MASK 0x188 + #define HDA_IPFS_EN_INTR (1 << 16) + ++/* FPCI */ ++#define FPCI_DBG_CFG_2 0x10F4 ++#define FPCI_GCAP_NSDO_SHIFT 18 ++#define FPCI_GCAP_NSDO_MASK (0x3 << FPCI_GCAP_NSDO_SHIFT) ++ + /* max number of SDs */ + #define NUM_CAPTURE_SD 1 + #define NUM_PLAYBACK_SD 1 + ++/* ++ * Tegra194 does not reflect correct number of SDO lines. Below macro ++ * is used to update the GCAP register to workaround the issue. ++ */ ++#define TEGRA194_NUM_SDO_LINES 4 ++ + struct hda_tegra { + struct azx chip; + struct device *dev; +@@ -392,6 +403,7 @@ static int hda_tegra_init_clk(struct hda_tegra *hda) + + static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) + { ++ struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); + struct hdac_bus *bus = azx_bus(chip); + struct snd_card *card = chip->card; + int err; +@@ -417,6 +429,26 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) + + synchronize_irq(bus->irq); + ++ /* ++ * Tegra194 has 4 SDO lines and the STRIPE can be used to ++ * indicate how many of the SDO lines the stream should be ++ * striped. But GCAP register does not reflect the true ++ * capability of HW. Below workaround helps to fix this. ++ * ++ * GCAP_NSDO is bits 19:18 in T_AZA_DBG_CFG_2, ++ * 0 for 1 SDO, 1 for 2 SDO, 2 for 4 SDO lines. ++ */ ++ if (of_device_is_compatible(np, "nvidia,tegra194-hda")) { ++ u32 val; ++ ++ dev_info(card->dev, "Override SDO lines to %u\n", ++ TEGRA194_NUM_SDO_LINES); ++ ++ val = readl(hda->regs + FPCI_DBG_CFG_2) & ~FPCI_GCAP_NSDO_MASK; ++ val |= (TEGRA194_NUM_SDO_LINES >> 1) << FPCI_GCAP_NSDO_SHIFT; ++ writel(val, hda->regs + FPCI_DBG_CFG_2); ++ } ++ + gcap = azx_readw(chip, GCAP); + dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap); + +@@ -517,6 +549,7 @@ static int hda_tegra_create(struct snd_card *card, + + static const struct of_device_id hda_tegra_match[] = { + { .compatible = "nvidia,tegra30-hda" }, ++ { .compatible = "nvidia,tegra194-hda" }, + {}, + }; + MODULE_DEVICE_TABLE(of, hda_tegra_match); +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-tegra-fix-tegra194-hda-reset-failure.patch b/queue-4.19/alsa-hda-tegra-fix-tegra194-hda-reset-failure.patch new file mode 100644 index 00000000000..19a84c6e637 --- /dev/null +++ b/queue-4.19/alsa-hda-tegra-fix-tegra194-hda-reset-failure.patch @@ -0,0 +1,129 @@ +From 311cc5077ae25f12adc94b85e2ac6506a36949b3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Dec 2021 17:23:49 +0530 +Subject: ALSA: hda/tegra: Fix Tegra194 HDA reset failure + +From: Sameer Pujar + +[ Upstream commit d278dc9151a034674b31ffeda24cdfb0073570f3 ] + +HDA regression is recently reported on Tegra194 based platforms. +This happens because "hda2codec_2x" reset does not really exist +in Tegra194 and it causes probe failure. All the HDA based audio +tests fail at the moment. This underlying issue is exposed by +commit c045ceb5a145 ("reset: tegra-bpmp: Handle errors in BPMP +response") which now checks return code of BPMP command response. +Fix this issue by skipping unavailable reset on Tegra194. + +Cc: stable@vger.kernel.org +Signed-off-by: Sameer Pujar +Reviewed-by: Dmitry Osipenko +Link: https://lore.kernel.org/r/1640260431-11613-2-git-send-email-spujar@nvidia.com +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_tegra.c | 43 +++++++++++++++++++++++++++++++-------- + 1 file changed, 34 insertions(+), 9 deletions(-) + +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c +index ce0bcb641ee3..15cdc4f29baf 100644 +--- a/sound/pci/hda/hda_tegra.c ++++ b/sound/pci/hda/hda_tegra.c +@@ -78,14 +78,20 @@ + */ + #define TEGRA194_NUM_SDO_LINES 4 + ++struct hda_tegra_soc { ++ bool has_hda2codec_2x_reset; ++}; ++ + struct hda_tegra { + struct azx chip; + struct device *dev; +- struct reset_control *reset; ++ struct reset_control_bulk_data resets[3]; + struct clk_bulk_data clocks[3]; ++ unsigned int nresets; + unsigned int nclocks; + void __iomem *regs; + struct work_struct probe_work; ++ const struct hda_tegra_soc *soc; + }; + + #ifdef CONFIG_PM +@@ -280,7 +286,7 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) + int rc; + + if (!chip->running) { +- rc = reset_control_assert(hda->reset); ++ rc = reset_control_bulk_assert(hda->nresets, hda->resets); + if (rc) + return rc; + } +@@ -297,7 +303,7 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) + } else { + usleep_range(10, 100); + +- rc = reset_control_deassert(hda->reset); ++ rc = reset_control_bulk_deassert(hda->nresets, hda->resets); + if (rc) + return rc; + } +@@ -514,9 +520,17 @@ static int hda_tegra_create(struct snd_card *card, + return 0; + } + ++static const struct hda_tegra_soc tegra30_data = { ++ .has_hda2codec_2x_reset = true, ++}; ++ ++static const struct hda_tegra_soc tegra194_data = { ++ .has_hda2codec_2x_reset = false, ++}; ++ + static const struct of_device_id hda_tegra_match[] = { +- { .compatible = "nvidia,tegra30-hda" }, +- { .compatible = "nvidia,tegra194-hda" }, ++ { .compatible = "nvidia,tegra30-hda", .data = &tegra30_data }, ++ { .compatible = "nvidia,tegra194-hda", .data = &tegra194_data }, + {}, + }; + MODULE_DEVICE_TABLE(of, hda_tegra_match); +@@ -535,6 +549,8 @@ static int hda_tegra_probe(struct platform_device *pdev) + hda->dev = &pdev->dev; + chip = &hda->chip; + ++ hda->soc = of_device_get_match_data(&pdev->dev); ++ + err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, + THIS_MODULE, 0, &card); + if (err < 0) { +@@ -542,11 +558,20 @@ static int hda_tegra_probe(struct platform_device *pdev) + return err; + } + +- hda->reset = devm_reset_control_array_get_exclusive(&pdev->dev); +- if (IS_ERR(hda->reset)) { +- err = PTR_ERR(hda->reset); ++ hda->resets[hda->nresets++].id = "hda"; ++ hda->resets[hda->nresets++].id = "hda2hdmi"; ++ /* ++ * "hda2codec_2x" reset is not present on Tegra194. Though DT would ++ * be updated to reflect this, but to have backward compatibility ++ * below is necessary. ++ */ ++ if (hda->soc->has_hda2codec_2x_reset) ++ hda->resets[hda->nresets++].id = "hda2codec_2x"; ++ ++ err = devm_reset_control_bulk_get_exclusive(&pdev->dev, hda->nresets, ++ hda->resets); ++ if (err) + goto out_free; +- } + + hda->clocks[hda->nclocks++].id = "hda"; + hda->clocks[hda->nclocks++].id = "hda2hdmi"; +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-tegra-get-clock-handles-early-in-probe.patch b/queue-4.19/alsa-hda-tegra-get-clock-handles-early-in-probe.patch new file mode 100644 index 00000000000..0e737d6675d --- /dev/null +++ b/queue-4.19/alsa-hda-tegra-get-clock-handles-early-in-probe.patch @@ -0,0 +1,97 @@ +From 781506f3065207b35f9c152aea371ae64949058d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jan 2019 13:03:17 +0530 +Subject: ALSA: hda/tegra: get clock handles early in probe + +From: Sameer Pujar + +[ Upstream commit 65af2122e8727a6bf4890a0d2a1d79ea1db323c1 ] + +Moved devm_clk_get() API calls to a separate function and the same +can be called early in the probe. This is done before runtime PM +for the device is enabled. The runtime resume/suspend callbacks can +later enable/disable clocks respectively(the support would be added +in subsequent patches). Clock handles should be available by the +time runtime suspend/resume calls can happen. + +Signed-off-by: Sameer Pujar +Reviewed-by: Ravindra Lokhande +Reviewed-by: Mohan Kumar D +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_tegra.c | 43 ++++++++++++++++++++++++--------------- + 1 file changed, 27 insertions(+), 16 deletions(-) + +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c +index b567c4bdae00..40d71fe88f14 100644 +--- a/sound/pci/hda/hda_tegra.c ++++ b/sound/pci/hda/hda_tegra.c +@@ -320,22 +320,6 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) + struct resource *res; + int err; + +- hda->hda_clk = devm_clk_get(dev, "hda"); +- if (IS_ERR(hda->hda_clk)) { +- dev_err(dev, "failed to get hda clock\n"); +- return PTR_ERR(hda->hda_clk); +- } +- hda->hda2codec_2x_clk = devm_clk_get(dev, "hda2codec_2x"); +- if (IS_ERR(hda->hda2codec_2x_clk)) { +- dev_err(dev, "failed to get hda2codec_2x clock\n"); +- return PTR_ERR(hda->hda2codec_2x_clk); +- } +- hda->hda2hdmi_clk = devm_clk_get(dev, "hda2hdmi"); +- if (IS_ERR(hda->hda2hdmi_clk)) { +- dev_err(dev, "failed to get hda2hdmi clock\n"); +- return PTR_ERR(hda->hda2hdmi_clk); +- } +- + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + hda->regs = devm_ioremap_resource(dev, res); + if (IS_ERR(hda->regs)) +@@ -355,6 +339,29 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) + return 0; + } + ++static int hda_tegra_init_clk(struct hda_tegra *hda) ++{ ++ struct device *dev = hda->dev; ++ ++ hda->hda_clk = devm_clk_get(dev, "hda"); ++ if (IS_ERR(hda->hda_clk)) { ++ dev_err(dev, "failed to get hda clock\n"); ++ return PTR_ERR(hda->hda_clk); ++ } ++ hda->hda2codec_2x_clk = devm_clk_get(dev, "hda2codec_2x"); ++ if (IS_ERR(hda->hda2codec_2x_clk)) { ++ dev_err(dev, "failed to get hda2codec_2x clock\n"); ++ return PTR_ERR(hda->hda2codec_2x_clk); ++ } ++ hda->hda2hdmi_clk = devm_clk_get(dev, "hda2hdmi"); ++ if (IS_ERR(hda->hda2hdmi_clk)) { ++ dev_err(dev, "failed to get hda2hdmi clock\n"); ++ return PTR_ERR(hda->hda2hdmi_clk); ++ } ++ ++ return 0; ++} ++ + static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) + { + struct hdac_bus *bus = azx_bus(chip); +@@ -507,6 +514,10 @@ static int hda_tegra_probe(struct platform_device *pdev) + return err; + } + ++ err = hda_tegra_init_clk(hda); ++ if (err < 0) ++ goto out_free; ++ + err = hda_tegra_create(card, driver_flags, hda); + if (err < 0) + goto out_free; +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-tegra-implement-runtime-suspend-resume.patch b/queue-4.19/alsa-hda-tegra-implement-runtime-suspend-resume.patch new file mode 100644 index 00000000000..f740ca67197 --- /dev/null +++ b/queue-4.19/alsa-hda-tegra-implement-runtime-suspend-resume.patch @@ -0,0 +1,114 @@ +From b63ff156c9a560bf3581ee0069761d90aa465ded Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jan 2019 13:03:20 +0530 +Subject: ALSA: hda/tegra: implement runtime suspend/resume + +From: Sameer Pujar + +[ Upstream commit 707e0759f2f4aefcc5c3f08ce5fb9e98495fdc93 ] + +This patch moves clock enable/disable from system resume/suspend to +runtime resume/suspend respectively. Along with this hda controller +chip init or stop is also moved. System resume/suspend can invoke +runtime callbacks and do necessary setup. + +chip->running can be used to check for probe completion and device +access during runtime_resume or runtime_suspend can be avoided if +probe is not yet finished. This helps to avoid kernel panic during +boot where runtime PM callbacks can happen from system PM. + +Signed-off-by: Sameer Pujar +Reviewed-by: Ravindra Lokhande +Reviewed-by: Mohan Kumar D +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_tegra.c | 49 ++++++++++++++++++++++++++------------- + 1 file changed, 33 insertions(+), 16 deletions(-) + +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c +index 79a7d9bbf8ed..7bcdbbab13fa 100644 +--- a/sound/pci/hda/hda_tegra.c ++++ b/sound/pci/hda/hda_tegra.c +@@ -247,32 +247,24 @@ static void hda_tegra_disable_clocks(struct hda_tegra *data) + static int hda_tegra_suspend(struct device *dev) + { + struct snd_card *card = dev_get_drvdata(dev); +- struct azx *chip = card->private_data; +- struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); +- struct hdac_bus *bus = azx_bus(chip); ++ int rc; + ++ rc = pm_runtime_force_suspend(dev); ++ if (rc < 0) ++ return rc; + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + +- azx_stop_chip(chip); +- synchronize_irq(bus->irq); +- azx_enter_link_reset(chip); +- hda_tegra_disable_clocks(hda); +- + return 0; + } + + static int hda_tegra_resume(struct device *dev) + { + struct snd_card *card = dev_get_drvdata(dev); +- struct azx *chip = card->private_data; +- struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); +- +- hda_tegra_enable_clocks(hda); +- +- hda_tegra_init(hda); +- +- azx_init_chip(chip, 1); ++ int rc; + ++ rc = pm_runtime_force_resume(dev); ++ if (rc < 0) ++ return rc; + snd_power_change_state(card, SNDRV_CTL_POWER_D0); + + return 0; +@@ -282,11 +274,36 @@ static int hda_tegra_resume(struct device *dev) + #ifdef CONFIG_PM + static int hda_tegra_runtime_suspend(struct device *dev) + { ++ struct snd_card *card = dev_get_drvdata(dev); ++ struct azx *chip = card->private_data; ++ struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); ++ struct hdac_bus *bus = azx_bus(chip); ++ ++ if (chip && chip->running) { ++ azx_stop_chip(chip); ++ synchronize_irq(bus->irq); ++ azx_enter_link_reset(chip); ++ } ++ hda_tegra_disable_clocks(hda); ++ + return 0; + } + + static int hda_tegra_runtime_resume(struct device *dev) + { ++ struct snd_card *card = dev_get_drvdata(dev); ++ struct azx *chip = card->private_data; ++ struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); ++ int rc; ++ ++ rc = hda_tegra_enable_clocks(hda); ++ if (rc != 0) ++ return rc; ++ if (chip && chip->running) { ++ hda_tegra_init(hda); ++ azx_init_chip(chip, 1); ++ } ++ + return 0; + } + #endif /* CONFIG_PM */ +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-tegra-program-wakeen-register-for-tegra.patch b/queue-4.19/alsa-hda-tegra-program-wakeen-register-for-tegra.patch new file mode 100644 index 00000000000..f613ead0a46 --- /dev/null +++ b/queue-4.19/alsa-hda-tegra-program-wakeen-register-for-tegra.patch @@ -0,0 +1,52 @@ +From b18c53be0ec95dc1373e5acd0d2f879c83e96232 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Aug 2020 10:54:15 +0530 +Subject: ALSA: hda/tegra: Program WAKEEN register for Tegra + +From: Mohan Kumar + +[ Upstream commit 23d63a31d9f44d7daeac0d1fb65c6a73c70e5216 ] + +The WAKEEN bits are used to indicate which bits in the +STATESTS register may cause wake event during the codec +state change request. Configure the WAKEEN register for +the Tegra to detect the wake events. + +Signed-off-by: Mohan Kumar +Acked-by: Sameer Pujar +Link: https://lore.kernel.org/r/20200825052415.20626-3-mkumard@nvidia.com +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_tegra.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c +index bdd0459438f7..071d6ccf8f49 100644 +--- a/sound/pci/hda/hda_tegra.c ++++ b/sound/pci/hda/hda_tegra.c +@@ -288,6 +288,10 @@ static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev) + struct hdac_bus *bus = azx_bus(chip); + + if (chip && chip->running) { ++ /* enable controller wake up event */ ++ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | ++ STATESTS_INT_MASK); ++ + azx_stop_chip(chip); + synchronize_irq(bus->irq); + azx_enter_link_reset(chip); +@@ -310,6 +314,9 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) + if (chip && chip->running) { + hda_tegra_init(hda); + azx_init_chip(chip, 1); ++ /* disable controller wake up event*/ ++ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & ++ ~STATESTS_INT_MASK); + } + + return 0; +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-tegra-reset-hardware.patch b/queue-4.19/alsa-hda-tegra-reset-hardware.patch new file mode 100644 index 00000000000..b8ab9680f32 --- /dev/null +++ b/queue-4.19/alsa-hda-tegra-reset-hardware.patch @@ -0,0 +1,86 @@ +From 110fc22de06dfce1e394b36868e71dc3cc59fb32 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Jan 2021 03:31:50 +0300 +Subject: ALSA: hda/tegra: Reset hardware + +From: Dmitry Osipenko + +[ Upstream commit 87f0e46e7559beb6f1d1ff99f8f48b1b9d86db52 ] + +Reset hardware on RPM-resume in order to bring it into a predictable +state. + +Tested-by: Peter Geis # Ouya T30 audio works +Tested-by: Matt Merhar # Ouya T30 boot-tested +Tested-by: Nicolas Chauvet # TK1 boot-tested +Signed-off-by: Dmitry Osipenko +Link: https://lore.kernel.org/r/20210120003154.26749-3-digetx@gmail.com +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_tegra.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c +index 5dcc0bbeb216..ce0bcb641ee3 100644 +--- a/sound/pci/hda/hda_tegra.c ++++ b/sound/pci/hda/hda_tegra.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -80,6 +81,7 @@ + struct hda_tegra { + struct azx chip; + struct device *dev; ++ struct reset_control *reset; + struct clk_bulk_data clocks[3]; + unsigned int nclocks; + void __iomem *regs; +@@ -277,6 +279,12 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) + struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); + int rc; + ++ if (!chip->running) { ++ rc = reset_control_assert(hda->reset); ++ if (rc) ++ return rc; ++ } ++ + rc = clk_bulk_prepare_enable(hda->nclocks, hda->clocks); + if (rc != 0) + return rc; +@@ -286,6 +294,12 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) + /* disable controller wake up event*/ + azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & + ~STATESTS_INT_MASK); ++ } else { ++ usleep_range(10, 100); ++ ++ rc = reset_control_deassert(hda->reset); ++ if (rc) ++ return rc; + } + + return 0; +@@ -528,6 +542,12 @@ static int hda_tegra_probe(struct platform_device *pdev) + return err; + } + ++ hda->reset = devm_reset_control_array_get_exclusive(&pdev->dev); ++ if (IS_ERR(hda->reset)) { ++ err = PTR_ERR(hda->reset); ++ goto out_free; ++ } ++ + hda->clocks[hda->nclocks++].id = "hda"; + hda->clocks[hda->nclocks++].id = "hda2hdmi"; + hda->clocks[hda->nclocks++].id = "hda2codec_2x"; +-- +2.35.1 + diff --git a/queue-4.19/alsa-hda-tegra-use-clk_bulk-helpers.patch b/queue-4.19/alsa-hda-tegra-use-clk_bulk-helpers.patch new file mode 100644 index 00000000000..fdfa7870a5a --- /dev/null +++ b/queue-4.19/alsa-hda-tegra-use-clk_bulk-helpers.patch @@ -0,0 +1,143 @@ +From d7eb9f702d14864e3225a46b8cd0a6af6f8b96bd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Jan 2021 03:31:49 +0300 +Subject: ALSA: hda/tegra: Use clk_bulk helpers + +From: Dmitry Osipenko + +[ Upstream commit 3a465f027a33cbd2af74f882ad41729583195e8f ] + +Use clk_bulk helpers to make code cleaner. Note that this patch changed +the order in which clocks are enabled to make code look nicer, but this +doesn't matter in terms of hardware. + +Tested-by: Peter Geis # Ouya T30 audio works +Tested-by: Matt Merhar # Ouya T30 boot-tested +Tested-by: Nicolas Chauvet # TK1 boot-tested +Acked-by: Thierry Reding +Signed-off-by: Dmitry Osipenko +Link: https://lore.kernel.org/r/20210120003154.26749-2-digetx@gmail.com +Signed-off-by: Takashi Iwai +Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_tegra.c | 68 ++++++--------------------------------- + 1 file changed, 9 insertions(+), 59 deletions(-) + +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c +index 071d6ccf8f49..5dcc0bbeb216 100644 +--- a/sound/pci/hda/hda_tegra.c ++++ b/sound/pci/hda/hda_tegra.c +@@ -80,9 +80,8 @@ + struct hda_tegra { + struct azx chip; + struct device *dev; +- struct clk *hda_clk; +- struct clk *hda2codec_2x_clk; +- struct clk *hda2hdmi_clk; ++ struct clk_bulk_data clocks[3]; ++ unsigned int nclocks; + void __iomem *regs; + struct work_struct probe_work; + }; +@@ -221,36 +220,6 @@ static void hda_tegra_init(struct hda_tegra *hda) + writel(v, hda->regs + HDA_IPFS_INTR_MASK); + } + +-static int hda_tegra_enable_clocks(struct hda_tegra *data) +-{ +- int rc; +- +- rc = clk_prepare_enable(data->hda_clk); +- if (rc) +- return rc; +- rc = clk_prepare_enable(data->hda2codec_2x_clk); +- if (rc) +- goto disable_hda; +- rc = clk_prepare_enable(data->hda2hdmi_clk); +- if (rc) +- goto disable_codec_2x; +- +- return 0; +- +-disable_codec_2x: +- clk_disable_unprepare(data->hda2codec_2x_clk); +-disable_hda: +- clk_disable_unprepare(data->hda_clk); +- return rc; +-} +- +-static void hda_tegra_disable_clocks(struct hda_tegra *data) +-{ +- clk_disable_unprepare(data->hda2hdmi_clk); +- clk_disable_unprepare(data->hda2codec_2x_clk); +- clk_disable_unprepare(data->hda_clk); +-} +- + /* + * power management + */ +@@ -296,7 +265,7 @@ static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev) + synchronize_irq(bus->irq); + azx_enter_link_reset(chip); + } +- hda_tegra_disable_clocks(hda); ++ clk_bulk_disable_unprepare(hda->nclocks, hda->clocks); + + return 0; + } +@@ -308,7 +277,7 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) + struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); + int rc; + +- rc = hda_tegra_enable_clocks(hda); ++ rc = clk_bulk_prepare_enable(hda->nclocks, hda->clocks); + if (rc != 0) + return rc; + if (chip && chip->running) { +@@ -385,29 +354,6 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) + return 0; + } + +-static int hda_tegra_init_clk(struct hda_tegra *hda) +-{ +- struct device *dev = hda->dev; +- +- hda->hda_clk = devm_clk_get(dev, "hda"); +- if (IS_ERR(hda->hda_clk)) { +- dev_err(dev, "failed to get hda clock\n"); +- return PTR_ERR(hda->hda_clk); +- } +- hda->hda2codec_2x_clk = devm_clk_get(dev, "hda2codec_2x"); +- if (IS_ERR(hda->hda2codec_2x_clk)) { +- dev_err(dev, "failed to get hda2codec_2x clock\n"); +- return PTR_ERR(hda->hda2codec_2x_clk); +- } +- hda->hda2hdmi_clk = devm_clk_get(dev, "hda2hdmi"); +- if (IS_ERR(hda->hda2hdmi_clk)) { +- dev_err(dev, "failed to get hda2hdmi clock\n"); +- return PTR_ERR(hda->hda2hdmi_clk); +- } +- +- return 0; +-} +- + static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) + { + struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); +@@ -582,7 +528,11 @@ static int hda_tegra_probe(struct platform_device *pdev) + return err; + } + +- err = hda_tegra_init_clk(hda); ++ hda->clocks[hda->nclocks++].id = "hda"; ++ hda->clocks[hda->nclocks++].id = "hda2hdmi"; ++ hda->clocks[hda->nclocks++].id = "hda2codec_2x"; ++ ++ err = devm_clk_bulk_get(&pdev->dev, hda->nclocks, hda->clocks); + if (err < 0) + goto out_free; + +-- +2.35.1 + diff --git a/queue-4.19/btrfs-fix-hang-during-unmount-when-stopping-a-space-.patch b/queue-4.19/btrfs-fix-hang-during-unmount-when-stopping-a-space-.patch new file mode 100644 index 00000000000..55a1d396ac3 --- /dev/null +++ b/queue-4.19/btrfs-fix-hang-during-unmount-when-stopping-a-space-.patch @@ -0,0 +1,165 @@ +From 236a8edd9bd90fb29bc6f5fd65ffe091a0f7ac07 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Sep 2022 12:31:51 +0100 +Subject: btrfs: fix hang during unmount when stopping a space reclaim worker + +From: Filipe Manana + +[ Upstream commit a362bb864b8db4861977d00bd2c3222503ccc34b ] + +Often when running generic/562 from fstests we can hang during unmount, +resulting in a trace like this: + + Sep 07 11:52:00 debian9 unknown: run fstests generic/562 at 2022-09-07 11:52:00 + Sep 07 11:55:32 debian9 kernel: INFO: task umount:49438 blocked for more than 120 seconds. + Sep 07 11:55:32 debian9 kernel: Not tainted 6.0.0-rc2-btrfs-next-122 #1 + Sep 07 11:55:32 debian9 kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. + Sep 07 11:55:32 debian9 kernel: task:umount state:D stack: 0 pid:49438 ppid: 25683 flags:0x00004000 + Sep 07 11:55:32 debian9 kernel: Call Trace: + Sep 07 11:55:32 debian9 kernel: + Sep 07 11:55:32 debian9 kernel: __schedule+0x3c8/0xec0 + Sep 07 11:55:32 debian9 kernel: ? rcu_read_lock_sched_held+0x12/0x70 + Sep 07 11:55:32 debian9 kernel: schedule+0x5d/0xf0 + Sep 07 11:55:32 debian9 kernel: schedule_timeout+0xf1/0x130 + Sep 07 11:55:32 debian9 kernel: ? lock_release+0x224/0x4a0 + Sep 07 11:55:32 debian9 kernel: ? lock_acquired+0x1a0/0x420 + Sep 07 11:55:32 debian9 kernel: ? trace_hardirqs_on+0x2c/0xd0 + Sep 07 11:55:32 debian9 kernel: __wait_for_common+0xac/0x200 + Sep 07 11:55:32 debian9 kernel: ? usleep_range_state+0xb0/0xb0 + Sep 07 11:55:32 debian9 kernel: __flush_work+0x26d/0x530 + Sep 07 11:55:32 debian9 kernel: ? flush_workqueue_prep_pwqs+0x140/0x140 + Sep 07 11:55:32 debian9 kernel: ? trace_clock_local+0xc/0x30 + Sep 07 11:55:32 debian9 kernel: __cancel_work_timer+0x11f/0x1b0 + Sep 07 11:55:32 debian9 kernel: ? close_ctree+0x12b/0x5b3 [btrfs] + Sep 07 11:55:32 debian9 kernel: ? __trace_bputs+0x10b/0x170 + Sep 07 11:55:32 debian9 kernel: close_ctree+0x152/0x5b3 [btrfs] + Sep 07 11:55:32 debian9 kernel: ? evict_inodes+0x166/0x1c0 + Sep 07 11:55:32 debian9 kernel: generic_shutdown_super+0x71/0x120 + Sep 07 11:55:32 debian9 kernel: kill_anon_super+0x14/0x30 + Sep 07 11:55:32 debian9 kernel: btrfs_kill_super+0x12/0x20 [btrfs] + Sep 07 11:55:32 debian9 kernel: deactivate_locked_super+0x2e/0xa0 + Sep 07 11:55:32 debian9 kernel: cleanup_mnt+0x100/0x160 + Sep 07 11:55:32 debian9 kernel: task_work_run+0x59/0xa0 + Sep 07 11:55:32 debian9 kernel: exit_to_user_mode_prepare+0x1a6/0x1b0 + Sep 07 11:55:32 debian9 kernel: syscall_exit_to_user_mode+0x16/0x40 + Sep 07 11:55:32 debian9 kernel: do_syscall_64+0x48/0x90 + Sep 07 11:55:32 debian9 kernel: entry_SYSCALL_64_after_hwframe+0x63/0xcd + Sep 07 11:55:32 debian9 kernel: RIP: 0033:0x7fcde59a57a7 + Sep 07 11:55:32 debian9 kernel: RSP: 002b:00007ffe914217c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 + Sep 07 11:55:32 debian9 kernel: RAX: 0000000000000000 RBX: 00007fcde5ae8264 RCX: 00007fcde59a57a7 + Sep 07 11:55:32 debian9 kernel: RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000055b57556cdd0 + Sep 07 11:55:32 debian9 kernel: RBP: 000055b57556cba0 R08: 0000000000000000 R09: 00007ffe91420570 + Sep 07 11:55:32 debian9 kernel: R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 + Sep 07 11:55:32 debian9 kernel: R13: 000055b57556cdd0 R14: 000055b57556ccb8 R15: 0000000000000000 + Sep 07 11:55:32 debian9 kernel: + +What happens is the following: + +1) The cleaner kthread tries to start a transaction to delete an unused + block group, but the metadata reservation can not be satisfied right + away, so a reservation ticket is created and it starts the async + metadata reclaim task (fs_info->async_reclaim_work); + +2) Writeback for all the filler inodes with an i_size of 2K starts + (generic/562 creates a lot of 2K files with the goal of filling + metadata space). We try to create an inline extent for them, but we + fail when trying to insert the inline extent with -ENOSPC (at + cow_file_range_inline()) - since this is not critical, we fallback + to non-inline mode (back to cow_file_range()), reserve extents, create + extent maps and create the ordered extents; + +3) An unmount starts, enters close_ctree(); + +4) The async reclaim task is flushing stuff, entering the flush states one + by one, until it reaches RUN_DELAYED_IPUTS. There it runs all current + delayed iputs. + + After running the delayed iputs and before calling + btrfs_wait_on_delayed_iputs(), one or more ordered extents complete, + and btrfs_add_delayed_iput() is called for each one through + btrfs_finish_ordered_io() -> btrfs_put_ordered_extent(). This results + in bumping fs_info->nr_delayed_iputs from 0 to some positive value. + + So the async reclaim task blocks at btrfs_wait_on_delayed_iputs() waiting + for fs_info->nr_delayed_iputs to become 0; + +5) The current transaction is committed by the transaction kthread, we then + start unpinning extents and end up calling btrfs_try_granting_tickets() + through unpin_extent_range(), since we released some space. + This results in satisfying the ticket created by the cleaner kthread at + step 1, waking up the cleaner kthread; + +6) At close_ctree() we ask the cleaner kthread to park; + +7) The cleaner kthread starts the transaction, deletes the unused block + group, and then calls kthread_should_park(), which returns true, so it + parks. And at this point we have the delayed iputs added by the + completion of the ordered extents still pending; + +8) Then later at close_ctree(), when we call: + + cancel_work_sync(&fs_info->async_reclaim_work); + + We hang forever, since the cleaner was parked and no one else can run + delayed iputs after that, while the reclaim task is waiting for the + remaining delayed iputs to be completed. + +Fix this by waiting for all ordered extents to complete and running the +delayed iputs before attempting to stop the async reclaim tasks. Note that +we can not wait for ordered extents with btrfs_wait_ordered_roots() (or +other similar functions) because that waits for the BTRFS_ORDERED_COMPLETE +flag to be set on an ordered extent, but the delayed iput is added after +that, when doing the final btrfs_put_ordered_extent(). So instead wait for +the work queues used for executing ordered extent completion to be empty, +which works because we do the final put on an ordered extent at +btrfs_finish_ordered_io() (while we are in the unmount context). + +Fixes: d6fd0ae25c6495 ("Btrfs: fix missing delayed iputs on unmount") +CC: stable@vger.kernel.org # 5.15+ +Reviewed-by: Josef Bacik +Signed-off-by: Filipe Manana +Signed-off-by: David Sterba +Signed-off-by: Sasha Levin +--- + fs/btrfs/disk-io.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c +index 98f87cc47433..a5e8b2887565 100644 +--- a/fs/btrfs/disk-io.c ++++ b/fs/btrfs/disk-io.c +@@ -3994,6 +3994,31 @@ void close_ctree(struct btrfs_fs_info *fs_info) + /* clear out the rbtree of defraggable inodes */ + btrfs_cleanup_defrag_inodes(fs_info); + ++ /* ++ * After we parked the cleaner kthread, ordered extents may have ++ * completed and created new delayed iputs. If one of the async reclaim ++ * tasks is running and in the RUN_DELAYED_IPUTS flush state, then we ++ * can hang forever trying to stop it, because if a delayed iput is ++ * added after it ran btrfs_run_delayed_iputs() and before it called ++ * btrfs_wait_on_delayed_iputs(), it will hang forever since there is ++ * no one else to run iputs. ++ * ++ * So wait for all ongoing ordered extents to complete and then run ++ * delayed iputs. This works because once we reach this point no one ++ * can either create new ordered extents nor create delayed iputs ++ * through some other means. ++ * ++ * Also note that btrfs_wait_ordered_roots() is not safe here, because ++ * it waits for BTRFS_ORDERED_COMPLETE to be set on an ordered extent, ++ * but the delayed iput for the respective inode is made only when doing ++ * the final btrfs_put_ordered_extent() (which must happen at ++ * btrfs_finish_ordered_io() when we are unmounting). ++ */ ++ btrfs_flush_workqueue(fs_info->endio_write_workers); ++ /* Ordered extents for free space inodes. */ ++ btrfs_flush_workqueue(fs_info->endio_freespace_worker); ++ btrfs_run_delayed_iputs(fs_info); ++ + cancel_work_sync(&fs_info->async_reclaim_work); + + if (!sb_rdonly(fs_info->sb)) { +-- +2.35.1 + diff --git a/queue-4.19/ext4-limit-the-number-of-retries-after-discarding-pr.patch b/queue-4.19/ext4-limit-the-number-of-retries-after-discarding-pr.patch new file mode 100644 index 00000000000..b2188513087 --- /dev/null +++ b/queue-4.19/ext4-limit-the-number-of-retries-after-discarding-pr.patch @@ -0,0 +1,80 @@ +From ffc48fe0212c439fc39dbf2e2f0db168b5278abd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 1 Sep 2022 18:03:14 -0400 +Subject: ext4: limit the number of retries after discarding preallocations + blocks + +From: Theodore Ts'o + +[ Upstream commit 80fa46d6b9e7b1527bfd2197d75431fd9c382161 ] + +This patch avoids threads live-locking for hours when a large number +threads are competing over the last few free extents as they blocks +getting added and removed from preallocation pools. From our bug +reporter: + + A reliable way for triggering this has multiple writers + continuously write() to files when the filesystem is full, while + small amounts of space are freed (e.g. by truncating a large file + -1MiB at a time). In the local filesystem, this can be done by + simply not checking the return code of write (0) and/or the error + (ENOSPACE) that is set. Over NFS with an async mount, even clients + with proper error checking will behave this way since the linux NFS + client implementation will not propagate the server errors [the + write syscalls immediately return success] until the file handle is + closed. This leads to a situation where NFS clients send a + continuous stream of WRITE rpcs which result in ERRNOSPACE -- but + since the client isn't seeing this, the stream of writes continues + at maximum network speed. + + When some space does appear, multiple writers will all attempt to + claim it for their current write. For NFS, we may see dozens to + hundreds of threads that do this. + + The real-world scenario of this is database backup tooling (in + particular, github.com/mdkent/percona-xtrabackup) which may write + large files (>1TiB) to NFS for safe keeping. Some temporary files + are written, rewound, and read back -- all before closing the file + handle (the temp file is actually unlinked, to trigger automatic + deletion on close/crash.) An application like this operating on an + async NFS mount will not see an error code until TiB have been + written/read. + + The lockup was observed when running this database backup on large + filesystems (64 TiB in this case) with a high number of block + groups and no free space. Fragmentation is generally not a factor + in this filesystem (~thousands of large files, mostly contiguous + except for the parts written while the filesystem is at capacity.) + +Signed-off-by: Theodore Ts'o +Cc: stable@kernel.org +Signed-off-by: Sasha Levin +--- + fs/ext4/mballoc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c +index 40d5c7a4ccc3..daa343d278b1 100644 +--- a/fs/ext4/mballoc.c ++++ b/fs/ext4/mballoc.c +@@ -4561,6 +4561,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, + ext4_fsblk_t block = 0; + unsigned int inquota = 0; + unsigned int reserv_clstrs = 0; ++ int retries = 0; + u64 seq; + + might_sleep(); +@@ -4655,7 +4656,8 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, + ar->len = ac->ac_b_ex.fe_len; + } + } else { +- if (ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)) ++ if (++retries < 3 && ++ ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)) + goto repeat; + *errp = -ENOSPC; + } +-- +2.35.1 + diff --git a/queue-4.19/ext4-mballoc-introduce-pcpu-seqcnt-for-freeing-pa-to.patch b/queue-4.19/ext4-mballoc-introduce-pcpu-seqcnt-for-freeing-pa-to.patch new file mode 100644 index 00000000000..72b42232578 --- /dev/null +++ b/queue-4.19/ext4-mballoc-introduce-pcpu-seqcnt-for-freeing-pa-to.patch @@ -0,0 +1,194 @@ +From 37b184a053d16749d0e09a8c1ab8a6b91c56eb97 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 May 2020 12:10:34 +0530 +Subject: ext4: mballoc: introduce pcpu seqcnt for freeing PA to improve ENOSPC + handling + +From: Ritesh Harjani + +[ Upstream commit 07b5b8e1ac4004b7db1065a301df65cd434c31c9 ] + +There could be a race in function ext4_mb_discard_group_preallocations() +where the 1st thread may iterate through group's bb_prealloc_list and +remove all the PAs and add to function's local list head. +Now if the 2nd thread comes in to discard the group preallocations, +it will see that the group->bb_prealloc_list is empty and will return 0. + +Consider for a case where we have less number of groups +(for e.g. just group 0), +this may even return an -ENOSPC error from ext4_mb_new_blocks() +(where we call for ext4_mb_discard_group_preallocations()). +But that is wrong, since 2nd thread should have waited for 1st thread +to release all the PAs and should have retried for allocation. +Since 1st thread was anyway going to discard the PAs. + +The algorithm using this percpu seq counter goes below: +1. We sample the percpu discard_pa_seq counter before trying for block + allocation in ext4_mb_new_blocks(). +2. We increment this percpu discard_pa_seq counter when we either allocate + or free these blocks i.e. while marking those blocks as used/free in + mb_mark_used()/mb_free_blocks(). +3. We also increment this percpu seq counter when we successfully identify + that the bb_prealloc_list is not empty and hence proceed for discarding + of those PAs inside ext4_mb_discard_group_preallocations(). + +Now to make sure that the regular fast path of block allocation is not +affected, as a small optimization we only sample the percpu seq counter +on that cpu. Only when the block allocation fails and when freed blocks +found were 0, that is when we sample percpu seq counter for all cpus using +below function ext4_get_discard_pa_seq_sum(). This happens after making +sure that all the PAs on grp->bb_prealloc_list got freed or if it's empty. + +It can be well argued that why don't just check for grp->bb_free to +see if there are any free blocks to be allocated. So here are the two +concerns which were discussed:- + +1. If for some reason the blocks available in the group are not + appropriate for allocation logic (say for e.g. + EXT4_MB_HINT_GOAL_ONLY, although this is not yet implemented), then + the retry logic may result into infinte looping since grp->bb_free is + non-zero. + +2. Also before preallocation was clubbed with block allocation with the + same ext4_lock_group() held, there were lot of races where grp->bb_free + could not be reliably relied upon. +Due to above, this patch considers discard_pa_seq logic to determine if +we should retry for block allocation. Say if there are are n threads +trying for block allocation and none of those could allocate or discard +any of the blocks, then all of those n threads will fail the block +allocation and return -ENOSPC error. (Since the seq counter for all of +those will match as no block allocation/discard was done during that +duration). + +Signed-off-by: Ritesh Harjani +Link: https://lore.kernel.org/r/7f254686903b87c419d798742fd9a1be34f0657b.1589955723.git.riteshh@linux.ibm.com +Signed-off-by: Theodore Ts'o +Stable-dep-of: 80fa46d6b9e7 ("ext4: limit the number of retries after discarding preallocations blocks") +Signed-off-by: Sasha Levin +--- + fs/ext4/mballoc.c | 56 ++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 51 insertions(+), 5 deletions(-) + +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c +index ad2b7832f153..40d5c7a4ccc3 100644 +--- a/fs/ext4/mballoc.c ++++ b/fs/ext4/mballoc.c +@@ -357,6 +357,35 @@ static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, + static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap, + ext4_group_t group); + ++/* ++ * The algorithm using this percpu seq counter goes below: ++ * 1. We sample the percpu discard_pa_seq counter before trying for block ++ * allocation in ext4_mb_new_blocks(). ++ * 2. We increment this percpu discard_pa_seq counter when we either allocate ++ * or free these blocks i.e. while marking those blocks as used/free in ++ * mb_mark_used()/mb_free_blocks(). ++ * 3. We also increment this percpu seq counter when we successfully identify ++ * that the bb_prealloc_list is not empty and hence proceed for discarding ++ * of those PAs inside ext4_mb_discard_group_preallocations(). ++ * ++ * Now to make sure that the regular fast path of block allocation is not ++ * affected, as a small optimization we only sample the percpu seq counter ++ * on that cpu. Only when the block allocation fails and when freed blocks ++ * found were 0, that is when we sample percpu seq counter for all cpus using ++ * below function ext4_get_discard_pa_seq_sum(). This happens after making ++ * sure that all the PAs on grp->bb_prealloc_list got freed or if it's empty. ++ */ ++static DEFINE_PER_CPU(u64, discard_pa_seq); ++static inline u64 ext4_get_discard_pa_seq_sum(void) ++{ ++ int __cpu; ++ u64 __seq = 0; ++ ++ for_each_possible_cpu(__cpu) ++ __seq += per_cpu(discard_pa_seq, __cpu); ++ return __seq; ++} ++ + static inline void *mb_correct_addr_and_bit(int *bit, void *addr) + { + #if BITS_PER_LONG == 64 +@@ -1430,6 +1459,7 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, + mb_check_buddy(e4b); + mb_free_blocks_double(inode, e4b, first, count); + ++ this_cpu_inc(discard_pa_seq); + e4b->bd_info->bb_free += count; + if (first < e4b->bd_info->bb_first_free) + e4b->bd_info->bb_first_free = first; +@@ -1572,6 +1602,7 @@ static int mb_mark_used(struct ext4_buddy *e4b, struct ext4_free_extent *ex) + mb_check_buddy(e4b); + mb_mark_used_double(e4b, start, len); + ++ this_cpu_inc(discard_pa_seq); + e4b->bd_info->bb_free -= len; + if (e4b->bd_info->bb_first_free == start) + e4b->bd_info->bb_first_free += len; +@@ -3950,6 +3981,7 @@ ext4_mb_discard_group_preallocations(struct super_block *sb, + INIT_LIST_HEAD(&list); + repeat: + ext4_lock_group(sb, group); ++ this_cpu_inc(discard_pa_seq); + list_for_each_entry_safe(pa, tmp, + &grp->bb_prealloc_list, pa_group_list) { + spin_lock(&pa->pa_lock); +@@ -4493,14 +4525,26 @@ static int ext4_mb_discard_preallocations(struct super_block *sb, int needed) + } + + static bool ext4_mb_discard_preallocations_should_retry(struct super_block *sb, +- struct ext4_allocation_context *ac) ++ struct ext4_allocation_context *ac, u64 *seq) + { + int freed; ++ u64 seq_retry = 0; ++ bool ret = false; + + freed = ext4_mb_discard_preallocations(sb, ac->ac_o_ex.fe_len); +- if (freed) +- return true; +- return false; ++ if (freed) { ++ ret = true; ++ goto out_dbg; ++ } ++ seq_retry = ext4_get_discard_pa_seq_sum(); ++ if (seq_retry != *seq) { ++ *seq = seq_retry; ++ ret = true; ++ } ++ ++out_dbg: ++ mb_debug(sb, "freed %d, retry ? %s\n", freed, ret ? "yes" : "no"); ++ return ret; + } + + /* +@@ -4517,6 +4561,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, + ext4_fsblk_t block = 0; + unsigned int inquota = 0; + unsigned int reserv_clstrs = 0; ++ u64 seq; + + might_sleep(); + sb = ar->inode->i_sb; +@@ -4578,6 +4623,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, + } + + ac->ac_op = EXT4_MB_HISTORY_PREALLOC; ++ seq = *this_cpu_ptr(&discard_pa_seq); + if (!ext4_mb_use_preallocated(ac)) { + ac->ac_op = EXT4_MB_HISTORY_ALLOC; + ext4_mb_normalize_request(ac, ar); +@@ -4609,7 +4655,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, + ar->len = ac->ac_b_ex.fe_len; + } + } else { +- if (ext4_mb_discard_preallocations_should_retry(sb, ac)) ++ if (ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)) + goto repeat; + *errp = -ENOSPC; + } +-- +2.35.1 + diff --git a/queue-4.19/ext4-mballoc-refactor-ext4_mb_discard_preallocations.patch b/queue-4.19/ext4-mballoc-refactor-ext4_mb_discard_preallocations.patch new file mode 100644 index 00000000000..40ffe5def60 --- /dev/null +++ b/queue-4.19/ext4-mballoc-refactor-ext4_mb_discard_preallocations.patch @@ -0,0 +1,68 @@ +From 9bf11e2a59fcfcf9201865de5ac241f3713e91bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 May 2020 12:10:33 +0530 +Subject: ext4: mballoc: refactor ext4_mb_discard_preallocations() + +From: Ritesh Harjani + +[ Upstream commit cf5e2ca6c99077d128e971149f0c262e808ca831 ] + +Implement ext4_mb_discard_preallocations_should_retry() +which we will need in later patches to add more logic +like check for sequence number match to see if we should +retry for block allocation or not. + +There should be no functionality change in this patch. + +Signed-off-by: Ritesh Harjani +Link: https://lore.kernel.org/r/1cfae0098d2aa9afbeb59331401258182868c8f2.1589955723.git.riteshh@linux.ibm.com +Signed-off-by: Theodore Ts'o +Stable-dep-of: 80fa46d6b9e7 ("ext4: limit the number of retries after discarding preallocations blocks") +Signed-off-by: Sasha Levin +--- + fs/ext4/mballoc.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c +index 4ea4fe92eb8c..ad2b7832f153 100644 +--- a/fs/ext4/mballoc.c ++++ b/fs/ext4/mballoc.c +@@ -4492,6 +4492,17 @@ static int ext4_mb_discard_preallocations(struct super_block *sb, int needed) + return freed; + } + ++static bool ext4_mb_discard_preallocations_should_retry(struct super_block *sb, ++ struct ext4_allocation_context *ac) ++{ ++ int freed; ++ ++ freed = ext4_mb_discard_preallocations(sb, ac->ac_o_ex.fe_len); ++ if (freed) ++ return true; ++ return false; ++} ++ + /* + * Main entry point into mballoc to allocate blocks + * it tries to use preallocation first, then falls back +@@ -4500,7 +4511,6 @@ static int ext4_mb_discard_preallocations(struct super_block *sb, int needed) + ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, + struct ext4_allocation_request *ar, int *errp) + { +- int freed; + struct ext4_allocation_context *ac = NULL; + struct ext4_sb_info *sbi; + struct super_block *sb; +@@ -4599,8 +4609,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, + ar->len = ac->ac_b_ex.fe_len; + } + } else { +- freed = ext4_mb_discard_preallocations(sb, ac->ac_o_ex.fe_len); +- if (freed) ++ if (ext4_mb_discard_preallocations_should_retry(sb, ac)) + goto repeat; + *errp = -ENOSPC; + } +-- +2.35.1 + diff --git a/queue-4.19/riscv-fix-a-nasty-sigreturn-bug.patch b/queue-4.19/riscv-fix-a-nasty-sigreturn-bug.patch new file mode 100644 index 00000000000..ab31ce3d9c1 --- /dev/null +++ b/queue-4.19/riscv-fix-a-nasty-sigreturn-bug.patch @@ -0,0 +1,45 @@ +From b09c75a75f4d2a2141d20c889c8b3357ffc60dbc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Sep 2021 01:55:27 +0000 +Subject: riscv: fix a nasty sigreturn bug... + +From: Al Viro + +[ Upstream commit 762df359aa5849e010ef04c3ed79d57588ce17d9 ] + +riscv has an equivalent of arm bug fixed by 653d48b22166 ("arm: fix +really nasty sigreturn bug"); if signal gets caught by an interrupt that +hits when we have the right value in a0 (-513), *and* another signal +gets delivered upon sigreturn() (e.g. included into the blocked mask for +the first signal and posted while the handler had been running), the +syscall restart logics will see regs->cause equal to EXC_SYSCALL (we are +in a syscall, after all) and a0 already restored to its original value +(-513, which happens to be -ERESTARTNOINTR) and assume that we need to +apply the usual syscall restart logics. + +Signed-off-by: Al Viro +Fixes: e2c0cdfba7f6 ("RISC-V: User-facing API") +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/YxJEiSq%2FCGaL6Gm9@ZenIV/ +Signed-off-by: Palmer Dabbelt +Signed-off-by: Sasha Levin +--- + arch/riscv/kernel/signal.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c +index 718d0c984ef0..d396ab5db807 100644 +--- a/arch/riscv/kernel/signal.c ++++ b/arch/riscv/kernel/signal.c +@@ -105,6 +105,8 @@ SYSCALL_DEFINE0(rt_sigreturn) + if (restore_altstack(&frame->uc.uc_stack)) + goto badframe; + ++ regs->cause = -1UL; ++ + return regs->a0; + + badframe: +-- +2.35.1 + diff --git a/queue-4.19/series b/queue-4.19/series new file mode 100644 index 00000000000..7a19583a8a7 --- /dev/null +++ b/queue-4.19/series @@ -0,0 +1,42 @@ +thunderbolt-move-lc-specific-functionality-into-a-se.patch +thunderbolt-rename-tunnel_pci-to-tunnel.patch +thunderbolt-move-nvm-upgrade-support-flag-to-struct-.patch +alsa-hda-realtek-add-supported-new-mute-led-for-hp.patch +alsa-hda-realtek-add-hp-new-mute-led-supported-for-a.patch +alsa-hda-realtek-add-quirk-for-samsung-notebook.patch +alsa-hda-realtek-enable-headset-mic-of-asus-gl503vm-.patch +alsa-hda-realtek-add-mute-led-and-micmute-led-suppor.patch +alsa-hda-realtek-enable-audio-jacks-of-acer-vcopperb.patch +alsa-hda-realtek-enable-headset-mic-of-acer-c20-820-.patch +alsa-hda-realtek-enable-headset-mic-of-acer-veriton-.patch +alsa-hda-realtek-enable-headset-mic-of-asus-rog-zeph.patch +alsa-hda-realtek-enable-headset-mic-of-acer-travelma.patch +alsa-hda-realtek-fixed-hp-right-speaker-no-sound.patch +alsa-hda-tegra-get-clock-handles-early-in-probe.patch +alsa-hda-tegra-add-runtime-pm-callbacks.patch +alsa-hda-tegra-implement-runtime-suspend-resume.patch +alsa-hda-tegra-avoid-build-error-without-config_pm.patch +alsa-hda-hdmi-add-icelake-support.patch +alsa-hda-hdmi-add-tigerlake-support.patch +alsa-hda-hdmi-fix-pin-setup-on-tigerlake.patch +alsa-hda-tegra-correct-number-of-sdo-lines-for-tegra.patch +alsa-hda-tegra-program-wakeen-register-for-tegra.patch +alsa-hda-tegra-use-clk_bulk-helpers.patch +alsa-hda-tegra-reset-hardware.patch +alsa-hda-tegra-fix-tegra194-hda-reset-failure.patch +btrfs-fix-hang-during-unmount-when-stopping-a-space-.patch +alsa-hda-realtek-add-model-alc298-samsung-headphone.patch +alsa-hda-realtek-add-coef-workaround-for-asus-zenboo.patch +alsa-hda-realtek-enable-headset-mic-of-asus-rog-zeph.patch-26261 +alsa-hda-realtek-typo_fix-enable-headset-mic-of-asus.patch +alsa-hda-fixup-headset-for-asus-gx502-laptop.patch +alsa-hda-realtek-ga503-use-same-quirks-as-ga401.patch +alsa-hda-fixup-headset-for-asus-gu502-laptop.patch +alsa-hda-realtek-add-pincfg-for-asus-g513-hp-jack.patch +alsa-hda-realtek-re-order-alc269-asus-quirk-table-en.patch +alsa-hda-realtek-add-pincfg-for-asus-g533z-hp-jack.patch +alsa-hda-realtek-add-quirk-for-asus-ga503r-laptop.patch +riscv-fix-a-nasty-sigreturn-bug.patch +ext4-mballoc-refactor-ext4_mb_discard_preallocations.patch +ext4-mballoc-introduce-pcpu-seqcnt-for-freeing-pa-to.patch +ext4-limit-the-number-of-retries-after-discarding-pr.patch diff --git a/queue-4.19/thunderbolt-move-lc-specific-functionality-into-a-se.patch b/queue-4.19/thunderbolt-move-lc-specific-functionality-into-a-se.patch new file mode 100644 index 00000000000..16774d87609 --- /dev/null +++ b/queue-4.19/thunderbolt-move-lc-specific-functionality-into-a-se.patch @@ -0,0 +1,157 @@ +From 68b8195c360f51c792260066f31951f3e8e64002 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Jan 2019 16:42:12 +0200 +Subject: thunderbolt: Move LC specific functionality into a separate file + +From: Mika Westerberg + +[ Upstream commit a9be55824a10653d0247de12dc6b9a741ce3fc98 ] + +We will be adding more link controller functionality in subsequent +patches and it does not make sense to keep all that in switch.c, so +separate LC functionality into its own file. + +Signed-off-by: Mika Westerberg +Stable-dep-of: 14c7d9052837 ("thunderbolt: Add support for Intel Maple Ridge single port controller") +Signed-off-by: Sasha Levin +--- + drivers/thunderbolt/Makefile | 2 +- + drivers/thunderbolt/lc.c | 21 +++++++++++++++++++++ + drivers/thunderbolt/switch.c | 21 ++++++++++----------- + drivers/thunderbolt/tb.h | 3 +++ + drivers/thunderbolt/tb_regs.h | 2 ++ + 5 files changed, 37 insertions(+), 12 deletions(-) + create mode 100644 drivers/thunderbolt/lc.c + +diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile +index f2f0de27252b..8531f15d3b3c 100644 +--- a/drivers/thunderbolt/Makefile ++++ b/drivers/thunderbolt/Makefile +@@ -1,3 +1,3 @@ + obj-${CONFIG_THUNDERBOLT} := thunderbolt.o + thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel_pci.o eeprom.o +-thunderbolt-objs += domain.o dma_port.o icm.o property.o xdomain.o ++thunderbolt-objs += domain.o dma_port.o icm.o property.o xdomain.o lc.o +diff --git a/drivers/thunderbolt/lc.c b/drivers/thunderbolt/lc.c +new file mode 100644 +index 000000000000..2134a55ed837 +--- /dev/null ++++ b/drivers/thunderbolt/lc.c +@@ -0,0 +1,21 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Thunderbolt link controller support ++ * ++ * Copyright (C) 2019, Intel Corporation ++ * Author: Mika Westerberg ++ */ ++ ++#include "tb.h" ++ ++/** ++ * tb_lc_read_uuid() - Read switch UUID from link controller common register ++ * @sw: Switch whose UUID is read ++ * @uuid: UUID is placed here ++ */ ++int tb_lc_read_uuid(struct tb_switch *sw, u32 *uuid) ++{ ++ if (!sw->cap_lc) ++ return -EINVAL; ++ return tb_sw_read(sw, uuid, TB_CFG_SWITCH, sw->cap_lc + TB_LC_FUSE, 4); ++} +diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c +index 010a50ac4881..dede8c9fc867 100644 +--- a/drivers/thunderbolt/switch.c ++++ b/drivers/thunderbolt/switch.c +@@ -1201,6 +1201,10 @@ struct tb_switch *tb_switch_alloc(struct tb *tb, struct device *parent, + } + sw->cap_plug_events = cap; + ++ cap = tb_switch_find_vse_cap(sw, TB_VSE_CAP_LINK_CONTROLLER); ++ if (cap > 0) ++ sw->cap_lc = cap; ++ + /* Root switch is always authorized */ + if (!route) + sw->authorized = true; +@@ -1298,22 +1302,17 @@ int tb_switch_configure(struct tb_switch *sw) + static int tb_switch_set_uuid(struct tb_switch *sw) + { + u32 uuid[4]; +- int cap, ret; ++ int ret; + +- ret = 0; + if (sw->uuid) +- return ret; ++ return 0; + + /* + * The newer controllers include fused UUID as part of link + * controller specific registers + */ +- cap = tb_switch_find_vse_cap(sw, TB_VSE_CAP_LINK_CONTROLLER); +- if (cap > 0) { +- ret = tb_sw_read(sw, uuid, TB_CFG_SWITCH, cap + 3, 4); +- if (ret) +- return ret; +- } else { ++ ret = tb_lc_read_uuid(sw, uuid); ++ if (ret) { + /* + * ICM generates UUID based on UID and fills the upper + * two words with ones. This is not strictly following +@@ -1328,8 +1327,8 @@ static int tb_switch_set_uuid(struct tb_switch *sw) + + sw->uuid = kmemdup(uuid, sizeof(uuid), GFP_KERNEL); + if (!sw->uuid) +- ret = -ENOMEM; +- return ret; ++ return -ENOMEM; ++ return 0; + } + + static int tb_switch_add_dma_port(struct tb_switch *sw) +diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h +index d927cf7b14d2..108067d45e61 100644 +--- a/drivers/thunderbolt/tb.h ++++ b/drivers/thunderbolt/tb.h +@@ -61,6 +61,7 @@ struct tb_switch_nvm { + * @device_name: Name of the device (or %NULL if not known) + * @generation: Switch Thunderbolt generation + * @cap_plug_events: Offset to the plug events capability (%0 if not found) ++ * @cap_lc: Offset to the link controller capability (%0 if not found) + * @is_unplugged: The switch is going away + * @drom: DROM of the switch (%NULL if not found) + * @nvm: Pointer to the NVM if the switch has one (%NULL otherwise) +@@ -95,6 +96,7 @@ struct tb_switch { + const char *device_name; + unsigned int generation; + int cap_plug_events; ++ int cap_lc; + bool is_unplugged; + u8 *drom; + struct tb_switch_nvm *nvm; +@@ -442,6 +444,7 @@ bool tb_path_is_invalid(struct tb_path *path); + int tb_drom_read(struct tb_switch *sw); + int tb_drom_read_uid_only(struct tb_switch *sw, u64 *uid); + ++int tb_lc_read_uuid(struct tb_switch *sw, u32 *uuid); + + static inline int tb_route_length(u64 route) + { +diff --git a/drivers/thunderbolt/tb_regs.h b/drivers/thunderbolt/tb_regs.h +index 693b0353c3fe..c23bbd31bcb9 100644 +--- a/drivers/thunderbolt/tb_regs.h ++++ b/drivers/thunderbolt/tb_regs.h +@@ -236,5 +236,7 @@ struct tb_regs_hop { + u32 unknown3:4; /* set to zero */ + } __packed; + ++/* Common link controller registers */ ++#define TB_LC_FUSE 0x03 + + #endif +-- +2.35.1 + diff --git a/queue-4.19/thunderbolt-move-nvm-upgrade-support-flag-to-struct-.patch b/queue-4.19/thunderbolt-move-nvm-upgrade-support-flag-to-struct-.patch new file mode 100644 index 00000000000..c4674572e2b --- /dev/null +++ b/queue-4.19/thunderbolt-move-nvm-upgrade-support-flag-to-struct-.patch @@ -0,0 +1,88 @@ +From a48299db30c54d225b798cc508edb26976d9aa3f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 16 Jan 2018 22:30:40 +0200 +Subject: thunderbolt: Move NVM upgrade support flag to struct icm + +From: Mika Westerberg + +[ Upstream commit f437c24bf694b0293f835dea8c25e3a5c1433d07 ] + +This is depends on the controller and on the platform/CPU we are +running. Move it to struct icm so we can set it per controller. + +Signed-off-by: Mika Westerberg +Reviewed-by: Yehezkel Bernat +Tested-by: Mario Limonciello +Stable-dep-of: 14c7d9052837 ("thunderbolt: Add support for Intel Maple Ridge single port controller") +Signed-off-by: Sasha Levin +--- + drivers/thunderbolt/icm.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c +index 2b83d8b02f81..6588be5a07b8 100644 +--- a/drivers/thunderbolt/icm.c ++++ b/drivers/thunderbolt/icm.c +@@ -59,6 +59,7 @@ + * @safe_mode: ICM is in safe mode + * @max_boot_acl: Maximum number of preboot ACL entries (%0 if not supported) + * @rpm: Does the controller support runtime PM (RTD3) ++ * @can_upgrade_nvm: Can the NVM firmware be upgrade on this controller + * @is_supported: Checks if we can support ICM on this controller + * @get_mode: Read and return the ICM firmware mode (optional) + * @get_route: Find a route string for given switch +@@ -77,6 +78,7 @@ struct icm { + int vnd_cap; + bool safe_mode; + bool rpm; ++ bool can_upgrade_nvm; + bool (*is_supported)(struct tb *tb); + int (*get_mode)(struct tb *tb); + int (*get_route)(struct tb *tb, u8 link, u8 depth, u64 *route); +@@ -1868,12 +1870,7 @@ static int icm_start(struct tb *tb) + if (!tb->root_switch) + return -ENODEV; + +- /* +- * NVM upgrade has not been tested on Apple systems and they +- * don't provide images publicly either. To be on the safe side +- * prevent root switch NVM upgrade on Macs for now. +- */ +- tb->root_switch->no_nvm_upgrade = x86_apple_machine; ++ tb->root_switch->no_nvm_upgrade = !icm->can_upgrade_nvm; + tb->root_switch->rpm = icm->rpm; + + ret = tb_switch_add(tb->root_switch); +@@ -1972,6 +1969,7 @@ struct tb *icm_probe(struct tb_nhi *nhi) + switch (nhi->pdev->device) { + case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI: + case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI: ++ icm->can_upgrade_nvm = true; + icm->is_supported = icm_fr_is_supported; + icm->get_route = icm_fr_get_route; + icm->save_devices = icm_fr_save_devices; +@@ -1989,6 +1987,13 @@ struct tb *icm_probe(struct tb_nhi *nhi) + case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_NHI: + case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_NHI: + icm->max_boot_acl = ICM_AR_PREBOOT_ACL_ENTRIES; ++ /* ++ * NVM upgrade has not been tested on Apple systems and ++ * they don't provide images publicly either. To be on ++ * the safe side prevent root switch NVM upgrade on Macs ++ * for now. ++ */ ++ icm->can_upgrade_nvm = !x86_apple_machine; + icm->is_supported = icm_ar_is_supported; + icm->get_mode = icm_ar_get_mode; + icm->get_route = icm_ar_get_route; +@@ -2004,6 +2009,7 @@ struct tb *icm_probe(struct tb_nhi *nhi) + case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_NHI: + case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_NHI: + icm->max_boot_acl = ICM_AR_PREBOOT_ACL_ENTRIES; ++ icm->can_upgrade_nvm = !x86_apple_machine; + icm->is_supported = icm_ar_is_supported; + icm->get_mode = icm_ar_get_mode; + icm->driver_ready = icm_tr_driver_ready; +-- +2.35.1 + diff --git a/queue-4.19/thunderbolt-rename-tunnel_pci-to-tunnel.patch b/queue-4.19/thunderbolt-rename-tunnel_pci-to-tunnel.patch new file mode 100644 index 00000000000..9ce150c147b --- /dev/null +++ b/queue-4.19/thunderbolt-rename-tunnel_pci-to-tunnel.patch @@ -0,0 +1,96 @@ +From 7a1f3588efee48121609a9ca787bb36af8594327 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 19 Feb 2017 10:58:35 +0200 +Subject: thunderbolt: Rename tunnel_pci to tunnel + +From: Mika Westerberg + +[ Upstream commit 1752b9f78713c7a188495319ebafbe7868718962 ] + +In order to tunnel non-PCIe traffic as well rename tunnel_pci.[ch] to +tunnel.[ch] to reflect this fact. No functional changes. + +Signed-off-by: Mika Westerberg +Stable-dep-of: 14c7d9052837 ("thunderbolt: Add support for Intel Maple Ridge single port controller") +Signed-off-by: Sasha Levin +--- + drivers/thunderbolt/Makefile | 2 +- + drivers/thunderbolt/tb.c | 2 +- + drivers/thunderbolt/{tunnel_pci.c => tunnel.c} | 4 ++-- + drivers/thunderbolt/{tunnel_pci.h => tunnel.h} | 6 +++--- + 4 files changed, 7 insertions(+), 7 deletions(-) + rename drivers/thunderbolt/{tunnel_pci.c => tunnel.c} (98%) + rename drivers/thunderbolt/{tunnel_pci.h => tunnel.h} (87%) + +diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile +index 8531f15d3b3c..833bdee3cec7 100644 +--- a/drivers/thunderbolt/Makefile ++++ b/drivers/thunderbolt/Makefile +@@ -1,3 +1,3 @@ + obj-${CONFIG_THUNDERBOLT} := thunderbolt.o +-thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel_pci.o eeprom.o ++thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel.o eeprom.o + thunderbolt-objs += domain.o dma_port.o icm.o property.o xdomain.o lc.o +diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c +index 146f261bf2c3..f149f4074505 100644 +--- a/drivers/thunderbolt/tb.c ++++ b/drivers/thunderbolt/tb.c +@@ -12,7 +12,7 @@ + + #include "tb.h" + #include "tb_regs.h" +-#include "tunnel_pci.h" ++#include "tunnel.h" + + /** + * struct tb_cm - Simple Thunderbolt connection manager +diff --git a/drivers/thunderbolt/tunnel_pci.c b/drivers/thunderbolt/tunnel.c +similarity index 98% +rename from drivers/thunderbolt/tunnel_pci.c +rename to drivers/thunderbolt/tunnel.c +index 0637537ea53f..94d5806c106e 100644 +--- a/drivers/thunderbolt/tunnel_pci.c ++++ b/drivers/thunderbolt/tunnel.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /* +- * Thunderbolt Cactus Ridge driver - PCIe tunnel ++ * Thunderbolt Cactus Ridge driver - Tunneling support + * + * Copyright (c) 2014 Andreas Noever + */ +@@ -8,7 +8,7 @@ + #include + #include + +-#include "tunnel_pci.h" ++#include "tunnel.h" + #include "tb.h" + + #define __TB_TUNNEL_PRINT(level, tunnel, fmt, arg...) \ +diff --git a/drivers/thunderbolt/tunnel_pci.h b/drivers/thunderbolt/tunnel.h +similarity index 87% +rename from drivers/thunderbolt/tunnel_pci.h +rename to drivers/thunderbolt/tunnel.h +index f9b65fa1fd4d..dff0f27d6ab5 100644 +--- a/drivers/thunderbolt/tunnel_pci.h ++++ b/drivers/thunderbolt/tunnel.h +@@ -1,12 +1,12 @@ + /* SPDX-License-Identifier: GPL-2.0 */ + /* +- * Thunderbolt Cactus Ridge driver - PCIe tunnel ++ * Thunderbolt Cactus Ridge driver - Tunneling support + * + * Copyright (c) 2014 Andreas Noever + */ + +-#ifndef TB_PCI_H_ +-#define TB_PCI_H_ ++#ifndef TB_TUNNEL_H_ ++#define TB_TUNNEL_H_ + + #include "tb.h" + +-- +2.35.1 + -- 2.47.3