]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Feb 2025 14:08:25 +0000 (15:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Feb 2025 14:08:25 +0000 (15:08 +0100)
added patches:
alsa-usb-audio-add-delay-quirk-for-ibasso-dc07-pro.patch
drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch
ktest.pl-check-kernelrelease-return-in-get_version.patch
net-usb-rtl8150-enable-basic-endpoint-checking.patch
netfilter-nf_tables-reject-mismatching-sum-of-field_len-with-set-key-length.patch
usb-dwc3-core-defer-the-probe-until-usb-power-supply-ready.patch
usb-gadget-f_tcm-fix-get-setinterface-return-value.patch
usb-typec-tcpci-prevent-sink-disconnection-before-vppsshutdown-in-spr-pps.patch
usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch

queue-5.15/alsa-usb-audio-add-delay-quirk-for-ibasso-dc07-pro.patch [new file with mode: 0644]
queue-5.15/drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch [new file with mode: 0644]
queue-5.15/ktest.pl-check-kernelrelease-return-in-get_version.patch [new file with mode: 0644]
queue-5.15/net-usb-rtl8150-enable-basic-endpoint-checking.patch [new file with mode: 0644]
queue-5.15/netfilter-nf_tables-reject-mismatching-sum-of-field_len-with-set-key-length.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/usb-dwc3-core-defer-the-probe-until-usb-power-supply-ready.patch [new file with mode: 0644]
queue-5.15/usb-gadget-f_tcm-fix-get-setinterface-return-value.patch [new file with mode: 0644]
queue-5.15/usb-typec-tcpci-prevent-sink-disconnection-before-vppsshutdown-in-spr-pps.patch [new file with mode: 0644]
queue-5.15/usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch [new file with mode: 0644]

diff --git a/queue-5.15/alsa-usb-audio-add-delay-quirk-for-ibasso-dc07-pro.patch b/queue-5.15/alsa-usb-audio-add-delay-quirk-for-ibasso-dc07-pro.patch
new file mode 100644 (file)
index 0000000..484dfd5
--- /dev/null
@@ -0,0 +1,38 @@
+From d85fc52cbb9a719c8335d93a28d6a79d7acd419f Mon Sep 17 00:00:00 2001
+From: Lianqin Hu <hulianqin@vivo.com>
+Date: Sun, 26 Jan 2025 03:51:11 +0000
+Subject: ALSA: usb-audio: Add delay quirk for iBasso DC07 Pro
+
+From: Lianqin Hu <hulianqin@vivo.com>
+
+commit d85fc52cbb9a719c8335d93a28d6a79d7acd419f upstream.
+
+Audio control requests that sets sampling frequency sometimes fail on
+this card. Adding delay between control messages eliminates that problem.
+
+usb 1-1: New USB device found, idVendor=2fc6, idProduct=f0b7
+usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
+usb 1-1: Product: iBasso DC07 Pro
+usb 1-1: Manufacturer: iBasso
+usb 1-1: SerialNumber: CTUA171130B
+
+Signed-off-by: Lianqin Hu <hulianqin@vivo.com>
+Cc: <stable@vger.kernel.org>
+Link: https://patch.msgid.link/TYUPR06MB62174A48D04E09A37996DF84D2ED2@TYUPR06MB6217.apcprd06.prod.outlook.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/quirks.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/sound/usb/quirks.c
++++ b/sound/usb/quirks.c
+@@ -1934,6 +1934,8 @@ static const struct usb_audio_quirk_flag
+                  QUIRK_FLAG_CTL_MSG_DELAY_1M),
+       DEVICE_FLG(0x2d95, 0x8021, /* VIVO USB-C-XE710 HEADSET */
+                  QUIRK_FLAG_CTL_MSG_DELAY_1M),
++      DEVICE_FLG(0x2fc6, 0xf0b7, /* iBasso DC07 Pro */
++                 QUIRK_FLAG_CTL_MSG_DELAY_1M),
+       DEVICE_FLG(0x30be, 0x0101, /* Schiit Hel */
+                  QUIRK_FLAG_IGNORE_CTL_ERROR),
+       DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */
diff --git a/queue-5.15/drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch b/queue-5.15/drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch
new file mode 100644 (file)
index 0000000..d3d02a8
--- /dev/null
@@ -0,0 +1,59 @@
+From 235b630eda072d7e7b102ab346d6b8a2c028a772 Mon Sep 17 00:00:00 2001
+From: Sean Rhodes <sean@starlabs.systems>
+Date: Tue, 19 Nov 2024 08:58:15 +0000
+Subject: drivers/card_reader/rtsx_usb: Restore interrupt based detection
+
+From: Sean Rhodes <sean@starlabs.systems>
+
+commit 235b630eda072d7e7b102ab346d6b8a2c028a772 upstream.
+
+This commit reintroduces interrupt-based card detection previously
+used in the rts5139 driver. This functionality was removed in commit
+00d8521dcd23 ("staging: remove rts5139 driver code").
+
+Reintroducing this mechanism fixes presence detection for certain card
+readers, which with the current driver, will taken approximately 20
+seconds to enter S3 as `mmc_rescan` has to be frozen.
+
+Fixes: 00d8521dcd23 ("staging: remove rts5139 driver code")
+Cc: stable@vger.kernel.org
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sean Rhodes <sean@starlabs.systems>
+Link: https://lore.kernel.org/r/20241119085815.11769-1-sean@starlabs.systems
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/misc/cardreader/rtsx_usb.c |   15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+--- a/drivers/misc/cardreader/rtsx_usb.c
++++ b/drivers/misc/cardreader/rtsx_usb.c
+@@ -286,6 +286,7 @@ static int rtsx_usb_get_status_with_bulk
+ int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status)
+ {
+       int ret;
++      u8 interrupt_val = 0;
+       u16 *buf;
+       if (!status)
+@@ -308,6 +309,20 @@ int rtsx_usb_get_card_status(struct rtsx
+               ret = rtsx_usb_get_status_with_bulk(ucr, status);
+       }
++      rtsx_usb_read_register(ucr, CARD_INT_PEND, &interrupt_val);
++      /* Cross check presence with interrupts */
++      if (*status & XD_CD)
++              if (!(interrupt_val & XD_INT))
++                      *status &= ~XD_CD;
++
++      if (*status & SD_CD)
++              if (!(interrupt_val & SD_INT))
++                      *status &= ~SD_CD;
++
++      if (*status & MS_CD)
++              if (!(interrupt_val & MS_INT))
++                      *status &= ~MS_CD;
++
+       /* usb_control_msg may return positive when success */
+       if (ret < 0)
+               return ret;
diff --git a/queue-5.15/ktest.pl-check-kernelrelease-return-in-get_version.patch b/queue-5.15/ktest.pl-check-kernelrelease-return-in-get_version.patch
new file mode 100644 (file)
index 0000000..4506115
--- /dev/null
@@ -0,0 +1,40 @@
+From a4e17a8f239a545c463f8ec27db4ed6e74b31841 Mon Sep 17 00:00:00 2001
+From: "Ricardo B. Marliere" <rbm@suse.com>
+Date: Thu, 5 Dec 2024 17:50:35 -0300
+Subject: ktest.pl: Check kernelrelease return in get_version
+
+From: Ricardo B. Marliere <rbm@suse.com>
+
+commit a4e17a8f239a545c463f8ec27db4ed6e74b31841 upstream.
+
+In the case of a test that uses the special option ${KERNEL_VERSION} in one
+of its settings but has no configuration available in ${OUTPUT_DIR}, for
+example if it's a new empty directory, then the `make kernelrelease` call
+will fail and the subroutine will chomp an empty string, silently. Fix that
+by adding an empty configuration and retrying.
+
+Cc: stable@vger.kernel.org
+Cc: John Hawley <warthog9@eaglescrag.net>
+Fixes: 5f9b6ced04a4e ("ktest: Bisecting, install modules, add logging")
+Link: https://lore.kernel.org/20241205-ktest_kver_fallback-v2-1-869dae4c7777@suse.com
+Signed-off-by: Ricardo B. Marliere <rbm@suse.com>
+Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/ktest/ktest.pl |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/tools/testing/ktest/ktest.pl
++++ b/tools/testing/ktest/ktest.pl
+@@ -2399,6 +2399,11 @@ sub get_version {
+     return if ($have_version);
+     doprint "$make kernelrelease ... ";
+     $version = `$make -s kernelrelease | tail -1`;
++    if (!length($version)) {
++      run_command "$make allnoconfig" or return 0;
++      doprint "$make kernelrelease ... ";
++      $version = `$make -s kernelrelease | tail -1`;
++    }
+     chomp($version);
+     doprint "$version\n";
+     $have_version = 1;
diff --git a/queue-5.15/net-usb-rtl8150-enable-basic-endpoint-checking.patch b/queue-5.15/net-usb-rtl8150-enable-basic-endpoint-checking.patch
new file mode 100644 (file)
index 0000000..de5c994
--- /dev/null
@@ -0,0 +1,116 @@
+From 90b7f2961798793275b4844348619b622f983907 Mon Sep 17 00:00:00 2001
+From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+Date: Fri, 24 Jan 2025 01:30:20 -0800
+Subject: net: usb: rtl8150: enable basic endpoint checking
+
+From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+
+commit 90b7f2961798793275b4844348619b622f983907 upstream.
+
+Syzkaller reports [1] encountering a common issue of utilizing a wrong
+usb endpoint type during URB submitting stage. This, in turn, triggers
+a warning shown below.
+
+For now, enable simple endpoint checking (specifically, bulk and
+interrupt eps, testing control one is not essential) to mitigate
+the issue with a view to do other related cosmetic changes later,
+if they are necessary.
+
+[1] Syzkaller report:
+usb 1-1: BOGUS urb xfer, pipe 3 != type 1
+WARNING: CPU: 1 PID: 2586 at drivers/usb/core/urb.c:503 usb_submit_urb+0xe4b/0x1730 driv>
+Modules linked in:
+CPU: 1 UID: 0 PID: 2586 Comm: dhcpcd Not tainted 6.11.0-rc4-syzkaller-00069-gfc88bb11617>
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
+RIP: 0010:usb_submit_urb+0xe4b/0x1730 drivers/usb/core/urb.c:503
+Code: 84 3c 02 00 00 e8 05 e4 fc fc 4c 89 ef e8 fd 25 d7 fe 45 89 e0 89 e9 4c 89 f2 48 8>
+RSP: 0018:ffffc9000441f740 EFLAGS: 00010282
+RAX: 0000000000000000 RBX: ffff888112487a00 RCX: ffffffff811a99a9
+RDX: ffff88810df6ba80 RSI: ffffffff811a99b6 RDI: 0000000000000001
+RBP: 0000000000000003 R08: 0000000000000001 R09: 0000000000000000
+R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001
+R13: ffff8881023bf0a8 R14: ffff888112452a20 R15: ffff888112487a7c
+FS:  00007fc04eea5740(0000) GS:ffff8881f6300000(0000) knlGS:0000000000000000
+CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 00007f0a1de9f870 CR3: 000000010dbd0000 CR4: 00000000003506f0
+DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+Call Trace:
+ <TASK>
+ rtl8150_open+0x300/0xe30 drivers/net/usb/rtl8150.c:733
+ __dev_open+0x2d4/0x4e0 net/core/dev.c:1474
+ __dev_change_flags+0x561/0x720 net/core/dev.c:8838
+ dev_change_flags+0x8f/0x160 net/core/dev.c:8910
+ devinet_ioctl+0x127a/0x1f10 net/ipv4/devinet.c:1177
+ inet_ioctl+0x3aa/0x3f0 net/ipv4/af_inet.c:1003
+ sock_do_ioctl+0x116/0x280 net/socket.c:1222
+ sock_ioctl+0x22e/0x6c0 net/socket.c:1341
+ vfs_ioctl fs/ioctl.c:51 [inline]
+ __do_sys_ioctl fs/ioctl.c:907 [inline]
+ __se_sys_ioctl fs/ioctl.c:893 [inline]
+ __x64_sys_ioctl+0x193/0x220 fs/ioctl.c:893
+ do_syscall_x64 arch/x86/entry/common.c:52 [inline]
+ do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+RIP: 0033:0x7fc04ef73d49
+...
+
+This change has not been tested on real hardware.
+
+Reported-and-tested-by: syzbot+d7e968426f644b567e31@syzkaller.appspotmail.com
+Closes: https://syzkaller.appspot.com/bug?extid=d7e968426f644b567e31
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Cc: stable@vger.kernel.org
+Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+Link: https://patch.msgid.link/20250124093020.234642-1-n.zhandarovich@fintech.ru
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/usb/rtl8150.c |   22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+--- a/drivers/net/usb/rtl8150.c
++++ b/drivers/net/usb/rtl8150.c
+@@ -71,6 +71,14 @@
+ #define MSR_SPEED             (1<<3)
+ #define MSR_LINK              (1<<2)
++/* USB endpoints */
++enum rtl8150_usb_ep {
++      RTL8150_USB_EP_CONTROL = 0,
++      RTL8150_USB_EP_BULK_IN = 1,
++      RTL8150_USB_EP_BULK_OUT = 2,
++      RTL8150_USB_EP_INT_IN = 3,
++};
++
+ /* Interrupt pipe data */
+ #define INT_TSR                       0x00
+ #define INT_RSR                       0x01
+@@ -867,6 +875,13 @@ static int rtl8150_probe(struct usb_inte
+       struct usb_device *udev = interface_to_usbdev(intf);
+       rtl8150_t *dev;
+       struct net_device *netdev;
++      static const u8 bulk_ep_addr[] = {
++              RTL8150_USB_EP_BULK_IN | USB_DIR_IN,
++              RTL8150_USB_EP_BULK_OUT | USB_DIR_OUT,
++              0};
++      static const u8 int_ep_addr[] = {
++              RTL8150_USB_EP_INT_IN | USB_DIR_IN,
++              0};
+       netdev = alloc_etherdev(sizeof(rtl8150_t));
+       if (!netdev)
+@@ -880,6 +895,13 @@ static int rtl8150_probe(struct usb_inte
+               return -ENOMEM;
+       }
++      /* Verify that all required endpoints are present */
++      if (!usb_check_bulk_endpoints(intf, bulk_ep_addr) ||
++          !usb_check_int_endpoints(intf, int_ep_addr)) {
++              dev_err(&intf->dev, "couldn't find required endpoints\n");
++              goto out;
++      }
++
+       tasklet_setup(&dev->tl, rx_fixup);
+       spin_lock_init(&dev->rx_pool_lock);
diff --git a/queue-5.15/netfilter-nf_tables-reject-mismatching-sum-of-field_len-with-set-key-length.patch b/queue-5.15/netfilter-nf_tables-reject-mismatching-sum-of-field_len-with-set-key-length.patch
new file mode 100644 (file)
index 0000000..0b2453e
--- /dev/null
@@ -0,0 +1,55 @@
+From 1b9335a8000fb70742f7db10af314104b6ace220 Mon Sep 17 00:00:00 2001
+From: Pablo Neira Ayuso <pablo@netfilter.org>
+Date: Tue, 28 Jan 2025 12:26:33 +0100
+Subject: netfilter: nf_tables: reject mismatching sum of field_len with set key length
+
+From: Pablo Neira Ayuso <pablo@netfilter.org>
+
+commit 1b9335a8000fb70742f7db10af314104b6ace220 upstream.
+
+The field length description provides the length of each separated key
+field in the concatenation, each field gets rounded up to 32-bits to
+calculate the pipapo rule width from pipapo_init(). The set key length
+provides the total size of the key aligned to 32-bits.
+
+Register-based arithmetics still allows for combining mismatching set
+key length and field length description, eg. set key length 10 and field
+description [ 5, 4 ] leading to pipapo width of 12.
+
+Cc: stable@vger.kernel.org
+Fixes: 3ce67e3793f4 ("netfilter: nf_tables: do not allow mismatch field size and set key length")
+Reported-by: Noam Rathaus <noamr@ssd-disclosure.com>
+Reviewed-by: Florian Westphal <fw@strlen.de>
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/netfilter/nf_tables_api.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/net/netfilter/nf_tables_api.c
++++ b/net/netfilter/nf_tables_api.c
+@@ -4497,7 +4497,7 @@ static int nft_set_desc_concat_parse(con
+ static int nft_set_desc_concat(struct nft_set_desc *desc,
+                              const struct nlattr *nla)
+ {
+-      u32 num_regs = 0, key_num_regs = 0;
++      u32 len = 0, num_regs;
+       struct nlattr *attr;
+       int rem, err, i;
+@@ -4511,12 +4511,12 @@ static int nft_set_desc_concat(struct nf
+       }
+       for (i = 0; i < desc->field_count; i++)
+-              num_regs += DIV_ROUND_UP(desc->field_len[i], sizeof(u32));
++              len += round_up(desc->field_len[i], sizeof(u32));
+-      key_num_regs = DIV_ROUND_UP(desc->klen, sizeof(u32));
+-      if (key_num_regs != num_regs)
++      if (len != desc->klen)
+               return -EINVAL;
++      num_regs = DIV_ROUND_UP(desc->klen, sizeof(u32));
+       if (num_regs > NFT_REG32_COUNT)
+               return -E2BIG;
index a1e374b739909579bbe8ef0537813014b87cff7e..673dca26d0593b81495e0ad7cc3252af84bdc043 100644 (file)
@@ -201,3 +201,12 @@ hexagon-fix-using-plain-integer-as-null-pointer-warn.patch
 hexagon-fix-unbalanced-spinlock-in-die.patch
 f2fs-introduce-linear-search-for-dentries.patch
 nfsd-reset-cb_seq_status-after-nfs4err_delay.patch
+netfilter-nf_tables-reject-mismatching-sum-of-field_len-with-set-key-length.patch
+ktest.pl-check-kernelrelease-return-in-get_version.patch
+alsa-usb-audio-add-delay-quirk-for-ibasso-dc07-pro.patch
+net-usb-rtl8150-enable-basic-endpoint-checking.patch
+drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch
+usb-gadget-f_tcm-fix-get-setinterface-return-value.patch
+usb-dwc3-core-defer-the-probe-until-usb-power-supply-ready.patch
+usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch
+usb-typec-tcpci-prevent-sink-disconnection-before-vppsshutdown-in-spr-pps.patch
diff --git a/queue-5.15/usb-dwc3-core-defer-the-probe-until-usb-power-supply-ready.patch b/queue-5.15/usb-dwc3-core-defer-the-probe-until-usb-power-supply-ready.patch
new file mode 100644 (file)
index 0000000..8d6bbe5
--- /dev/null
@@ -0,0 +1,87 @@
+From 66e0ea341a2a78d14336117f19763bd9be26d45d Mon Sep 17 00:00:00 2001
+From: Kyle Tso <kyletso@google.com>
+Date: Wed, 15 Jan 2025 12:45:48 +0800
+Subject: usb: dwc3: core: Defer the probe until USB power supply ready
+
+From: Kyle Tso <kyletso@google.com>
+
+commit 66e0ea341a2a78d14336117f19763bd9be26d45d upstream.
+
+Currently, DWC3 driver attempts to acquire the USB power supply only
+once during the probe. If the USB power supply is not ready at that
+time, the driver simply ignores the failure and continues the probe,
+leading to permanent non-functioning of the gadget vbus_draw callback.
+
+Address this problem by delaying the dwc3 driver initialization until
+the USB power supply is registered.
+
+Fixes: 6f0764b5adea ("usb: dwc3: add a power supply for current control")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Kyle Tso <kyletso@google.com>
+Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+Link: https://lore.kernel.org/r/20250115044548.2701138-1-kyletso@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/dwc3/core.c |   30 +++++++++++++++++++++---------
+ 1 file changed, 21 insertions(+), 9 deletions(-)
+
+--- a/drivers/usb/dwc3/core.c
++++ b/drivers/usb/dwc3/core.c
+@@ -1314,8 +1314,6 @@ static void dwc3_get_properties(struct d
+       u8                      tx_thr_num_pkt_prd = 0;
+       u8                      tx_max_burst_prd = 0;
+       u8                      tx_fifo_resize_max_num;
+-      const char              *usb_psy_name;
+-      int                     ret;
+       /* default to highest possible threshold */
+       lpm_nyet_threshold = 0xf;
+@@ -1348,13 +1346,6 @@ static void dwc3_get_properties(struct d
+       else
+               dwc->sysdev = dwc->dev;
+-      ret = device_property_read_string(dev, "usb-psy-name", &usb_psy_name);
+-      if (ret >= 0) {
+-              dwc->usb_psy = power_supply_get_by_name(usb_psy_name);
+-              if (!dwc->usb_psy)
+-                      dev_err(dev, "couldn't get usb power supply\n");
+-      }
+-
+       dwc->has_lpm_erratum = device_property_read_bool(dev,
+                               "snps,has-lpm-erratum");
+       device_property_read_u8(dev, "snps,lpm-nyet-threshold",
+@@ -1564,6 +1555,23 @@ static void dwc3_check_params(struct dwc
+       }
+ }
++static struct power_supply *dwc3_get_usb_power_supply(struct dwc3 *dwc)
++{
++      struct power_supply *usb_psy;
++      const char *usb_psy_name;
++      int ret;
++
++      ret = device_property_read_string(dwc->dev, "usb-psy-name", &usb_psy_name);
++      if (ret < 0)
++              return NULL;
++
++      usb_psy = power_supply_get_by_name(usb_psy_name);
++      if (!usb_psy)
++              return ERR_PTR(-EPROBE_DEFER);
++
++      return usb_psy;
++}
++
+ static int dwc3_probe(struct platform_device *pdev)
+ {
+       struct device           *dev = &pdev->dev;
+@@ -1608,6 +1616,10 @@ static int dwc3_probe(struct platform_de
+       dwc3_get_properties(dwc);
++      dwc->usb_psy = dwc3_get_usb_power_supply(dwc);
++      if (IS_ERR(dwc->usb_psy))
++              return dev_err_probe(dev, PTR_ERR(dwc->usb_psy), "couldn't get usb power supply\n");
++
+       dwc->reset = devm_reset_control_array_get_optional_shared(dev);
+       if (IS_ERR(dwc->reset))
+               return PTR_ERR(dwc->reset);
diff --git a/queue-5.15/usb-gadget-f_tcm-fix-get-setinterface-return-value.patch b/queue-5.15/usb-gadget-f_tcm-fix-get-setinterface-return-value.patch
new file mode 100644 (file)
index 0000000..3ed2001
--- /dev/null
@@ -0,0 +1,50 @@
+From 3b997089903b909684114aca6f79d683e5c64a0e Mon Sep 17 00:00:00 2001
+From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+Date: Wed, 11 Dec 2024 00:31:55 +0000
+Subject: usb: gadget: f_tcm: Fix Get/SetInterface return value
+
+From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+
+commit 3b997089903b909684114aca6f79d683e5c64a0e upstream.
+
+Check to make sure that the GetInterface and SetInterface are for valid
+interface. Return proper alternate setting number on GetInterface.
+
+Fixes: 0b8b1a1fede0 ("usb: gadget: f_tcm: Provide support to get alternate setting in tcm function")
+Cc: stable@vger.kernel.org
+Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+Link: https://lore.kernel.org/r/ffd91b4640945ea4d3b4f4091cf1abbdbd9cf4fc.1733876548.git.Thinh.Nguyen@synopsys.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/gadget/function/f_tcm.c |   12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/gadget/function/f_tcm.c
++++ b/drivers/usb/gadget/function/f_tcm.c
+@@ -2098,9 +2098,14 @@ static void tcm_delayed_set_alt(struct w
+ static int tcm_get_alt(struct usb_function *f, unsigned intf)
+ {
+-      if (intf == bot_intf_desc.bInterfaceNumber)
++      struct f_uas *fu = to_f_uas(f);
++
++      if (fu->iface != intf)
++              return -EOPNOTSUPP;
++
++      if (fu->flags & USBG_IS_BOT)
+               return USB_G_ALT_INT_BBB;
+-      if (intf == uasp_intf_desc.bInterfaceNumber)
++      else if (fu->flags & USBG_IS_UAS)
+               return USB_G_ALT_INT_UAS;
+       return -EOPNOTSUPP;
+@@ -2110,6 +2115,9 @@ static int tcm_set_alt(struct usb_functi
+ {
+       struct f_uas *fu = to_f_uas(f);
++      if (fu->iface != intf)
++              return -EOPNOTSUPP;
++
+       if ((alt == USB_G_ALT_INT_BBB) || (alt == USB_G_ALT_INT_UAS)) {
+               struct guas_setup_wq *work;
diff --git a/queue-5.15/usb-typec-tcpci-prevent-sink-disconnection-before-vppsshutdown-in-spr-pps.patch b/queue-5.15/usb-typec-tcpci-prevent-sink-disconnection-before-vppsshutdown-in-spr-pps.patch
new file mode 100644 (file)
index 0000000..e7e23cc
--- /dev/null
@@ -0,0 +1,100 @@
+From 4d27afbf256028a1f54363367f30efc8854433c3 Mon Sep 17 00:00:00 2001
+From: Kyle Tso <kyletso@google.com>
+Date: Tue, 14 Jan 2025 22:24:35 +0800
+Subject: usb: typec: tcpci: Prevent Sink disconnection before vPpsShutdown in SPR PPS
+
+From: Kyle Tso <kyletso@google.com>
+
+commit 4d27afbf256028a1f54363367f30efc8854433c3 upstream.
+
+The Source can drop its output voltage to the minimum of the requested
+PPS APDO voltage range when it is in Current Limit Mode. If this voltage
+falls within the range of vPpsShutdown, the Source initiates a Hard
+Reset and discharges Vbus. However, currently the Sink may disconnect
+before the voltage reaches vPpsShutdown, leading to unexpected behavior.
+
+Prevent premature disconnection by setting the Sink's disconnect
+threshold to the minimum vPpsShutdown value. Additionally, consider the
+voltage drop due to IR drop when calculating the appropriate threshold.
+This ensures a robust and reliable interaction between the Source and
+Sink during SPR PPS Current Limit Mode operation.
+
+Fixes: 4288debeaa4e ("usb: typec: tcpci: Fix up sink disconnect thresholds for PD")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Kyle Tso <kyletso@google.com>
+Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
+Link: https://lore.kernel.org/r/20250114142435.2093857-1-kyletso@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/tcpm/tcpci.c |   13 +++++++++----
+ drivers/usb/typec/tcpm/tcpm.c  |    8 +++++---
+ include/linux/usb/tcpm.h       |    3 ++-
+ 3 files changed, 16 insertions(+), 8 deletions(-)
+
+--- a/drivers/usb/typec/tcpm/tcpci.c
++++ b/drivers/usb/typec/tcpm/tcpci.c
+@@ -26,6 +26,7 @@
+ #define       VPPS_NEW_MIN_PERCENT                    95
+ #define       VPPS_VALID_MIN_MV                       100
+ #define       VSINKDISCONNECT_PD_MIN_PERCENT          90
++#define       VPPS_SHUTDOWN_MIN_PERCENT               85
+ #define tcpc_presenting_rd(reg, cc) \
+       (!(TCPC_ROLE_CTRL_DRP & (reg)) && \
+@@ -358,7 +359,8 @@ static int tcpci_enable_auto_vbus_discha
+ }
+ static int tcpci_set_auto_vbus_discharge_threshold(struct tcpc_dev *dev, enum typec_pwr_opmode mode,
+-                                                 bool pps_active, u32 requested_vbus_voltage_mv)
++                                                 bool pps_active, u32 requested_vbus_voltage_mv,
++                                                 u32 apdo_min_voltage_mv)
+ {
+       struct tcpci *tcpci = tcpc_to_tcpci(dev);
+       unsigned int pwr_ctrl, threshold = 0;
+@@ -380,9 +382,12 @@ static int tcpci_set_auto_vbus_discharge
+               threshold = AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV;
+       } else if (mode == TYPEC_PWR_MODE_PD) {
+               if (pps_active)
+-                      threshold = ((VPPS_NEW_MIN_PERCENT * requested_vbus_voltage_mv / 100) -
+-                                   VSINKPD_MIN_IR_DROP_MV - VPPS_VALID_MIN_MV) *
+-                                   VSINKDISCONNECT_PD_MIN_PERCENT / 100;
++                      /*
++                       * To prevent disconnect when the source is in Current Limit Mode.
++                       * Set the threshold to the lowest possible voltage vPpsShutdown (min)
++                       */
++                      threshold = VPPS_SHUTDOWN_MIN_PERCENT * apdo_min_voltage_mv / 100 -
++                                  VSINKPD_MIN_IR_DROP_MV;
+               else
+                       threshold = ((VSRC_NEW_MIN_PERCENT * requested_vbus_voltage_mv / 100) -
+                                    VSINKPD_MIN_IR_DROP_MV - VSRC_VALID_MIN_MV) *
+--- a/drivers/usb/typec/tcpm/tcpm.c
++++ b/drivers/usb/typec/tcpm/tcpm.c
+@@ -2312,10 +2312,12 @@ static int tcpm_set_auto_vbus_discharge_
+               return 0;
+       ret = port->tcpc->set_auto_vbus_discharge_threshold(port->tcpc, mode, pps_active,
+-                                                          requested_vbus_voltage);
++                                                          requested_vbus_voltage,
++                                                          port->pps_data.min_volt);
+       tcpm_log_force(port,
+-                     "set_auto_vbus_discharge_threshold mode:%d pps_active:%c vbus:%u ret:%d",
+-                     mode, pps_active ? 'y' : 'n', requested_vbus_voltage, ret);
++                     "set_auto_vbus_discharge_threshold mode:%d pps_active:%c vbus:%u pps_apdo_min_volt:%u ret:%d",
++                     mode, pps_active ? 'y' : 'n', requested_vbus_voltage,
++                     port->pps_data.min_volt, ret);
+       return ret;
+ }
+--- a/include/linux/usb/tcpm.h
++++ b/include/linux/usb/tcpm.h
+@@ -145,7 +145,8 @@ struct tcpc_dev {
+       void (*frs_sourcing_vbus)(struct tcpc_dev *dev);
+       int (*enable_auto_vbus_discharge)(struct tcpc_dev *dev, bool enable);
+       int (*set_auto_vbus_discharge_threshold)(struct tcpc_dev *dev, enum typec_pwr_opmode mode,
+-                                               bool pps_active, u32 requested_vbus_voltage);
++                                               bool pps_active, u32 requested_vbus_voltage,
++                                               u32 pps_apdo_min_voltage);
+       bool (*is_vbus_vsafe0v)(struct tcpc_dev *dev);
+       void (*set_partner_usb_comm_capable)(struct tcpc_dev *dev, bool enable);
+ };
diff --git a/queue-5.15/usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch b/queue-5.15/usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch
new file mode 100644 (file)
index 0000000..988db35
--- /dev/null
@@ -0,0 +1,36 @@
+From 2eb3da037c2c20fa30bc502bc092479b2a1aaae2 Mon Sep 17 00:00:00 2001
+From: Jos Wang <joswang@lenovo.com>
+Date: Sun, 5 Jan 2025 21:52:45 +0800
+Subject: usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE
+
+From: Jos Wang <joswang@lenovo.com>
+
+commit 2eb3da037c2c20fa30bc502bc092479b2a1aaae2 upstream.
+
+As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the
+Source receives the GoodCRC Message from the Sink in response to the
+Source_Capabilities message, it should start the SenderResponseTimer,
+after the timer times out, the state machine transitions to the
+HARD_RESET state.
+
+Fixes: f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jos Wang <joswang@lenovo.com>
+Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
+Link: https://lore.kernel.org/r/20250105135245.7493-1-joswang1221@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/tcpm/tcpm.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/typec/tcpm/tcpm.c
++++ b/drivers/usb/typec/tcpm/tcpm.c
+@@ -4042,7 +4042,7 @@ static void run_state_machine(struct tcp
+                       port->caps_count = 0;
+                       port->pd_capable = true;
+                       tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT,
+-                                          PD_T_SEND_SOURCE_CAP);
++                                          PD_T_SENDER_RESPONSE);
+               }
+               break;
+       case SRC_SEND_CAPABILITIES_TIMEOUT: