2024-02-27 12:45:40

by Jianhua Lu

[permalink] [raw]
Subject: [PATCH] arm64: dts: qcom: sm8250-xiaomi-elish: add usb pd negotiation support

Add usb pd negotiation, but charging is controlled by pm8150b pmic,
so it can only charge battery with 5W,

Signed-off-by: Jianhua Lu <[email protected]>
---
arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi b/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
index 6f54f50a70b0..ed103b90f4e6 100644
--- a/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
@@ -636,7 +636,8 @@ &pm8150b_typec {
connector {
compatible = "usb-c-connector";

- power-role = "source";
+ op-sink-microwatt = <10000000>;
+ power-role = "dual";
data-role = "dual";
self-powered;

@@ -645,6 +646,12 @@ PDO_FIXED_DUAL_ROLE |
PDO_FIXED_USB_COMM |
PDO_FIXED_DATA_SWAP)>;

+ sink-pdos = <PDO_FIXED(5000, 3000,
+ PDO_FIXED_DUAL_ROLE |
+ PDO_FIXED_USB_COMM |
+ PDO_FIXED_DATA_SWAP)
+ PDO_VAR(5000, 12000, 5000)>;
+
ports {
#address-cells = <1>;
#size-cells = <0>;
--
2.43.2



2024-03-01 23:59:15

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH] arm64: dts: qcom: sm8250-xiaomi-elish: add usb pd negotiation support

On 27.02.2024 13:45, Jianhua Lu wrote:
> Add usb pd negotiation, but charging is controlled by pm8150b pmic,
> so it can only charge battery with 5W,
>
> Signed-off-by: Jianhua Lu <[email protected]>
> ---
> arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi b/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
> index 6f54f50a70b0..ed103b90f4e6 100644
> --- a/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
> @@ -636,7 +636,8 @@ &pm8150b_typec {
> connector {
> compatible = "usb-c-connector";
>
> - power-role = "source";
> + op-sink-microwatt = <10000000>;

Is 10W really the minimum value for this tablet to function as a sink?

Is that what the downstream kernel sets?

> + power-role = "dual";
> data-role = "dual";
> self-powered;
>
> @@ -645,6 +646,12 @@ PDO_FIXED_DUAL_ROLE |
> PDO_FIXED_USB_COMM |
> PDO_FIXED_DATA_SWAP)>;
>
> + sink-pdos = <PDO_FIXED(5000, 3000,
> + PDO_FIXED_DUAL_ROLE |

Please align the PDO_.. against the open brace

> + PDO_FIXED_USB_COMM |
> + PDO_FIXED_DATA_SWAP)
> + PDO_VAR(5000, 12000, 5000)>;

60W max? This is not unheard of, but I'm just making sure you know..

Konrad


2024-03-02 03:05:14

by Jianhua Lu

[permalink] [raw]
Subject: Re: [PATCH] arm64: dts: qcom: sm8250-xiaomi-elish: add usb pd negotiation support

On Sat, Mar 02, 2024 at 12:58:57AM +0100, Konrad Dybcio wrote:
> On 27.02.2024 13:45, Jianhua Lu wrote:
> > Add usb pd negotiation, but charging is controlled by pm8150b pmic,
> > so it can only charge battery with 5W,
> >
> > Signed-off-by: Jianhua Lu <[email protected]>
> > ---
> > arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi b/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
> > index 6f54f50a70b0..ed103b90f4e6 100644
> > --- a/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
> > @@ -636,7 +636,8 @@ &pm8150b_typec {
> > connector {
> > compatible = "usb-c-connector";
> >
> > - power-role = "source";
> > + op-sink-microwatt = <10000000>;
>
> Is 10W really the minimum value for this tablet to function as a sink?
>
> Is that what the downstream kernel sets?

This value is taken from other device, I will adjust it to minimum
value in Patch v2.
>
> > + power-role = "dual";
> > data-role = "dual";
> > self-powered;
> >
> > @@ -645,6 +646,12 @@ PDO_FIXED_DUAL_ROLE |
> > PDO_FIXED_USB_COMM |
> > PDO_FIXED_DATA_SWAP)>;
> >
> > + sink-pdos = <PDO_FIXED(5000, 3000,
> > + PDO_FIXED_DUAL_ROLE |
>
> Please align the PDO_.. against the open brace

Acked
>
> > + PDO_FIXED_USB_COMM |
> > + PDO_FIXED_DATA_SWAP)
> > + PDO_VAR(5000, 12000, 5000)>;
>
> 60W max? This is not unheard of, but I'm just making sure you know..
downstream kernel's pd adapter allowance is 5v or 9v-12v and vendor
charger allowance is 5v-20v...6.2A-3.25A (67W max), so I set it to 60W.
>
> Konrad
>

2024-03-02 13:01:55

by Jianhua Lu

[permalink] [raw]
Subject: Re: [PATCH] arm64: dts: qcom: sm8250-xiaomi-elish: add usb pd negotiation support

On Sat, Mar 02, 2024 at 12:58:57AM +0100, Konrad Dybcio wrote:
> On 27.02.2024 13:45, Jianhua Lu wrote:
> > Add usb pd negotiation, but charging is controlled by pm8150b pmic,
> > so it can only charge battery with 5W,
> >
> > Signed-off-by: Jianhua Lu <[email protected]>
> > ---
> > arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi b/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
> > index 6f54f50a70b0..ed103b90f4e6 100644
> > --- a/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/sm8250-xiaomi-elish-common.dtsi
> > @@ -636,7 +636,8 @@ &pm8150b_typec {
> > connector {
> > compatible = "usb-c-connector";
> >
> > - power-role = "source";
> > + op-sink-microwatt = <10000000>;
>
> Is 10W really the minimum value for this tablet to function as a sink?
>
After testing 1W, 5W and 10W, 10W is the minimum value for this device to function as a
sink.
>