2024-02-17 16:32:53

by Danila Tikhonov

[permalink] [raw]
Subject: [PATCH 0/3] arm64: dts: qcom: pm6150: Add typec support for PM6150

This series adds typec support for PM6150. Was tested on SM7150
(xiaomi-surya).

To: Bjorn Andersson <[email protected]>
To: Konrad Dybcio <[email protected]>
To: Liam Girdwood <[email protected]>
To: Mark Brown <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: "Bryan O'Donoghue" <[email protected]>
To: Greg Kroah-Hartman <[email protected]>
To: Wesley Cheng <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Danila Tikhonov <[email protected]>

Danila Tikhonov (3):
dt-bindings: regulator: qcom,usb-vbus-regulator: Add PM6150 compatible
dt-bindings: usb: qcom,pmic-typec: Add support for the PM6150 PMIC
arm64: dts: qcom: pm6150: define USB-C related blocks

.../regulator/qcom,usb-vbus-regulator.yaml | 9 +++-
.../bindings/usb/qcom,pmic-typec.yaml | 9 +++-
arch/arm64/boot/dts/qcom/pm6150.dtsi | 46 +++++++++++++++++++
3 files changed, 60 insertions(+), 4 deletions(-)

--
2.43.2



2024-02-17 16:32:55

by Danila Tikhonov

[permalink] [raw]
Subject: [PATCH 1/3] dt-bindings: regulator: qcom,usb-vbus-regulator: Add PM6150 compatible

The VBUS register block on the PM6150 PMIC shares the design with the
PM8150B one. Define corresponding compatible string, having the
qcom,pm8150b-vbus-reg as a fallback.

Signed-off-by: Danila Tikhonov <[email protected]>
---
.../bindings/regulator/qcom,usb-vbus-regulator.yaml | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
index 534f87e98716..bf6336850be6 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
@@ -19,8 +19,13 @@ allOf:

properties:
compatible:
- enum:
- - qcom,pm8150b-vbus-reg
+ oneOf:
+ - enum:
+ - qcom,pm8150b-vbus-reg
+ - items:
+ - enum:
+ - qcom,pm6150-vbus-reg
+ - const: qcom,pm8150b-vbus-reg

reg:
maxItems: 1
--
2.43.2


2024-02-17 16:33:10

by Danila Tikhonov

[permalink] [raw]
Subject: [PATCH 3/3] arm64: dts: qcom: pm6150: define USB-C related blocks

Define VBUS regulator and the Type-C handling block as present on the
Quacomm PM6150 PMIC.

Signed-off-by: Danila Tikhonov <[email protected]>
---
arch/arm64/boot/dts/qcom/pm6150.dtsi | 46 ++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/pm6150.dtsi b/arch/arm64/boot/dts/qcom/pm6150.dtsi
index ddbaf7280b03..bef5f28ba7cc 100644
--- a/arch/arm64/boot/dts/qcom/pm6150.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm6150.dtsi
@@ -63,6 +63,52 @@ pm6150_resin: resin {
};
};

+ pm6150_vbus: usb-vbus-regulator@1100 {
+ compatible = "qcom,pm6150-vbus-reg,
+ qcom,pm8150b-vbus-reg";
+ reg = <0x1100>;
+ status = "disabled";
+ };
+
+ pm6150_typec: typec@1500 {
+ compatible = "qcom,pm6150-typec,
+ qcom,pm8150b-typec";
+ reg = <0x1500>, <0x1700>;
+ interrupts = <0x0 0x15 0x00 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x15 0x01 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x15 0x02 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x15 0x03 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x15 0x04 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x15 0x05 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x15 0x06 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x15 0x07 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x17 0x00 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x17 0x01 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x17 0x02 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x17 0x03 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x17 0x04 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x17 0x05 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x17 0x06 IRQ_TYPE_EDGE_RISING>,
+ <0x0 0x17 0x07 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "or-rid-detect-change",
+ "vpd-detect",
+ "cc-state-change",
+ "vconn-oc",
+ "vbus-change",
+ "attach-detach",
+ "legacy-cable-detect",
+ "try-snk-src-detect",
+ "sig-tx",
+ "sig-rx",
+ "msg-tx",
+ "msg-rx",
+ "msg-tx-failed",
+ "msg-tx-discarded",
+ "msg-rx-discarded",
+ "fr-swap";
+ status = "disabled";
+ };
+
pm6150_temp: temp-alarm@2400 {
compatible = "qcom,spmi-temp-alarm";
reg = <0x2400>;
--
2.43.2


2024-02-17 18:18:19

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH 3/3] arm64: dts: qcom: pm6150: define USB-C related blocks

On Sat, 17 Feb 2024 at 18:32, Danila Tikhonov <[email protected]> wrote:
>
> Define VBUS regulator and the Type-C handling block as present on the
> Quacomm PM6150 PMIC.
>
> Signed-off-by: Danila Tikhonov <[email protected]>

Reviewed-by: Dmitry Baryshkov <[email protected]>

> ---
> arch/arm64/boot/dts/qcom/pm6150.dtsi | 46 ++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)



--
With best wishes
Dmitry

2024-02-17 23:19:40

by Bryan O'Donoghue

[permalink] [raw]
Subject: Re: [PATCH 3/3] arm64: dts: qcom: pm6150: define USB-C related blocks

On 17/02/2024 16:32, Danila Tikhonov wrote:
> Define VBUS regulator and the Type-C handling block as present on the
> Quacomm PM6150 PMIC.
>
> Signed-off-by: Danila Tikhonov <[email protected]>

> + pm6150_typec: typec@1500 {
> + compatible = "qcom,pm6150-typec,
> + qcom,pm8150b-typec";
> + reg = <0x1500>, <0x1700>;
> + interrupts = <0x0 0x15 0x00 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x15 0x01 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x15 0x02 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x15 0x03 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x15 0x04 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x15 0x05 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x15 0x06 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x15 0x07 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x17 0x00 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x17 0x01 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x17 0x02 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x17 0x03 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x17 0x04 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x17 0x05 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x17 0x06 IRQ_TYPE_EDGE_RISING>,
> + <0x0 0x17 0x07 IRQ_TYPE_EDGE_RISING>;
> + interrupt-names = "or-rid-detect-change",
> + "vpd-detect",
> + "cc-state-change",
> + "vconn-oc",
> + "vbus-change",
> + "attach-detach",
> + "legacy-cable-detect",
> + "try-snk-src-detect",
> + "sig-tx",
> + "sig-rx",
> + "msg-tx",
> + "msg-rx",
> + "msg-tx-failed",
> + "msg-tx-discarded",
> + "msg-rx-discarded",
> + "fr-swap";
> + status = "disabled";
> + };

Should all of these be rising ? Looks incorrect to me.

Please review: arch/arm64/boot/dts/qcom/pm8150b.dtsi

pm8150b_typec: typec@1500 {
compatible = "qcom,pm8150b-typec";
status = "disabled";
reg = <0x1500>,
<0x1700>;

interrupts = <0x2 0x15 0x00 IRQ_TYPE_EDGE_RISING>,
<0x2 0x15 0x01 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x15 0x02 IRQ_TYPE_EDGE_RISING>,
<0x2 0x15 0x03 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x15 0x04 IRQ_TYPE_EDGE_RISING>,
<0x2 0x15 0x05 IRQ_TYPE_EDGE_RISING>,
<0x2 0x15 0x06 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x15 0x07 IRQ_TYPE_EDGE_RISING>,
<0x2 0x17 0x00 IRQ_TYPE_EDGE_RISING>,
<0x2 0x17 0x01 IRQ_TYPE_EDGE_RISING>,
<0x2 0x17 0x02 IRQ_TYPE_EDGE_RISING>,
<0x2 0x17 0x03 IRQ_TYPE_EDGE_RISING>,
<0x2 0x17 0x04 IRQ_TYPE_EDGE_RISING>,
<0x2 0x17 0x05 IRQ_TYPE_EDGE_RISING>,
<0x2 0x17 0x06 IRQ_TYPE_EDGE_RISING>,
<0x2 0x17 0x07 IRQ_TYPE_EDGE_RISING>;

interrupt-names = "or-rid-detect-change",
"vpd-detect",
"cc-state-change",
"vconn-oc",
"vbus-change",
"attach-detach",
"legacy-cable-detect",
"try-snk-src-detect",
"sig-tx",
"sig-rx",
"msg-tx",
"msg-rx",
"msg-tx-failed",
"msg-tx-discarded",
"msg-rx-discarded",
"fr-swap";
}

---
bod

2024-02-18 08:06:29

by Danila Tikhonov

[permalink] [raw]
Subject: Re: [PATCH 3/3] arm64: dts: qcom: pm6150: define USB-C related blocks

I know that some interrupts have both for PM8150B, but for PM6150 all
interrupts are rising.
Please look at the downstream kernel:
https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/187022f2721d584ac4ec92c0ac1af77da487521d/arch/arm64/boot/dts/qcom/pm6150.dtsi#L319
https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/187022f2721d584ac4ec92c0ac1af77da487521d/arch/arm64/boot/dts/qcom/pm8150b.dtsi#L292

---
Best wishes
Danila

On 2/18/24 02:19, Bryan O'Donoghue wrote:
> On 17/02/2024 16:32, Danila Tikhonov wrote:
>> Define VBUS regulator and the Type-C handling block as present on the
>> Quacomm PM6150 PMIC.
>>
>> Signed-off-by: Danila Tikhonov <[email protected]>
>
>> +        pm6150_typec: typec@1500 {
>> +            compatible = "qcom,pm6150-typec,
>> +                      qcom,pm8150b-typec";
>> +            reg = <0x1500>, <0x1700>;
>> +            interrupts = <0x0 0x15 0x00 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x15 0x01 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x15 0x02 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x15 0x03 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x15 0x04 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x15 0x05 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x15 0x06 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x15 0x07 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x17 0x00 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x17 0x01 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x17 0x02 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x17 0x03 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x17 0x04 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x17 0x05 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x17 0x06 IRQ_TYPE_EDGE_RISING>,
>> +                     <0x0 0x17 0x07 IRQ_TYPE_EDGE_RISING>;
>> +            interrupt-names = "or-rid-detect-change",
>> +                      "vpd-detect",
>> +                      "cc-state-change",
>> +                      "vconn-oc",
>> +                      "vbus-change",
>> +                      "attach-detach",
>> +                      "legacy-cable-detect",
>> +                      "try-snk-src-detect",
>> +                      "sig-tx",
>> +                      "sig-rx",
>> +                      "msg-tx",
>> +                      "msg-rx",
>> +                      "msg-tx-failed",
>> +                      "msg-tx-discarded",
>> +                      "msg-rx-discarded",
>> +                      "fr-swap";
>> +            status = "disabled";
>> +        };
>
> Should all of these be rising ? Looks incorrect to me.
>
> Please review: arch/arm64/boot/dts/qcom/pm8150b.dtsi
>
> pm8150b_typec: typec@1500 {
>         compatible = "qcom,pm8150b-typec";
>         status = "disabled";
>         reg = <0x1500>,
>               <0x1700>;
>
>     interrupts = <0x2 0x15 0x00 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x15 0x01 IRQ_TYPE_EDGE_BOTH>,
>              <0x2 0x15 0x02 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x15 0x03 IRQ_TYPE_EDGE_BOTH>,
>              <0x2 0x15 0x04 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x15 0x05 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x15 0x06 IRQ_TYPE_EDGE_BOTH>,
>              <0x2 0x15 0x07 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x17 0x00 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x17 0x01 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x17 0x02 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x17 0x03 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x17 0x04 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x17 0x05 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x17 0x06 IRQ_TYPE_EDGE_RISING>,
>              <0x2 0x17 0x07 IRQ_TYPE_EDGE_RISING>;
>
>         interrupt-names = "or-rid-detect-change",
>                   "vpd-detect",
>                   "cc-state-change",
>                   "vconn-oc",
>                   "vbus-change",
>                   "attach-detach",
>                   "legacy-cable-detect",
>                   "try-snk-src-detect",
>                   "sig-tx",
>                   "sig-rx",
>                   "msg-tx",
>                   "msg-rx",
>                   "msg-tx-failed",
>                   "msg-tx-discarded",
>                   "msg-rx-discarded",
>                   "fr-swap";
> }
>
> ---
> bod


2024-02-18 17:14:28

by Bryan O'Donoghue

[permalink] [raw]
Subject: Re: [PATCH 3/3] arm64: dts: qcom: pm6150: define USB-C related blocks

On 18/02/2024 8:05 a.m., Danila Tikhonov wrote:
> I know that some interrupts have both for PM8150B, but for PM6150 all
> interrupts are rising.
> Please look at the downstream kernel:
> https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/187022f2721d584ac4ec92c0ac1af77da487521d/arch/arm64/boot/dts/qcom/pm6150.dtsi#L319
> https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/187022f2721d584ac4ec92c0ac1af77da487521d/arch/arm64/boot/dts/qcom/pm8150b.dtsi#L292
>


Please take a look here, I think the same logic should apply to your
patchset.

https://www.spinics.net/lists/devicetree/msg665558.html

---
bod

2024-02-18 19:16:46

by Bryan O'Donoghue

[permalink] [raw]
Subject: Re: [PATCH 3/3] arm64: dts: qcom: pm6150: define USB-C related blocks

On 18/02/2024 6:52 p.m., Danila Tikhonov wrote:
> You are referring to Dmitry Baryshkov, as I see. But Dmitry has already
> reviewed my patch (message above).

Yes we previously debated and discussed verbatim copy of downstream
versus the format we used for 8150b.

The original driver I wrote for tcpm and the dts that went with it
derived from 4.19 where the interrupt definition was already right, so
in that case copy/paste of downstream is fine.

However with earlier kernels, 4.14 in this case the signalling isn't right.

Please read the discussion and reconsider your patch.

> So it would be rude to change anything without his knowledge. Let's wait
> for his answer
He'd have to be arguing against his own patch.....

One final nag - please use the kernel discussion format of bottom not
top posting.

https://git.codelinaro.org/bryan.odonoghue/kernel/-/blob/sc8280xp-v6.8-rc4-camss/Documentation/process/submitting-patches.rst?ref_type=heads

---
bod


2024-02-18 19:36:55

by Danila Tikhonov

[permalink] [raw]
Subject: Re: [PATCH 3/3] arm64: dts: qcom: pm6150: define USB-C related blocks

You are referring to Dmitry Baryshkov, as I see. But Dmitry has already
reviewed my patch (message above).
So it would be rude to change anything without his knowledge. Let's wait
for his answer.

---
Best wishes
Danila

On 2/18/24 20:14, Bryan O'Donoghue wrote:
> On 18/02/2024 8:05 a.m., Danila Tikhonov wrote:
>> I know that some interrupts have both for PM8150B, but for PM6150 all
>> interrupts are rising.
>> Please look at the downstream kernel:
>> https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/187022f2721d584ac4ec92c0ac1af77da487521d/arch/arm64/boot/dts/qcom/pm6150.dtsi#L319
>>
>> https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/187022f2721d584ac4ec92c0ac1af77da487521d/arch/arm64/boot/dts/qcom/pm8150b.dtsi#L292
>>
>>
>
>
> Please take a look here, I think the same logic should apply to your
> patchset.
>
> https://www.spinics.net/lists/devicetree/msg665558.html
>
> ---
> bod


2024-02-18 22:08:03

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH 3/3] arm64: dts: qcom: pm6150: define USB-C related blocks

On Sun, 18 Feb 2024 at 20:53, Danila Tikhonov <[email protected]> wrote:
>
> You are referring to Dmitry Baryshkov, as I see. But Dmitry has already
> reviewed my patch (message above).
> So it would be rude to change anything without his knowledge. Let's wait
> for his answer.

I missed this point, so please update the IRQ flags accordingly to
PM8150B, as Bryan has pointed out.

>
> ---
> Best wishes
> Danila
>
> On 2/18/24 20:14, Bryan O'Donoghue wrote:
> > On 18/02/2024 8:05 a.m., Danila Tikhonov wrote:
> >> I know that some interrupts have both for PM8150B, but for PM6150 all
> >> interrupts are rising.
> >> Please look at the downstream kernel:
> >> https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/187022f2721d584ac4ec92c0ac1af77da487521d/arch/arm64/boot/dts/qcom/pm6150.dtsi#L319
> >>
> >> https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/187022f2721d584ac4ec92c0ac1af77da487521d/arch/arm64/boot/dts/qcom/pm8150b.dtsi#L292
> >>
> >>
> >
> >
> > Please take a look here, I think the same logic should apply to your
> > patchset.
> >
> > https://www.spinics.net/lists/devicetree/msg665558.html
> >
> > ---
> > bod
>


--
With best wishes
Dmitry

2024-02-19 07:13:47

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: regulator: qcom,usb-vbus-regulator: Add PM6150 compatible

On 17/02/2024 17:31, Danila Tikhonov wrote:
> The VBUS register block on the PM6150 PMIC shares the design with the
> PM8150B one. Define corresponding compatible string, having the
> qcom,pm8150b-vbus-reg as a fallback.
>
> Signed-off-by: Danila Tikhonov <[email protected]>
> ---

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2024-02-19 16:24:03

by Mark Brown

[permalink] [raw]
Subject: Re: (subset) [PATCH 0/3] arm64: dts: qcom: pm6150: Add typec support for PM6150

On Sat, 17 Feb 2024 19:31:58 +0300, Danila Tikhonov wrote:
> This series adds typec support for PM6150. Was tested on SM7150
> (xiaomi-surya).
>
> To: Bjorn Andersson <[email protected]>
> To: Konrad Dybcio <[email protected]>
> To: Liam Girdwood <[email protected]>
> To: Mark Brown <[email protected]>
> To: Rob Herring <[email protected]>
> To: Krzysztof Kozlowski <[email protected]>
> To: Conor Dooley <[email protected]>
> To: "Bryan O'Donoghue" <[email protected]>
> To: Greg Kroah-Hartman <[email protected]>
> To: Wesley Cheng <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Danila Tikhonov <[email protected]>
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/3] dt-bindings: regulator: qcom,usb-vbus-regulator: Add PM6150 compatible
commit: ec29a4d9b7c7329afc61e7932cb91e9b292b2b74

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark