Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.8.2/main] Support USB Type-C functionality on Fairphone 3 #190

Merged
merged 9 commits into from
Apr 17, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ allOf:

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

reg:
maxItems: 1
Expand Down
32 changes: 31 additions & 1 deletion Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ description:
properties:
compatible:
enum:
- qcom,pmi632-typec
- qcom,pm8150b-typec

connector:
Expand All @@ -24,9 +25,11 @@ properties:

reg:
description: Type-C port and pdphy SPMI register base offsets
minItems: 1
maxItems: 2

interrupts:
minItems: 8
items:
- description: Type-C CC attach notification, VBUS error, tCCDebounce done
- description: Type-C VCONN powered
Expand All @@ -46,6 +49,7 @@ properties:
- description: Power Domain Fast Role Swap event

interrupt-names:
minItems: 8
items:
- const: or-rid-detect-change
- const: vpd-detect
Expand Down Expand Up @@ -81,7 +85,33 @@ required:
- interrupts
- interrupt-names
- vdd-vbus-supply
- vdd-pdphy-supply

allOf:
- if:
properties:
compatible:
contains:
enum:
- qcom,pmi632-typec
then:
properties:
reg:
maxItems: 1
interrupts:
maxItems: 8
interrupt-names:
maxItems: 8
vdd-pdphy-supply: false
else:
properties:
reg:
maxItems: 2
interrupts:
minItems: 16
interrupt-names:
maxItems: 16
required:
- vdd-pdphy-supply

additionalProperties: false

Expand Down
14 changes: 14 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8953.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -2297,6 +2297,20 @@
snps,hird-threshold = /bits/ 8 <0x00>;

maximum-speed = "high-speed";

usb-role-switch;

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;

usb_dwc3_hs: endpoint {
};
};
};
};
};

Expand Down
30 changes: 30 additions & 0 deletions arch/arm64/boot/dts/qcom/pmi632.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,36 @@
#address-cells = <1>;
#size-cells = <0>;

pmi632_vbus: usb-vbus-regulator@1100 {
compatible = "qcom,pmi632-vbus-reg", "qcom,pm8150b-vbus-reg";
reg = <0x1100>;
status = "disabled";
};

pmi632_typec: typec@1500 {
compatible = "qcom,pmi632-typec";
reg = <0x1500>;
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>;
interrupt-names = "or-rid-detect-change",
"vpd-detect",
"cc-state-change",
"vconn-oc",
"vbus-change",
"attach-detach",
"legacy-cable-detect",
"try-snk-src-detect";
vdd-vbus-supply = <&pmi632_vbus>;

status = "disabled";
};

pmi632_temp: temp-alarm@2400 {
compatible = "qcom,spmi-temp-alarm";
reg = <0x2400>;
Expand Down
31 changes: 29 additions & 2 deletions arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,33 @@
};
};

&pmi632_typec {
status = "okay";

connector {
compatible = "usb-c-connector";

power-role = "dual";
data-role = "dual";
self-powered;

typec-power-opmode = "default";
pd-disable;

port {
pmi632_hs_in: endpoint {
remote-endpoint = <&usb_dwc3_hs>;
};
};
};
};

&pmi632_vbus {
regulator-min-microamp = <500000>;
regulator-max-microamp = <1000000>;
status = "okay";
};

&pmi632_vib {
status = "okay";
};
Expand Down Expand Up @@ -301,8 +328,8 @@
status = "okay";
};

&usb3_dwc3 {
dr_mode = "peripheral";
&usb_dwc3_hs {
remote-endpoint = <&pmi632_hs_in>;
};

&wcnss {
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ CONFIG_REGULATOR_PWM=y
CONFIG_REGULATOR_QCOM_RPMH=y
CONFIG_REGULATOR_QCOM_SMD_RPM=y
CONFIG_REGULATOR_QCOM_SPMI=y
CONFIG_REGULATOR_QCOM_USB_VBUS=m
CONFIG_REGULATOR_RAA215300=y
CONFIG_REGULATOR_RK808=y
CONFIG_REGULATOR_S2MPS11=y
Expand Down
3 changes: 2 additions & 1 deletion drivers/usb/typec/tcpm/qcom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
obj-$(CONFIG_TYPEC_QCOM_PMIC) += qcom_pmic_tcpm.o
qcom_pmic_tcpm-y += qcom_pmic_typec.o \
qcom_pmic_typec_port.o \
qcom_pmic_typec_pdphy.o
qcom_pmic_typec_pdphy.o \
qcom_pmic_typec_pdphy_stub.o \
Loading