Re: [PATCH RFC 2/2] usb: typec: qcom: Add support for shared USBIN VBUS detection
From: Konrad Dybcio
Date: Wed Mar 11 2026 - 09:07:19 EST
On 3/9/26 12:20 AM, Alexander Koskovich wrote:
> On devices with multiple USB-C ports whose VBUS lines are wired to a
> single shared USBIN input on the PM8150B PMIC (e.g. ASUS ROG Phone 3), the
> Type-C port controller cannot distinguish which port is providing VBUS.
>
> In practice this shows up as being unable to use the affected Type-C port
> while the other port is connected to a device providing VBUS such as a PC
> or charger.
>
> Add support for an optional vbus-detect-gpios property that allows the
> Type-C port controller to read VBUS state from a per-port GPIO instead of
> the shared USBIN input. When present, the driver also bypasses VSAFE0V
> checks and switches DRP toggling to TRY_SRC to avoid false source
> detection caused by VBUS present on USBIN from another port.
>
> Signed-off-by: Alexander Koskovich <akoskovich@xxxxx>
> ---
[...]
> + if (pmic_typec_port->vbus_detect_gpio) {
> + vbus = gpiod_get_value_cansleep(pmic_typec_port->vbus_detect_gpio);
> + return vbus;
"return gpiod_..."
[...]
> + /*
> + * On devices with multiple USB-C ports sharing USBIN, bypass
> + * VSAFE0V so SRC attachment can complete despite VBUS being
> + * present on USBIN from another port.
> + */
> + if (pmic_typec_port->vbus_detect_gpio) {
> + ret = regmap_update_bits(pmic_typec_port->regmap,
> + pmic_typec_port->base + TYPEC_EXIT_STATE_CFG_REG,
> + BYPASS_VSAFE0V_DURING_ROLE_SWAP,
> + BYPASS_VSAFE0V_DURING_ROLE_SWAP);
regmap_set_bits()
> + if (ret)
> + goto done;
> + }
> +
> pmic_typec_port->tcpm_port = tcpm_port;
>
> for (i = 0; i < pmic_typec_port->nr_irqs; i++)
> @@ -724,6 +760,12 @@ int qcom_pmic_typec_port_probe(struct platform_device *pdev,
> if (IS_ERR(pmic_typec_port->vdd_vbus))
> return PTR_ERR(pmic_typec_port->vdd_vbus);
>
> + pmic_typec_port->vbus_detect_gpio = devm_gpiod_get_optional(dev, "vbus-detect",
> + GPIOD_IN);
I thought the intent here was to have 2 GPIOs, one per port - could
you please shed some light on this?
Konrad