Skip to contentSkip to conversation

usb: typec: tcpm: fix missed frs_sourcing_vbus() call during FRS

PATCH In review Max Andreev 3 participants 6 messages Nov 22

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: typec: tcpm: fix missed frs_sourcing_vbus() call during FRS

Since commit 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance") the TCPC reports sourcing vbus while the port is still in AMS_START with FR_SWAP_SEND as the upcoming state. Because of _tcpm_pd_vbus_on() ignores this state, frs_sourcing_vbus() is never called during FRS.

On Pixel 11 Pro XL after an FRS from sink to source the phone keeps showing the charging indicator, and about 20 seconds later VBUS drops and the attached device reboots.

Call frs_sourcing_vbus() from AMS_START when the upcoming state is FR_SWAP_SEND.

---
I'm not test theese changes on mainline, but tested on Pixel 11 Pro XL vendor kernel 6.1 with the same _tcpm_pd_vbus_on() code, as i see mainline tcpm.c is identical in this area.

Fixes 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance")
---
 drivers/usb/typec/tcpm/tcpm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +5 -0
index 51e5c72799f2..5caa649a92f1 100644
@@ -6889,6 +6889,11 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
 			port->tcpc->frs_sourcing_vbus(port->tcpc);
 		tcpm_set_state(port, FR_SWAP_SNK_SRC_SOURCE_VBUS_APPLIED, 0);
 		break;
+	case AMS_START:
+		if (port->upcoming_state == FR_SWAP_SEND &&
+		    port->tcpc->frs_sourcing_vbus)
+			port->tcpc->frs_sourcing_vbus(port->tcpc);
+		break;
 
 	case PORT_RESET:
 	case PORT_RESET_WAIT_OFF:
Signature · 1 line
2.47.3
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] usb: typec: tcpm: Signed-off-by and Fixes trailers placed below --- tearline --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] usb: typec: tcpm: Signed-off-by and Fixes trailers placed below --- tearline
--

commit 2b51cba8ef01ebefb9093ae6c74c438910efa79e
Author: Max Andreev <[email protected]>

Quoted 8 lines

usb: typec: tcpm: fix missed frs_sourcing_vbus() call during FRS

Since commit 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance") the TCPC reports sourcing vbus while the port is still in AMS_START with FR_SWAP_SEND as the upcoming state. Because of _tcpm_pd_vbus_on() ignores this state, frs_sourcing_vbus() is never called during FRS.

Quoted 6 lines

On Pixel 11 Pro XL after an FRS from sink to source the phone keeps showing the charging indicator, and about 20 seconds later VBUS drops and the attached device reboots.

Call frs_sourcing_vbus() from AMS_START when the upcoming state is FR_SWAP_SEND.

[Severity: High]
The Fixes:, Cc:, and Signed-off-by: trailers were placed below the first "---" separator line in the patch, causing git am to strip them along with the patch commentary and leaving the applied commit without a
Signed-off-by: or Fixes: trailer. Those trailers need to sit above the first "---" line so they are kept in the commit message.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Max Andreev
Quoted 13 lines · Max Andreev

Since commit 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance") the TCPC reports sourcing vbus while the port is still in AMS_START with FR_SWAP_SEND as the upcoming state. Because of _tcpm_pd_vbus_on() ignores this state, frs_sourcing_vbus() is never called during FRS.

On Pixel 11 Pro XL after an FRS from sink to source the phone keeps showing the charging indicator, and about 20 seconds later VBUS drops and the attached device reboots.

Call frs_sourcing_vbus() from AMS_START when the upcoming state is FR_SWAP_SEND.

Quoted 8 lines

---
I'm not test theese changes on mainline, but tested on Pixel 11 Pro XL vendor kernel 6.1 with the same _tcpm_pd_vbus_on() code, as i see mainline tcpm.c is identical in this area.

Fixes 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance")

Why is this all below the --- line? That will get cut off :(

#3 lore raw

PATCH 1/1 usb: typec: tcpm: fix missed frs_sourcing_vbus() call during FRS

Since commit 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance") the TCPC reports sourcing vbus while the port is still in AMS_START with FR_SWAP_SEND as the upcoming state. Because of _tcpm_pd_vbus_on() ignores this state, frs_sourcing_vbus() is never called during FRS.

On Pixel 11 Pro XL after an FRS from sink to source the phone keeps showing the charging indicator, and about 20 seconds later VBUS drops and the attached device reboots.

Call frs_sourcing_vbus() from AMS_START when the upcoming state is FR_SWAP_SEND.

---
I'm not test theese changes on mainline, but tested on Pixel 11 Pro XL vendor kernel 6.1 with the same _tcpm_pd_vbus_on() code, as i see mainline tcpm.c is identical in this area.

Fixes 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance")
---
 drivers/usb/typec/tcpm/tcpm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +5 -0
index 51e5c72799f2..5caa649a92f1 100644
@@ -6889,6 +6889,11 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
 			port->tcpc->frs_sourcing_vbus(port->tcpc);
 		tcpm_set_state(port, FR_SWAP_SNK_SRC_SOURCE_VBUS_APPLIED, 0);
 		break;
+	case AMS_START:
+		if (port->upcoming_state == FR_SWAP_SEND &&
+		    port->tcpc->frs_sourcing_vbus)
+			port->tcpc->frs_sourcing_vbus(port->tcpc);
+		break;
 
 	case PORT_RESET:
 	case PORT_RESET_WAIT_OFF:
Signature · 1 line
2.47.3
#4 lore raw

PATCH v2 1/1 usb: typec: tcpm: fix missed frs_sourcing_vbus() call during FRS

In reply to Greg Kroah-Hartman

Since commit 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance") the TCPC reports sourcing vbus while the port is still in AMS_START with FR_SWAP_SEND as the upcoming state. Because of _tcpm_pd_vbus_on() ignores this state, frs_sourcing_vbus() is never called during FRS.

On Pixel 11 Pro XL after an FRS from sink to source the phone keeps showing the charging indicator, and about 20 seconds later VBUS drops and the attached device reboots.

Call frs_sourcing_vbus() from AMS_START when the upcoming state is FR_SWAP_SEND.

Fixes 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance")

---
v2: moved the trailers above the --- line

I'm not test theese changes on mainline, but tested on Pixel 11 Pro XL vendor kernel 6.1 with the same _tcpm_pd_vbus_on() code, as i see mainline tcpm.c is identical in this area.

 drivers/usb/typec/tcpm/tcpm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +5 -0
index 51e5c72799f2..5caa649a92f1 100644
@@ -6889,6 +6889,11 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
 			port->tcpc->frs_sourcing_vbus(port->tcpc);
 		tcpm_set_state(port, FR_SWAP_SNK_SRC_SOURCE_VBUS_APPLIED, 0);
 		break;
+	case AMS_START:
+		if (port->upcoming_state == FR_SWAP_SEND &&
+		    port->tcpc->frs_sourcing_vbus)
+			port->tcpc->frs_sourcing_vbus(port->tcpc);
+		break;
 
 	case PORT_RESET:
 	case PORT_RESET_WAIT_OFF:
Signature · 1 line
2.47.3
#5 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 10 lines

Since commit 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance") the TCPC reports sourcing vbus while the port is still in AMS_START with FR_SWAP_SEND as the upcoming state. Because of _tcpm_pd_vbus_on() ignores this state, frs_sourcing_vbus() is never called during FRS.

On Pixel 11 Pro XL after an FRS from sink to source the phone keeps showing the charging indicator, and about 20 seconds later VBUS drops and the attached device reboots.

Quoted 6 lines

Call frs_sourcing_vbus() from AMS_START when the upcoming state is FR_SWAP_SEND.

Fixes 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance")

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1