From: sashiko-bot@kernel.org
To: "Neil Armstrong" <neil.armstrong@linaro.org>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2 4/4] usb: typec: qcom-pmic-typec: detach the port on probe
Date: Wed, 25 Nov 2026 11:13:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-233203@kernel.org> (raw)
In-Reply-To: <20261125-topic-tcpm-qcom-fixes-v2-4-6fede9a69f6f@linaro.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] usb: typec: qcom-pmic-typec: unsafe disable in
qcom_pmic_typec_port_probe()
--
commit 3a740bf28aab0b4c112846a62403e5fa9d63a6b5
Author: Neil Armstrong <neil.armstrong@linaro.org>
usb: typec: qcom-pmic-typec: detach the port on probe
This commit disables the Type-C block and sleeps for 200 ms during probe
to force a detach if the port was left attached by the bootloader.
> diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
> index f125ac722e8b8..a33903fedfb7d 100644
> --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
> +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
> @@ -803,6 +803,17 @@ int qcom_pmic_typec_port_probe(struct platform_device *pdev,
> tcpm->port_stop = qcom_pmic_typec_port_stop;
> tcpm->port_disable = qcom_pmic_typec_port_disable;
>
> + /*
> + * The Type-C block may have been left attached by the bootloader,
> + * force a detach longer than tPDDebounce so the partner and TCPM
> + * start from a known state.
> + */
> + regmap_write(pmic_typec_port->regmap,
> + pmic_typec_port->base + TYPEC_MODE_CFG_REG,
> + TYPEC_DISABLE_CMD);
> +
> + msleep(200);
> +
> return 0;
> }
[Severity: Medium]
Should this call qcom_pmic_typec_port_disable(tcpm) instead of writing
TYPEC_DISABLE_CMD directly to TYPEC_MODE_CFG_REG?
As noted in qcom_pmic_typec_port_disable() right above, disabling the
Type-C block straight from DRP mode can trigger a VBUS boost over-voltage
fault unless it transitions through EN_SNK_ONLY first:
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c:qcom_pmic_typec_port_disable() {
/*
* Disabling the Type-C block straight from DRP mode can trigger
* a VBUS boost over-voltage fault, so go through sink only mode first.
*/
regmap_write(pmic_typec_port->regmap,
pmic_typec_port->base + TYPEC_MODE_CFG_REG,
EN_SNK_ONLY);
usleep_range(2000, 3000);
/* Present neither Rp nor Rd, so a connected partner detects a detach */
regmap_write(pmic_typec_port->regmap,
pmic_typec_port->base + TYPEC_MODE_CFG_REG,
TYPEC_DISABLE_CMD);
}
If the bootloader left the Type-C block in DRP mode, writing
TYPEC_DISABLE_CMD directly during probe can trigger that over-voltage
fault.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-topic-tcpm-qcom-fixes-v2-0-6fede9a69f6f@linaro.org?part=4
next prev parent reply other threads:[~2026-11-25 11:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 11:04 [PATCH v2 0/4] usb: typec: qcom-pmic-typec: properly tear down port on remove and shutdown Neil Armstrong
2026-11-25 11:04 ` [PATCH v2 1/4] usb: typec: qcom-pmic-typec: pdphy: disable the PD PHY on stop Neil Armstrong
2026-11-25 11:04 ` [PATCH v2 2/4] usb: typec: qcom-pmic-typec: detach the port on shutdown Neil Armstrong
2026-11-25 11:18 ` sashiko-bot
2026-11-25 11:04 ` [PATCH v2 3/4] usb: typec: qcom-pmic-typec: switch to SNK_ONLY before DISABLE when disabling port Neil Armstrong
2026-11-25 11:04 ` [PATCH v2 4/4] usb: typec: qcom-pmic-typec: detach the port on probe Neil Armstrong
2026-11-25 11:13 ` sashiko-bot [this message]
2026-11-25 11:18 ` [PATCH v2 0/4] usb: typec: qcom-pmic-typec: properly tear down port on remove and shutdown sashiko-bot
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-233203@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=neil.armstrong@linaro.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