[PATCH v3 1/2] usb: typec: tcpm: Don't cut a pending state delay short on a re-queue
Heikki Krogerus
heikki.krogerus at linux.intel.com
Mon Nov 30 05:47:44 PST 2026
On Thu, Nov 26, 2026 at 09:19:21AM +0000, Arun Iyengar via B4 Relay wrote:
> From: Arun Iyengar <aiyengar1990 at gmail.com>
>
> A re-queue while the work runs applies a pending delayed state at once
> (the 100 ms ErrorRecovery took 6 us). Re-arm the timer for the time left.
>
> Fixes: 3ed8e1c2ac99 ("usb: typec: tcpm: Migrate workqueue to RT priority for processing events")
> Cc: stable at vger.kernel.org
> Signed-off-by: Arun Iyengar <aiyengar1990 at gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus at linux.intel.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 51e5c72799f2..565073b4ca93 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -6572,6 +6572,11 @@ static void tcpm_state_machine_work(struct kthread_work *work)
>
> /* If we were queued due to a delayed state change, update it now */
> if (port->delayed_state) {
> + if (ktime_after(port->delayed_runtime, ktime_get())) {
> + hrtimer_start(&port->state_machine_timer,
> + port->delayed_runtime, HRTIMER_MODE_ABS);
> + goto done;
> + }
> tcpm_log(port, "state change %s -> %s [delayed %ld ms]",
> tcpm_states[port->state],
> tcpm_states[port->delayed_state], port->delay_ms);
>
> --
> 2.55.0
>
>
--
heikki
More information about the Linux-rockchip
mailing list