From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7059035B62D for ; Fri, 20 Mar 2026 10:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774001026; cv=none; b=ZBrE54cLxcuuEbC0A4BuxewZu+Vhq8bXiWlzHhidrL65hIStUajnPG/6pDtTRecluJQn+ij3axyLkyYvD6a7zpgWX5zEN50YsgLiGwNMXcsn6cfnf44zFkkJlshME83T2ciUOWtqbPz/am75wPrHOF5yz14PgwBLe1yKco/OFKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774001026; c=relaxed/simple; bh=56ptuFV6vKuqQtRYvbY1Sa1x02snZLdIibVK2WtkLD4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XhePaZMQ+nbEKNAZXDhU3fNpqc+UczcSUiUVs6QBLwC3S8S3nJMe4656EQ8h8nwR0M9oWqZJpc7/K9Nok810nAMUeSCBaES5FmAOwopaeyeKIC0Js6ZxlvqVLzcO1958twkO457hyNOR1CFwHciXMjqHWGgE6xbR1suOJBilp4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=NBS2DpqK; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NBS2DpqK" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-486fb14227cso17088545e9.3 for ; Fri, 20 Mar 2026 03:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1774001024; x=1774605824; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=8PECkdzxQUdMWnA4pDWLZe22ZFUxdMUPX+0kBZcNa+Q=; b=NBS2DpqKvwzvDrt/G6WWQ2lEzIu/q2rwtTeY+WusxH0Q5Yc/U1iW0+chUHILsKfKXw t/e0PLsYPq+JxEsRUA6n0Zqce4X3Jjml+T85PkAS+RUL9uqZ4gzm8bseM+DHnB/OD/3F eYgAR3VtvgFCWB28xj6euUxfFNyJl4Poe00CWU+NTf+8kIqXU9VNKrEmQTw++eg5f0nI h/iY2RhpYyjbIETT7CJJg8ONMC9OVQt+OEjeuxoP7kAY6N83Difz6cFu629BFDEDEoDa +iFLRJMNOzr05Bo/cYSah1DIRMU4KthZy23N5fYarUIGzdSCIOaLEeYxYH6ZPoR+EIgR fVsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774001024; x=1774605824; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8PECkdzxQUdMWnA4pDWLZe22ZFUxdMUPX+0kBZcNa+Q=; b=kZp0DqpiBuxnnyrtAPPipyAaPghc2ehRBpsiZ7FKa1pcUlRBNABXYIt1yyftDNczFR DdznHTzJ/OmKtyP1AX+bji29GcmfgecHBZIgw3k01UUJsirDo7c85iHwvn0gq1IJkpEF TSe1vn3zIBmn4y+LErpo7f5clKyQUlbLdtEpr4e1CBvzGY1tt4Dp0cnNvQIA2KECqJ0z uf7DGhn2TK4L+sBs4QIyoJb6EHdAnr6WuUa8EOe1myhLaTRNgS5yYdb8VILR1D7oOVi7 H4/lrW+zik//RDyn1euuFaCQY4GfQOjAxFBRXQ3NfYywMEw02XTPC1j7ZgmMpXFPChWk ZXsQ== X-Forwarded-Encrypted: i=1; AJvYcCVpewzD7HqJ4NnaUR1At1dsZ0rdL9h08nczXW2os5Dn4Qlv57ehXxWv13Pnfx1oJTdDGqikqrwsHGD/M3o=@vger.kernel.org X-Gm-Message-State: AOJu0YyVrLqI4jJkJDCE4AZzEiJ8bW2Qf87PxE1N/b9OeR8Yw/tizK56 1xCfNEIo6ayvizZjIOGNTzszAV8SIhVf/paQWWug5vbukXDAa1C0Qj0yCkTYC01qIo0au+9XKXp utQu7 X-Gm-Gg: ATEYQzwlqXmKZIzl25sv346sRNG8C8Rb943Q6LAWhZySBT59Z8jSrpwoIWCr3pdxZoG 1etHHWYjjqWzawMktZWUG/jEdePAF2yD9w9qTrmo4o5Ixs2Lm09W/4R47jr90nxQG+Fs5+AOphM Ebxr9pm8Sn0PawEhGl1Lv9gXtxu+To2wzuVdNjl6R+TteeF1xyZb4aIPvkO/9WwFA+9TyDL8WSU D8dg0YfA86VKjiLluH+G1pcqvJm5a4HTBgA8R5/UWFUD77drXH/lAevjG56dDFnzRiYlVxNiSoJ PdThNsUUU8GVXxNn3i6w/B/c88ammTjGnJyi8UdcZrEJLzvslgdq/aMbybheRjtgp2IQ2trivAp ib6yM+jSr86JMsUvMRS0dzxVRkEPGa7eJNzxLn2TzAjnFdx18FtXjr699Ya9AcdR5/tW2VEPyYM 4hqbc20RuuZuwOoIQrEu4kjDtYGfiDet/D/O0I X-Received: by 2002:a05:600c:820e:b0:483:7903:c3b1 with SMTP id 5b1f17b1804b1-486fee12c91mr37811065e9.20.1774001023684; Fri, 20 Mar 2026 03:03:43 -0700 (PDT) Received: from [192.168.0.167] ([109.76.207.215]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-486ff1db4aesm15557435e9.7.2026.03.20.03.03.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Mar 2026 03:03:42 -0700 (PDT) Message-ID: <90dc434a-42a7-4719-8006-0b141d281ac7@linaro.org> Date: Fri, 20 Mar 2026 10:03:41 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] usb: typec: qcom: Add support for per port VBUS detection To: Dmitry Baryshkov , Konrad Dybcio Cc: Alexander Koskovich , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heikki Krogerus , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260312-qcom-typec-shared-vbus-v2-1-99ed9e500947@pm.me> <1fd9048c-b0c0-451a-a6f7-e5474352d118@oss.qualcomm.com> From: Bryan O'Donoghue Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 >>> --- >>> 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 >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -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. --- bod