Message ID | 20240527-yoga-ec-driver-v3-6-327a9851dad5@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | power: supply: Lenovo Yoga C630 EC | expand |
On Mon, May 27, 2024 at 01:03:51PM GMT, Dmitry Baryshkov wrote: > From: Bjorn Andersson <andersson@kernel.org> Please align this with the S-o-b - feel free to use either form. > > The Embedded Controller in the Lenovo Yoga C630 is accessible on &i2c1 > and provides battery and adapter status, as well as altmode > notifications for the second USB Type-C port. > > Add a definition for the EC. > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- > .../boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 76 ++++++++++++++++++++++ > 1 file changed, 76 insertions(+) > > diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts > index 47dc42f6e936..d975f78eb3ab 100644 > --- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts > +++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts > @@ -370,6 +370,66 @@ zap-shader { > &i2c1 { > status = "okay"; > clock-frequency = <400000>; > + > + embedded-controller@70 { > + compatible = "lenovo,yoga-c630-ec"; > + reg = <0x70>; > + > + interrupts-extended = <&tlmm 20 IRQ_TYPE_LEVEL_HIGH>; > + > + pinctrl-names = "default"; > + pinctrl-0 = <&ec_int_state>; > + > + #address-cells = <1>; > + #size-cells = <0>; > + > + connector@0 { > + compatible = "usb-c-connector"; > + reg = <0>; > + power-role = "dual"; > + data-role = "host"; I was under the impression that this port is wired directly to the SoC and as such this would support data role switching as well. No concern with that, but just out of curiosity, is this not the case? Regards, Bjorn
On Tue, 28 May 2024 at 18:06, Bjorn Andersson <andersson@kernel.org> wrote: > > On Mon, May 27, 2024 at 01:03:51PM GMT, Dmitry Baryshkov wrote: > > From: Bjorn Andersson <andersson@kernel.org> > > Please align this with the S-o-b - feel free to use either form. Ack. I'll check what went wrong. > > > > > The Embedded Controller in the Lenovo Yoga C630 is accessible on &i2c1 > > and provides battery and adapter status, as well as altmode > > notifications for the second USB Type-C port. > > > > Add a definition for the EC. > > > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > > --- > > .../boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 76 ++++++++++++++++++++++ > > 1 file changed, 76 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts > > index 47dc42f6e936..d975f78eb3ab 100644 > > --- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts > > +++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts > > @@ -370,6 +370,66 @@ zap-shader { > > &i2c1 { > > status = "okay"; > > clock-frequency = <400000>; > > + > > + embedded-controller@70 { > > + compatible = "lenovo,yoga-c630-ec"; > > + reg = <0x70>; > > + > > + interrupts-extended = <&tlmm 20 IRQ_TYPE_LEVEL_HIGH>; > > + > > + pinctrl-names = "default"; > > + pinctrl-0 = <&ec_int_state>; > > + > > + #address-cells = <1>; > > + #size-cells = <0>; > > + > > + connector@0 { > > + compatible = "usb-c-connector"; > > + reg = <0>; > > + power-role = "dual"; > > + data-role = "host"; > > I was under the impression that this port is wired directly to the SoC > and as such this would support data role switching as well. > > No concern with that, but just out of curiosity, is this not the case? It is wired through the external Type-C port controller RTS5437, which also controls the vbus pins, etc. The UCSI firmware reports both ports as host-only and doesn't implement data role switching. So, having it as "host" is a safe bet. I must admit, I also hoped to be able to use this port in gadget mode, but it seems to be nearly impossible.
On Tue, May 28, 2024 at 06:12:58PM GMT, Dmitry Baryshkov wrote: > On Tue, 28 May 2024 at 18:06, Bjorn Andersson <andersson@kernel.org> wrote: > > > > On Mon, May 27, 2024 at 01:03:51PM GMT, Dmitry Baryshkov wrote: > > > From: Bjorn Andersson <andersson@kernel.org> > > > > Please align this with the S-o-b - feel free to use either form. > > Ack. I'll check what went wrong. > > > > > > > > > The Embedded Controller in the Lenovo Yoga C630 is accessible on &i2c1 > > > and provides battery and adapter status, as well as altmode > > > notifications for the second USB Type-C port. > > > > > > Add a definition for the EC. > > > > > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> > > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > > > --- > > > .../boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 76 ++++++++++++++++++++++ > > > 1 file changed, 76 insertions(+) > > > > > > diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts > > > index 47dc42f6e936..d975f78eb3ab 100644 > > > --- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts > > > +++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts > > > @@ -370,6 +370,66 @@ zap-shader { > > > &i2c1 { > > > status = "okay"; > > > clock-frequency = <400000>; > > > + > > > + embedded-controller@70 { > > > + compatible = "lenovo,yoga-c630-ec"; > > > + reg = <0x70>; > > > + > > > + interrupts-extended = <&tlmm 20 IRQ_TYPE_LEVEL_HIGH>; > > > + > > > + pinctrl-names = "default"; > > > + pinctrl-0 = <&ec_int_state>; > > > + > > > + #address-cells = <1>; > > > + #size-cells = <0>; > > > + > > > + connector@0 { > > > + compatible = "usb-c-connector"; > > > + reg = <0>; > > > + power-role = "dual"; > > > + data-role = "host"; > > > > I was under the impression that this port is wired directly to the SoC > > and as such this would support data role switching as well. > > > > No concern with that, but just out of curiosity, is this not the case? > > It is wired through the external Type-C port controller RTS5437, which > also controls the vbus pins, etc. The UCSI firmware reports both ports > as host-only and doesn't implement data role switching. So, having it > as "host" is a safe bet. > Thanks for the explanation, that makes sense. > I must admit, I also hoped to be able to use this port in gadget mode, > but it seems to be nearly impossible. > Someone must have managed to use the device in peripheral mode to get the firmware on there originally...just saying... ;) Regards, Bjorn
diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts index 47dc42f6e936..d975f78eb3ab 100644 --- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts @@ -370,6 +370,66 @@ zap-shader { &i2c1 { status = "okay"; clock-frequency = <400000>; + + embedded-controller@70 { + compatible = "lenovo,yoga-c630-ec"; + reg = <0x70>; + + interrupts-extended = <&tlmm 20 IRQ_TYPE_LEVEL_HIGH>; + + pinctrl-names = "default"; + pinctrl-0 = <&ec_int_state>; + + #address-cells = <1>; + #size-cells = <0>; + + connector@0 { + compatible = "usb-c-connector"; + reg = <0>; + power-role = "dual"; + data-role = "host"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + ucsi0_hs_in: endpoint { + remote-endpoint = <&usb_1_dwc3_hs>; + }; + }; + + port@1 { + reg = <1>; + + ucsi0_ss_in: endpoint { + remote-endpoint = <&usb_1_qmpphy_out>; + }; + }; + + port@2 { + reg = <2>; + + ucsi0_sbu: endpoint { + }; + }; + }; + }; + + connector@1 { + compatible = "usb-c-connector"; + reg = <1>; + power-role = "dual"; + data-role = "host"; + + /* + * connected to the onboard USB hub, orientation is + * handled by the controller + */ + }; + }; }; &i2c3 { @@ -694,6 +754,14 @@ mode_pin_active: mode-pin-state { bias-disable; }; + + ec_int_state: ec-int-state { + pins = "gpio20"; + function = "gpio"; + + input-enable; + bias-disable; + }; }; &uart6 { @@ -741,6 +809,10 @@ &usb_1_dwc3 { dr_mode = "host"; }; +&usb_1_dwc3_hs { + remote-endpoint = <&ucsi0_hs_in>; +}; + &usb_1_hsphy { status = "okay"; @@ -761,6 +833,10 @@ &usb_1_qmpphy { vdda-pll-supply = <&vdda_usb1_ss_core>; }; +&usb_1_qmpphy_out { + remote-endpoint = <&ucsi0_ss_in>; +}; + &usb_2 { status = "okay"; };