On Mon, Jul 24, 2023 at 9:55 AM Christopher Obbard <chris.obbard@xxxxxxxxxxxxx> wrote: > > On Wed, 2023-07-19 at 17:51 +0530, Jagan Teki wrote: > > The power supply circuit in ROC-RK3399-PC is > > > > Power Supply (or PPS) => FUSB => MP8859 > > > > VUBS pin of FUSB and IN pin of MP8859 is supplied via TYPEC_IN. > > > > The MP8859 operated with 2.8V to 22V supply voltage and typical > > applications this supply can be 12V. > > > > This patch is trying to support the PD by changing the FUSB VBUS supply > > to 12V and tune the I2C7 timings from downstream kernel. > > > > Tested with PD3.0 PPS with supply voltages of 12V/3A and 20V/5A. > > Hi Jagan, > > This series works fine with a "dumb" (no PD negotiation) 5.1V Raspberry Pi PSU. > > It also works fine with a Dell 45W USB-C Laptop Power Supply (model AA45NM170) which provides 5V@3A,9V@3A,15V@3A,20V@2.25A, where Linux master fails and just tells the USB-PD PSU to power-off. I think this depends on the recent Rockchip TCPM changes. FUSB302 has been a pain in the USB or else this platform would have launched a lot longer ago. > > It doesn't work with a Lenovo 65W PSU (model ADLX65YLC3D) which provides 5V@2A,9V@2A,15V@3A,20V@3.25A, after negotiation the driver turns the PD PSU off and on again, resetting the board. > So it'd be great to get this fixed, but it seems like the sink-pdos should already support this PSU ? Something to note about USB PD that I read in the TI PD 2.0 paper and re-spewing based on memory: during transitions, the sink should self-limit to 500mA. If that is the case, the transition behavior is up to the source. > > > As a side note for full transparency, another issue is that with Linux master or with this patch applied, applying power to the DC_12V header without a USB-C PSU connected (e.g. powering from the POE > expansion shield), boot hangs and dumps to an initramfs shell with: > > [ 7.411798] random: crng init done > [ 12.568138] platform fe3a0000.usb: deferred probe pending > [ 12.568673] platform sdio-pwrseq: deferred probe pending > [ 12.569162] platform fe3e0000.usb: deferred probe pending > [ 12.569658] platform adc-keys: deferred probe pending > [ 12.570123] i2c 7-0022: deferred probe pending > [ 12.570533] i2c 4-0022: deferred probe pending > [ 12.570944] platform ff940000.hdmi: deferred probe pending > [ 12.571448] platform vcc3v0-sd: deferred probe pending > [ 12.572000] platform vcc1v8-s3: deferred probe pending > [ 12.572475] platform sys-12v: deferred probe pending > [ 12.572933] platform vcc3v3-sys: deferred probe pending > [ 12.573412] platform fe320000.mmc: deferred probe pending > [ 12.573907] platform vcca-0v9: deferred probe pending > [ 12.574371] platform vcc5v0-host-regulator: deferred probe pending > [ 12.574935] platform ff770000.syscon:usb2phy@e450: deferred probe pending > [ 12.575552] platform vcc-vbus-typec1: deferred probe pending > [ 12.576090] platform fe300000.ethernet: deferred probe pending > [ 12.576623] platform vcc-sys: deferred probe pending > [ 12.577080] platform ff770000.syscon:usb2phy@e460: deferred probe pending > [ 12.577697] platform ff320000.syscon:io-domains: deferred probe pending > [ 12.578298] platform ff770000.syscon:io-domains: deferred probe pending > [ 12.578901] platform fe800000.usb: deferred probe pending > [ 12.579395] platform fe900000.usb: deferred probe pending > [ 12.579904] platform vdd-log: deferred probe pending > [ 12.580362] i2c 0-001b: deferred probe pending > [ 12.580772] i2c 0-0040: deferred probe pending > [ 12.581182] platform cpufreq-dt: deferred probe pending > [ 12.581663] i2c 0-0041: deferred probe pending > > > > Thanks, > > Chris > > > > > Cc: Corentin Labbe <clabbe@xxxxxxxxxxxx> > > Signed-off-by: Jagan Teki <jagan@xxxxxxxxxxxxxxxxxxxx> > > --- > > .../boot/dts/rockchip/rk3399-roc-pc.dtsi | 19 ++++++++++++++++--- > > 1 file changed, 16 insertions(+), 3 deletions(-) > > > > diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi > > index c32913df93c3..8963b3858eae 100644 > > --- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi > > +++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi > > @@ -6,6 +6,7 @@ > > /dts-v1/; > > #include <dt-bindings/input/linux-event-codes.h> > > #include <dt-bindings/pwm/pwm.h> > > +#include "dt-bindings/usb/pd.h" > > #include "rk3399.dtsi" > > #include "rk3399-opp.dtsi" > > > > @@ -524,8 +525,9 @@ &i2c3 { > > }; > > > > &i2c4 { > > - i2c-scl-rising-time-ns = <600>; > > - i2c-scl-falling-time-ns = <20>; > > + clock-frequency = <400000>; > > + i2c-scl-rising-time-ns = <345>; > > + i2c-scl-falling-time-ns = <11>; > > status = "okay"; > > > > fusb1: usb-typec@22 { > > @@ -552,8 +554,19 @@ fusb0: usb-typec@22 { > > interrupts = <2 IRQ_TYPE_LEVEL_LOW>; > > pinctrl-names = "default"; > > pinctrl-0 = <&fusb0_int>; > > - vbus-supply = <&vcc_vbus_typec0>; > > + vbus-supply = <&dc_12v>; > > status = "okay"; > > + > > + connector { > > + compatible = "usb-c-connector"; > > + data-role = "dual"; > > + label = "USB-C"; > > + power-role = "sink"; > > + try-power-role = "sink"; > > + op-sink-microwatt = <10000000>; > > + sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM) > > + PDO_VAR(5000, 20000, 5000)>; > > + }; > > }; > > > > mp8859: regulator@66 { > > -- > Christopher Obbard BEng (Hons) MIET > Senior Engineer > > Collabora Ltd > Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK > Registered in England & Wales no 5513718. > This message is intended for the use of only the person(s) ("intended > recipient") to whom it is addressed. > It may contain information that is privileged and confidential. > Accordingly, any dissemination, distribution, copying or other use of > this message or any of its content by any person other than the > intended recipient may constitute a breach of civil or criminal law and > is strictly prohibited. > > > _______________________________________________ > Linux-rockchip mailing list > Linux-rockchip@xxxxxxxxxxxxxxxxxxx > http://lists.infradead.org/mailman/listinfo/linux-rockchip