Skip to contentSkip to conversation

usb: typec: tcpm: Keep other events when receiving FRS and Sourcing_vbus events

PATCH In review Kyle Tso 3 participants 3 messages Aug 3, 2021

Subsystems (3)
lore
Share & tools
lore

Kyle Tso

author
#0 lore raw

PATCH 1/1 usb: typec: tcpm: Keep other events when receiving FRS and Sourcing_vbus events

When receiving FRS and Sourcing_Vbus events from low-level drivers, keep other events which come a bit earlier so that they will not be ignored in the event handler.

Fixes 8dc4bd073663 ("usb: typec: tcpm: Add support for Sink Fast Role SWAP(FRS)")
Cc Badhri Jagan Sridharan <[email protected]>
---
 drivers/usb/typec/tcpm/tcpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +2 -2
index 5b22a1c931a9..b9bb63d749ec 100644
@@ -5369,7 +5369,7 @@ EXPORT_SYMBOL_GPL(tcpm_pd_hard_reset);
 void tcpm_sink_frs(struct tcpm_port *port)
 {
 	spin_lock(&port->pd_event_lock);
-	port->pd_events = TCPM_FRS_EVENT;
+	port->pd_events |= TCPM_FRS_EVENT;
 	spin_unlock(&port->pd_event_lock);
 	kthread_queue_work(port->wq, &port->event_work);
 }
@@ -5378,7 +5378,7 @@ EXPORT_SYMBOL_GPL(tcpm_sink_frs);
 void tcpm_sourcing_vbus(struct tcpm_port *port)
 {
 	spin_lock(&port->pd_event_lock);
-	port->pd_events = TCPM_SOURCING_VBUS;
+	port->pd_events |= TCPM_SOURCING_VBUS;
 	spin_unlock(&port->pd_event_lock);
 	kthread_queue_work(port->wq, &port->event_work);
 }
Signature · 1 line
2.32.0.554.ge1b32706d8-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Kyle Tso

When receiving FRS and Sourcing_Vbus events from low-level drivers, keep other events which come a bit earlier so that they will not be ignored in the event handler.

Fixes 8dc4bd073663 ("usb: typec: tcpm: Add support for Sink Fast Role SWAP(FRS)")
Cc Badhri Jagan Sridharan <[email protected]>
Quoted 27 lines
---
  drivers/usb/typec/tcpm/tcpm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +2 -2
index 5b22a1c931a9..b9bb63d749ec 100644
@@ -5369,7 +5369,7 @@ EXPORT_SYMBOL_GPL(tcpm_pd_hard_reset);
  void tcpm_sink_frs(struct tcpm_port *port)
  {
  	spin_lock(&port->pd_event_lock);
-	port->pd_events = TCPM_FRS_EVENT;
+	port->pd_events |= TCPM_FRS_EVENT;
  	spin_unlock(&port->pd_event_lock);
  	kthread_queue_work(port->wq, &port->event_work);
  }
@@ -5378,7 +5378,7 @@ EXPORT_SYMBOL_GPL(tcpm_sink_frs);
  void tcpm_sourcing_vbus(struct tcpm_port *port)
  {
  	spin_lock(&port->pd_event_lock);
-	port->pd_events = TCPM_SOURCING_VBUS;
+	port->pd_events |= TCPM_SOURCING_VBUS;
  	spin_unlock(&port->pd_event_lock);
  	kthread_queue_work(port->wq, &port->event_work);
  }
maintainer Reviewed-by
#2 lore raw
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Kyle Tso

When receiving FRS and Sourcing_Vbus events from low-level drivers, keep other events which come a bit earlier so that they will not be ignored in the event handler.

Fixes 8dc4bd073663 ("usb: typec: tcpm: Add support for Sink Fast Role SWAP(FRS)")
Cc Badhri Jagan Sridharan <[email protected]>
Quoted 29 lines
Quoted 28 lines
---
  drivers/usb/typec/tcpm/tcpm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +2 -2
index 5b22a1c931a9..b9bb63d749ec 100644
@@ -5369,7 +5369,7 @@ EXPORT_SYMBOL_GPL(tcpm_pd_hard_reset);
  void tcpm_sink_frs(struct tcpm_port *port)
  {
      spin_lock(&port->pd_event_lock);
-     port->pd_events = TCPM_FRS_EVENT;
+     port->pd_events |= TCPM_FRS_EVENT;
      spin_unlock(&port->pd_event_lock);
      kthread_queue_work(port->wq, &port->event_work);
  }
@@ -5378,7 +5378,7 @@ EXPORT_SYMBOL_GPL(tcpm_sink_frs);
  void tcpm_sourcing_vbus(struct tcpm_port *port)
  {
      spin_lock(&port->pd_event_lock);
-     port->pd_events = TCPM_SOURCING_VBUS;
+     port->pd_events |= TCPM_SOURCING_VBUS;
      spin_unlock(&port->pd_event_lock);
      kthread_queue_work(port->wq, &port->event_work);
  }