From: sashiko-bot@kernel.org
To: "Sasha Finkelstein" <k@chaosmail.tech>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v9 3/3] usb: typec: tipd: Add sn201202x support
Date: Sat, 21 Nov 2026 13:21:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-227061@kernel.org> (raw)
In-Reply-To: <20261121-tipd-ace3-v9-3-9a2f1327a330@chaosmail.tech>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] usb: typec: tipd: race with tps->irq in sn201202x_suspend()
and resume
--
commit f1872e14e7db08290e3e00b97a27f328d4ac8b8d
Author: Sasha Finkelstein <k@chaosmail.tech>
usb: typec: tipd: Add sn201202x support
This commit adds an SPMI driver and variant definition for the SN201202x
USB Power Delivery controller.
> diff --git a/drivers/usb/typec/tipd/spmi.c b/drivers/usb/typec/tipd/spmi.c
> new file mode 100644
> index 0000000000000..8c6c97b0b3e2f
> --- /dev/null
> +++ b/drivers/usb/typec/tipd/spmi.c
[ ... ]
> +static int __maybe_unused sn201202x_resume(struct device *dev)
> +{
> + struct tps6598x *tps = dev_get_drvdata(dev);
> + struct sn201202x *sn = tps_to_sn(tps);
> + int err;
> +
> + reinit_completion(&sn->wake_completion);
> + err = spmi_command_wakeup(sn->sdev);
> + if (err)
> + return err;
> + if (!wait_for_completion_timeout(&sn->wake_completion, msecs_to_jiffies(100)))
> + return -ETIMEDOUT;
> + return tipd_resume(tps);
> +}
> +
> +static int __maybe_unused sn201202x_suspend(struct device *dev)
> +{
> + struct tps6598x *tps = dev_get_drvdata(dev);
> + struct sn201202x *sn = tps_to_sn(tps);
> + int err;
> +
> + err = tipd_suspend(tps);
> + if (err)
> + return err;
> + reinit_completion(&sn->sleep_completion);
> + err = spmi_command_sleep(sn->sdev);
> + if (err)
> + goto out_resume;
> + if (!wait_for_completion_timeout(&sn->sleep_completion, msecs_to_jiffies(100)))
> + dev_err(dev, "Waiting for sleep complete irq timed out");
> +
> + return 0;
> +
> +out_resume:
> + tipd_resume(tps);
> + return err;
> +}
[Severity: Medium]
Can cd321x_interrupt() race with spmi_command_sleep() and
spmi_command_wakeup() when tps->wakeup is false?
tipd_suspend() only calls disable_irq(tps->irq) when tps->wakeup is set:
drivers/usb/typec/tipd/core.c:tipd_suspend() {
if (tps->wakeup) {
disable_irq(tps->irq);
enable_irq_wake(tps->irq);
} else if (tps->reset) {
gpiod_set_value_cansleep(tps->reset, 1);
}
...
}
When tps->wakeup is false, tps->irq stays enabled during dpm_suspend() and
is re-enabled by dpm_resume_noirq() before dpm_resume() runs
sn201202x_resume():
CPU0 CPU1 (irq thread)
sn201202x_suspend()
tipd_suspend(tps)
spmi_command_sleep(sn->sdev)
cd321x_interrupt()
...
regmap_sn201202x_select_reg()
<-- SPMI access while sleeping
The same race occurs on resume if a pending tps->irq fires after
resume_device_irqs() but before sn201202x_resume() issues
spmi_command_wakeup(), causing logical register selection timeouts and
dropped Type-C status updates. Disabling tps->irq in tipd_suspend() (and
re-enabling it in tipd_resume()) unconditionally when tps->irq is valid
would serialize the IRQ thread against the SPMI sleep state.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121-tipd-ace3-v9-0-9a2f1327a330@chaosmail.tech?part=3
prev parent reply other threads:[~2026-11-21 13:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 13:07 [PATCH v9 0/3] usb: typec: tipd: Add sn201202x (ACE3) support Sasha Finkelstein
2026-11-21 13:07 ` [PATCH v9 1/3] dt-bindings: usb: tps6598x: Add sn201202x/ACE3 Sasha Finkelstein
2026-11-21 13:07 ` [PATCH v9 2/3] usb: typec: tipd: Factor out i2c specifics Sasha Finkelstein
2026-11-21 13:07 ` [PATCH v9 3/3] usb: typec: tipd: Add sn201202x support Sasha Finkelstein
2026-11-21 13:21 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-227061@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=k@chaosmail.tech \
--cc=linux-usb@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox