mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Alexander Koskovich <akoskovich@pm.me>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb: typec: qcom: Add support for per port VBUS detection
Date: Mon, 23 Mar 2026 10:36:55 +0100	[thread overview]
Message-ID: <c05ae272-6498-4af5-bf30-2bd151153195@oss.qualcomm.com> (raw)
In-Reply-To: <90dc434a-42a7-4719-8006-0b141d281ac7@linaro.org>

On 3/20/26 11:03 AM, Bryan O'Donoghue wrote:
> On 19/03/2026 19:57, Dmitry Baryshkov wrote:
>> On Thu, Mar 19, 2026 at 02:26:00PM +0100, Konrad Dybcio wrote:
>>> On 3/12/26 7:16 AM, Alexander Koskovich wrote:
>>>> This is required for devices (e.g. ASUS ROG Phone 3) where more than
>>>> one USB port can act as a sink and both share a single USBIN input on
>>>> the PMIC.
>>>>
>>>> Because the PM8150B uses USBIN to determine VBUS presence, a charger
>>>> connected to one port causes the PMIC to falsely detect VBUS on the
>>>> other port, preventing it from entering source mode.
>>>>
>>>> For example, plugging a charger into one port prevents using the other
>>>> port for a flash drive.
>>>>
>>>> Fix this by adding support for the vbus-gpios connector binding so the
>>>> driver can use an external GPIO for per-port VBUS presence detection
>>>> instead of the shared USBIN register.
>>>>
>>>> Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
>>>> ---
>>>> Changes in v2:
>>>> - Dropped RFC prefix
>>>> - Remove redundant vbus-detect-gpios, instead use existing vbus-gpios from usb-connector (Dmitry)
>>>> - Updated cover to better describe scenario where this change is relevant
>>>> - Update comment for EN_TRY_SRC to make more sense
>>>> - Skip vSafe5V poll too not just vSafe0V
>>>> - return gpiod_get_value_cansleep (Konrad)
>>>> - regmap_update_bits -> regmap_set_bits (Konrad)
>>>> - Get vbus-gpios per connector (Konrad)
>>>> - Add bracket to if (IS_ERR(pmic_typec_port->vbus_detect_gpio)) (Bryan)
>>>> - Link to v1: https://lore.kernel.org/r/20260308-qcom-typec-shared-vbus-v1-0-7d574b91052a@pm.me
>>>> ---
>>>>   drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c | 53 +++++++++++++++++++++-
>>>>   1 file changed, 52 insertions(+), 1 deletion(-)
>>>>
>>>> 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 8051eaa46991..a8f6687a3522 100644
>>>> --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
>>>> +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
>>>> @@ -5,6 +5,7 @@
>>>>     #include <linux/delay.h>
>>>>   #include <linux/err.h>
>>>> +#include <linux/gpio/consumer.h>
>>>>   #include <linux/interrupt.h>
>>>>   #include <linux/kernel.h>
>>>>   #include <linux/mod_devicetable.h>
>>>> @@ -176,6 +177,8 @@ struct pmic_typec_port {
>>>>       bool                vbus_enabled;
>>>>       struct mutex            vbus_lock;        /* VBUS state serialization */
>>>>   +    struct gpio_desc        *vbus_detect_gpio;
>>>
>>> I'd like for this to include the word 'secondary', since it's not obvious
>>> that if an external GPIO is at play, we have two ports connected in this
>>> uhh non-standard fashion
>>>
>>> perhaps just secondary_vbus_detect_gpio
>>
>> In theory it can be used even if we have one port.
>>
> 
> That's true.
> 
> Its quite common in OTG devices to have VBUS detect GPIOs.

Sure, that's true for the qcom_pmic_typec_port_vbus_detect() part, but
this also triggers the 'TRY_SRC/TRY_SNK' and 'bypass VSAFE0V' workarounds
which I would assume would not necessary in that case

Konrad

      reply	other threads:[~2026-03-23  9:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12  6:16 Alexander Koskovich
2026-03-12 10:04 ` Bryan O'Donoghue
2026-03-13  8:46 ` Heikki Krogerus
2026-03-19 13:26 ` Konrad Dybcio
2026-03-19 19:57   ` Dmitry Baryshkov
2026-03-20 10:03     ` Bryan O'Donoghue
2026-03-23  9:36       ` Konrad Dybcio [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=c05ae272-6498-4af5-bf30-2bd151153195@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=akoskovich@pm.me \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh@kernel.org \
    /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

all inboxes | Powered by JetHome®