Message ID | 20211028164941.831918-6-bryan.odonoghue@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Add pm8150b TPCM driver | expand |
On Thu, Oct 28, 2021 at 05:49:39PM +0100, Bryan O'Donoghue wrote: > Add a YAML description for the pm8150b-tcpm driver. The pm8150b-tcpm > encapsulates a type-c block and a pdphy block into one block presented to > the tcpm Linux API. > > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > --- > .../bindings/usb/qcom,pmic-tcpm.yaml | 110 ++++++++++++++++++ > 1 file changed, 110 insertions(+) > create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-tcpm.yaml > > diff --git a/Documentation/devicetree/bindings/usb/qcom,pmic-tcpm.yaml b/Documentation/devicetree/bindings/usb/qcom,pmic-tcpm.yaml > new file mode 100644 > index 0000000000000..6dd51a1dd944f > --- /dev/null > +++ b/Documentation/devicetree/bindings/usb/qcom,pmic-tcpm.yaml > @@ -0,0 +1,110 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: "http://devicetree.org/schemas/usb/qcom,pmic-tcpm.yaml#" > +$schema: "http://devicetree.org/meta-schemas/core.yaml#" > + > +title: Qualcomm PMIC TCPM Driver > + > +maintainers: > + - Bryan O'Donoghue <bryan.odonoghue@linaro.org> > + > +description: | > + Qualcomm PMIC Type-C Port Manager Driver > + > +properties: > + compatible: > + enum: > + - qcom,pm8150b-tcpm > + > + ports: > + description: Remote endpoint connections > + $ref: /connector/usb-connector.yaml#/properties/ports > + > + properties: > + port@0: > + description: Remote endpoints for the type-c device > + > + port@1: > + description: Remote endpoints for the pdphy device > + > + port@2: > + description: Connection to role switch node I don't understand these ports. The graph binding should be showing data stream connections. It should look something like a block diagram of the h/w components. > + > + required: > + - port@0 > + - port@1 > + - port@2 > + > +required: > + - compatible > + - ports > + > +additionalProperties: false > + > +examples: > + - | > + #include <dt-bindings/interrupt-controller/irq.h> > + #include <dt-bindings/usb/pd.h> > + #include <dt-bindings/usb/typec/tcpm/qcom,pmic-usb-typec.h> > + #include <dt-bindings/usb/typec/tcpm/qcom,pmic-usb-pdphy.h> > + > + pm8150b_tcpm: pmic-tcpm { > + compatible = "qcom,pmic-tcpm"; > + > + #address-cells = <1>; > + #size-cells = <0>; > + > + status = "disabled"; Not much point in having a disabled example. > + ports { > + > + #address-cells = <1>; > + #size-cells = <0>; > + > + port@0 { > + reg = <0>; > + pmic_tcpm_typec: endpoint { > + remote-endpoint = <&pmic_typec>; > + }; > + }; > + port@1 { > + reg = <1>; > + pmic_tcpm_pdphy: endpoint { > + remote-endpoint = <&pmic_pdphy>; > + }; > + }; > + port@2 { > + ret = <2>; > + usb3_role: endpoint@0 { > + remote-endpoint = <&dwc3_drd_switch>; > + }; > + }; > + }; > + > + connector { > + compatible = "usb-c-connector"; > + > + power-role = "source"; > + data-role = "dual"; > + self-powered; > + > + source-pdos = <PDO_FIXED(5000, 3000, > + PDO_FIXED_DUAL_ROLE | > + PDO_FIXED_USB_COMM | > + PDO_FIXED_DATA_SWAP)>; > + > + ports { > + #address-cells = <1>; > + #size-cells = <0>; > + > + port@0 { > + reg = <0>; > + pmic_tcpm_ss_mux: endpoint@0 { > + remote-endpoint = <&qmp_ss_mux>; > + }; > + }; > + }; > + }; > + }; > + > +... > -- > 2.33.0 > >
On 28/10/2021 21:43, Rob Herring wrote: > I don't understand these ports. The graph binding should be showing data > stream connections. It should look something like a block diagram of the > h/w components. Two different PHYs which live inside of the pm8150b USB typec/pdphy/charger block. The typec phy and power-delivery phy are not adjacent to each other typec@1500 charger@1600 pdphy@1700 The typec and pdphy pieces are being brought together into a standard Linux TCPM driver. Rather than have a TCPM device that starts @1500 and spans over the charger I've opted to have "virtual" TCPM device that has links to typec@1500 and pdphy@1700 via remote-endpoints That lets the end result dts look like this pm8150b_tcpm: pmic-tcpm { compatible = "qcom,pmic-tcpm"; status = "disabled"; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; pmic_tcpm_typec: endpoint { remote-endpoint = <&pmic_typec>; }; }; port@1 { reg = <1>; pmic_tcpm_pdphy: endpoint { remote-endpoint = <&pmic_pdphy>; }; }; }; }; pm8150b_typec: typec@1500 { compatible = "qcom,pm8150b-typec"; reg = <0x1500>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; pmic_typec: endpoint { remote-endpoint = <&pmic_tcpm_typec>; }; }; }; }; pm8150b_pdphy: pdphy@1700 { compatible = "qcom,pm8150b-pdphy"; reg = <0x1700>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; pmic_pdphy: endpoint { remote-endpoint = <&pmic_tcpm_pdphy>; }; }; }; }; at a later date we might want to add in the charger but, if we do we don't want that to be inside of a Linux TCPM device and I thought it would be a mess to have, since we try to keep addresses linear in DTS files pm8150b_tcpm: pmic-tcpm@1500 { compatible = "qcom,pmic-tcpm"; pm8150b_typec: typec@1500 { compatible = "qcom,pm8150b-typec"; reg = <0x1500>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; pmic_typec: endpoint { remote-endpoint = <&pmic_tcpm_typec>; }; }; }; }; pm8150b_pdphy: pdphy@1700 { compatible = "qcom,pm8150b-pdphy"; reg = <0x1700>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; pmic_pdphy: endpoint { remote-endpoint = <&pmic_tcpm_pdphy>; }; }; }; }; }; pm8150b_charger: pmic-charger@1600 { /* Consume electrons here */ }; --- bod
On 28/10/2021 22:46, Bryan O'Donoghue wrote: > I thought it would be a mess to have, since we try to keep addresses > linear in DTS files sic: I thought the following DTS would be messy since the tcpm device would span over all three silicon blocks and should we want to add in charger, the charger would then end up as an out-of-order address. > > > pm8150b_tcpm: pmic-tcpm@1500 { > compatible = "qcom,pmic-tcpm"; > > > pm8150b_typec: typec@1500 { > compatible = "qcom,pm8150b-typec"; > reg = <0x1500>; > ports { > #address-cells = <1>; > #size-cells = <0>; > > port@0 { > reg = <0>; > pmic_typec: endpoint { > remote-endpoint = <&pmic_tcpm_typec>; > }; > }; > }; > }; > > pm8150b_pdphy: pdphy@1700 { > compatible = "qcom,pm8150b-pdphy"; > reg = <0x1700>; > ports { > #address-cells = <1>; > #size-cells = <0>; > > port@0 { > reg = <0>; > pmic_pdphy: endpoint { > remote-endpoint = <&pmic_tcpm_pdphy>; > }; > }; > }; > }; > }; > > pm8150b_charger: pmic-charger@1600 { > /* Consume electrons here */ > };
diff --git a/Documentation/devicetree/bindings/usb/qcom,pmic-tcpm.yaml b/Documentation/devicetree/bindings/usb/qcom,pmic-tcpm.yaml new file mode 100644 index 0000000000000..6dd51a1dd944f --- /dev/null +++ b/Documentation/devicetree/bindings/usb/qcom,pmic-tcpm.yaml @@ -0,0 +1,110 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/usb/qcom,pmic-tcpm.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Qualcomm PMIC TCPM Driver + +maintainers: + - Bryan O'Donoghue <bryan.odonoghue@linaro.org> + +description: | + Qualcomm PMIC Type-C Port Manager Driver + +properties: + compatible: + enum: + - qcom,pm8150b-tcpm + + ports: + description: Remote endpoint connections + $ref: /connector/usb-connector.yaml#/properties/ports + + properties: + port@0: + description: Remote endpoints for the type-c device + + port@1: + description: Remote endpoints for the pdphy device + + port@2: + description: Connection to role switch node + + required: + - port@0 + - port@1 + - port@2 + +required: + - compatible + - ports + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/usb/pd.h> + #include <dt-bindings/usb/typec/tcpm/qcom,pmic-usb-typec.h> + #include <dt-bindings/usb/typec/tcpm/qcom,pmic-usb-pdphy.h> + + pm8150b_tcpm: pmic-tcpm { + compatible = "qcom,pmic-tcpm"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + ports { + + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + pmic_tcpm_typec: endpoint { + remote-endpoint = <&pmic_typec>; + }; + }; + port@1 { + reg = <1>; + pmic_tcpm_pdphy: endpoint { + remote-endpoint = <&pmic_pdphy>; + }; + }; + port@2 { + ret = <2>; + usb3_role: endpoint@0 { + remote-endpoint = <&dwc3_drd_switch>; + }; + }; + }; + + connector { + compatible = "usb-c-connector"; + + power-role = "source"; + data-role = "dual"; + self-powered; + + source-pdos = <PDO_FIXED(5000, 3000, + PDO_FIXED_DUAL_ROLE | + PDO_FIXED_USB_COMM | + PDO_FIXED_DATA_SWAP)>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + pmic_tcpm_ss_mux: endpoint@0 { + remote-endpoint = <&qmp_ss_mux>; + }; + }; + }; + }; + }; + +...
Add a YAML description for the pm8150b-tcpm driver. The pm8150b-tcpm encapsulates a type-c block and a pdphy block into one block presented to the tcpm Linux API. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- .../bindings/usb/qcom,pmic-tcpm.yaml | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-tcpm.yaml