From: Greg Kroah-Hartman Date: Wed, 28 Dec 2022 09:08:45 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v5.15.86~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f1c4770dd8ab45fbd4c6d13f652639649bcb7097;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: alsa-hda-hdmi-add-hp-device-0x8711-to-force-connect-list.patch alsa-hda-realtek-add-quirk-for-lenovo-tianyi510pro-14iob.patch alsa-usb-audio-add-the-quirk-for-kt0206-device.patch usb-dwc3-core-defer-probe-on-ulpi_read_id-timeout.patch usb-dwc3-fix-race-between-dwc3_set_mode-and-__dwc3_set_mode.patch --- diff --git a/queue-5.10/alsa-hda-hdmi-add-hp-device-0x8711-to-force-connect-list.patch b/queue-5.10/alsa-hda-hdmi-add-hp-device-0x8711-to-force-connect-list.patch new file mode 100644 index 00000000000..8d8b53fddd4 --- /dev/null +++ b/queue-5.10/alsa-hda-hdmi-add-hp-device-0x8711-to-force-connect-list.patch @@ -0,0 +1,32 @@ +From 31b573946ea55e1ea0e08ae8e83bcf879b30f83a Mon Sep 17 00:00:00 2001 +From: Jiao Zhou +Date: Tue, 6 Dec 2022 13:53:11 -0500 +Subject: ALSA: hda/hdmi: Add HP Device 0x8711 to force connect list + +From: Jiao Zhou + +commit 31b573946ea55e1ea0e08ae8e83bcf879b30f83a upstream. + +HDMI audio is not working on the HP EliteDesk 800 G6 because the pin is +unconnected. This issue can be resolved by using the 'hdajackretask' +tool to override the unconnected pin to force it to connect. + +Signed-off-by: Jiao Zhou +Cc: +Link: https://lore.kernel.org/r/20221206185311.3669950-1-jiaozhou@google.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_hdmi.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/patch_hdmi.c ++++ b/sound/pci/hda/patch_hdmi.c +@@ -1965,6 +1965,7 @@ static int hdmi_add_cvt(struct hda_codec + static const struct snd_pci_quirk force_connect_list[] = { + SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1), + SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1), ++ SND_PCI_QUIRK(0x103c, 0x8711, "HP", 1), + SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1), + {} + }; diff --git a/queue-5.10/alsa-hda-realtek-add-quirk-for-lenovo-tianyi510pro-14iob.patch b/queue-5.10/alsa-hda-realtek-add-quirk-for-lenovo-tianyi510pro-14iob.patch new file mode 100644 index 00000000000..d3e5ea2c8b3 --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-add-quirk-for-lenovo-tianyi510pro-14iob.patch @@ -0,0 +1,79 @@ +From 4bf5bf54476dffe60e6b6d8d539f67309ff599e2 Mon Sep 17 00:00:00 2001 +From: Edward Pacman +Date: Wed, 7 Dec 2022 21:32:18 +0800 +Subject: ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB + +From: Edward Pacman + +commit 4bf5bf54476dffe60e6b6d8d539f67309ff599e2 upstream. + +Lenovo TianYi510Pro-14IOB (17aa:3742) +require quirk for enabling headset-mic + +Signed-off-by: Edward Pacman +Cc: +Link: https://bugzilla.kernel.org/show_bug.cgi?id=216756 +Link: https://lore.kernel.org/r/20221207133218.18989-1-edward@edward-p.xyz +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_realtek.c | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -10514,6 +10514,17 @@ static void alc897_fixup_lenovo_headset_ + } + } + ++static void alc897_fixup_lenovo_headset_mode(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->parse_flags |= HDA_PINCFG_HEADSET_MIC; ++ spec->gen.hp_automute_hook = alc897_hp_automute_hook; ++ } ++} ++ + static const struct coef_fw alc668_coefs[] = { + WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), + WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), +@@ -10597,6 +10608,8 @@ enum { + ALC897_FIXUP_LENOVO_HEADSET_MIC, + ALC897_FIXUP_HEADSET_MIC_PIN, + ALC897_FIXUP_HP_HSMIC_VERB, ++ ALC897_FIXUP_LENOVO_HEADSET_MODE, ++ ALC897_FIXUP_HEADSET_MIC_PIN2, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -11023,6 +11036,19 @@ static const struct hda_fixup alc662_fix + { } + }, + }, ++ [ALC897_FIXUP_LENOVO_HEADSET_MODE] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc897_fixup_lenovo_headset_mode, ++ }, ++ [ALC897_FIXUP_HEADSET_MIC_PIN2] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -11075,6 +11101,7 @@ static const struct snd_pci_quirk alc662 + SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN), + SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN), + SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN), ++ SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2), + SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), + SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), + SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO), diff --git a/queue-5.10/alsa-usb-audio-add-the-quirk-for-kt0206-device.patch b/queue-5.10/alsa-usb-audio-add-the-quirk-for-kt0206-device.patch new file mode 100644 index 00000000000..eb280130c6d --- /dev/null +++ b/queue-5.10/alsa-usb-audio-add-the-quirk-for-kt0206-device.patch @@ -0,0 +1,32 @@ +From 696b66ac26ef953aed5783ef26a252ec8f207013 Mon Sep 17 00:00:00 2001 +From: wangdicheng +Date: Wed, 7 Dec 2022 16:20:36 +0800 +Subject: ALSA: usb-audio: add the quirk for KT0206 device + +From: wangdicheng + +commit 696b66ac26ef953aed5783ef26a252ec8f207013 upstream. + +Add relevant information to the quirks-table.h file. +The test passes and the sound source file plays normally. + +Signed-off-by: wangdicheng +Cc: +Link: https://lore.kernel.org/r/SG2PR02MB587849631CB96809CF90DBED8A1A9@SG2PR02MB5878.apcprd02.prod.outlook.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/usb/quirks-table.h | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -76,6 +76,8 @@ + { USB_DEVICE_VENDOR_SPEC(0x041e, 0x3f0a) }, + /* E-Mu 0204 USB */ + { USB_DEVICE_VENDOR_SPEC(0x041e, 0x3f19) }, ++/* Ktmicro Usb_audio device */ ++{ USB_DEVICE_VENDOR_SPEC(0x31b2, 0x0011) }, + + /* + * Creative Technology, Ltd Live! Cam Sync HD [VF0770] diff --git a/queue-5.10/series b/queue-5.10/series index 9faabadff06..d550b738546 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -557,3 +557,8 @@ perf-debug-set-debug_peo_args-and-redirect_to_stderr.patch afs-fix-lost-servers_outstanding-count.patch pstore-make-sure-config_pstore_pmsg-selects-config_r.patch ima-simplify-ima_lsm_copy_rule.patch +alsa-usb-audio-add-the-quirk-for-kt0206-device.patch +alsa-hda-realtek-add-quirk-for-lenovo-tianyi510pro-14iob.patch +alsa-hda-hdmi-add-hp-device-0x8711-to-force-connect-list.patch +usb-dwc3-fix-race-between-dwc3_set_mode-and-__dwc3_set_mode.patch +usb-dwc3-core-defer-probe-on-ulpi_read_id-timeout.patch diff --git a/queue-5.10/usb-dwc3-core-defer-probe-on-ulpi_read_id-timeout.patch b/queue-5.10/usb-dwc3-core-defer-probe-on-ulpi_read_id-timeout.patch new file mode 100644 index 00000000000..dfeaa989875 --- /dev/null +++ b/queue-5.10/usb-dwc3-core-defer-probe-on-ulpi_read_id-timeout.patch @@ -0,0 +1,58 @@ +From 63130462c919ece0ad0d9bb5a1f795ef8d79687e Mon Sep 17 00:00:00 2001 +From: Ferry Toth +Date: Mon, 5 Dec 2022 21:15:27 +0100 +Subject: usb: dwc3: core: defer probe on ulpi_read_id timeout + +From: Ferry Toth + +commit 63130462c919ece0ad0d9bb5a1f795ef8d79687e upstream. + +Since commit 0f0101719138 ("usb: dwc3: Don't switch OTG -> peripheral +if extcon is present"), Dual Role support on Intel Merrifield platform +broke due to rearranging the call to dwc3_get_extcon(). + +It appears to be caused by ulpi_read_id() masking the timeout on the first +test write. In the past dwc3 probe continued by calling dwc3_core_soft_reset() +followed by dwc3_get_extcon() which happend to return -EPROBE_DEFER. +On deferred probe ulpi_read_id() finally succeeded. Due to above mentioned +rearranging -EPROBE_DEFER is not returned and probe completes without phy. + +On Intel Merrifield the timeout on the first test write issue is reproducible +but it is difficult to find the root cause. Using a mainline kernel and +rootfs with buildroot ulpi_read_id() succeeds. As soon as adding +ftrace / bootconfig to find out why, ulpi_read_id() fails and we can't +analyze the flow. Using another rootfs ulpi_read_id() fails even without +adding ftrace. We suspect the issue is some kind of timing / race, but +merely retrying ulpi_read_id() does not resolve the issue. + +As we now changed ulpi_read_id() to return -ETIMEDOUT in this case, we +need to handle the error by calling dwc3_core_soft_reset() and request +-EPROBE_DEFER. On deferred probe ulpi_read_id() is retried and succeeds. + +Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") +Cc: stable@vger.kernel.org +Acked-by: Thinh Nguyen +Signed-off-by: Ferry Toth +Link: https://lore.kernel.org/r/20221205201527.13525-3-ftoth@exalondelft.nl +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/core.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -960,8 +960,13 @@ static int dwc3_core_init(struct dwc3 *d + + if (!dwc->ulpi_ready) { + ret = dwc3_core_ulpi_init(dwc); +- if (ret) ++ if (ret) { ++ if (ret == -ETIMEDOUT) { ++ dwc3_core_soft_reset(dwc); ++ ret = -EPROBE_DEFER; ++ } + goto err0; ++ } + dwc->ulpi_ready = true; + } + diff --git a/queue-5.10/usb-dwc3-fix-race-between-dwc3_set_mode-and-__dwc3_set_mode.patch b/queue-5.10/usb-dwc3-fix-race-between-dwc3_set_mode-and-__dwc3_set_mode.patch new file mode 100644 index 00000000000..5d5d035aa3b --- /dev/null +++ b/queue-5.10/usb-dwc3-fix-race-between-dwc3_set_mode-and-__dwc3_set_mode.patch @@ -0,0 +1,112 @@ +From 62c73bfea048e66168df09da6d3e4510ecda40bb Mon Sep 17 00:00:00 2001 +From: Sven Peter +Date: Mon, 28 Nov 2022 17:15:26 +0100 +Subject: usb: dwc3: Fix race between dwc3_set_mode and __dwc3_set_mode + +From: Sven Peter + +commit 62c73bfea048e66168df09da6d3e4510ecda40bb upstream. + +dwc->desired_dr_role is changed by dwc3_set_mode inside a spinlock but +then read by __dwc3_set_mode outside of that lock. This can lead to a +race condition when very quick successive role switch events happen: + +CPU A + dwc3_set_mode(DWC3_GCTL_PRTCAP_HOST) // first role switch event + spin_lock_irqsave(&dwc->lock, flags); + dwc->desired_dr_role = mode; // DWC3_GCTL_PRTCAP_HOST + spin_unlock_irqrestore(&dwc->lock, flags); + queue_work(system_freezable_wq, &dwc->drd_work); + +CPU B + __dwc3_set_mode + // .... + spin_lock_irqsave(&dwc->lock, flags); + // desired_dr_role is DWC3_GCTL_PRTCAP_HOST + dwc3_set_prtcap(dwc, dwc->desired_dr_role); + spin_unlock_irqrestore(&dwc->lock, flags); + +CPU A + dwc3_set_mode(DWC3_GCTL_PRTCAP_DEVICE) // second event + spin_lock_irqsave(&dwc->lock, flags); + dwc->desired_dr_role = mode; // DWC3_GCTL_PRTCAP_DEVICE + spin_unlock_irqrestore(&dwc->lock, flags); + +CPU B (continues running __dwc3_set_mode) + switch (dwc->desired_dr_role) { // DWC3_GCTL_PRTCAP_DEVICE + // .... + case DWC3_GCTL_PRTCAP_DEVICE: + // .... + ret = dwc3_gadget_init(dwc); + +We then have DWC3_GCTL.DWC3_GCTL_PRTCAPDIR = DWC3_GCTL_PRTCAP_HOST and +dwc->current_dr_role = DWC3_GCTL_PRTCAP_HOST but initialized the +controller in device mode. It's also possible to get into a state +where both host and device are intialized at the same time. +Fix this race by creating a local copy of desired_dr_role inside +__dwc3_set_mode while holding dwc->lock. + +Fixes: 41ce1456e1db ("usb: dwc3: core: make dwc3_set_mode() work properly") +Cc: stable +Acked-by: Thinh Nguyen +Signed-off-by: Sven Peter +Link: https://lore.kernel.org/r/20221128161526.79730-1-sven@svenpeter.dev +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/core.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -120,21 +120,25 @@ static void __dwc3_set_mode(struct work_ + unsigned long flags; + int ret; + u32 reg; ++ u32 desired_dr_role; + + mutex_lock(&dwc->mutex); ++ spin_lock_irqsave(&dwc->lock, flags); ++ desired_dr_role = dwc->desired_dr_role; ++ spin_unlock_irqrestore(&dwc->lock, flags); + + pm_runtime_get_sync(dwc->dev); + + if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_OTG) + dwc3_otg_update(dwc, 0); + +- if (!dwc->desired_dr_role) ++ if (!desired_dr_role) + goto out; + +- if (dwc->desired_dr_role == dwc->current_dr_role) ++ if (desired_dr_role == dwc->current_dr_role) + goto out; + +- if (dwc->desired_dr_role == DWC3_GCTL_PRTCAP_OTG && dwc->edev) ++ if (desired_dr_role == DWC3_GCTL_PRTCAP_OTG && dwc->edev) + goto out; + + switch (dwc->current_dr_role) { +@@ -162,7 +166,7 @@ static void __dwc3_set_mode(struct work_ + */ + if (dwc->current_dr_role && ((DWC3_IP_IS(DWC3) || + DWC3_VER_IS_PRIOR(DWC31, 190A)) && +- dwc->desired_dr_role != DWC3_GCTL_PRTCAP_OTG)) { ++ desired_dr_role != DWC3_GCTL_PRTCAP_OTG)) { + reg = dwc3_readl(dwc->regs, DWC3_GCTL); + reg |= DWC3_GCTL_CORESOFTRESET; + dwc3_writel(dwc->regs, DWC3_GCTL, reg); +@@ -182,11 +186,11 @@ static void __dwc3_set_mode(struct work_ + + spin_lock_irqsave(&dwc->lock, flags); + +- dwc3_set_prtcap(dwc, dwc->desired_dr_role); ++ dwc3_set_prtcap(dwc, desired_dr_role); + + spin_unlock_irqrestore(&dwc->lock, flags); + +- switch (dwc->desired_dr_role) { ++ switch (desired_dr_role) { + case DWC3_GCTL_PRTCAP_HOST: + ret = dwc3_host_init(dwc); + if (ret) {