From: David Heidelberg <david@ixit.cz>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Alexey Minnekhanov <alexeymin@minlexx.ru>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Lee Jones <lee@kernel.org>, Stephen Boyd <sboyd@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
phone-devel@vger.kernel.org, mfd@lists.linux.dev
Subject: Re: [PATCH RFC 06/12] usb: typec: qcom: Add gen1 Type-C port support
Date: Sat, 26 Sep 2026 16:45:30 +0200 [thread overview]
Message-ID: <b6628737-6535-42ea-bf8e-93dcaddaeb5c@ixit.cz> (raw)
In-Reply-To: <8f6c3e69-f616-42b4-8e33-f05ac0812722@linaro.org>
On 26/09/2026 16:41, Bryan O'Donoghue wrote:
> On 26/09/2026 15:32, David Heidelberg wrote:
>> On 26/09/2026 16:22, Bryan O'Donoghue wrote:
>>> On 26/09/2026 13:40, David Heidelberg via B4 Relay wrote:
>>>> From: David Heidelberg <david@ixit.cz>
>>>>
>>>> Add a port backend for the first generation of the Qualcomm PMIC Type-C
>>>> block, found on PM660 and PMI8998.
>>>>
>>>> On gen1 the Type-C CC logic is part of the charger's USBIN peripheral
>>>> (base 0x1300) instead of the standalone Type-C peripheral used by
>>>> PM8150B and later PMICs. All Type-C events (CC state change,
>>>> tCCDebounce done, VBUS change and error) are signalled through a single
>>>> aggregate "type-c-change" interrupt, the handler re-reads TYPEC_STATUS_4
>>>> to find out what changed. The PD PHY is register compatible with PM8150B
>>>> and is reused as is.
>>>>
>>>> Differences to the PM8150B backend:
>>>> - get_cc() returns -EBUSY until the hardware reports tCCDebounce done,
>>>> instead of using a software debounce.
>>>> - As a source, only the default and 1.5A Rp can be advertised, 3.0A
>>>> requests are advertised as 1.5A.
>>>> - The PBS workaround of the downstream SMB2 driver (TM_IO_DTEST4_SEL)
>>>> is applied on every power role change.
>>>>
>>>> VBUS sourcing is optional and only used when the connector provides
>>>> a vbus-supply, as the charger doesn't expose a VBUS regulator yet.
>>>>
>>>> Assisted-by: LLM
>>>> Co-developed-by: Alexey Minnekhanov <alexeymin@minlexx.ru>
>>>> Signed-off-by: Alexey Minnekhanov <alexeymin@minlexx.ru>
>>>> Signed-off-by: David Heidelberg <david@ixit.cz>
>>>> ---
>>>> drivers/usb/typec/tcpm/qcom/Makefile | 1 +
>>>> drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 9 +
>>>> .../typec/tcpm/qcom/qcom_pmic_typec_port_gen1.c | 605 ++++++++++ ++++++
>>>> +++++
>>>> .../typec/tcpm/qcom/qcom_pmic_typec_port_gen1.h | 15 +
>>>> 4 files changed, 630 insertions(+)
>>>>
>>
>> [...]
>>
>>>> +/*
>>>> + * Failure of this workaround write is non-fatal and
>>>> + * we can continue with the role transition.
>>>> + */
>>>> +static void gen1_typec_pbs_wa(struct gen1_typec_port *port, bool sink)
>>>> +{
>>>> + unsigned int val = sink ? 0 : PBS_CRUDE_SENSOR_ENABLE;
>>>> + int ret;
>>>> +
>>>> + ret = regmap_write(port->regmap, port->base +
>>>> + MISC_BASE_OFFSET + TM_IO_DTEST4_SEL, val);
>>>> + if (!ret)
>>>> + return;
>>>
>>> Why would the write fail and why wouldn't that be a critical case if the
>>> write did fail ?
>>
>> Heya Bryan,
>>
>> thanks a lot for reviewing the series. For the rest notes, I'll incorporate
>> that and/or think about it later. Here to quickly answer to this note,
>>
>> this one quirk is definitely NOT REQUIRED. Originally, I was testing the
>> driver without it on sdm845 devices, and everything worked without it just
>> fine. I ASSUME in some situation or with some devices combination it may come
>> handy, thus likely if it fails, not much usually happens (and clanker was
>> suggesting to port this one from downstream, so I did).
>>
>> David
>>
>> [...]
>
> I ran this code though an LLM and it is babbling about the "shape" of things to
> hand you LoL.
>
> Anyway the pattern matching part flagged this:
>
> "Write outside the node's reg. base + MISC_BASE_OFFSET + TM_IO_DTEST4_SEL is
> 0x16e9, the MISC peripheral. 03 declares reg = <USBIN>, <PDPHY> only."
>
> Worth also verifying.
Yup, I explicitly split the addr into MISC_BASE_OFFSET, as it's pretty much
outside of this block range (same reason why I haven't sent the vbus patches for
qcom smbx charger).
Maybe Konrad with more insight can tell more about it. In the Type-C submission
I can pretty much confidently drop it (if it'll need separate driver) and still
assure users get expected functionality.
David
>
> ---
> bod
next prev parent reply other threads:[~2026-09-26 14:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 12:40 [PATCH RFC 00/12] Qualcomm Type-C support for 1st generation David Heidelberg via B4 Relay
2026-09-26 12:40 ` [PATCH RFC 01/12] usb: typec: tcpm: qcom: Release the connector fwnode reference David Heidelberg via B4 Relay
2026-09-26 12:40 ` [PATCH RFC 02/12] dt-bindings: usb: qcom,pmic-typec: Update example with vbus-supply David Heidelberg via B4 Relay
2026-09-26 13:34 ` Bryan O'Donoghue
2026-09-26 12:40 ` [PATCH RFC 03/12] dt-bindings: usb: Add Qualcomm 1st-gen PMIC Type-C David Heidelberg via B4 Relay
2026-09-26 12:40 ` [PATCH RFC 04/12] usb: typec: qcom: Make PMIC port probe selectable David Heidelberg via B4 Relay
2026-09-26 13:39 ` Bryan O'Donoghue
2026-09-26 12:40 ` [PATCH RFC 05/12] usb: typec: qcom: Make typec_port accept also different structure David Heidelberg via B4 Relay
2026-09-26 13:40 ` Bryan O'Donoghue
2026-09-26 12:40 ` [PATCH RFC 06/12] usb: typec: qcom: Add gen1 Type-C port support David Heidelberg via B4 Relay
2026-09-26 14:22 ` Bryan O'Donoghue
2026-09-26 14:32 ` David Heidelberg
2026-09-26 14:41 ` Bryan O'Donoghue
2026-09-26 14:45 ` David Heidelberg [this message]
2026-09-26 12:40 ` [PATCH RFC 07/12] arm64: dts: qcom: pm660: Add USB Type-C port controller node David Heidelberg via B4 Relay
2026-09-26 14:25 ` Bryan O'Donoghue
2026-09-26 12:40 ` [PATCH RFC 08/12] arm64: dts: qcom: pmi8998: " David Heidelberg via B4 Relay
2026-09-26 14:28 ` Bryan O'Donoghue
2026-09-26 12:40 ` [PATCH RFC 09/12] arm64: dts: qcom: sdm670-google-common: Enable USB Type-C port controller David Heidelberg via B4 Relay
2026-09-26 12:40 ` [PATCH RFC 10/12] arm64: dts: qcom: sdm845-google-common: " David Heidelberg via B4 Relay
2026-09-26 12:40 ` [PATCH RFC 11/12] arm64: dts: qcom: sdm845-oneplus-common: " David Heidelberg via B4 Relay
2026-09-26 12:40 ` [PATCH RFC 12/12] arm64: dts: qcom: sdm845-shift-axolotl: " David Heidelberg via B4 Relay
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=b6628737-6535-42ea-bf8e-93dcaddaeb5c@ixit.cz \
--to=david@ixit.cz \
--cc=alexeymin@minlexx.ru \
--cc=andersson@kernel.org \
--cc=broonie@kernel.org \
--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=konrad.dybcio@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mfd@lists.linux.dev \
--cc=phone-devel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sboyd@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®